{-# 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.EC2.CreateTransitGatewayVpcAttachment
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Attaches the specified VPC to the specified transit gateway.
--
-- If you attach a VPC with a CIDR range that overlaps the CIDR range of a
-- VPC that is already attached, the new VPC CIDR range is not propagated
-- to the default propagation route table.
--
-- To send VPC traffic to an attached transit gateway, add a route to the
-- VPC route table using CreateRoute.
module Amazonka.EC2.CreateTransitGatewayVpcAttachment
  ( -- * Creating a Request
    CreateTransitGatewayVpcAttachment (..),
    newCreateTransitGatewayVpcAttachment,

    -- * Request Lenses
    createTransitGatewayVpcAttachment_dryRun,
    createTransitGatewayVpcAttachment_options,
    createTransitGatewayVpcAttachment_tagSpecifications,
    createTransitGatewayVpcAttachment_transitGatewayId,
    createTransitGatewayVpcAttachment_vpcId,
    createTransitGatewayVpcAttachment_subnetIds,

    -- * Destructuring the Response
    CreateTransitGatewayVpcAttachmentResponse (..),
    newCreateTransitGatewayVpcAttachmentResponse,

    -- * Response Lenses
    createTransitGatewayVpcAttachmentResponse_transitGatewayVpcAttachment,
    createTransitGatewayVpcAttachmentResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateTransitGatewayVpcAttachment' smart constructor.
data CreateTransitGatewayVpcAttachment = CreateTransitGatewayVpcAttachment'
  { -- | Checks whether you have the required permissions for the action, without
    -- actually making the request, and provides an error response. If you have
    -- the required permissions, the error response is @DryRunOperation@.
    -- Otherwise, it is @UnauthorizedOperation@.
    CreateTransitGatewayVpcAttachment -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | The VPC attachment options.
    CreateTransitGatewayVpcAttachment
-> Maybe CreateTransitGatewayVpcAttachmentRequestOptions
options :: Prelude.Maybe CreateTransitGatewayVpcAttachmentRequestOptions,
    -- | The tags to apply to the VPC attachment.
    CreateTransitGatewayVpcAttachment -> Maybe [TagSpecification]
tagSpecifications :: Prelude.Maybe [TagSpecification],
    -- | The ID of the transit gateway.
    CreateTransitGatewayVpcAttachment -> Text
transitGatewayId :: Prelude.Text,
    -- | The ID of the VPC.
    CreateTransitGatewayVpcAttachment -> Text
vpcId :: Prelude.Text,
    -- | The IDs of one or more subnets. You can specify only one subnet per
    -- Availability Zone. You must specify at least one subnet, but we
    -- recommend that you specify two subnets for better availability. The
    -- transit gateway uses one IP address from each specified subnet.
    CreateTransitGatewayVpcAttachment -> [Text]
subnetIds :: [Prelude.Text]
  }
  deriving (CreateTransitGatewayVpcAttachment
-> CreateTransitGatewayVpcAttachment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTransitGatewayVpcAttachment
-> CreateTransitGatewayVpcAttachment -> Bool
$c/= :: CreateTransitGatewayVpcAttachment
-> CreateTransitGatewayVpcAttachment -> Bool
== :: CreateTransitGatewayVpcAttachment
-> CreateTransitGatewayVpcAttachment -> Bool
$c== :: CreateTransitGatewayVpcAttachment
-> CreateTransitGatewayVpcAttachment -> Bool
Prelude.Eq, ReadPrec [CreateTransitGatewayVpcAttachment]
ReadPrec CreateTransitGatewayVpcAttachment
Int -> ReadS CreateTransitGatewayVpcAttachment
ReadS [CreateTransitGatewayVpcAttachment]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTransitGatewayVpcAttachment]
$creadListPrec :: ReadPrec [CreateTransitGatewayVpcAttachment]
readPrec :: ReadPrec CreateTransitGatewayVpcAttachment
$creadPrec :: ReadPrec CreateTransitGatewayVpcAttachment
readList :: ReadS [CreateTransitGatewayVpcAttachment]
$creadList :: ReadS [CreateTransitGatewayVpcAttachment]
readsPrec :: Int -> ReadS CreateTransitGatewayVpcAttachment
$creadsPrec :: Int -> ReadS CreateTransitGatewayVpcAttachment
Prelude.Read, Int -> CreateTransitGatewayVpcAttachment -> ShowS
[CreateTransitGatewayVpcAttachment] -> ShowS
CreateTransitGatewayVpcAttachment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTransitGatewayVpcAttachment] -> ShowS
$cshowList :: [CreateTransitGatewayVpcAttachment] -> ShowS
show :: CreateTransitGatewayVpcAttachment -> String
$cshow :: CreateTransitGatewayVpcAttachment -> String
showsPrec :: Int -> CreateTransitGatewayVpcAttachment -> ShowS
$cshowsPrec :: Int -> CreateTransitGatewayVpcAttachment -> ShowS
Prelude.Show, forall x.
Rep CreateTransitGatewayVpcAttachment x
-> CreateTransitGatewayVpcAttachment
forall x.
CreateTransitGatewayVpcAttachment
-> Rep CreateTransitGatewayVpcAttachment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateTransitGatewayVpcAttachment x
-> CreateTransitGatewayVpcAttachment
$cfrom :: forall x.
CreateTransitGatewayVpcAttachment
-> Rep CreateTransitGatewayVpcAttachment x
Prelude.Generic)

-- |
-- Create a value of 'CreateTransitGatewayVpcAttachment' 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:
--
-- 'dryRun', 'createTransitGatewayVpcAttachment_dryRun' - Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
--
-- 'options', 'createTransitGatewayVpcAttachment_options' - The VPC attachment options.
--
-- 'tagSpecifications', 'createTransitGatewayVpcAttachment_tagSpecifications' - The tags to apply to the VPC attachment.
--
-- 'transitGatewayId', 'createTransitGatewayVpcAttachment_transitGatewayId' - The ID of the transit gateway.
--
-- 'vpcId', 'createTransitGatewayVpcAttachment_vpcId' - The ID of the VPC.
--
-- 'subnetIds', 'createTransitGatewayVpcAttachment_subnetIds' - The IDs of one or more subnets. You can specify only one subnet per
-- Availability Zone. You must specify at least one subnet, but we
-- recommend that you specify two subnets for better availability. The
-- transit gateway uses one IP address from each specified subnet.
newCreateTransitGatewayVpcAttachment ::
  -- | 'transitGatewayId'
  Prelude.Text ->
  -- | 'vpcId'
  Prelude.Text ->
  CreateTransitGatewayVpcAttachment
newCreateTransitGatewayVpcAttachment :: Text -> Text -> CreateTransitGatewayVpcAttachment
newCreateTransitGatewayVpcAttachment
  Text
pTransitGatewayId_
  Text
pVpcId_ =
    CreateTransitGatewayVpcAttachment'
      { $sel:dryRun:CreateTransitGatewayVpcAttachment' :: Maybe Bool
dryRun =
          forall a. Maybe a
Prelude.Nothing,
        $sel:options:CreateTransitGatewayVpcAttachment' :: Maybe CreateTransitGatewayVpcAttachmentRequestOptions
options = forall a. Maybe a
Prelude.Nothing,
        $sel:tagSpecifications:CreateTransitGatewayVpcAttachment' :: Maybe [TagSpecification]
tagSpecifications = forall a. Maybe a
Prelude.Nothing,
        $sel:transitGatewayId:CreateTransitGatewayVpcAttachment' :: Text
transitGatewayId = Text
pTransitGatewayId_,
        $sel:vpcId:CreateTransitGatewayVpcAttachment' :: Text
vpcId = Text
pVpcId_,
        $sel:subnetIds:CreateTransitGatewayVpcAttachment' :: [Text]
subnetIds = forall a. Monoid a => a
Prelude.mempty
      }

-- | Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
createTransitGatewayVpcAttachment_dryRun :: Lens.Lens' CreateTransitGatewayVpcAttachment (Prelude.Maybe Prelude.Bool)
createTransitGatewayVpcAttachment_dryRun :: Lens' CreateTransitGatewayVpcAttachment (Maybe Bool)
createTransitGatewayVpcAttachment_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTransitGatewayVpcAttachment' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: CreateTransitGatewayVpcAttachment
s@CreateTransitGatewayVpcAttachment' {} Maybe Bool
a -> CreateTransitGatewayVpcAttachment
s {$sel:dryRun:CreateTransitGatewayVpcAttachment' :: Maybe Bool
dryRun = Maybe Bool
a} :: CreateTransitGatewayVpcAttachment)

-- | The VPC attachment options.
createTransitGatewayVpcAttachment_options :: Lens.Lens' CreateTransitGatewayVpcAttachment (Prelude.Maybe CreateTransitGatewayVpcAttachmentRequestOptions)
createTransitGatewayVpcAttachment_options :: Lens'
  CreateTransitGatewayVpcAttachment
  (Maybe CreateTransitGatewayVpcAttachmentRequestOptions)
createTransitGatewayVpcAttachment_options = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTransitGatewayVpcAttachment' {Maybe CreateTransitGatewayVpcAttachmentRequestOptions
options :: Maybe CreateTransitGatewayVpcAttachmentRequestOptions
$sel:options:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment
-> Maybe CreateTransitGatewayVpcAttachmentRequestOptions
options} -> Maybe CreateTransitGatewayVpcAttachmentRequestOptions
options) (\s :: CreateTransitGatewayVpcAttachment
s@CreateTransitGatewayVpcAttachment' {} Maybe CreateTransitGatewayVpcAttachmentRequestOptions
a -> CreateTransitGatewayVpcAttachment
s {$sel:options:CreateTransitGatewayVpcAttachment' :: Maybe CreateTransitGatewayVpcAttachmentRequestOptions
options = Maybe CreateTransitGatewayVpcAttachmentRequestOptions
a} :: CreateTransitGatewayVpcAttachment)

-- | The tags to apply to the VPC attachment.
createTransitGatewayVpcAttachment_tagSpecifications :: Lens.Lens' CreateTransitGatewayVpcAttachment (Prelude.Maybe [TagSpecification])
createTransitGatewayVpcAttachment_tagSpecifications :: Lens' CreateTransitGatewayVpcAttachment (Maybe [TagSpecification])
createTransitGatewayVpcAttachment_tagSpecifications = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTransitGatewayVpcAttachment' {Maybe [TagSpecification]
tagSpecifications :: Maybe [TagSpecification]
$sel:tagSpecifications:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> Maybe [TagSpecification]
tagSpecifications} -> Maybe [TagSpecification]
tagSpecifications) (\s :: CreateTransitGatewayVpcAttachment
s@CreateTransitGatewayVpcAttachment' {} Maybe [TagSpecification]
a -> CreateTransitGatewayVpcAttachment
s {$sel:tagSpecifications:CreateTransitGatewayVpcAttachment' :: Maybe [TagSpecification]
tagSpecifications = Maybe [TagSpecification]
a} :: CreateTransitGatewayVpcAttachment) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the transit gateway.
createTransitGatewayVpcAttachment_transitGatewayId :: Lens.Lens' CreateTransitGatewayVpcAttachment Prelude.Text
createTransitGatewayVpcAttachment_transitGatewayId :: Lens' CreateTransitGatewayVpcAttachment Text
createTransitGatewayVpcAttachment_transitGatewayId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTransitGatewayVpcAttachment' {Text
transitGatewayId :: Text
$sel:transitGatewayId:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> Text
transitGatewayId} -> Text
transitGatewayId) (\s :: CreateTransitGatewayVpcAttachment
s@CreateTransitGatewayVpcAttachment' {} Text
a -> CreateTransitGatewayVpcAttachment
s {$sel:transitGatewayId:CreateTransitGatewayVpcAttachment' :: Text
transitGatewayId = Text
a} :: CreateTransitGatewayVpcAttachment)

-- | The ID of the VPC.
createTransitGatewayVpcAttachment_vpcId :: Lens.Lens' CreateTransitGatewayVpcAttachment Prelude.Text
createTransitGatewayVpcAttachment_vpcId :: Lens' CreateTransitGatewayVpcAttachment Text
createTransitGatewayVpcAttachment_vpcId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTransitGatewayVpcAttachment' {Text
vpcId :: Text
$sel:vpcId:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> Text
vpcId} -> Text
vpcId) (\s :: CreateTransitGatewayVpcAttachment
s@CreateTransitGatewayVpcAttachment' {} Text
a -> CreateTransitGatewayVpcAttachment
s {$sel:vpcId:CreateTransitGatewayVpcAttachment' :: Text
vpcId = Text
a} :: CreateTransitGatewayVpcAttachment)

-- | The IDs of one or more subnets. You can specify only one subnet per
-- Availability Zone. You must specify at least one subnet, but we
-- recommend that you specify two subnets for better availability. The
-- transit gateway uses one IP address from each specified subnet.
createTransitGatewayVpcAttachment_subnetIds :: Lens.Lens' CreateTransitGatewayVpcAttachment [Prelude.Text]
createTransitGatewayVpcAttachment_subnetIds :: Lens' CreateTransitGatewayVpcAttachment [Text]
createTransitGatewayVpcAttachment_subnetIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTransitGatewayVpcAttachment' {[Text]
subnetIds :: [Text]
$sel:subnetIds:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> [Text]
subnetIds} -> [Text]
subnetIds) (\s :: CreateTransitGatewayVpcAttachment
s@CreateTransitGatewayVpcAttachment' {} [Text]
a -> CreateTransitGatewayVpcAttachment
s {$sel:subnetIds:CreateTransitGatewayVpcAttachment' :: [Text]
subnetIds = [Text]
a} :: CreateTransitGatewayVpcAttachment) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.AWSRequest
    CreateTransitGatewayVpcAttachment
  where
  type
    AWSResponse CreateTransitGatewayVpcAttachment =
      CreateTransitGatewayVpcAttachmentResponse
  request :: (Service -> Service)
-> CreateTransitGatewayVpcAttachment
-> Request CreateTransitGatewayVpcAttachment
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateTransitGatewayVpcAttachment
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse CreateTransitGatewayVpcAttachment)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe TransitGatewayVpcAttachment
-> Int -> CreateTransitGatewayVpcAttachmentResponse
CreateTransitGatewayVpcAttachmentResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"transitGatewayVpcAttachment")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    CreateTransitGatewayVpcAttachment
  where
  hashWithSalt :: Int -> CreateTransitGatewayVpcAttachment -> Int
hashWithSalt
    Int
_salt
    CreateTransitGatewayVpcAttachment' {[Text]
Maybe Bool
Maybe [TagSpecification]
Maybe CreateTransitGatewayVpcAttachmentRequestOptions
Text
subnetIds :: [Text]
vpcId :: Text
transitGatewayId :: Text
tagSpecifications :: Maybe [TagSpecification]
options :: Maybe CreateTransitGatewayVpcAttachmentRequestOptions
dryRun :: Maybe Bool
$sel:subnetIds:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> [Text]
$sel:vpcId:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> Text
$sel:transitGatewayId:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> Text
$sel:tagSpecifications:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> Maybe [TagSpecification]
$sel:options:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment
-> Maybe CreateTransitGatewayVpcAttachmentRequestOptions
$sel:dryRun:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> Maybe Bool
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CreateTransitGatewayVpcAttachmentRequestOptions
options
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [TagSpecification]
tagSpecifications
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
transitGatewayId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
vpcId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
subnetIds

instance
  Prelude.NFData
    CreateTransitGatewayVpcAttachment
  where
  rnf :: CreateTransitGatewayVpcAttachment -> ()
rnf CreateTransitGatewayVpcAttachment' {[Text]
Maybe Bool
Maybe [TagSpecification]
Maybe CreateTransitGatewayVpcAttachmentRequestOptions
Text
subnetIds :: [Text]
vpcId :: Text
transitGatewayId :: Text
tagSpecifications :: Maybe [TagSpecification]
options :: Maybe CreateTransitGatewayVpcAttachmentRequestOptions
dryRun :: Maybe Bool
$sel:subnetIds:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> [Text]
$sel:vpcId:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> Text
$sel:transitGatewayId:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> Text
$sel:tagSpecifications:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> Maybe [TagSpecification]
$sel:options:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment
-> Maybe CreateTransitGatewayVpcAttachmentRequestOptions
$sel:dryRun:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CreateTransitGatewayVpcAttachmentRequestOptions
options
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [TagSpecification]
tagSpecifications
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
transitGatewayId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
vpcId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
subnetIds

instance
  Data.ToHeaders
    CreateTransitGatewayVpcAttachment
  where
  toHeaders :: CreateTransitGatewayVpcAttachment -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance
  Data.ToQuery
    CreateTransitGatewayVpcAttachment
  where
  toQuery :: CreateTransitGatewayVpcAttachment -> QueryString
toQuery CreateTransitGatewayVpcAttachment' {[Text]
Maybe Bool
Maybe [TagSpecification]
Maybe CreateTransitGatewayVpcAttachmentRequestOptions
Text
subnetIds :: [Text]
vpcId :: Text
transitGatewayId :: Text
tagSpecifications :: Maybe [TagSpecification]
options :: Maybe CreateTransitGatewayVpcAttachmentRequestOptions
dryRun :: Maybe Bool
$sel:subnetIds:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> [Text]
$sel:vpcId:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> Text
$sel:transitGatewayId:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> Text
$sel:tagSpecifications:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> Maybe [TagSpecification]
$sel:options:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment
-> Maybe CreateTransitGatewayVpcAttachmentRequestOptions
$sel:dryRun:CreateTransitGatewayVpcAttachment' :: CreateTransitGatewayVpcAttachment -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ( ByteString
"CreateTransitGatewayVpcAttachment" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
        ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
        ByteString
"Options" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe CreateTransitGatewayVpcAttachmentRequestOptions
options,
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          ( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"TagSpecifications"
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [TagSpecification]
tagSpecifications
          ),
        ByteString
"TransitGatewayId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
transitGatewayId,
        ByteString
"VpcId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
vpcId,
        forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"SubnetIds" [Text]
subnetIds
      ]

-- | /See:/ 'newCreateTransitGatewayVpcAttachmentResponse' smart constructor.
data CreateTransitGatewayVpcAttachmentResponse = CreateTransitGatewayVpcAttachmentResponse'
  { -- | Information about the VPC attachment.
    CreateTransitGatewayVpcAttachmentResponse
-> Maybe TransitGatewayVpcAttachment
transitGatewayVpcAttachment :: Prelude.Maybe TransitGatewayVpcAttachment,
    -- | The response's http status code.
    CreateTransitGatewayVpcAttachmentResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateTransitGatewayVpcAttachmentResponse
-> CreateTransitGatewayVpcAttachmentResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTransitGatewayVpcAttachmentResponse
-> CreateTransitGatewayVpcAttachmentResponse -> Bool
$c/= :: CreateTransitGatewayVpcAttachmentResponse
-> CreateTransitGatewayVpcAttachmentResponse -> Bool
== :: CreateTransitGatewayVpcAttachmentResponse
-> CreateTransitGatewayVpcAttachmentResponse -> Bool
$c== :: CreateTransitGatewayVpcAttachmentResponse
-> CreateTransitGatewayVpcAttachmentResponse -> Bool
Prelude.Eq, ReadPrec [CreateTransitGatewayVpcAttachmentResponse]
ReadPrec CreateTransitGatewayVpcAttachmentResponse
Int -> ReadS CreateTransitGatewayVpcAttachmentResponse
ReadS [CreateTransitGatewayVpcAttachmentResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTransitGatewayVpcAttachmentResponse]
$creadListPrec :: ReadPrec [CreateTransitGatewayVpcAttachmentResponse]
readPrec :: ReadPrec CreateTransitGatewayVpcAttachmentResponse
$creadPrec :: ReadPrec CreateTransitGatewayVpcAttachmentResponse
readList :: ReadS [CreateTransitGatewayVpcAttachmentResponse]
$creadList :: ReadS [CreateTransitGatewayVpcAttachmentResponse]
readsPrec :: Int -> ReadS CreateTransitGatewayVpcAttachmentResponse
$creadsPrec :: Int -> ReadS CreateTransitGatewayVpcAttachmentResponse
Prelude.Read, Int -> CreateTransitGatewayVpcAttachmentResponse -> ShowS
[CreateTransitGatewayVpcAttachmentResponse] -> ShowS
CreateTransitGatewayVpcAttachmentResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTransitGatewayVpcAttachmentResponse] -> ShowS
$cshowList :: [CreateTransitGatewayVpcAttachmentResponse] -> ShowS
show :: CreateTransitGatewayVpcAttachmentResponse -> String
$cshow :: CreateTransitGatewayVpcAttachmentResponse -> String
showsPrec :: Int -> CreateTransitGatewayVpcAttachmentResponse -> ShowS
$cshowsPrec :: Int -> CreateTransitGatewayVpcAttachmentResponse -> ShowS
Prelude.Show, forall x.
Rep CreateTransitGatewayVpcAttachmentResponse x
-> CreateTransitGatewayVpcAttachmentResponse
forall x.
CreateTransitGatewayVpcAttachmentResponse
-> Rep CreateTransitGatewayVpcAttachmentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateTransitGatewayVpcAttachmentResponse x
-> CreateTransitGatewayVpcAttachmentResponse
$cfrom :: forall x.
CreateTransitGatewayVpcAttachmentResponse
-> Rep CreateTransitGatewayVpcAttachmentResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateTransitGatewayVpcAttachmentResponse' 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:
--
-- 'transitGatewayVpcAttachment', 'createTransitGatewayVpcAttachmentResponse_transitGatewayVpcAttachment' - Information about the VPC attachment.
--
-- 'httpStatus', 'createTransitGatewayVpcAttachmentResponse_httpStatus' - The response's http status code.
newCreateTransitGatewayVpcAttachmentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateTransitGatewayVpcAttachmentResponse
newCreateTransitGatewayVpcAttachmentResponse :: Int -> CreateTransitGatewayVpcAttachmentResponse
newCreateTransitGatewayVpcAttachmentResponse
  Int
pHttpStatus_ =
    CreateTransitGatewayVpcAttachmentResponse'
      { $sel:transitGatewayVpcAttachment:CreateTransitGatewayVpcAttachmentResponse' :: Maybe TransitGatewayVpcAttachment
transitGatewayVpcAttachment =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:CreateTransitGatewayVpcAttachmentResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Information about the VPC attachment.
createTransitGatewayVpcAttachmentResponse_transitGatewayVpcAttachment :: Lens.Lens' CreateTransitGatewayVpcAttachmentResponse (Prelude.Maybe TransitGatewayVpcAttachment)
createTransitGatewayVpcAttachmentResponse_transitGatewayVpcAttachment :: Lens'
  CreateTransitGatewayVpcAttachmentResponse
  (Maybe TransitGatewayVpcAttachment)
createTransitGatewayVpcAttachmentResponse_transitGatewayVpcAttachment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTransitGatewayVpcAttachmentResponse' {Maybe TransitGatewayVpcAttachment
transitGatewayVpcAttachment :: Maybe TransitGatewayVpcAttachment
$sel:transitGatewayVpcAttachment:CreateTransitGatewayVpcAttachmentResponse' :: CreateTransitGatewayVpcAttachmentResponse
-> Maybe TransitGatewayVpcAttachment
transitGatewayVpcAttachment} -> Maybe TransitGatewayVpcAttachment
transitGatewayVpcAttachment) (\s :: CreateTransitGatewayVpcAttachmentResponse
s@CreateTransitGatewayVpcAttachmentResponse' {} Maybe TransitGatewayVpcAttachment
a -> CreateTransitGatewayVpcAttachmentResponse
s {$sel:transitGatewayVpcAttachment:CreateTransitGatewayVpcAttachmentResponse' :: Maybe TransitGatewayVpcAttachment
transitGatewayVpcAttachment = Maybe TransitGatewayVpcAttachment
a} :: CreateTransitGatewayVpcAttachmentResponse)

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

instance
  Prelude.NFData
    CreateTransitGatewayVpcAttachmentResponse
  where
  rnf :: CreateTransitGatewayVpcAttachmentResponse -> ()
rnf CreateTransitGatewayVpcAttachmentResponse' {Int
Maybe TransitGatewayVpcAttachment
httpStatus :: Int
transitGatewayVpcAttachment :: Maybe TransitGatewayVpcAttachment
$sel:httpStatus:CreateTransitGatewayVpcAttachmentResponse' :: CreateTransitGatewayVpcAttachmentResponse -> Int
$sel:transitGatewayVpcAttachment:CreateTransitGatewayVpcAttachmentResponse' :: CreateTransitGatewayVpcAttachmentResponse
-> Maybe TransitGatewayVpcAttachment
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe TransitGatewayVpcAttachment
transitGatewayVpcAttachment
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus