{-# 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.Proton.CreateEnvironmentAccountConnection
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Create an environment account connection in an environment account so
-- that environment infrastructure resources can be provisioned in the
-- environment account from a management account.
--
-- An environment account connection is a secure bi-directional connection
-- between a /management account/ and an /environment account/ that
-- maintains authorization and permissions. For more information, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/ag-env-account-connections.html Environment account connections>
-- in the /Proton User guide/.
module Amazonka.Proton.CreateEnvironmentAccountConnection
  ( -- * Creating a Request
    CreateEnvironmentAccountConnection (..),
    newCreateEnvironmentAccountConnection,

    -- * Request Lenses
    createEnvironmentAccountConnection_clientToken,
    createEnvironmentAccountConnection_codebuildRoleArn,
    createEnvironmentAccountConnection_componentRoleArn,
    createEnvironmentAccountConnection_roleArn,
    createEnvironmentAccountConnection_tags,
    createEnvironmentAccountConnection_environmentName,
    createEnvironmentAccountConnection_managementAccountId,

    -- * Destructuring the Response
    CreateEnvironmentAccountConnectionResponse (..),
    newCreateEnvironmentAccountConnectionResponse,

    -- * Response Lenses
    createEnvironmentAccountConnectionResponse_httpStatus,
    createEnvironmentAccountConnectionResponse_environmentAccountConnection,
  )
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
import Amazonka.Proton.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateEnvironmentAccountConnection' smart constructor.
data CreateEnvironmentAccountConnection = CreateEnvironmentAccountConnection'
  { -- | When included, if two identical requests are made with the same client
    -- token, Proton returns the environment account connection that the first
    -- request created.
    CreateEnvironmentAccountConnection -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of an IAM service role in the environment
    -- account. Proton uses this role to provision infrastructure resources
    -- using CodeBuild-based provisioning in the associated environment
    -- account.
    CreateEnvironmentAccountConnection -> Maybe Text
codebuildRoleArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM service role that Proton uses
    -- when provisioning directly defined components in the associated
    -- environment account. It determines the scope of infrastructure that a
    -- component can provision in the account.
    --
    -- You must specify @componentRoleArn@ to allow directly defined components
    -- to be associated with any environments running in this account.
    --
    -- For more information about components, see
    -- <https://docs.aws.amazon.com/proton/latest/userguide/ag-components.html Proton components>
    -- in the /Proton User Guide/.
    CreateEnvironmentAccountConnection -> Maybe Text
componentRoleArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM service role that\'s created
    -- in the environment account. Proton uses this role to provision
    -- infrastructure resources in the associated environment account.
    CreateEnvironmentAccountConnection -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
    -- | An optional list of metadata items that you can associate with the
    -- Proton environment account connection. A tag is a key-value pair.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/proton/latest/userguide/resources.html Proton resources and tagging>
    -- in the /Proton User Guide/.
    CreateEnvironmentAccountConnection -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name of the Proton environment that\'s created in the associated
    -- management account.
    CreateEnvironmentAccountConnection -> Text
environmentName :: Prelude.Text,
    -- | The ID of the management account that accepts or rejects the environment
    -- account connection. You create and manage the Proton environment in this
    -- account. If the management account accepts the environment account
    -- connection, Proton can use the associated IAM role to provision
    -- environment infrastructure resources in the associated environment
    -- account.
    CreateEnvironmentAccountConnection -> Text
managementAccountId :: Prelude.Text
  }
  deriving (CreateEnvironmentAccountConnection
-> CreateEnvironmentAccountConnection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEnvironmentAccountConnection
-> CreateEnvironmentAccountConnection -> Bool
$c/= :: CreateEnvironmentAccountConnection
-> CreateEnvironmentAccountConnection -> Bool
== :: CreateEnvironmentAccountConnection
-> CreateEnvironmentAccountConnection -> Bool
$c== :: CreateEnvironmentAccountConnection
-> CreateEnvironmentAccountConnection -> Bool
Prelude.Eq, ReadPrec [CreateEnvironmentAccountConnection]
ReadPrec CreateEnvironmentAccountConnection
Int -> ReadS CreateEnvironmentAccountConnection
ReadS [CreateEnvironmentAccountConnection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEnvironmentAccountConnection]
$creadListPrec :: ReadPrec [CreateEnvironmentAccountConnection]
readPrec :: ReadPrec CreateEnvironmentAccountConnection
$creadPrec :: ReadPrec CreateEnvironmentAccountConnection
readList :: ReadS [CreateEnvironmentAccountConnection]
$creadList :: ReadS [CreateEnvironmentAccountConnection]
readsPrec :: Int -> ReadS CreateEnvironmentAccountConnection
$creadsPrec :: Int -> ReadS CreateEnvironmentAccountConnection
Prelude.Read, Int -> CreateEnvironmentAccountConnection -> ShowS
[CreateEnvironmentAccountConnection] -> ShowS
CreateEnvironmentAccountConnection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEnvironmentAccountConnection] -> ShowS
$cshowList :: [CreateEnvironmentAccountConnection] -> ShowS
show :: CreateEnvironmentAccountConnection -> String
$cshow :: CreateEnvironmentAccountConnection -> String
showsPrec :: Int -> CreateEnvironmentAccountConnection -> ShowS
$cshowsPrec :: Int -> CreateEnvironmentAccountConnection -> ShowS
Prelude.Show, forall x.
Rep CreateEnvironmentAccountConnection x
-> CreateEnvironmentAccountConnection
forall x.
CreateEnvironmentAccountConnection
-> Rep CreateEnvironmentAccountConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateEnvironmentAccountConnection x
-> CreateEnvironmentAccountConnection
$cfrom :: forall x.
CreateEnvironmentAccountConnection
-> Rep CreateEnvironmentAccountConnection x
Prelude.Generic)

-- |
-- Create a value of 'CreateEnvironmentAccountConnection' 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:
--
-- 'clientToken', 'createEnvironmentAccountConnection_clientToken' - When included, if two identical requests are made with the same client
-- token, Proton returns the environment account connection that the first
-- request created.
--
-- 'codebuildRoleArn', 'createEnvironmentAccountConnection_codebuildRoleArn' - The Amazon Resource Name (ARN) of an IAM service role in the environment
-- account. Proton uses this role to provision infrastructure resources
-- using CodeBuild-based provisioning in the associated environment
-- account.
--
-- 'componentRoleArn', 'createEnvironmentAccountConnection_componentRoleArn' - The Amazon Resource Name (ARN) of the IAM service role that Proton uses
-- when provisioning directly defined components in the associated
-- environment account. It determines the scope of infrastructure that a
-- component can provision in the account.
--
-- You must specify @componentRoleArn@ to allow directly defined components
-- to be associated with any environments running in this account.
--
-- For more information about components, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/ag-components.html Proton components>
-- in the /Proton User Guide/.
--
-- 'roleArn', 'createEnvironmentAccountConnection_roleArn' - The Amazon Resource Name (ARN) of the IAM service role that\'s created
-- in the environment account. Proton uses this role to provision
-- infrastructure resources in the associated environment account.
--
-- 'tags', 'createEnvironmentAccountConnection_tags' - An optional list of metadata items that you can associate with the
-- Proton environment account connection. A tag is a key-value pair.
--
-- For more information, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/resources.html Proton resources and tagging>
-- in the /Proton User Guide/.
--
-- 'environmentName', 'createEnvironmentAccountConnection_environmentName' - The name of the Proton environment that\'s created in the associated
-- management account.
--
-- 'managementAccountId', 'createEnvironmentAccountConnection_managementAccountId' - The ID of the management account that accepts or rejects the environment
-- account connection. You create and manage the Proton environment in this
-- account. If the management account accepts the environment account
-- connection, Proton can use the associated IAM role to provision
-- environment infrastructure resources in the associated environment
-- account.
newCreateEnvironmentAccountConnection ::
  -- | 'environmentName'
  Prelude.Text ->
  -- | 'managementAccountId'
  Prelude.Text ->
  CreateEnvironmentAccountConnection
newCreateEnvironmentAccountConnection :: Text -> Text -> CreateEnvironmentAccountConnection
newCreateEnvironmentAccountConnection
  Text
pEnvironmentName_
  Text
pManagementAccountId_ =
    CreateEnvironmentAccountConnection'
      { $sel:clientToken:CreateEnvironmentAccountConnection' :: Maybe Text
clientToken =
          forall a. Maybe a
Prelude.Nothing,
        $sel:codebuildRoleArn:CreateEnvironmentAccountConnection' :: Maybe Text
codebuildRoleArn = forall a. Maybe a
Prelude.Nothing,
        $sel:componentRoleArn:CreateEnvironmentAccountConnection' :: Maybe Text
componentRoleArn = forall a. Maybe a
Prelude.Nothing,
        $sel:roleArn:CreateEnvironmentAccountConnection' :: Maybe Text
roleArn = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateEnvironmentAccountConnection' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:environmentName:CreateEnvironmentAccountConnection' :: Text
environmentName = Text
pEnvironmentName_,
        $sel:managementAccountId:CreateEnvironmentAccountConnection' :: Text
managementAccountId =
          Text
pManagementAccountId_
      }

-- | When included, if two identical requests are made with the same client
-- token, Proton returns the environment account connection that the first
-- request created.
createEnvironmentAccountConnection_clientToken :: Lens.Lens' CreateEnvironmentAccountConnection (Prelude.Maybe Prelude.Text)
createEnvironmentAccountConnection_clientToken :: Lens' CreateEnvironmentAccountConnection (Maybe Text)
createEnvironmentAccountConnection_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentAccountConnection' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateEnvironmentAccountConnection
s@CreateEnvironmentAccountConnection' {} Maybe Text
a -> CreateEnvironmentAccountConnection
s {$sel:clientToken:CreateEnvironmentAccountConnection' :: Maybe Text
clientToken = Maybe Text
a} :: CreateEnvironmentAccountConnection)

-- | The Amazon Resource Name (ARN) of an IAM service role in the environment
-- account. Proton uses this role to provision infrastructure resources
-- using CodeBuild-based provisioning in the associated environment
-- account.
createEnvironmentAccountConnection_codebuildRoleArn :: Lens.Lens' CreateEnvironmentAccountConnection (Prelude.Maybe Prelude.Text)
createEnvironmentAccountConnection_codebuildRoleArn :: Lens' CreateEnvironmentAccountConnection (Maybe Text)
createEnvironmentAccountConnection_codebuildRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentAccountConnection' {Maybe Text
codebuildRoleArn :: Maybe Text
$sel:codebuildRoleArn:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe Text
codebuildRoleArn} -> Maybe Text
codebuildRoleArn) (\s :: CreateEnvironmentAccountConnection
s@CreateEnvironmentAccountConnection' {} Maybe Text
a -> CreateEnvironmentAccountConnection
s {$sel:codebuildRoleArn:CreateEnvironmentAccountConnection' :: Maybe Text
codebuildRoleArn = Maybe Text
a} :: CreateEnvironmentAccountConnection)

-- | The Amazon Resource Name (ARN) of the IAM service role that Proton uses
-- when provisioning directly defined components in the associated
-- environment account. It determines the scope of infrastructure that a
-- component can provision in the account.
--
-- You must specify @componentRoleArn@ to allow directly defined components
-- to be associated with any environments running in this account.
--
-- For more information about components, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/ag-components.html Proton components>
-- in the /Proton User Guide/.
createEnvironmentAccountConnection_componentRoleArn :: Lens.Lens' CreateEnvironmentAccountConnection (Prelude.Maybe Prelude.Text)
createEnvironmentAccountConnection_componentRoleArn :: Lens' CreateEnvironmentAccountConnection (Maybe Text)
createEnvironmentAccountConnection_componentRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentAccountConnection' {Maybe Text
componentRoleArn :: Maybe Text
$sel:componentRoleArn:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe Text
componentRoleArn} -> Maybe Text
componentRoleArn) (\s :: CreateEnvironmentAccountConnection
s@CreateEnvironmentAccountConnection' {} Maybe Text
a -> CreateEnvironmentAccountConnection
s {$sel:componentRoleArn:CreateEnvironmentAccountConnection' :: Maybe Text
componentRoleArn = Maybe Text
a} :: CreateEnvironmentAccountConnection)

-- | The Amazon Resource Name (ARN) of the IAM service role that\'s created
-- in the environment account. Proton uses this role to provision
-- infrastructure resources in the associated environment account.
createEnvironmentAccountConnection_roleArn :: Lens.Lens' CreateEnvironmentAccountConnection (Prelude.Maybe Prelude.Text)
createEnvironmentAccountConnection_roleArn :: Lens' CreateEnvironmentAccountConnection (Maybe Text)
createEnvironmentAccountConnection_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentAccountConnection' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: CreateEnvironmentAccountConnection
s@CreateEnvironmentAccountConnection' {} Maybe Text
a -> CreateEnvironmentAccountConnection
s {$sel:roleArn:CreateEnvironmentAccountConnection' :: Maybe Text
roleArn = Maybe Text
a} :: CreateEnvironmentAccountConnection)

-- | An optional list of metadata items that you can associate with the
-- Proton environment account connection. A tag is a key-value pair.
--
-- For more information, see
-- <https://docs.aws.amazon.com/proton/latest/userguide/resources.html Proton resources and tagging>
-- in the /Proton User Guide/.
createEnvironmentAccountConnection_tags :: Lens.Lens' CreateEnvironmentAccountConnection (Prelude.Maybe [Tag])
createEnvironmentAccountConnection_tags :: Lens' CreateEnvironmentAccountConnection (Maybe [Tag])
createEnvironmentAccountConnection_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentAccountConnection' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateEnvironmentAccountConnection
s@CreateEnvironmentAccountConnection' {} Maybe [Tag]
a -> CreateEnvironmentAccountConnection
s {$sel:tags:CreateEnvironmentAccountConnection' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateEnvironmentAccountConnection) 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 name of the Proton environment that\'s created in the associated
-- management account.
createEnvironmentAccountConnection_environmentName :: Lens.Lens' CreateEnvironmentAccountConnection Prelude.Text
createEnvironmentAccountConnection_environmentName :: Lens' CreateEnvironmentAccountConnection Text
createEnvironmentAccountConnection_environmentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentAccountConnection' {Text
environmentName :: Text
$sel:environmentName:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Text
environmentName} -> Text
environmentName) (\s :: CreateEnvironmentAccountConnection
s@CreateEnvironmentAccountConnection' {} Text
a -> CreateEnvironmentAccountConnection
s {$sel:environmentName:CreateEnvironmentAccountConnection' :: Text
environmentName = Text
a} :: CreateEnvironmentAccountConnection)

-- | The ID of the management account that accepts or rejects the environment
-- account connection. You create and manage the Proton environment in this
-- account. If the management account accepts the environment account
-- connection, Proton can use the associated IAM role to provision
-- environment infrastructure resources in the associated environment
-- account.
createEnvironmentAccountConnection_managementAccountId :: Lens.Lens' CreateEnvironmentAccountConnection Prelude.Text
createEnvironmentAccountConnection_managementAccountId :: Lens' CreateEnvironmentAccountConnection Text
createEnvironmentAccountConnection_managementAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentAccountConnection' {Text
managementAccountId :: Text
$sel:managementAccountId:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Text
managementAccountId} -> Text
managementAccountId) (\s :: CreateEnvironmentAccountConnection
s@CreateEnvironmentAccountConnection' {} Text
a -> CreateEnvironmentAccountConnection
s {$sel:managementAccountId:CreateEnvironmentAccountConnection' :: Text
managementAccountId = Text
a} :: CreateEnvironmentAccountConnection)

instance
  Core.AWSRequest
    CreateEnvironmentAccountConnection
  where
  type
    AWSResponse CreateEnvironmentAccountConnection =
      CreateEnvironmentAccountConnectionResponse
  request :: (Service -> Service)
-> CreateEnvironmentAccountConnection
-> Request CreateEnvironmentAccountConnection
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateEnvironmentAccountConnection
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse CreateEnvironmentAccountConnection)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int
-> EnvironmentAccountConnection
-> CreateEnvironmentAccountConnectionResponse
CreateEnvironmentAccountConnectionResponse'
            forall (f :: * -> *) a b. Functor 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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"environmentAccountConnection")
      )

instance
  Prelude.Hashable
    CreateEnvironmentAccountConnection
  where
  hashWithSalt :: Int -> CreateEnvironmentAccountConnection -> Int
hashWithSalt
    Int
_salt
    CreateEnvironmentAccountConnection' {Maybe [Tag]
Maybe Text
Text
managementAccountId :: Text
environmentName :: Text
tags :: Maybe [Tag]
roleArn :: Maybe Text
componentRoleArn :: Maybe Text
codebuildRoleArn :: Maybe Text
clientToken :: Maybe Text
$sel:managementAccountId:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Text
$sel:environmentName:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Text
$sel:tags:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe [Tag]
$sel:roleArn:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe Text
$sel:componentRoleArn:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe Text
$sel:codebuildRoleArn:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe Text
$sel:clientToken:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
codebuildRoleArn
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
componentRoleArn
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleArn
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
environmentName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
managementAccountId

instance
  Prelude.NFData
    CreateEnvironmentAccountConnection
  where
  rnf :: CreateEnvironmentAccountConnection -> ()
rnf CreateEnvironmentAccountConnection' {Maybe [Tag]
Maybe Text
Text
managementAccountId :: Text
environmentName :: Text
tags :: Maybe [Tag]
roleArn :: Maybe Text
componentRoleArn :: Maybe Text
codebuildRoleArn :: Maybe Text
clientToken :: Maybe Text
$sel:managementAccountId:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Text
$sel:environmentName:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Text
$sel:tags:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe [Tag]
$sel:roleArn:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe Text
$sel:componentRoleArn:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe Text
$sel:codebuildRoleArn:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe Text
$sel:clientToken:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
codebuildRoleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
componentRoleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
environmentName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
managementAccountId

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

instance
  Data.ToJSON
    CreateEnvironmentAccountConnection
  where
  toJSON :: CreateEnvironmentAccountConnection -> Value
toJSON CreateEnvironmentAccountConnection' {Maybe [Tag]
Maybe Text
Text
managementAccountId :: Text
environmentName :: Text
tags :: Maybe [Tag]
roleArn :: Maybe Text
componentRoleArn :: Maybe Text
codebuildRoleArn :: Maybe Text
clientToken :: Maybe Text
$sel:managementAccountId:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Text
$sel:environmentName:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Text
$sel:tags:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe [Tag]
$sel:roleArn:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe Text
$sel:componentRoleArn:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe Text
$sel:codebuildRoleArn:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe Text
$sel:clientToken:CreateEnvironmentAccountConnection' :: CreateEnvironmentAccountConnection -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"clientToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
            (Key
"codebuildRoleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
codebuildRoleArn,
            (Key
"componentRoleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
componentRoleArn,
            (Key
"roleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
roleArn,
            (Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"environmentName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
environmentName),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"managementAccountId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
managementAccountId)
          ]
      )

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

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

-- | /See:/ 'newCreateEnvironmentAccountConnectionResponse' smart constructor.
data CreateEnvironmentAccountConnectionResponse = CreateEnvironmentAccountConnectionResponse'
  { -- | The response's http status code.
    CreateEnvironmentAccountConnectionResponse -> Int
httpStatus :: Prelude.Int,
    -- | The environment account connection detail data that\'s returned by
    -- Proton.
    CreateEnvironmentAccountConnectionResponse
-> EnvironmentAccountConnection
environmentAccountConnection :: EnvironmentAccountConnection
  }
  deriving (CreateEnvironmentAccountConnectionResponse
-> CreateEnvironmentAccountConnectionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEnvironmentAccountConnectionResponse
-> CreateEnvironmentAccountConnectionResponse -> Bool
$c/= :: CreateEnvironmentAccountConnectionResponse
-> CreateEnvironmentAccountConnectionResponse -> Bool
== :: CreateEnvironmentAccountConnectionResponse
-> CreateEnvironmentAccountConnectionResponse -> Bool
$c== :: CreateEnvironmentAccountConnectionResponse
-> CreateEnvironmentAccountConnectionResponse -> Bool
Prelude.Eq, ReadPrec [CreateEnvironmentAccountConnectionResponse]
ReadPrec CreateEnvironmentAccountConnectionResponse
Int -> ReadS CreateEnvironmentAccountConnectionResponse
ReadS [CreateEnvironmentAccountConnectionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEnvironmentAccountConnectionResponse]
$creadListPrec :: ReadPrec [CreateEnvironmentAccountConnectionResponse]
readPrec :: ReadPrec CreateEnvironmentAccountConnectionResponse
$creadPrec :: ReadPrec CreateEnvironmentAccountConnectionResponse
readList :: ReadS [CreateEnvironmentAccountConnectionResponse]
$creadList :: ReadS [CreateEnvironmentAccountConnectionResponse]
readsPrec :: Int -> ReadS CreateEnvironmentAccountConnectionResponse
$creadsPrec :: Int -> ReadS CreateEnvironmentAccountConnectionResponse
Prelude.Read, Int -> CreateEnvironmentAccountConnectionResponse -> ShowS
[CreateEnvironmentAccountConnectionResponse] -> ShowS
CreateEnvironmentAccountConnectionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEnvironmentAccountConnectionResponse] -> ShowS
$cshowList :: [CreateEnvironmentAccountConnectionResponse] -> ShowS
show :: CreateEnvironmentAccountConnectionResponse -> String
$cshow :: CreateEnvironmentAccountConnectionResponse -> String
showsPrec :: Int -> CreateEnvironmentAccountConnectionResponse -> ShowS
$cshowsPrec :: Int -> CreateEnvironmentAccountConnectionResponse -> ShowS
Prelude.Show, forall x.
Rep CreateEnvironmentAccountConnectionResponse x
-> CreateEnvironmentAccountConnectionResponse
forall x.
CreateEnvironmentAccountConnectionResponse
-> Rep CreateEnvironmentAccountConnectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateEnvironmentAccountConnectionResponse x
-> CreateEnvironmentAccountConnectionResponse
$cfrom :: forall x.
CreateEnvironmentAccountConnectionResponse
-> Rep CreateEnvironmentAccountConnectionResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateEnvironmentAccountConnectionResponse' 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:
--
-- 'httpStatus', 'createEnvironmentAccountConnectionResponse_httpStatus' - The response's http status code.
--
-- 'environmentAccountConnection', 'createEnvironmentAccountConnectionResponse_environmentAccountConnection' - The environment account connection detail data that\'s returned by
-- Proton.
newCreateEnvironmentAccountConnectionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'environmentAccountConnection'
  EnvironmentAccountConnection ->
  CreateEnvironmentAccountConnectionResponse
newCreateEnvironmentAccountConnectionResponse :: Int
-> EnvironmentAccountConnection
-> CreateEnvironmentAccountConnectionResponse
newCreateEnvironmentAccountConnectionResponse
  Int
pHttpStatus_
  EnvironmentAccountConnection
pEnvironmentAccountConnection_ =
    CreateEnvironmentAccountConnectionResponse'
      { $sel:httpStatus:CreateEnvironmentAccountConnectionResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:environmentAccountConnection:CreateEnvironmentAccountConnectionResponse' :: EnvironmentAccountConnection
environmentAccountConnection =
          EnvironmentAccountConnection
pEnvironmentAccountConnection_
      }

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

-- | The environment account connection detail data that\'s returned by
-- Proton.
createEnvironmentAccountConnectionResponse_environmentAccountConnection :: Lens.Lens' CreateEnvironmentAccountConnectionResponse EnvironmentAccountConnection
createEnvironmentAccountConnectionResponse_environmentAccountConnection :: Lens'
  CreateEnvironmentAccountConnectionResponse
  EnvironmentAccountConnection
createEnvironmentAccountConnectionResponse_environmentAccountConnection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentAccountConnectionResponse' {EnvironmentAccountConnection
environmentAccountConnection :: EnvironmentAccountConnection
$sel:environmentAccountConnection:CreateEnvironmentAccountConnectionResponse' :: CreateEnvironmentAccountConnectionResponse
-> EnvironmentAccountConnection
environmentAccountConnection} -> EnvironmentAccountConnection
environmentAccountConnection) (\s :: CreateEnvironmentAccountConnectionResponse
s@CreateEnvironmentAccountConnectionResponse' {} EnvironmentAccountConnection
a -> CreateEnvironmentAccountConnectionResponse
s {$sel:environmentAccountConnection:CreateEnvironmentAccountConnectionResponse' :: EnvironmentAccountConnection
environmentAccountConnection = EnvironmentAccountConnection
a} :: CreateEnvironmentAccountConnectionResponse)

instance
  Prelude.NFData
    CreateEnvironmentAccountConnectionResponse
  where
  rnf :: CreateEnvironmentAccountConnectionResponse -> ()
rnf CreateEnvironmentAccountConnectionResponse' {Int
EnvironmentAccountConnection
environmentAccountConnection :: EnvironmentAccountConnection
httpStatus :: Int
$sel:environmentAccountConnection:CreateEnvironmentAccountConnectionResponse' :: CreateEnvironmentAccountConnectionResponse
-> EnvironmentAccountConnection
$sel:httpStatus:CreateEnvironmentAccountConnectionResponse' :: CreateEnvironmentAccountConnectionResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf EnvironmentAccountConnection
environmentAccountConnection