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

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

-- |
-- Module      : Amazonka.DirectConnect.CreateDirectConnectGatewayAssociation
-- 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)
--
-- Creates an association between a Direct Connect gateway and a virtual
-- private gateway. The virtual private gateway must be attached to a VPC
-- and must not be associated with another Direct Connect gateway.
module Amazonka.DirectConnect.CreateDirectConnectGatewayAssociation
  ( -- * Creating a Request
    CreateDirectConnectGatewayAssociation (..),
    newCreateDirectConnectGatewayAssociation,

    -- * Request Lenses
    createDirectConnectGatewayAssociation_virtualGatewayId,
    createDirectConnectGatewayAssociation_addAllowedPrefixesToDirectConnectGateway,
    createDirectConnectGatewayAssociation_gatewayId,
    createDirectConnectGatewayAssociation_directConnectGatewayId,

    -- * Destructuring the Response
    CreateDirectConnectGatewayAssociationResponse (..),
    newCreateDirectConnectGatewayAssociationResponse,

    -- * Response Lenses
    createDirectConnectGatewayAssociationResponse_directConnectGatewayAssociation,
    createDirectConnectGatewayAssociationResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DirectConnect.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateDirectConnectGatewayAssociation' smart constructor.
data CreateDirectConnectGatewayAssociation = CreateDirectConnectGatewayAssociation'
  { -- | The ID of the virtual private gateway.
    CreateDirectConnectGatewayAssociation -> Maybe Text
virtualGatewayId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon VPC prefixes to advertise to the Direct Connect gateway
    --
    -- This parameter is required when you create an association to a transit
    -- gateway.
    --
    -- For information about how to set the prefixes, see
    -- <https://docs.aws.amazon.com/directconnect/latest/UserGuide/multi-account-associate-vgw.html#allowed-prefixes Allowed Prefixes>
    -- in the /Direct Connect User Guide/.
    CreateDirectConnectGatewayAssociation -> Maybe [RouteFilterPrefix]
addAllowedPrefixesToDirectConnectGateway :: Prelude.Maybe [RouteFilterPrefix],
    -- | The ID of the virtual private gateway or transit gateway.
    CreateDirectConnectGatewayAssociation -> Maybe Text
gatewayId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Direct Connect gateway.
    CreateDirectConnectGatewayAssociation -> Text
directConnectGatewayId :: Prelude.Text
  }
  deriving (CreateDirectConnectGatewayAssociation
-> CreateDirectConnectGatewayAssociation -> Bool
(CreateDirectConnectGatewayAssociation
 -> CreateDirectConnectGatewayAssociation -> Bool)
-> (CreateDirectConnectGatewayAssociation
    -> CreateDirectConnectGatewayAssociation -> Bool)
-> Eq CreateDirectConnectGatewayAssociation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDirectConnectGatewayAssociation
-> CreateDirectConnectGatewayAssociation -> Bool
$c/= :: CreateDirectConnectGatewayAssociation
-> CreateDirectConnectGatewayAssociation -> Bool
== :: CreateDirectConnectGatewayAssociation
-> CreateDirectConnectGatewayAssociation -> Bool
$c== :: CreateDirectConnectGatewayAssociation
-> CreateDirectConnectGatewayAssociation -> Bool
Prelude.Eq, ReadPrec [CreateDirectConnectGatewayAssociation]
ReadPrec CreateDirectConnectGatewayAssociation
Int -> ReadS CreateDirectConnectGatewayAssociation
ReadS [CreateDirectConnectGatewayAssociation]
(Int -> ReadS CreateDirectConnectGatewayAssociation)
-> ReadS [CreateDirectConnectGatewayAssociation]
-> ReadPrec CreateDirectConnectGatewayAssociation
-> ReadPrec [CreateDirectConnectGatewayAssociation]
-> Read CreateDirectConnectGatewayAssociation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDirectConnectGatewayAssociation]
$creadListPrec :: ReadPrec [CreateDirectConnectGatewayAssociation]
readPrec :: ReadPrec CreateDirectConnectGatewayAssociation
$creadPrec :: ReadPrec CreateDirectConnectGatewayAssociation
readList :: ReadS [CreateDirectConnectGatewayAssociation]
$creadList :: ReadS [CreateDirectConnectGatewayAssociation]
readsPrec :: Int -> ReadS CreateDirectConnectGatewayAssociation
$creadsPrec :: Int -> ReadS CreateDirectConnectGatewayAssociation
Prelude.Read, Int -> CreateDirectConnectGatewayAssociation -> ShowS
[CreateDirectConnectGatewayAssociation] -> ShowS
CreateDirectConnectGatewayAssociation -> String
(Int -> CreateDirectConnectGatewayAssociation -> ShowS)
-> (CreateDirectConnectGatewayAssociation -> String)
-> ([CreateDirectConnectGatewayAssociation] -> ShowS)
-> Show CreateDirectConnectGatewayAssociation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDirectConnectGatewayAssociation] -> ShowS
$cshowList :: [CreateDirectConnectGatewayAssociation] -> ShowS
show :: CreateDirectConnectGatewayAssociation -> String
$cshow :: CreateDirectConnectGatewayAssociation -> String
showsPrec :: Int -> CreateDirectConnectGatewayAssociation -> ShowS
$cshowsPrec :: Int -> CreateDirectConnectGatewayAssociation -> ShowS
Prelude.Show, (forall x.
 CreateDirectConnectGatewayAssociation
 -> Rep CreateDirectConnectGatewayAssociation x)
-> (forall x.
    Rep CreateDirectConnectGatewayAssociation x
    -> CreateDirectConnectGatewayAssociation)
-> Generic CreateDirectConnectGatewayAssociation
forall x.
Rep CreateDirectConnectGatewayAssociation x
-> CreateDirectConnectGatewayAssociation
forall x.
CreateDirectConnectGatewayAssociation
-> Rep CreateDirectConnectGatewayAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDirectConnectGatewayAssociation x
-> CreateDirectConnectGatewayAssociation
$cfrom :: forall x.
CreateDirectConnectGatewayAssociation
-> Rep CreateDirectConnectGatewayAssociation x
Prelude.Generic)

-- |
-- Create a value of 'CreateDirectConnectGatewayAssociation' 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:
--
-- 'virtualGatewayId', 'createDirectConnectGatewayAssociation_virtualGatewayId' - The ID of the virtual private gateway.
--
-- 'addAllowedPrefixesToDirectConnectGateway', 'createDirectConnectGatewayAssociation_addAllowedPrefixesToDirectConnectGateway' - The Amazon VPC prefixes to advertise to the Direct Connect gateway
--
-- This parameter is required when you create an association to a transit
-- gateway.
--
-- For information about how to set the prefixes, see
-- <https://docs.aws.amazon.com/directconnect/latest/UserGuide/multi-account-associate-vgw.html#allowed-prefixes Allowed Prefixes>
-- in the /Direct Connect User Guide/.
--
-- 'gatewayId', 'createDirectConnectGatewayAssociation_gatewayId' - The ID of the virtual private gateway or transit gateway.
--
-- 'directConnectGatewayId', 'createDirectConnectGatewayAssociation_directConnectGatewayId' - The ID of the Direct Connect gateway.
newCreateDirectConnectGatewayAssociation ::
  -- | 'directConnectGatewayId'
  Prelude.Text ->
  CreateDirectConnectGatewayAssociation
newCreateDirectConnectGatewayAssociation :: Text -> CreateDirectConnectGatewayAssociation
newCreateDirectConnectGatewayAssociation
  Text
pDirectConnectGatewayId_ =
    CreateDirectConnectGatewayAssociation' :: Maybe Text
-> Maybe [RouteFilterPrefix]
-> Maybe Text
-> Text
-> CreateDirectConnectGatewayAssociation
CreateDirectConnectGatewayAssociation'
      { $sel:virtualGatewayId:CreateDirectConnectGatewayAssociation' :: Maybe Text
virtualGatewayId =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:addAllowedPrefixesToDirectConnectGateway:CreateDirectConnectGatewayAssociation' :: Maybe [RouteFilterPrefix]
addAllowedPrefixesToDirectConnectGateway =
          Maybe [RouteFilterPrefix]
forall a. Maybe a
Prelude.Nothing,
        $sel:gatewayId:CreateDirectConnectGatewayAssociation' :: Maybe Text
gatewayId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:directConnectGatewayId:CreateDirectConnectGatewayAssociation' :: Text
directConnectGatewayId =
          Text
pDirectConnectGatewayId_
      }

-- | The ID of the virtual private gateway.
createDirectConnectGatewayAssociation_virtualGatewayId :: Lens.Lens' CreateDirectConnectGatewayAssociation (Prelude.Maybe Prelude.Text)
createDirectConnectGatewayAssociation_virtualGatewayId :: (Maybe Text -> f (Maybe Text))
-> CreateDirectConnectGatewayAssociation
-> f CreateDirectConnectGatewayAssociation
createDirectConnectGatewayAssociation_virtualGatewayId = (CreateDirectConnectGatewayAssociation -> Maybe Text)
-> (CreateDirectConnectGatewayAssociation
    -> Maybe Text -> CreateDirectConnectGatewayAssociation)
-> Lens
     CreateDirectConnectGatewayAssociation
     CreateDirectConnectGatewayAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDirectConnectGatewayAssociation' {Maybe Text
virtualGatewayId :: Maybe Text
$sel:virtualGatewayId:CreateDirectConnectGatewayAssociation' :: CreateDirectConnectGatewayAssociation -> Maybe Text
virtualGatewayId} -> Maybe Text
virtualGatewayId) (\s :: CreateDirectConnectGatewayAssociation
s@CreateDirectConnectGatewayAssociation' {} Maybe Text
a -> CreateDirectConnectGatewayAssociation
s {$sel:virtualGatewayId:CreateDirectConnectGatewayAssociation' :: Maybe Text
virtualGatewayId = Maybe Text
a} :: CreateDirectConnectGatewayAssociation)

-- | The Amazon VPC prefixes to advertise to the Direct Connect gateway
--
-- This parameter is required when you create an association to a transit
-- gateway.
--
-- For information about how to set the prefixes, see
-- <https://docs.aws.amazon.com/directconnect/latest/UserGuide/multi-account-associate-vgw.html#allowed-prefixes Allowed Prefixes>
-- in the /Direct Connect User Guide/.
createDirectConnectGatewayAssociation_addAllowedPrefixesToDirectConnectGateway :: Lens.Lens' CreateDirectConnectGatewayAssociation (Prelude.Maybe [RouteFilterPrefix])
createDirectConnectGatewayAssociation_addAllowedPrefixesToDirectConnectGateway :: (Maybe [RouteFilterPrefix] -> f (Maybe [RouteFilterPrefix]))
-> CreateDirectConnectGatewayAssociation
-> f CreateDirectConnectGatewayAssociation
createDirectConnectGatewayAssociation_addAllowedPrefixesToDirectConnectGateway = (CreateDirectConnectGatewayAssociation
 -> Maybe [RouteFilterPrefix])
-> (CreateDirectConnectGatewayAssociation
    -> Maybe [RouteFilterPrefix]
    -> CreateDirectConnectGatewayAssociation)
-> Lens
     CreateDirectConnectGatewayAssociation
     CreateDirectConnectGatewayAssociation
     (Maybe [RouteFilterPrefix])
     (Maybe [RouteFilterPrefix])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDirectConnectGatewayAssociation' {Maybe [RouteFilterPrefix]
addAllowedPrefixesToDirectConnectGateway :: Maybe [RouteFilterPrefix]
$sel:addAllowedPrefixesToDirectConnectGateway:CreateDirectConnectGatewayAssociation' :: CreateDirectConnectGatewayAssociation -> Maybe [RouteFilterPrefix]
addAllowedPrefixesToDirectConnectGateway} -> Maybe [RouteFilterPrefix]
addAllowedPrefixesToDirectConnectGateway) (\s :: CreateDirectConnectGatewayAssociation
s@CreateDirectConnectGatewayAssociation' {} Maybe [RouteFilterPrefix]
a -> CreateDirectConnectGatewayAssociation
s {$sel:addAllowedPrefixesToDirectConnectGateway:CreateDirectConnectGatewayAssociation' :: Maybe [RouteFilterPrefix]
addAllowedPrefixesToDirectConnectGateway = Maybe [RouteFilterPrefix]
a} :: CreateDirectConnectGatewayAssociation) ((Maybe [RouteFilterPrefix] -> f (Maybe [RouteFilterPrefix]))
 -> CreateDirectConnectGatewayAssociation
 -> f CreateDirectConnectGatewayAssociation)
-> ((Maybe [RouteFilterPrefix] -> f (Maybe [RouteFilterPrefix]))
    -> Maybe [RouteFilterPrefix] -> f (Maybe [RouteFilterPrefix]))
-> (Maybe [RouteFilterPrefix] -> f (Maybe [RouteFilterPrefix]))
-> CreateDirectConnectGatewayAssociation
-> f CreateDirectConnectGatewayAssociation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [RouteFilterPrefix]
  [RouteFilterPrefix]
  [RouteFilterPrefix]
  [RouteFilterPrefix]
-> Iso
     (Maybe [RouteFilterPrefix])
     (Maybe [RouteFilterPrefix])
     (Maybe [RouteFilterPrefix])
     (Maybe [RouteFilterPrefix])
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
  [RouteFilterPrefix]
  [RouteFilterPrefix]
  [RouteFilterPrefix]
  [RouteFilterPrefix]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the virtual private gateway or transit gateway.
createDirectConnectGatewayAssociation_gatewayId :: Lens.Lens' CreateDirectConnectGatewayAssociation (Prelude.Maybe Prelude.Text)
createDirectConnectGatewayAssociation_gatewayId :: (Maybe Text -> f (Maybe Text))
-> CreateDirectConnectGatewayAssociation
-> f CreateDirectConnectGatewayAssociation
createDirectConnectGatewayAssociation_gatewayId = (CreateDirectConnectGatewayAssociation -> Maybe Text)
-> (CreateDirectConnectGatewayAssociation
    -> Maybe Text -> CreateDirectConnectGatewayAssociation)
-> Lens
     CreateDirectConnectGatewayAssociation
     CreateDirectConnectGatewayAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDirectConnectGatewayAssociation' {Maybe Text
gatewayId :: Maybe Text
$sel:gatewayId:CreateDirectConnectGatewayAssociation' :: CreateDirectConnectGatewayAssociation -> Maybe Text
gatewayId} -> Maybe Text
gatewayId) (\s :: CreateDirectConnectGatewayAssociation
s@CreateDirectConnectGatewayAssociation' {} Maybe Text
a -> CreateDirectConnectGatewayAssociation
s {$sel:gatewayId:CreateDirectConnectGatewayAssociation' :: Maybe Text
gatewayId = Maybe Text
a} :: CreateDirectConnectGatewayAssociation)

-- | The ID of the Direct Connect gateway.
createDirectConnectGatewayAssociation_directConnectGatewayId :: Lens.Lens' CreateDirectConnectGatewayAssociation Prelude.Text
createDirectConnectGatewayAssociation_directConnectGatewayId :: (Text -> f Text)
-> CreateDirectConnectGatewayAssociation
-> f CreateDirectConnectGatewayAssociation
createDirectConnectGatewayAssociation_directConnectGatewayId = (CreateDirectConnectGatewayAssociation -> Text)
-> (CreateDirectConnectGatewayAssociation
    -> Text -> CreateDirectConnectGatewayAssociation)
-> Lens
     CreateDirectConnectGatewayAssociation
     CreateDirectConnectGatewayAssociation
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDirectConnectGatewayAssociation' {Text
directConnectGatewayId :: Text
$sel:directConnectGatewayId:CreateDirectConnectGatewayAssociation' :: CreateDirectConnectGatewayAssociation -> Text
directConnectGatewayId} -> Text
directConnectGatewayId) (\s :: CreateDirectConnectGatewayAssociation
s@CreateDirectConnectGatewayAssociation' {} Text
a -> CreateDirectConnectGatewayAssociation
s {$sel:directConnectGatewayId:CreateDirectConnectGatewayAssociation' :: Text
directConnectGatewayId = Text
a} :: CreateDirectConnectGatewayAssociation)

instance
  Core.AWSRequest
    CreateDirectConnectGatewayAssociation
  where
  type
    AWSResponse
      CreateDirectConnectGatewayAssociation =
      CreateDirectConnectGatewayAssociationResponse
  request :: CreateDirectConnectGatewayAssociation
-> Request CreateDirectConnectGatewayAssociation
request = Service
-> CreateDirectConnectGatewayAssociation
-> Request CreateDirectConnectGatewayAssociation
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateDirectConnectGatewayAssociation
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse CreateDirectConnectGatewayAssociation)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either
      String (AWSResponse CreateDirectConnectGatewayAssociation))
-> Logger
-> Service
-> Proxy CreateDirectConnectGatewayAssociation
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse CreateDirectConnectGatewayAssociation)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe DirectConnectGatewayAssociation
-> Int -> CreateDirectConnectGatewayAssociationResponse
CreateDirectConnectGatewayAssociationResponse'
            (Maybe DirectConnectGatewayAssociation
 -> Int -> CreateDirectConnectGatewayAssociationResponse)
-> Either String (Maybe DirectConnectGatewayAssociation)
-> Either
     String (Int -> CreateDirectConnectGatewayAssociationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Either String (Maybe DirectConnectGatewayAssociation)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"directConnectGatewayAssociation")
              Either
  String (Int -> CreateDirectConnectGatewayAssociationResponse)
-> Either String Int
-> Either String CreateDirectConnectGatewayAssociationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    CreateDirectConnectGatewayAssociation

instance
  Prelude.NFData
    CreateDirectConnectGatewayAssociation

instance
  Core.ToHeaders
    CreateDirectConnectGatewayAssociation
  where
  toHeaders :: CreateDirectConnectGatewayAssociation -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> CreateDirectConnectGatewayAssociation -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"OvertureService.CreateDirectConnectGatewayAssociation" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance
  Core.ToJSON
    CreateDirectConnectGatewayAssociation
  where
  toJSON :: CreateDirectConnectGatewayAssociation -> Value
toJSON CreateDirectConnectGatewayAssociation' {Maybe [RouteFilterPrefix]
Maybe Text
Text
directConnectGatewayId :: Text
gatewayId :: Maybe Text
addAllowedPrefixesToDirectConnectGateway :: Maybe [RouteFilterPrefix]
virtualGatewayId :: Maybe Text
$sel:directConnectGatewayId:CreateDirectConnectGatewayAssociation' :: CreateDirectConnectGatewayAssociation -> Text
$sel:gatewayId:CreateDirectConnectGatewayAssociation' :: CreateDirectConnectGatewayAssociation -> Maybe Text
$sel:addAllowedPrefixesToDirectConnectGateway:CreateDirectConnectGatewayAssociation' :: CreateDirectConnectGatewayAssociation -> Maybe [RouteFilterPrefix]
$sel:virtualGatewayId:CreateDirectConnectGatewayAssociation' :: CreateDirectConnectGatewayAssociation -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"virtualGatewayId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
virtualGatewayId,
            (Text
"addAllowedPrefixesToDirectConnectGateway" Text -> [RouteFilterPrefix] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([RouteFilterPrefix] -> Pair)
-> Maybe [RouteFilterPrefix] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [RouteFilterPrefix]
addAllowedPrefixesToDirectConnectGateway,
            (Text
"gatewayId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
gatewayId,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"directConnectGatewayId"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
directConnectGatewayId
              )
          ]
      )

instance
  Core.ToPath
    CreateDirectConnectGatewayAssociation
  where
  toPath :: CreateDirectConnectGatewayAssociation -> ByteString
toPath = ByteString -> CreateDirectConnectGatewayAssociation -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance
  Core.ToQuery
    CreateDirectConnectGatewayAssociation
  where
  toQuery :: CreateDirectConnectGatewayAssociation -> QueryString
toQuery = QueryString -> CreateDirectConnectGatewayAssociation -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateDirectConnectGatewayAssociationResponse' smart constructor.
data CreateDirectConnectGatewayAssociationResponse = CreateDirectConnectGatewayAssociationResponse'
  { -- | The association to be created.
    CreateDirectConnectGatewayAssociationResponse
-> Maybe DirectConnectGatewayAssociation
directConnectGatewayAssociation :: Prelude.Maybe DirectConnectGatewayAssociation,
    -- | The response's http status code.
    CreateDirectConnectGatewayAssociationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateDirectConnectGatewayAssociationResponse
-> CreateDirectConnectGatewayAssociationResponse -> Bool
(CreateDirectConnectGatewayAssociationResponse
 -> CreateDirectConnectGatewayAssociationResponse -> Bool)
-> (CreateDirectConnectGatewayAssociationResponse
    -> CreateDirectConnectGatewayAssociationResponse -> Bool)
-> Eq CreateDirectConnectGatewayAssociationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDirectConnectGatewayAssociationResponse
-> CreateDirectConnectGatewayAssociationResponse -> Bool
$c/= :: CreateDirectConnectGatewayAssociationResponse
-> CreateDirectConnectGatewayAssociationResponse -> Bool
== :: CreateDirectConnectGatewayAssociationResponse
-> CreateDirectConnectGatewayAssociationResponse -> Bool
$c== :: CreateDirectConnectGatewayAssociationResponse
-> CreateDirectConnectGatewayAssociationResponse -> Bool
Prelude.Eq, ReadPrec [CreateDirectConnectGatewayAssociationResponse]
ReadPrec CreateDirectConnectGatewayAssociationResponse
Int -> ReadS CreateDirectConnectGatewayAssociationResponse
ReadS [CreateDirectConnectGatewayAssociationResponse]
(Int -> ReadS CreateDirectConnectGatewayAssociationResponse)
-> ReadS [CreateDirectConnectGatewayAssociationResponse]
-> ReadPrec CreateDirectConnectGatewayAssociationResponse
-> ReadPrec [CreateDirectConnectGatewayAssociationResponse]
-> Read CreateDirectConnectGatewayAssociationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDirectConnectGatewayAssociationResponse]
$creadListPrec :: ReadPrec [CreateDirectConnectGatewayAssociationResponse]
readPrec :: ReadPrec CreateDirectConnectGatewayAssociationResponse
$creadPrec :: ReadPrec CreateDirectConnectGatewayAssociationResponse
readList :: ReadS [CreateDirectConnectGatewayAssociationResponse]
$creadList :: ReadS [CreateDirectConnectGatewayAssociationResponse]
readsPrec :: Int -> ReadS CreateDirectConnectGatewayAssociationResponse
$creadsPrec :: Int -> ReadS CreateDirectConnectGatewayAssociationResponse
Prelude.Read, Int -> CreateDirectConnectGatewayAssociationResponse -> ShowS
[CreateDirectConnectGatewayAssociationResponse] -> ShowS
CreateDirectConnectGatewayAssociationResponse -> String
(Int -> CreateDirectConnectGatewayAssociationResponse -> ShowS)
-> (CreateDirectConnectGatewayAssociationResponse -> String)
-> ([CreateDirectConnectGatewayAssociationResponse] -> ShowS)
-> Show CreateDirectConnectGatewayAssociationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDirectConnectGatewayAssociationResponse] -> ShowS
$cshowList :: [CreateDirectConnectGatewayAssociationResponse] -> ShowS
show :: CreateDirectConnectGatewayAssociationResponse -> String
$cshow :: CreateDirectConnectGatewayAssociationResponse -> String
showsPrec :: Int -> CreateDirectConnectGatewayAssociationResponse -> ShowS
$cshowsPrec :: Int -> CreateDirectConnectGatewayAssociationResponse -> ShowS
Prelude.Show, (forall x.
 CreateDirectConnectGatewayAssociationResponse
 -> Rep CreateDirectConnectGatewayAssociationResponse x)
-> (forall x.
    Rep CreateDirectConnectGatewayAssociationResponse x
    -> CreateDirectConnectGatewayAssociationResponse)
-> Generic CreateDirectConnectGatewayAssociationResponse
forall x.
Rep CreateDirectConnectGatewayAssociationResponse x
-> CreateDirectConnectGatewayAssociationResponse
forall x.
CreateDirectConnectGatewayAssociationResponse
-> Rep CreateDirectConnectGatewayAssociationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDirectConnectGatewayAssociationResponse x
-> CreateDirectConnectGatewayAssociationResponse
$cfrom :: forall x.
CreateDirectConnectGatewayAssociationResponse
-> Rep CreateDirectConnectGatewayAssociationResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateDirectConnectGatewayAssociationResponse' 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:
--
-- 'directConnectGatewayAssociation', 'createDirectConnectGatewayAssociationResponse_directConnectGatewayAssociation' - The association to be created.
--
-- 'httpStatus', 'createDirectConnectGatewayAssociationResponse_httpStatus' - The response's http status code.
newCreateDirectConnectGatewayAssociationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDirectConnectGatewayAssociationResponse
newCreateDirectConnectGatewayAssociationResponse :: Int -> CreateDirectConnectGatewayAssociationResponse
newCreateDirectConnectGatewayAssociationResponse
  Int
pHttpStatus_ =
    CreateDirectConnectGatewayAssociationResponse' :: Maybe DirectConnectGatewayAssociation
-> Int -> CreateDirectConnectGatewayAssociationResponse
CreateDirectConnectGatewayAssociationResponse'
      { $sel:directConnectGatewayAssociation:CreateDirectConnectGatewayAssociationResponse' :: Maybe DirectConnectGatewayAssociation
directConnectGatewayAssociation =
          Maybe DirectConnectGatewayAssociation
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:CreateDirectConnectGatewayAssociationResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The association to be created.
createDirectConnectGatewayAssociationResponse_directConnectGatewayAssociation :: Lens.Lens' CreateDirectConnectGatewayAssociationResponse (Prelude.Maybe DirectConnectGatewayAssociation)
createDirectConnectGatewayAssociationResponse_directConnectGatewayAssociation :: (Maybe DirectConnectGatewayAssociation
 -> f (Maybe DirectConnectGatewayAssociation))
-> CreateDirectConnectGatewayAssociationResponse
-> f CreateDirectConnectGatewayAssociationResponse
createDirectConnectGatewayAssociationResponse_directConnectGatewayAssociation = (CreateDirectConnectGatewayAssociationResponse
 -> Maybe DirectConnectGatewayAssociation)
-> (CreateDirectConnectGatewayAssociationResponse
    -> Maybe DirectConnectGatewayAssociation
    -> CreateDirectConnectGatewayAssociationResponse)
-> Lens
     CreateDirectConnectGatewayAssociationResponse
     CreateDirectConnectGatewayAssociationResponse
     (Maybe DirectConnectGatewayAssociation)
     (Maybe DirectConnectGatewayAssociation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDirectConnectGatewayAssociationResponse' {Maybe DirectConnectGatewayAssociation
directConnectGatewayAssociation :: Maybe DirectConnectGatewayAssociation
$sel:directConnectGatewayAssociation:CreateDirectConnectGatewayAssociationResponse' :: CreateDirectConnectGatewayAssociationResponse
-> Maybe DirectConnectGatewayAssociation
directConnectGatewayAssociation} -> Maybe DirectConnectGatewayAssociation
directConnectGatewayAssociation) (\s :: CreateDirectConnectGatewayAssociationResponse
s@CreateDirectConnectGatewayAssociationResponse' {} Maybe DirectConnectGatewayAssociation
a -> CreateDirectConnectGatewayAssociationResponse
s {$sel:directConnectGatewayAssociation:CreateDirectConnectGatewayAssociationResponse' :: Maybe DirectConnectGatewayAssociation
directConnectGatewayAssociation = Maybe DirectConnectGatewayAssociation
a} :: CreateDirectConnectGatewayAssociationResponse)

-- | The response's http status code.
createDirectConnectGatewayAssociationResponse_httpStatus :: Lens.Lens' CreateDirectConnectGatewayAssociationResponse Prelude.Int
createDirectConnectGatewayAssociationResponse_httpStatus :: (Int -> f Int)
-> CreateDirectConnectGatewayAssociationResponse
-> f CreateDirectConnectGatewayAssociationResponse
createDirectConnectGatewayAssociationResponse_httpStatus = (CreateDirectConnectGatewayAssociationResponse -> Int)
-> (CreateDirectConnectGatewayAssociationResponse
    -> Int -> CreateDirectConnectGatewayAssociationResponse)
-> Lens
     CreateDirectConnectGatewayAssociationResponse
     CreateDirectConnectGatewayAssociationResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDirectConnectGatewayAssociationResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDirectConnectGatewayAssociationResponse' :: CreateDirectConnectGatewayAssociationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDirectConnectGatewayAssociationResponse
s@CreateDirectConnectGatewayAssociationResponse' {} Int
a -> CreateDirectConnectGatewayAssociationResponse
s {$sel:httpStatus:CreateDirectConnectGatewayAssociationResponse' :: Int
httpStatus = Int
a} :: CreateDirectConnectGatewayAssociationResponse)

instance
  Prelude.NFData
    CreateDirectConnectGatewayAssociationResponse