{-# 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.GetEnvironmentAccountConnection
-- 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)
--
-- In an environment account, view the detail data for an environment
-- account connection.
--
-- For more information, see
-- <https://docs.aws.amazon.com/proton/latest/adminguide/ag-env-account-connections.html Environment account connections>
-- in the /AWS Proton Administrator guide/.
module Amazonka.Proton.GetEnvironmentAccountConnection
  ( -- * Creating a Request
    GetEnvironmentAccountConnection (..),
    newGetEnvironmentAccountConnection,

    -- * Request Lenses
    getEnvironmentAccountConnection_id,

    -- * Destructuring the Response
    GetEnvironmentAccountConnectionResponse (..),
    newGetEnvironmentAccountConnectionResponse,

    -- * Response Lenses
    getEnvironmentAccountConnectionResponse_httpStatus,
    getEnvironmentAccountConnectionResponse_environmentAccountConnection,
  )
where

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

-- | /See:/ 'newGetEnvironmentAccountConnection' smart constructor.
data GetEnvironmentAccountConnection = GetEnvironmentAccountConnection'
  { -- | The ID of the environment account connection.
    GetEnvironmentAccountConnection -> Text
id :: Prelude.Text
  }
  deriving (GetEnvironmentAccountConnection
-> GetEnvironmentAccountConnection -> Bool
(GetEnvironmentAccountConnection
 -> GetEnvironmentAccountConnection -> Bool)
-> (GetEnvironmentAccountConnection
    -> GetEnvironmentAccountConnection -> Bool)
-> Eq GetEnvironmentAccountConnection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetEnvironmentAccountConnection
-> GetEnvironmentAccountConnection -> Bool
$c/= :: GetEnvironmentAccountConnection
-> GetEnvironmentAccountConnection -> Bool
== :: GetEnvironmentAccountConnection
-> GetEnvironmentAccountConnection -> Bool
$c== :: GetEnvironmentAccountConnection
-> GetEnvironmentAccountConnection -> Bool
Prelude.Eq, ReadPrec [GetEnvironmentAccountConnection]
ReadPrec GetEnvironmentAccountConnection
Int -> ReadS GetEnvironmentAccountConnection
ReadS [GetEnvironmentAccountConnection]
(Int -> ReadS GetEnvironmentAccountConnection)
-> ReadS [GetEnvironmentAccountConnection]
-> ReadPrec GetEnvironmentAccountConnection
-> ReadPrec [GetEnvironmentAccountConnection]
-> Read GetEnvironmentAccountConnection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetEnvironmentAccountConnection]
$creadListPrec :: ReadPrec [GetEnvironmentAccountConnection]
readPrec :: ReadPrec GetEnvironmentAccountConnection
$creadPrec :: ReadPrec GetEnvironmentAccountConnection
readList :: ReadS [GetEnvironmentAccountConnection]
$creadList :: ReadS [GetEnvironmentAccountConnection]
readsPrec :: Int -> ReadS GetEnvironmentAccountConnection
$creadsPrec :: Int -> ReadS GetEnvironmentAccountConnection
Prelude.Read, Int -> GetEnvironmentAccountConnection -> ShowS
[GetEnvironmentAccountConnection] -> ShowS
GetEnvironmentAccountConnection -> String
(Int -> GetEnvironmentAccountConnection -> ShowS)
-> (GetEnvironmentAccountConnection -> String)
-> ([GetEnvironmentAccountConnection] -> ShowS)
-> Show GetEnvironmentAccountConnection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetEnvironmentAccountConnection] -> ShowS
$cshowList :: [GetEnvironmentAccountConnection] -> ShowS
show :: GetEnvironmentAccountConnection -> String
$cshow :: GetEnvironmentAccountConnection -> String
showsPrec :: Int -> GetEnvironmentAccountConnection -> ShowS
$cshowsPrec :: Int -> GetEnvironmentAccountConnection -> ShowS
Prelude.Show, (forall x.
 GetEnvironmentAccountConnection
 -> Rep GetEnvironmentAccountConnection x)
-> (forall x.
    Rep GetEnvironmentAccountConnection x
    -> GetEnvironmentAccountConnection)
-> Generic GetEnvironmentAccountConnection
forall x.
Rep GetEnvironmentAccountConnection x
-> GetEnvironmentAccountConnection
forall x.
GetEnvironmentAccountConnection
-> Rep GetEnvironmentAccountConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetEnvironmentAccountConnection x
-> GetEnvironmentAccountConnection
$cfrom :: forall x.
GetEnvironmentAccountConnection
-> Rep GetEnvironmentAccountConnection x
Prelude.Generic)

-- |
-- Create a value of 'GetEnvironmentAccountConnection' 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:
--
-- 'id', 'getEnvironmentAccountConnection_id' - The ID of the environment account connection.
newGetEnvironmentAccountConnection ::
  -- | 'id'
  Prelude.Text ->
  GetEnvironmentAccountConnection
newGetEnvironmentAccountConnection :: Text -> GetEnvironmentAccountConnection
newGetEnvironmentAccountConnection Text
pId_ =
  GetEnvironmentAccountConnection' :: Text -> GetEnvironmentAccountConnection
GetEnvironmentAccountConnection' {$sel:id:GetEnvironmentAccountConnection' :: Text
id = Text
pId_}

-- | The ID of the environment account connection.
getEnvironmentAccountConnection_id :: Lens.Lens' GetEnvironmentAccountConnection Prelude.Text
getEnvironmentAccountConnection_id :: (Text -> f Text)
-> GetEnvironmentAccountConnection
-> f GetEnvironmentAccountConnection
getEnvironmentAccountConnection_id = (GetEnvironmentAccountConnection -> Text)
-> (GetEnvironmentAccountConnection
    -> Text -> GetEnvironmentAccountConnection)
-> Lens
     GetEnvironmentAccountConnection
     GetEnvironmentAccountConnection
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEnvironmentAccountConnection' {Text
id :: Text
$sel:id:GetEnvironmentAccountConnection' :: GetEnvironmentAccountConnection -> Text
id} -> Text
id) (\s :: GetEnvironmentAccountConnection
s@GetEnvironmentAccountConnection' {} Text
a -> GetEnvironmentAccountConnection
s {$sel:id:GetEnvironmentAccountConnection' :: Text
id = Text
a} :: GetEnvironmentAccountConnection)

instance
  Core.AWSRequest
    GetEnvironmentAccountConnection
  where
  type
    AWSResponse GetEnvironmentAccountConnection =
      GetEnvironmentAccountConnectionResponse
  request :: GetEnvironmentAccountConnection
-> Request GetEnvironmentAccountConnection
request = Service
-> GetEnvironmentAccountConnection
-> Request GetEnvironmentAccountConnection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetEnvironmentAccountConnection
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetEnvironmentAccountConnection)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetEnvironmentAccountConnection))
-> Logger
-> Service
-> Proxy GetEnvironmentAccountConnection
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetEnvironmentAccountConnection)))
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 ->
          Int
-> EnvironmentAccountConnection
-> GetEnvironmentAccountConnectionResponse
GetEnvironmentAccountConnectionResponse'
            (Int
 -> EnvironmentAccountConnection
 -> GetEnvironmentAccountConnectionResponse)
-> Either String Int
-> Either
     String
     (EnvironmentAccountConnection
      -> GetEnvironmentAccountConnectionResponse)
forall (f :: * -> *) a b. Functor 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))
            Either
  String
  (EnvironmentAccountConnection
   -> GetEnvironmentAccountConnectionResponse)
-> Either String EnvironmentAccountConnection
-> Either String GetEnvironmentAccountConnectionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String EnvironmentAccountConnection
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"environmentAccountConnection")
      )

instance
  Prelude.Hashable
    GetEnvironmentAccountConnection

instance
  Prelude.NFData
    GetEnvironmentAccountConnection

instance
  Core.ToHeaders
    GetEnvironmentAccountConnection
  where
  toHeaders :: GetEnvironmentAccountConnection -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> GetEnvironmentAccountConnection -> 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
"AwsProton20200720.GetEnvironmentAccountConnection" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON GetEnvironmentAccountConnection where
  toJSON :: GetEnvironmentAccountConnection -> Value
toJSON GetEnvironmentAccountConnection' {Text
id :: Text
$sel:id:GetEnvironmentAccountConnection' :: GetEnvironmentAccountConnection -> Text
..} =
    [Pair] -> Value
Core.object
      ([Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id)])

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

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

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

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

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

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

instance
  Prelude.NFData
    GetEnvironmentAccountConnectionResponse