{-# 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.VpcPeeringAuthorization
-- 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.VpcPeeringAuthorization where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Represents an authorization for a VPC peering connection between the VPC
-- for an Amazon GameLift fleet and another VPC on an account you have
-- access to. This authorization must exist and be valid for the peering
-- connection to be established. Authorizations are valid for 24 hours
-- after they are issued.
--
-- __Related actions__
--
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets All APIs by task>
--
-- /See:/ 'newVpcPeeringAuthorization' smart constructor.
data VpcPeeringAuthorization = VpcPeeringAuthorization'
  { -- | Time stamp indicating when this authorization was issued. Format is a
    -- number expressed in Unix time as milliseconds (for example
    -- @\"1469498468.057\"@).
    VpcPeeringAuthorization -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
    -- | Time stamp indicating when this authorization expires (24 hours after
    -- issuance). Format is a number expressed in Unix time as milliseconds
    -- (for example @\"1469498468.057\"@).
    VpcPeeringAuthorization -> Maybe POSIX
expirationTime :: Prelude.Maybe Data.POSIX,
    -- | A unique identifier for the Amazon Web Services account that you use to
    -- manage your GameLift fleet. You can find your Account ID in the Amazon
    -- Web Services Management Console under account settings.
    VpcPeeringAuthorization -> Maybe Text
gameLiftAwsAccountId :: Prelude.Maybe Prelude.Text,
    -- | The authorization\'s peer VPC Amazon Web Services account ID.
    VpcPeeringAuthorization -> Maybe Text
peerVpcAwsAccountId :: 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>.
    VpcPeeringAuthorization -> Maybe Text
peerVpcId :: Prelude.Maybe Prelude.Text
  }
  deriving (VpcPeeringAuthorization -> VpcPeeringAuthorization -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcPeeringAuthorization -> VpcPeeringAuthorization -> Bool
$c/= :: VpcPeeringAuthorization -> VpcPeeringAuthorization -> Bool
== :: VpcPeeringAuthorization -> VpcPeeringAuthorization -> Bool
$c== :: VpcPeeringAuthorization -> VpcPeeringAuthorization -> Bool
Prelude.Eq, ReadPrec [VpcPeeringAuthorization]
ReadPrec VpcPeeringAuthorization
Int -> ReadS VpcPeeringAuthorization
ReadS [VpcPeeringAuthorization]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcPeeringAuthorization]
$creadListPrec :: ReadPrec [VpcPeeringAuthorization]
readPrec :: ReadPrec VpcPeeringAuthorization
$creadPrec :: ReadPrec VpcPeeringAuthorization
readList :: ReadS [VpcPeeringAuthorization]
$creadList :: ReadS [VpcPeeringAuthorization]
readsPrec :: Int -> ReadS VpcPeeringAuthorization
$creadsPrec :: Int -> ReadS VpcPeeringAuthorization
Prelude.Read, Int -> VpcPeeringAuthorization -> ShowS
[VpcPeeringAuthorization] -> ShowS
VpcPeeringAuthorization -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcPeeringAuthorization] -> ShowS
$cshowList :: [VpcPeeringAuthorization] -> ShowS
show :: VpcPeeringAuthorization -> String
$cshow :: VpcPeeringAuthorization -> String
showsPrec :: Int -> VpcPeeringAuthorization -> ShowS
$cshowsPrec :: Int -> VpcPeeringAuthorization -> ShowS
Prelude.Show, forall x. Rep VpcPeeringAuthorization x -> VpcPeeringAuthorization
forall x. VpcPeeringAuthorization -> Rep VpcPeeringAuthorization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpcPeeringAuthorization x -> VpcPeeringAuthorization
$cfrom :: forall x. VpcPeeringAuthorization -> Rep VpcPeeringAuthorization x
Prelude.Generic)

-- |
-- Create a value of 'VpcPeeringAuthorization' 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:
--
-- 'creationTime', 'vpcPeeringAuthorization_creationTime' - Time stamp indicating when this authorization was issued. Format is a
-- number expressed in Unix time as milliseconds (for example
-- @\"1469498468.057\"@).
--
-- 'expirationTime', 'vpcPeeringAuthorization_expirationTime' - Time stamp indicating when this authorization expires (24 hours after
-- issuance). Format is a number expressed in Unix time as milliseconds
-- (for example @\"1469498468.057\"@).
--
-- 'gameLiftAwsAccountId', 'vpcPeeringAuthorization_gameLiftAwsAccountId' - A unique identifier for the Amazon Web Services account that you use to
-- manage your GameLift fleet. You can find your Account ID in the Amazon
-- Web Services Management Console under account settings.
--
-- 'peerVpcAwsAccountId', 'vpcPeeringAuthorization_peerVpcAwsAccountId' - The authorization\'s peer VPC Amazon Web Services account ID.
--
-- 'peerVpcId', 'vpcPeeringAuthorization_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>.
newVpcPeeringAuthorization ::
  VpcPeeringAuthorization
newVpcPeeringAuthorization :: VpcPeeringAuthorization
newVpcPeeringAuthorization =
  VpcPeeringAuthorization'
    { $sel:creationTime:VpcPeeringAuthorization' :: Maybe POSIX
creationTime =
        forall a. Maybe a
Prelude.Nothing,
      $sel:expirationTime:VpcPeeringAuthorization' :: Maybe POSIX
expirationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:gameLiftAwsAccountId:VpcPeeringAuthorization' :: Maybe Text
gameLiftAwsAccountId = forall a. Maybe a
Prelude.Nothing,
      $sel:peerVpcAwsAccountId:VpcPeeringAuthorization' :: Maybe Text
peerVpcAwsAccountId = forall a. Maybe a
Prelude.Nothing,
      $sel:peerVpcId:VpcPeeringAuthorization' :: Maybe Text
peerVpcId = forall a. Maybe a
Prelude.Nothing
    }

-- | Time stamp indicating when this authorization was issued. Format is a
-- number expressed in Unix time as milliseconds (for example
-- @\"1469498468.057\"@).
vpcPeeringAuthorization_creationTime :: Lens.Lens' VpcPeeringAuthorization (Prelude.Maybe Prelude.UTCTime)
vpcPeeringAuthorization_creationTime :: Lens' VpcPeeringAuthorization (Maybe UTCTime)
vpcPeeringAuthorization_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcPeeringAuthorization' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:VpcPeeringAuthorization' :: VpcPeeringAuthorization -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: VpcPeeringAuthorization
s@VpcPeeringAuthorization' {} Maybe POSIX
a -> VpcPeeringAuthorization
s {$sel:creationTime:VpcPeeringAuthorization' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: VpcPeeringAuthorization) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Time stamp indicating when this authorization expires (24 hours after
-- issuance). Format is a number expressed in Unix time as milliseconds
-- (for example @\"1469498468.057\"@).
vpcPeeringAuthorization_expirationTime :: Lens.Lens' VpcPeeringAuthorization (Prelude.Maybe Prelude.UTCTime)
vpcPeeringAuthorization_expirationTime :: Lens' VpcPeeringAuthorization (Maybe UTCTime)
vpcPeeringAuthorization_expirationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcPeeringAuthorization' {Maybe POSIX
expirationTime :: Maybe POSIX
$sel:expirationTime:VpcPeeringAuthorization' :: VpcPeeringAuthorization -> Maybe POSIX
expirationTime} -> Maybe POSIX
expirationTime) (\s :: VpcPeeringAuthorization
s@VpcPeeringAuthorization' {} Maybe POSIX
a -> VpcPeeringAuthorization
s {$sel:expirationTime:VpcPeeringAuthorization' :: Maybe POSIX
expirationTime = Maybe POSIX
a} :: VpcPeeringAuthorization) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A unique identifier for the Amazon Web Services account that you use to
-- manage your GameLift fleet. You can find your Account ID in the Amazon
-- Web Services Management Console under account settings.
vpcPeeringAuthorization_gameLiftAwsAccountId :: Lens.Lens' VpcPeeringAuthorization (Prelude.Maybe Prelude.Text)
vpcPeeringAuthorization_gameLiftAwsAccountId :: Lens' VpcPeeringAuthorization (Maybe Text)
vpcPeeringAuthorization_gameLiftAwsAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcPeeringAuthorization' {Maybe Text
gameLiftAwsAccountId :: Maybe Text
$sel:gameLiftAwsAccountId:VpcPeeringAuthorization' :: VpcPeeringAuthorization -> Maybe Text
gameLiftAwsAccountId} -> Maybe Text
gameLiftAwsAccountId) (\s :: VpcPeeringAuthorization
s@VpcPeeringAuthorization' {} Maybe Text
a -> VpcPeeringAuthorization
s {$sel:gameLiftAwsAccountId:VpcPeeringAuthorization' :: Maybe Text
gameLiftAwsAccountId = Maybe Text
a} :: VpcPeeringAuthorization)

-- | The authorization\'s peer VPC Amazon Web Services account ID.
vpcPeeringAuthorization_peerVpcAwsAccountId :: Lens.Lens' VpcPeeringAuthorization (Prelude.Maybe Prelude.Text)
vpcPeeringAuthorization_peerVpcAwsAccountId :: Lens' VpcPeeringAuthorization (Maybe Text)
vpcPeeringAuthorization_peerVpcAwsAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcPeeringAuthorization' {Maybe Text
peerVpcAwsAccountId :: Maybe Text
$sel:peerVpcAwsAccountId:VpcPeeringAuthorization' :: VpcPeeringAuthorization -> Maybe Text
peerVpcAwsAccountId} -> Maybe Text
peerVpcAwsAccountId) (\s :: VpcPeeringAuthorization
s@VpcPeeringAuthorization' {} Maybe Text
a -> VpcPeeringAuthorization
s {$sel:peerVpcAwsAccountId:VpcPeeringAuthorization' :: Maybe Text
peerVpcAwsAccountId = Maybe Text
a} :: VpcPeeringAuthorization)

-- | 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>.
vpcPeeringAuthorization_peerVpcId :: Lens.Lens' VpcPeeringAuthorization (Prelude.Maybe Prelude.Text)
vpcPeeringAuthorization_peerVpcId :: Lens' VpcPeeringAuthorization (Maybe Text)
vpcPeeringAuthorization_peerVpcId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcPeeringAuthorization' {Maybe Text
peerVpcId :: Maybe Text
$sel:peerVpcId:VpcPeeringAuthorization' :: VpcPeeringAuthorization -> Maybe Text
peerVpcId} -> Maybe Text
peerVpcId) (\s :: VpcPeeringAuthorization
s@VpcPeeringAuthorization' {} Maybe Text
a -> VpcPeeringAuthorization
s {$sel:peerVpcId:VpcPeeringAuthorization' :: Maybe Text
peerVpcId = Maybe Text
a} :: VpcPeeringAuthorization)

instance Data.FromJSON VpcPeeringAuthorization where
  parseJSON :: Value -> Parser VpcPeeringAuthorization
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VpcPeeringAuthorization"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> VpcPeeringAuthorization
VpcPeeringAuthorization'
            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
"CreationTime")
            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
"ExpirationTime")
            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
"GameLiftAwsAccountId")
            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
"PeerVpcAwsAccountId")
            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")
      )

instance Prelude.Hashable VpcPeeringAuthorization where
  hashWithSalt :: Int -> VpcPeeringAuthorization -> Int
hashWithSalt Int
_salt VpcPeeringAuthorization' {Maybe Text
Maybe POSIX
peerVpcId :: Maybe Text
peerVpcAwsAccountId :: Maybe Text
gameLiftAwsAccountId :: Maybe Text
expirationTime :: Maybe POSIX
creationTime :: Maybe POSIX
$sel:peerVpcId:VpcPeeringAuthorization' :: VpcPeeringAuthorization -> Maybe Text
$sel:peerVpcAwsAccountId:VpcPeeringAuthorization' :: VpcPeeringAuthorization -> Maybe Text
$sel:gameLiftAwsAccountId:VpcPeeringAuthorization' :: VpcPeeringAuthorization -> Maybe Text
$sel:expirationTime:VpcPeeringAuthorization' :: VpcPeeringAuthorization -> Maybe POSIX
$sel:creationTime:VpcPeeringAuthorization' :: VpcPeeringAuthorization -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
expirationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
gameLiftAwsAccountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
peerVpcAwsAccountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
peerVpcId

instance Prelude.NFData VpcPeeringAuthorization where
  rnf :: VpcPeeringAuthorization -> ()
rnf VpcPeeringAuthorization' {Maybe Text
Maybe POSIX
peerVpcId :: Maybe Text
peerVpcAwsAccountId :: Maybe Text
gameLiftAwsAccountId :: Maybe Text
expirationTime :: Maybe POSIX
creationTime :: Maybe POSIX
$sel:peerVpcId:VpcPeeringAuthorization' :: VpcPeeringAuthorization -> Maybe Text
$sel:peerVpcAwsAccountId:VpcPeeringAuthorization' :: VpcPeeringAuthorization -> Maybe Text
$sel:gameLiftAwsAccountId:VpcPeeringAuthorization' :: VpcPeeringAuthorization -> Maybe Text
$sel:expirationTime:VpcPeeringAuthorization' :: VpcPeeringAuthorization -> Maybe POSIX
$sel:creationTime:VpcPeeringAuthorization' :: VpcPeeringAuthorization -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
expirationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
gameLiftAwsAccountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
peerVpcAwsAccountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
peerVpcId