{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.GameLift.Types.VpcPeeringAuthorization where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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__
--
-- CreateVpcPeeringAuthorization | DescribeVpcPeeringAuthorizations |
-- DeleteVpcPeeringAuthorization | CreateVpcPeeringConnection |
-- DescribeVpcPeeringConnections | DeleteVpcPeeringConnection |
-- <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 Core.POSIX,
    -- | 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 AWS
    -- 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,
    VpcPeeringAuthorization -> Maybe Text
peerVpcAwsAccountId :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the AWS account that you use to manage your
    -- GameLift fleet. You can find your Account ID in the AWS Management
    -- Console under account settings.
    VpcPeeringAuthorization -> Maybe Text
gameLiftAwsAccountId :: Prelude.Maybe Prelude.Text,
    -- | 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 Core.POSIX
  }
  deriving (VpcPeeringAuthorization -> VpcPeeringAuthorization -> Bool
(VpcPeeringAuthorization -> VpcPeeringAuthorization -> Bool)
-> (VpcPeeringAuthorization -> VpcPeeringAuthorization -> Bool)
-> Eq VpcPeeringAuthorization
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]
(Int -> ReadS VpcPeeringAuthorization)
-> ReadS [VpcPeeringAuthorization]
-> ReadPrec VpcPeeringAuthorization
-> ReadPrec [VpcPeeringAuthorization]
-> Read 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
(Int -> VpcPeeringAuthorization -> ShowS)
-> (VpcPeeringAuthorization -> String)
-> ([VpcPeeringAuthorization] -> ShowS)
-> Show VpcPeeringAuthorization
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.
 VpcPeeringAuthorization -> Rep VpcPeeringAuthorization x)
-> (forall x.
    Rep VpcPeeringAuthorization x -> VpcPeeringAuthorization)
-> Generic VpcPeeringAuthorization
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\"@).
--
-- '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 AWS
-- Management Console. Learn more about VPC peering in
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/vpc-peering.html VPC Peering with GameLift Fleets>.
--
-- 'peerVpcAwsAccountId', 'vpcPeeringAuthorization_peerVpcAwsAccountId' -
--
-- 'gameLiftAwsAccountId', 'vpcPeeringAuthorization_gameLiftAwsAccountId' - A unique identifier for the AWS account that you use to manage your
-- GameLift fleet. You can find your Account ID in the AWS Management
-- Console under account settings.
--
-- '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\"@).
newVpcPeeringAuthorization ::
  VpcPeeringAuthorization
newVpcPeeringAuthorization :: VpcPeeringAuthorization
newVpcPeeringAuthorization =
  VpcPeeringAuthorization' :: Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> VpcPeeringAuthorization
VpcPeeringAuthorization'
    { $sel:creationTime:VpcPeeringAuthorization' :: Maybe POSIX
creationTime =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:peerVpcId:VpcPeeringAuthorization' :: Maybe Text
peerVpcId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:peerVpcAwsAccountId:VpcPeeringAuthorization' :: Maybe Text
peerVpcAwsAccountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:gameLiftAwsAccountId:VpcPeeringAuthorization' :: Maybe Text
gameLiftAwsAccountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:expirationTime:VpcPeeringAuthorization' :: Maybe POSIX
expirationTime = Maybe POSIX
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 :: (Maybe UTCTime -> f (Maybe UTCTime))
-> VpcPeeringAuthorization -> f VpcPeeringAuthorization
vpcPeeringAuthorization_creationTime = (VpcPeeringAuthorization -> Maybe POSIX)
-> (VpcPeeringAuthorization
    -> Maybe POSIX -> VpcPeeringAuthorization)
-> Lens
     VpcPeeringAuthorization
     VpcPeeringAuthorization
     (Maybe POSIX)
     (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> VpcPeeringAuthorization -> f VpcPeeringAuthorization)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> VpcPeeringAuthorization
-> f VpcPeeringAuthorization
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | 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 AWS
-- 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 :: (Maybe Text -> f (Maybe Text))
-> VpcPeeringAuthorization -> f VpcPeeringAuthorization
vpcPeeringAuthorization_peerVpcId = (VpcPeeringAuthorization -> Maybe Text)
-> (VpcPeeringAuthorization
    -> Maybe Text -> VpcPeeringAuthorization)
-> Lens
     VpcPeeringAuthorization
     VpcPeeringAuthorization
     (Maybe Text)
     (Maybe Text)
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)

-- |
vpcPeeringAuthorization_peerVpcAwsAccountId :: Lens.Lens' VpcPeeringAuthorization (Prelude.Maybe Prelude.Text)
vpcPeeringAuthorization_peerVpcAwsAccountId :: (Maybe Text -> f (Maybe Text))
-> VpcPeeringAuthorization -> f VpcPeeringAuthorization
vpcPeeringAuthorization_peerVpcAwsAccountId = (VpcPeeringAuthorization -> Maybe Text)
-> (VpcPeeringAuthorization
    -> Maybe Text -> VpcPeeringAuthorization)
-> Lens
     VpcPeeringAuthorization
     VpcPeeringAuthorization
     (Maybe Text)
     (Maybe Text)
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 the AWS account that you use to manage your
-- GameLift fleet. You can find your Account ID in the AWS Management
-- Console under account settings.
vpcPeeringAuthorization_gameLiftAwsAccountId :: Lens.Lens' VpcPeeringAuthorization (Prelude.Maybe Prelude.Text)
vpcPeeringAuthorization_gameLiftAwsAccountId :: (Maybe Text -> f (Maybe Text))
-> VpcPeeringAuthorization -> f VpcPeeringAuthorization
vpcPeeringAuthorization_gameLiftAwsAccountId = (VpcPeeringAuthorization -> Maybe Text)
-> (VpcPeeringAuthorization
    -> Maybe Text -> VpcPeeringAuthorization)
-> Lens
     VpcPeeringAuthorization
     VpcPeeringAuthorization
     (Maybe Text)
     (Maybe Text)
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)

-- | 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 :: (Maybe UTCTime -> f (Maybe UTCTime))
-> VpcPeeringAuthorization -> f VpcPeeringAuthorization
vpcPeeringAuthorization_expirationTime = (VpcPeeringAuthorization -> Maybe POSIX)
-> (VpcPeeringAuthorization
    -> Maybe POSIX -> VpcPeeringAuthorization)
-> Lens
     VpcPeeringAuthorization
     VpcPeeringAuthorization
     (Maybe POSIX)
     (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> VpcPeeringAuthorization -> f VpcPeeringAuthorization)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> VpcPeeringAuthorization
-> f VpcPeeringAuthorization
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON VpcPeeringAuthorization where
  parseJSON :: Value -> Parser VpcPeeringAuthorization
parseJSON =
    String
-> (Object -> Parser VpcPeeringAuthorization)
-> Value
-> Parser VpcPeeringAuthorization
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VpcPeeringAuthorization"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> VpcPeeringAuthorization
VpcPeeringAuthorization'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> VpcPeeringAuthorization)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> VpcPeeringAuthorization)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationTime")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> VpcPeeringAuthorization)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe POSIX -> VpcPeeringAuthorization)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PeerVpcId")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe POSIX -> VpcPeeringAuthorization)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> VpcPeeringAuthorization)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PeerVpcAwsAccountId")
            Parser (Maybe Text -> Maybe POSIX -> VpcPeeringAuthorization)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> VpcPeeringAuthorization)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"GameLiftAwsAccountId")
            Parser (Maybe POSIX -> VpcPeeringAuthorization)
-> Parser (Maybe POSIX) -> Parser VpcPeeringAuthorization
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ExpirationTime")
      )

instance Prelude.Hashable VpcPeeringAuthorization

instance Prelude.NFData VpcPeeringAuthorization