{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.GameLift.Types.VpcPeeringConnection
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.GameLift.Types.VpcPeeringConnection where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GameLift.Types.VpcPeeringConnectionStatus
import qualified Amazonka.Prelude as Prelude

-- | Represents a peering connection between a VPC on one of your Amazon Web
-- Services accounts and the VPC for your Amazon GameLift fleets. This
-- record may be for an active peering connection or a pending connection
-- that has not yet been established.
--
-- __Related actions__
--
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets All APIs by task>
--
-- /See:/ 'newVpcPeeringConnection' smart constructor.
data VpcPeeringConnection = VpcPeeringConnection'
  { -- | The Amazon Resource Name
    -- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
    -- associated with the GameLift fleet resource for this connection.
    VpcPeeringConnection -> Maybe Text
fleetArn :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the fleet. This ID determines the ID of the
    -- Amazon GameLift VPC for your fleet.
    VpcPeeringConnection -> Maybe Text
fleetId :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the VPC that contains the Amazon GameLift fleet
    -- for this connection. This VPC is managed by Amazon GameLift and does not
    -- appear in your Amazon Web Services account.
    VpcPeeringConnection -> Maybe Text
gameLiftVpcId :: Prelude.Maybe Prelude.Text,
    -- | CIDR block of IPv4 addresses assigned to the VPC peering connection for
    -- the GameLift VPC. The peered VPC also has an IPv4 CIDR block associated
    -- with it; these blocks cannot overlap or the peering connection cannot be
    -- created.
    VpcPeeringConnection -> Maybe Text
ipV4CidrBlock :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for a VPC with resources to be accessed by your
    -- GameLift fleet. The VPC must be in the same Region as your fleet. To
    -- look up a VPC ID, use the
    -- <https://console.aws.amazon.com/vpc/ VPC Dashboard> in the Amazon Web
    -- Services Management Console. Learn more about VPC peering in
    -- <https://docs.aws.amazon.com/gamelift/latest/developerguide/vpc-peering.html VPC Peering with GameLift Fleets>.
    VpcPeeringConnection -> Maybe Text
peerVpcId :: Prelude.Maybe Prelude.Text,
    -- | The status information about the connection. Status indicates if a
    -- connection is pending, successful, or failed.
    VpcPeeringConnection -> Maybe VpcPeeringConnectionStatus
status :: Prelude.Maybe VpcPeeringConnectionStatus,
    -- | A unique identifier that is automatically assigned to the connection
    -- record. This ID is referenced in VPC peering connection events, and is
    -- used when deleting a connection.
    VpcPeeringConnection -> Maybe Text
vpcPeeringConnectionId :: Prelude.Maybe Prelude.Text
  }
  deriving (VpcPeeringConnection -> VpcPeeringConnection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcPeeringConnection -> VpcPeeringConnection -> Bool
$c/= :: VpcPeeringConnection -> VpcPeeringConnection -> Bool
== :: VpcPeeringConnection -> VpcPeeringConnection -> Bool
$c== :: VpcPeeringConnection -> VpcPeeringConnection -> Bool
Prelude.Eq, ReadPrec [VpcPeeringConnection]
ReadPrec VpcPeeringConnection
Int -> ReadS VpcPeeringConnection
ReadS [VpcPeeringConnection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcPeeringConnection]
$creadListPrec :: ReadPrec [VpcPeeringConnection]
readPrec :: ReadPrec VpcPeeringConnection
$creadPrec :: ReadPrec VpcPeeringConnection
readList :: ReadS [VpcPeeringConnection]
$creadList :: ReadS [VpcPeeringConnection]
readsPrec :: Int -> ReadS VpcPeeringConnection
$creadsPrec :: Int -> ReadS VpcPeeringConnection
Prelude.Read, Int -> VpcPeeringConnection -> ShowS
[VpcPeeringConnection] -> ShowS
VpcPeeringConnection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcPeeringConnection] -> ShowS
$cshowList :: [VpcPeeringConnection] -> ShowS
show :: VpcPeeringConnection -> String
$cshow :: VpcPeeringConnection -> String
showsPrec :: Int -> VpcPeeringConnection -> ShowS
$cshowsPrec :: Int -> VpcPeeringConnection -> ShowS
Prelude.Show, forall x. Rep VpcPeeringConnection x -> VpcPeeringConnection
forall x. VpcPeeringConnection -> Rep VpcPeeringConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpcPeeringConnection x -> VpcPeeringConnection
$cfrom :: forall x. VpcPeeringConnection -> Rep VpcPeeringConnection x
Prelude.Generic)

-- |
-- Create a value of 'VpcPeeringConnection' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'fleetArn', 'vpcPeeringConnection_fleetArn' - The Amazon Resource Name
-- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
-- associated with the GameLift fleet resource for this connection.
--
-- 'fleetId', 'vpcPeeringConnection_fleetId' - A unique identifier for the fleet. This ID determines the ID of the
-- Amazon GameLift VPC for your fleet.
--
-- 'gameLiftVpcId', 'vpcPeeringConnection_gameLiftVpcId' - A unique identifier for the VPC that contains the Amazon GameLift fleet
-- for this connection. This VPC is managed by Amazon GameLift and does not
-- appear in your Amazon Web Services account.
--
-- 'ipV4CidrBlock', 'vpcPeeringConnection_ipV4CidrBlock' - CIDR block of IPv4 addresses assigned to the VPC peering connection for
-- the GameLift VPC. The peered VPC also has an IPv4 CIDR block associated
-- with it; these blocks cannot overlap or the peering connection cannot be
-- created.
--
-- 'peerVpcId', 'vpcPeeringConnection_peerVpcId' - A unique identifier for a VPC with resources to be accessed by your
-- GameLift fleet. The VPC must be in the same Region as your fleet. To
-- look up a VPC ID, use the
-- <https://console.aws.amazon.com/vpc/ VPC Dashboard> in the Amazon Web
-- Services Management Console. Learn more about VPC peering in
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/vpc-peering.html VPC Peering with GameLift Fleets>.
--
-- 'status', 'vpcPeeringConnection_status' - The status information about the connection. Status indicates if a
-- connection is pending, successful, or failed.
--
-- 'vpcPeeringConnectionId', 'vpcPeeringConnection_vpcPeeringConnectionId' - A unique identifier that is automatically assigned to the connection
-- record. This ID is referenced in VPC peering connection events, and is
-- used when deleting a connection.
newVpcPeeringConnection ::
  VpcPeeringConnection
newVpcPeeringConnection :: VpcPeeringConnection
newVpcPeeringConnection =
  VpcPeeringConnection'
    { $sel:fleetArn:VpcPeeringConnection' :: Maybe Text
fleetArn = forall a. Maybe a
Prelude.Nothing,
      $sel:fleetId:VpcPeeringConnection' :: Maybe Text
fleetId = forall a. Maybe a
Prelude.Nothing,
      $sel:gameLiftVpcId:VpcPeeringConnection' :: Maybe Text
gameLiftVpcId = forall a. Maybe a
Prelude.Nothing,
      $sel:ipV4CidrBlock:VpcPeeringConnection' :: Maybe Text
ipV4CidrBlock = forall a. Maybe a
Prelude.Nothing,
      $sel:peerVpcId:VpcPeeringConnection' :: Maybe Text
peerVpcId = forall a. Maybe a
Prelude.Nothing,
      $sel:status:VpcPeeringConnection' :: Maybe VpcPeeringConnectionStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcPeeringConnectionId:VpcPeeringConnection' :: Maybe Text
vpcPeeringConnectionId = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name
-- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
-- associated with the GameLift fleet resource for this connection.
vpcPeeringConnection_fleetArn :: Lens.Lens' VpcPeeringConnection (Prelude.Maybe Prelude.Text)
vpcPeeringConnection_fleetArn :: Lens' VpcPeeringConnection (Maybe Text)
vpcPeeringConnection_fleetArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcPeeringConnection' {Maybe Text
fleetArn :: Maybe Text
$sel:fleetArn:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
fleetArn} -> Maybe Text
fleetArn) (\s :: VpcPeeringConnection
s@VpcPeeringConnection' {} Maybe Text
a -> VpcPeeringConnection
s {$sel:fleetArn:VpcPeeringConnection' :: Maybe Text
fleetArn = Maybe Text
a} :: VpcPeeringConnection)

-- | A unique identifier for the fleet. This ID determines the ID of the
-- Amazon GameLift VPC for your fleet.
vpcPeeringConnection_fleetId :: Lens.Lens' VpcPeeringConnection (Prelude.Maybe Prelude.Text)
vpcPeeringConnection_fleetId :: Lens' VpcPeeringConnection (Maybe Text)
vpcPeeringConnection_fleetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcPeeringConnection' {Maybe Text
fleetId :: Maybe Text
$sel:fleetId:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
fleetId} -> Maybe Text
fleetId) (\s :: VpcPeeringConnection
s@VpcPeeringConnection' {} Maybe Text
a -> VpcPeeringConnection
s {$sel:fleetId:VpcPeeringConnection' :: Maybe Text
fleetId = Maybe Text
a} :: VpcPeeringConnection)

-- | A unique identifier for the VPC that contains the Amazon GameLift fleet
-- for this connection. This VPC is managed by Amazon GameLift and does not
-- appear in your Amazon Web Services account.
vpcPeeringConnection_gameLiftVpcId :: Lens.Lens' VpcPeeringConnection (Prelude.Maybe Prelude.Text)
vpcPeeringConnection_gameLiftVpcId :: Lens' VpcPeeringConnection (Maybe Text)
vpcPeeringConnection_gameLiftVpcId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcPeeringConnection' {Maybe Text
gameLiftVpcId :: Maybe Text
$sel:gameLiftVpcId:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
gameLiftVpcId} -> Maybe Text
gameLiftVpcId) (\s :: VpcPeeringConnection
s@VpcPeeringConnection' {} Maybe Text
a -> VpcPeeringConnection
s {$sel:gameLiftVpcId:VpcPeeringConnection' :: Maybe Text
gameLiftVpcId = Maybe Text
a} :: VpcPeeringConnection)

-- | CIDR block of IPv4 addresses assigned to the VPC peering connection for
-- the GameLift VPC. The peered VPC also has an IPv4 CIDR block associated
-- with it; these blocks cannot overlap or the peering connection cannot be
-- created.
vpcPeeringConnection_ipV4CidrBlock :: Lens.Lens' VpcPeeringConnection (Prelude.Maybe Prelude.Text)
vpcPeeringConnection_ipV4CidrBlock :: Lens' VpcPeeringConnection (Maybe Text)
vpcPeeringConnection_ipV4CidrBlock = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcPeeringConnection' {Maybe Text
ipV4CidrBlock :: Maybe Text
$sel:ipV4CidrBlock:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
ipV4CidrBlock} -> Maybe Text
ipV4CidrBlock) (\s :: VpcPeeringConnection
s@VpcPeeringConnection' {} Maybe Text
a -> VpcPeeringConnection
s {$sel:ipV4CidrBlock:VpcPeeringConnection' :: Maybe Text
ipV4CidrBlock = Maybe Text
a} :: VpcPeeringConnection)

-- | A unique identifier for a VPC with resources to be accessed by your
-- GameLift fleet. The VPC must be in the same Region as your fleet. To
-- look up a VPC ID, use the
-- <https://console.aws.amazon.com/vpc/ VPC Dashboard> in the Amazon Web
-- Services Management Console. Learn more about VPC peering in
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/vpc-peering.html VPC Peering with GameLift Fleets>.
vpcPeeringConnection_peerVpcId :: Lens.Lens' VpcPeeringConnection (Prelude.Maybe Prelude.Text)
vpcPeeringConnection_peerVpcId :: Lens' VpcPeeringConnection (Maybe Text)
vpcPeeringConnection_peerVpcId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcPeeringConnection' {Maybe Text
peerVpcId :: Maybe Text
$sel:peerVpcId:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
peerVpcId} -> Maybe Text
peerVpcId) (\s :: VpcPeeringConnection
s@VpcPeeringConnection' {} Maybe Text
a -> VpcPeeringConnection
s {$sel:peerVpcId:VpcPeeringConnection' :: Maybe Text
peerVpcId = Maybe Text
a} :: VpcPeeringConnection)

-- | The status information about the connection. Status indicates if a
-- connection is pending, successful, or failed.
vpcPeeringConnection_status :: Lens.Lens' VpcPeeringConnection (Prelude.Maybe VpcPeeringConnectionStatus)
vpcPeeringConnection_status :: Lens' VpcPeeringConnection (Maybe VpcPeeringConnectionStatus)
vpcPeeringConnection_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcPeeringConnection' {Maybe VpcPeeringConnectionStatus
status :: Maybe VpcPeeringConnectionStatus
$sel:status:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe VpcPeeringConnectionStatus
status} -> Maybe VpcPeeringConnectionStatus
status) (\s :: VpcPeeringConnection
s@VpcPeeringConnection' {} Maybe VpcPeeringConnectionStatus
a -> VpcPeeringConnection
s {$sel:status:VpcPeeringConnection' :: Maybe VpcPeeringConnectionStatus
status = Maybe VpcPeeringConnectionStatus
a} :: VpcPeeringConnection)

-- | A unique identifier that is automatically assigned to the connection
-- record. This ID is referenced in VPC peering connection events, and is
-- used when deleting a connection.
vpcPeeringConnection_vpcPeeringConnectionId :: Lens.Lens' VpcPeeringConnection (Prelude.Maybe Prelude.Text)
vpcPeeringConnection_vpcPeeringConnectionId :: Lens' VpcPeeringConnection (Maybe Text)
vpcPeeringConnection_vpcPeeringConnectionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcPeeringConnection' {Maybe Text
vpcPeeringConnectionId :: Maybe Text
$sel:vpcPeeringConnectionId:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
vpcPeeringConnectionId} -> Maybe Text
vpcPeeringConnectionId) (\s :: VpcPeeringConnection
s@VpcPeeringConnection' {} Maybe Text
a -> VpcPeeringConnection
s {$sel:vpcPeeringConnectionId:VpcPeeringConnection' :: Maybe Text
vpcPeeringConnectionId = Maybe Text
a} :: VpcPeeringConnection)

instance Data.FromJSON VpcPeeringConnection where
  parseJSON :: Value -> Parser VpcPeeringConnection
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VpcPeeringConnection"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe VpcPeeringConnectionStatus
-> Maybe Text
-> VpcPeeringConnection
VpcPeeringConnection'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"FleetArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"FleetId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"GameLiftVpcId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IpV4CidrBlock")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PeerVpcId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"VpcPeeringConnectionId")
      )

instance Prelude.Hashable VpcPeeringConnection where
  hashWithSalt :: Int -> VpcPeeringConnection -> Int
hashWithSalt Int
_salt VpcPeeringConnection' {Maybe Text
Maybe VpcPeeringConnectionStatus
vpcPeeringConnectionId :: Maybe Text
status :: Maybe VpcPeeringConnectionStatus
peerVpcId :: Maybe Text
ipV4CidrBlock :: Maybe Text
gameLiftVpcId :: Maybe Text
fleetId :: Maybe Text
fleetArn :: Maybe Text
$sel:vpcPeeringConnectionId:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
$sel:status:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe VpcPeeringConnectionStatus
$sel:peerVpcId:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
$sel:ipV4CidrBlock:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
$sel:gameLiftVpcId:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
$sel:fleetId:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
$sel:fleetArn:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
fleetArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
fleetId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
gameLiftVpcId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ipV4CidrBlock
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
peerVpcId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VpcPeeringConnectionStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpcPeeringConnectionId

instance Prelude.NFData VpcPeeringConnection where
  rnf :: VpcPeeringConnection -> ()
rnf VpcPeeringConnection' {Maybe Text
Maybe VpcPeeringConnectionStatus
vpcPeeringConnectionId :: Maybe Text
status :: Maybe VpcPeeringConnectionStatus
peerVpcId :: Maybe Text
ipV4CidrBlock :: Maybe Text
gameLiftVpcId :: Maybe Text
fleetId :: Maybe Text
fleetArn :: Maybe Text
$sel:vpcPeeringConnectionId:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
$sel:status:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe VpcPeeringConnectionStatus
$sel:peerVpcId:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
$sel:ipV4CidrBlock:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
$sel:gameLiftVpcId:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
$sel:fleetId:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
$sel:fleetArn:VpcPeeringConnection' :: VpcPeeringConnection -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
fleetArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
fleetId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
gameLiftVpcId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ipV4CidrBlock
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
peerVpcId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VpcPeeringConnectionStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vpcPeeringConnectionId