{-# 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.ListEnvironmentAccountConnections
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- View a list of environment account connections.
--
-- 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/.
--
-- This operation returns paginated results.
module Amazonka.Proton.ListEnvironmentAccountConnections
  ( -- * Creating a Request
    ListEnvironmentAccountConnections (..),
    newListEnvironmentAccountConnections,

    -- * Request Lenses
    listEnvironmentAccountConnections_environmentName,
    listEnvironmentAccountConnections_maxResults,
    listEnvironmentAccountConnections_nextToken,
    listEnvironmentAccountConnections_statuses,
    listEnvironmentAccountConnections_requestedBy,

    -- * Destructuring the Response
    ListEnvironmentAccountConnectionsResponse (..),
    newListEnvironmentAccountConnectionsResponse,

    -- * Response Lenses
    listEnvironmentAccountConnectionsResponse_nextToken,
    listEnvironmentAccountConnectionsResponse_httpStatus,
    listEnvironmentAccountConnectionsResponse_environmentAccountConnections,
  )
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:/ 'newListEnvironmentAccountConnections' smart constructor.
data ListEnvironmentAccountConnections = ListEnvironmentAccountConnections'
  { -- | The environment name that\'s associated with each listed environment
    -- account connection.
    ListEnvironmentAccountConnections -> Maybe Text
environmentName :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of environment account connections to list.
    ListEnvironmentAccountConnections -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | A token that indicates the location of the next environment account
    -- connection in the array of environment account connections, after the
    -- list of environment account connections that was previously requested.
    ListEnvironmentAccountConnections -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The status details for each listed environment account connection.
    ListEnvironmentAccountConnections
-> Maybe [EnvironmentAccountConnectionStatus]
statuses :: Prelude.Maybe [EnvironmentAccountConnectionStatus],
    -- | The type of account making the @ListEnvironmentAccountConnections@
    -- request.
    ListEnvironmentAccountConnections
-> EnvironmentAccountConnectionRequesterAccountType
requestedBy :: EnvironmentAccountConnectionRequesterAccountType
  }
  deriving (ListEnvironmentAccountConnections
-> ListEnvironmentAccountConnections -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEnvironmentAccountConnections
-> ListEnvironmentAccountConnections -> Bool
$c/= :: ListEnvironmentAccountConnections
-> ListEnvironmentAccountConnections -> Bool
== :: ListEnvironmentAccountConnections
-> ListEnvironmentAccountConnections -> Bool
$c== :: ListEnvironmentAccountConnections
-> ListEnvironmentAccountConnections -> Bool
Prelude.Eq, ReadPrec [ListEnvironmentAccountConnections]
ReadPrec ListEnvironmentAccountConnections
Int -> ReadS ListEnvironmentAccountConnections
ReadS [ListEnvironmentAccountConnections]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEnvironmentAccountConnections]
$creadListPrec :: ReadPrec [ListEnvironmentAccountConnections]
readPrec :: ReadPrec ListEnvironmentAccountConnections
$creadPrec :: ReadPrec ListEnvironmentAccountConnections
readList :: ReadS [ListEnvironmentAccountConnections]
$creadList :: ReadS [ListEnvironmentAccountConnections]
readsPrec :: Int -> ReadS ListEnvironmentAccountConnections
$creadsPrec :: Int -> ReadS ListEnvironmentAccountConnections
Prelude.Read, Int -> ListEnvironmentAccountConnections -> ShowS
[ListEnvironmentAccountConnections] -> ShowS
ListEnvironmentAccountConnections -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEnvironmentAccountConnections] -> ShowS
$cshowList :: [ListEnvironmentAccountConnections] -> ShowS
show :: ListEnvironmentAccountConnections -> String
$cshow :: ListEnvironmentAccountConnections -> String
showsPrec :: Int -> ListEnvironmentAccountConnections -> ShowS
$cshowsPrec :: Int -> ListEnvironmentAccountConnections -> ShowS
Prelude.Show, forall x.
Rep ListEnvironmentAccountConnections x
-> ListEnvironmentAccountConnections
forall x.
ListEnvironmentAccountConnections
-> Rep ListEnvironmentAccountConnections x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListEnvironmentAccountConnections x
-> ListEnvironmentAccountConnections
$cfrom :: forall x.
ListEnvironmentAccountConnections
-> Rep ListEnvironmentAccountConnections x
Prelude.Generic)

-- |
-- Create a value of 'ListEnvironmentAccountConnections' 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:
--
-- 'environmentName', 'listEnvironmentAccountConnections_environmentName' - The environment name that\'s associated with each listed environment
-- account connection.
--
-- 'maxResults', 'listEnvironmentAccountConnections_maxResults' - The maximum number of environment account connections to list.
--
-- 'nextToken', 'listEnvironmentAccountConnections_nextToken' - A token that indicates the location of the next environment account
-- connection in the array of environment account connections, after the
-- list of environment account connections that was previously requested.
--
-- 'statuses', 'listEnvironmentAccountConnections_statuses' - The status details for each listed environment account connection.
--
-- 'requestedBy', 'listEnvironmentAccountConnections_requestedBy' - The type of account making the @ListEnvironmentAccountConnections@
-- request.
newListEnvironmentAccountConnections ::
  -- | 'requestedBy'
  EnvironmentAccountConnectionRequesterAccountType ->
  ListEnvironmentAccountConnections
newListEnvironmentAccountConnections :: EnvironmentAccountConnectionRequesterAccountType
-> ListEnvironmentAccountConnections
newListEnvironmentAccountConnections EnvironmentAccountConnectionRequesterAccountType
pRequestedBy_ =
  ListEnvironmentAccountConnections'
    { $sel:environmentName:ListEnvironmentAccountConnections' :: Maybe Text
environmentName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListEnvironmentAccountConnections' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListEnvironmentAccountConnections' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:statuses:ListEnvironmentAccountConnections' :: Maybe [EnvironmentAccountConnectionStatus]
statuses = forall a. Maybe a
Prelude.Nothing,
      $sel:requestedBy:ListEnvironmentAccountConnections' :: EnvironmentAccountConnectionRequesterAccountType
requestedBy = EnvironmentAccountConnectionRequesterAccountType
pRequestedBy_
    }

-- | The environment name that\'s associated with each listed environment
-- account connection.
listEnvironmentAccountConnections_environmentName :: Lens.Lens' ListEnvironmentAccountConnections (Prelude.Maybe Prelude.Text)
listEnvironmentAccountConnections_environmentName :: Lens' ListEnvironmentAccountConnections (Maybe Text)
listEnvironmentAccountConnections_environmentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironmentAccountConnections' {Maybe Text
environmentName :: Maybe Text
$sel:environmentName:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections -> Maybe Text
environmentName} -> Maybe Text
environmentName) (\s :: ListEnvironmentAccountConnections
s@ListEnvironmentAccountConnections' {} Maybe Text
a -> ListEnvironmentAccountConnections
s {$sel:environmentName:ListEnvironmentAccountConnections' :: Maybe Text
environmentName = Maybe Text
a} :: ListEnvironmentAccountConnections)

-- | The maximum number of environment account connections to list.
listEnvironmentAccountConnections_maxResults :: Lens.Lens' ListEnvironmentAccountConnections (Prelude.Maybe Prelude.Natural)
listEnvironmentAccountConnections_maxResults :: Lens' ListEnvironmentAccountConnections (Maybe Natural)
listEnvironmentAccountConnections_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironmentAccountConnections' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListEnvironmentAccountConnections
s@ListEnvironmentAccountConnections' {} Maybe Natural
a -> ListEnvironmentAccountConnections
s {$sel:maxResults:ListEnvironmentAccountConnections' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListEnvironmentAccountConnections)

-- | A token that indicates the location of the next environment account
-- connection in the array of environment account connections, after the
-- list of environment account connections that was previously requested.
listEnvironmentAccountConnections_nextToken :: Lens.Lens' ListEnvironmentAccountConnections (Prelude.Maybe Prelude.Text)
listEnvironmentAccountConnections_nextToken :: Lens' ListEnvironmentAccountConnections (Maybe Text)
listEnvironmentAccountConnections_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironmentAccountConnections' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEnvironmentAccountConnections
s@ListEnvironmentAccountConnections' {} Maybe Text
a -> ListEnvironmentAccountConnections
s {$sel:nextToken:ListEnvironmentAccountConnections' :: Maybe Text
nextToken = Maybe Text
a} :: ListEnvironmentAccountConnections)

-- | The status details for each listed environment account connection.
listEnvironmentAccountConnections_statuses :: Lens.Lens' ListEnvironmentAccountConnections (Prelude.Maybe [EnvironmentAccountConnectionStatus])
listEnvironmentAccountConnections_statuses :: Lens'
  ListEnvironmentAccountConnections
  (Maybe [EnvironmentAccountConnectionStatus])
listEnvironmentAccountConnections_statuses = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironmentAccountConnections' {Maybe [EnvironmentAccountConnectionStatus]
statuses :: Maybe [EnvironmentAccountConnectionStatus]
$sel:statuses:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections
-> Maybe [EnvironmentAccountConnectionStatus]
statuses} -> Maybe [EnvironmentAccountConnectionStatus]
statuses) (\s :: ListEnvironmentAccountConnections
s@ListEnvironmentAccountConnections' {} Maybe [EnvironmentAccountConnectionStatus]
a -> ListEnvironmentAccountConnections
s {$sel:statuses:ListEnvironmentAccountConnections' :: Maybe [EnvironmentAccountConnectionStatus]
statuses = Maybe [EnvironmentAccountConnectionStatus]
a} :: ListEnvironmentAccountConnections) 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 type of account making the @ListEnvironmentAccountConnections@
-- request.
listEnvironmentAccountConnections_requestedBy :: Lens.Lens' ListEnvironmentAccountConnections EnvironmentAccountConnectionRequesterAccountType
listEnvironmentAccountConnections_requestedBy :: Lens'
  ListEnvironmentAccountConnections
  EnvironmentAccountConnectionRequesterAccountType
listEnvironmentAccountConnections_requestedBy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironmentAccountConnections' {EnvironmentAccountConnectionRequesterAccountType
requestedBy :: EnvironmentAccountConnectionRequesterAccountType
$sel:requestedBy:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections
-> EnvironmentAccountConnectionRequesterAccountType
requestedBy} -> EnvironmentAccountConnectionRequesterAccountType
requestedBy) (\s :: ListEnvironmentAccountConnections
s@ListEnvironmentAccountConnections' {} EnvironmentAccountConnectionRequesterAccountType
a -> ListEnvironmentAccountConnections
s {$sel:requestedBy:ListEnvironmentAccountConnections' :: EnvironmentAccountConnectionRequesterAccountType
requestedBy = EnvironmentAccountConnectionRequesterAccountType
a} :: ListEnvironmentAccountConnections)

instance
  Core.AWSPager
    ListEnvironmentAccountConnections
  where
  page :: ListEnvironmentAccountConnections
-> AWSResponse ListEnvironmentAccountConnections
-> Maybe ListEnvironmentAccountConnections
page ListEnvironmentAccountConnections
rq AWSResponse ListEnvironmentAccountConnections
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListEnvironmentAccountConnections
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListEnvironmentAccountConnectionsResponse (Maybe Text)
listEnvironmentAccountConnectionsResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListEnvironmentAccountConnections
rs
            forall s a. s -> Getting a s a -> a
Lens.^. Lens'
  ListEnvironmentAccountConnectionsResponse
  [EnvironmentAccountConnectionSummary]
listEnvironmentAccountConnectionsResponse_environmentAccountConnections
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListEnvironmentAccountConnections
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListEnvironmentAccountConnections (Maybe Text)
listEnvironmentAccountConnections_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListEnvironmentAccountConnections
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListEnvironmentAccountConnectionsResponse (Maybe Text)
listEnvironmentAccountConnectionsResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance
  Core.AWSRequest
    ListEnvironmentAccountConnections
  where
  type
    AWSResponse ListEnvironmentAccountConnections =
      ListEnvironmentAccountConnectionsResponse
  request :: (Service -> Service)
-> ListEnvironmentAccountConnections
-> Request ListEnvironmentAccountConnections
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 ListEnvironmentAccountConnections
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListEnvironmentAccountConnections)))
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 ->
          Maybe Text
-> Int
-> [EnvironmentAccountConnectionSummary]
-> ListEnvironmentAccountConnectionsResponse
ListEnvironmentAccountConnectionsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
            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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"environmentAccountConnections"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance
  Prelude.Hashable
    ListEnvironmentAccountConnections
  where
  hashWithSalt :: Int -> ListEnvironmentAccountConnections -> Int
hashWithSalt
    Int
_salt
    ListEnvironmentAccountConnections' {Maybe Natural
Maybe [EnvironmentAccountConnectionStatus]
Maybe Text
EnvironmentAccountConnectionRequesterAccountType
requestedBy :: EnvironmentAccountConnectionRequesterAccountType
statuses :: Maybe [EnvironmentAccountConnectionStatus]
nextToken :: Maybe Text
maxResults :: Maybe Natural
environmentName :: Maybe Text
$sel:requestedBy:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections
-> EnvironmentAccountConnectionRequesterAccountType
$sel:statuses:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections
-> Maybe [EnvironmentAccountConnectionStatus]
$sel:nextToken:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections -> Maybe Text
$sel:maxResults:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections -> Maybe Natural
$sel:environmentName:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
environmentName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [EnvironmentAccountConnectionStatus]
statuses
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` EnvironmentAccountConnectionRequesterAccountType
requestedBy

instance
  Prelude.NFData
    ListEnvironmentAccountConnections
  where
  rnf :: ListEnvironmentAccountConnections -> ()
rnf ListEnvironmentAccountConnections' {Maybe Natural
Maybe [EnvironmentAccountConnectionStatus]
Maybe Text
EnvironmentAccountConnectionRequesterAccountType
requestedBy :: EnvironmentAccountConnectionRequesterAccountType
statuses :: Maybe [EnvironmentAccountConnectionStatus]
nextToken :: Maybe Text
maxResults :: Maybe Natural
environmentName :: Maybe Text
$sel:requestedBy:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections
-> EnvironmentAccountConnectionRequesterAccountType
$sel:statuses:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections
-> Maybe [EnvironmentAccountConnectionStatus]
$sel:nextToken:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections -> Maybe Text
$sel:maxResults:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections -> Maybe Natural
$sel:environmentName:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
environmentName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [EnvironmentAccountConnectionStatus]
statuses
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf EnvironmentAccountConnectionRequesterAccountType
requestedBy

instance
  Data.ToHeaders
    ListEnvironmentAccountConnections
  where
  toHeaders :: ListEnvironmentAccountConnections -> 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.ListEnvironmentAccountConnections" ::
                          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
    ListEnvironmentAccountConnections
  where
  toJSON :: ListEnvironmentAccountConnections -> Value
toJSON ListEnvironmentAccountConnections' {Maybe Natural
Maybe [EnvironmentAccountConnectionStatus]
Maybe Text
EnvironmentAccountConnectionRequesterAccountType
requestedBy :: EnvironmentAccountConnectionRequesterAccountType
statuses :: Maybe [EnvironmentAccountConnectionStatus]
nextToken :: Maybe Text
maxResults :: Maybe Natural
environmentName :: Maybe Text
$sel:requestedBy:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections
-> EnvironmentAccountConnectionRequesterAccountType
$sel:statuses:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections
-> Maybe [EnvironmentAccountConnectionStatus]
$sel:nextToken:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections -> Maybe Text
$sel:maxResults:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections -> Maybe Natural
$sel:environmentName:ListEnvironmentAccountConnections' :: ListEnvironmentAccountConnections -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"environmentName" 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
environmentName,
            (Key
"maxResults" 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 Natural
maxResults,
            (Key
"nextToken" 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
nextToken,
            (Key
"statuses" 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 [EnvironmentAccountConnectionStatus]
statuses,
            forall a. a -> Maybe a
Prelude.Just (Key
"requestedBy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= EnvironmentAccountConnectionRequesterAccountType
requestedBy)
          ]
      )

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

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

-- | /See:/ 'newListEnvironmentAccountConnectionsResponse' smart constructor.
data ListEnvironmentAccountConnectionsResponse = ListEnvironmentAccountConnectionsResponse'
  { -- | A token that indicates the location of the next environment account
    -- connection in the array of environment account connections, after the
    -- current requested list of environment account connections.
    ListEnvironmentAccountConnectionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListEnvironmentAccountConnectionsResponse -> Int
httpStatus :: Prelude.Int,
    -- | An array of environment account connections with details that\'s
    -- returned by Proton.
    ListEnvironmentAccountConnectionsResponse
-> [EnvironmentAccountConnectionSummary]
environmentAccountConnections :: [EnvironmentAccountConnectionSummary]
  }
  deriving (ListEnvironmentAccountConnectionsResponse
-> ListEnvironmentAccountConnectionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEnvironmentAccountConnectionsResponse
-> ListEnvironmentAccountConnectionsResponse -> Bool
$c/= :: ListEnvironmentAccountConnectionsResponse
-> ListEnvironmentAccountConnectionsResponse -> Bool
== :: ListEnvironmentAccountConnectionsResponse
-> ListEnvironmentAccountConnectionsResponse -> Bool
$c== :: ListEnvironmentAccountConnectionsResponse
-> ListEnvironmentAccountConnectionsResponse -> Bool
Prelude.Eq, ReadPrec [ListEnvironmentAccountConnectionsResponse]
ReadPrec ListEnvironmentAccountConnectionsResponse
Int -> ReadS ListEnvironmentAccountConnectionsResponse
ReadS [ListEnvironmentAccountConnectionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEnvironmentAccountConnectionsResponse]
$creadListPrec :: ReadPrec [ListEnvironmentAccountConnectionsResponse]
readPrec :: ReadPrec ListEnvironmentAccountConnectionsResponse
$creadPrec :: ReadPrec ListEnvironmentAccountConnectionsResponse
readList :: ReadS [ListEnvironmentAccountConnectionsResponse]
$creadList :: ReadS [ListEnvironmentAccountConnectionsResponse]
readsPrec :: Int -> ReadS ListEnvironmentAccountConnectionsResponse
$creadsPrec :: Int -> ReadS ListEnvironmentAccountConnectionsResponse
Prelude.Read, Int -> ListEnvironmentAccountConnectionsResponse -> ShowS
[ListEnvironmentAccountConnectionsResponse] -> ShowS
ListEnvironmentAccountConnectionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEnvironmentAccountConnectionsResponse] -> ShowS
$cshowList :: [ListEnvironmentAccountConnectionsResponse] -> ShowS
show :: ListEnvironmentAccountConnectionsResponse -> String
$cshow :: ListEnvironmentAccountConnectionsResponse -> String
showsPrec :: Int -> ListEnvironmentAccountConnectionsResponse -> ShowS
$cshowsPrec :: Int -> ListEnvironmentAccountConnectionsResponse -> ShowS
Prelude.Show, forall x.
Rep ListEnvironmentAccountConnectionsResponse x
-> ListEnvironmentAccountConnectionsResponse
forall x.
ListEnvironmentAccountConnectionsResponse
-> Rep ListEnvironmentAccountConnectionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListEnvironmentAccountConnectionsResponse x
-> ListEnvironmentAccountConnectionsResponse
$cfrom :: forall x.
ListEnvironmentAccountConnectionsResponse
-> Rep ListEnvironmentAccountConnectionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListEnvironmentAccountConnectionsResponse' 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:
--
-- 'nextToken', 'listEnvironmentAccountConnectionsResponse_nextToken' - A token that indicates the location of the next environment account
-- connection in the array of environment account connections, after the
-- current requested list of environment account connections.
--
-- 'httpStatus', 'listEnvironmentAccountConnectionsResponse_httpStatus' - The response's http status code.
--
-- 'environmentAccountConnections', 'listEnvironmentAccountConnectionsResponse_environmentAccountConnections' - An array of environment account connections with details that\'s
-- returned by Proton.
newListEnvironmentAccountConnectionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListEnvironmentAccountConnectionsResponse
newListEnvironmentAccountConnectionsResponse :: Int -> ListEnvironmentAccountConnectionsResponse
newListEnvironmentAccountConnectionsResponse
  Int
pHttpStatus_ =
    ListEnvironmentAccountConnectionsResponse'
      { $sel:nextToken:ListEnvironmentAccountConnectionsResponse' :: Maybe Text
nextToken =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListEnvironmentAccountConnectionsResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:environmentAccountConnections:ListEnvironmentAccountConnectionsResponse' :: [EnvironmentAccountConnectionSummary]
environmentAccountConnections =
          forall a. Monoid a => a
Prelude.mempty
      }

-- | A token that indicates the location of the next environment account
-- connection in the array of environment account connections, after the
-- current requested list of environment account connections.
listEnvironmentAccountConnectionsResponse_nextToken :: Lens.Lens' ListEnvironmentAccountConnectionsResponse (Prelude.Maybe Prelude.Text)
listEnvironmentAccountConnectionsResponse_nextToken :: Lens' ListEnvironmentAccountConnectionsResponse (Maybe Text)
listEnvironmentAccountConnectionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironmentAccountConnectionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEnvironmentAccountConnectionsResponse' :: ListEnvironmentAccountConnectionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEnvironmentAccountConnectionsResponse
s@ListEnvironmentAccountConnectionsResponse' {} Maybe Text
a -> ListEnvironmentAccountConnectionsResponse
s {$sel:nextToken:ListEnvironmentAccountConnectionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListEnvironmentAccountConnectionsResponse)

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

-- | An array of environment account connections with details that\'s
-- returned by Proton.
listEnvironmentAccountConnectionsResponse_environmentAccountConnections :: Lens.Lens' ListEnvironmentAccountConnectionsResponse [EnvironmentAccountConnectionSummary]
listEnvironmentAccountConnectionsResponse_environmentAccountConnections :: Lens'
  ListEnvironmentAccountConnectionsResponse
  [EnvironmentAccountConnectionSummary]
listEnvironmentAccountConnectionsResponse_environmentAccountConnections = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironmentAccountConnectionsResponse' {[EnvironmentAccountConnectionSummary]
environmentAccountConnections :: [EnvironmentAccountConnectionSummary]
$sel:environmentAccountConnections:ListEnvironmentAccountConnectionsResponse' :: ListEnvironmentAccountConnectionsResponse
-> [EnvironmentAccountConnectionSummary]
environmentAccountConnections} -> [EnvironmentAccountConnectionSummary]
environmentAccountConnections) (\s :: ListEnvironmentAccountConnectionsResponse
s@ListEnvironmentAccountConnectionsResponse' {} [EnvironmentAccountConnectionSummary]
a -> ListEnvironmentAccountConnectionsResponse
s {$sel:environmentAccountConnections:ListEnvironmentAccountConnectionsResponse' :: [EnvironmentAccountConnectionSummary]
environmentAccountConnections = [EnvironmentAccountConnectionSummary]
a} :: ListEnvironmentAccountConnectionsResponse) 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
  Prelude.NFData
    ListEnvironmentAccountConnectionsResponse
  where
  rnf :: ListEnvironmentAccountConnectionsResponse -> ()
rnf ListEnvironmentAccountConnectionsResponse' {Int
[EnvironmentAccountConnectionSummary]
Maybe Text
environmentAccountConnections :: [EnvironmentAccountConnectionSummary]
httpStatus :: Int
nextToken :: Maybe Text
$sel:environmentAccountConnections:ListEnvironmentAccountConnectionsResponse' :: ListEnvironmentAccountConnectionsResponse
-> [EnvironmentAccountConnectionSummary]
$sel:httpStatus:ListEnvironmentAccountConnectionsResponse' :: ListEnvironmentAccountConnectionsResponse -> Int
$sel:nextToken:ListEnvironmentAccountConnectionsResponse' :: ListEnvironmentAccountConnectionsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 [EnvironmentAccountConnectionSummary]
environmentAccountConnections