{-# 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-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)
--
-- View a list of environment account connections.
--
-- 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/.
--
-- This operation returns paginated results.
module Amazonka.Proton.ListEnvironmentAccountConnections
  ( -- * Creating a Request
    ListEnvironmentAccountConnections (..),
    newListEnvironmentAccountConnections,

    -- * Request Lenses
    listEnvironmentAccountConnections_nextToken,
    listEnvironmentAccountConnections_environmentName,
    listEnvironmentAccountConnections_statuses,
    listEnvironmentAccountConnections_maxResults,
    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.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:/ 'newListEnvironmentAccountConnections' smart constructor.
data ListEnvironmentAccountConnections = ListEnvironmentAccountConnections'
  { -- | A token to indicate 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 environment name that\'s associated with each listed environment
    -- account connection.
    ListEnvironmentAccountConnections -> Maybe Text
environmentName :: Prelude.Maybe Prelude.Text,
    -- | The status details for each listed environment account connection.
    ListEnvironmentAccountConnections
-> Maybe [EnvironmentAccountConnectionStatus]
statuses :: Prelude.Maybe [EnvironmentAccountConnectionStatus],
    -- | The maximum number of environment account connections to list.
    ListEnvironmentAccountConnections -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The type of account making the @ListEnvironmentAccountConnections@
    -- request.
    ListEnvironmentAccountConnections
-> EnvironmentAccountConnectionRequesterAccountType
requestedBy :: EnvironmentAccountConnectionRequesterAccountType
  }
  deriving (ListEnvironmentAccountConnections
-> ListEnvironmentAccountConnections -> Bool
(ListEnvironmentAccountConnections
 -> ListEnvironmentAccountConnections -> Bool)
-> (ListEnvironmentAccountConnections
    -> ListEnvironmentAccountConnections -> Bool)
-> Eq ListEnvironmentAccountConnections
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]
(Int -> ReadS ListEnvironmentAccountConnections)
-> ReadS [ListEnvironmentAccountConnections]
-> ReadPrec ListEnvironmentAccountConnections
-> ReadPrec [ListEnvironmentAccountConnections]
-> Read 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
(Int -> ListEnvironmentAccountConnections -> ShowS)
-> (ListEnvironmentAccountConnections -> String)
-> ([ListEnvironmentAccountConnections] -> ShowS)
-> Show ListEnvironmentAccountConnections
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.
 ListEnvironmentAccountConnections
 -> Rep ListEnvironmentAccountConnections x)
-> (forall x.
    Rep ListEnvironmentAccountConnections x
    -> ListEnvironmentAccountConnections)
-> Generic ListEnvironmentAccountConnections
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:
--
-- 'nextToken', 'listEnvironmentAccountConnections_nextToken' - A token to indicate 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.
--
-- 'environmentName', 'listEnvironmentAccountConnections_environmentName' - The environment name that\'s associated with each listed environment
-- account connection.
--
-- 'statuses', 'listEnvironmentAccountConnections_statuses' - The status details for each listed environment account connection.
--
-- 'maxResults', 'listEnvironmentAccountConnections_maxResults' - The maximum number of environment account connections to list.
--
-- 'requestedBy', 'listEnvironmentAccountConnections_requestedBy' - The type of account making the @ListEnvironmentAccountConnections@
-- request.
newListEnvironmentAccountConnections ::
  -- | 'requestedBy'
  EnvironmentAccountConnectionRequesterAccountType ->
  ListEnvironmentAccountConnections
newListEnvironmentAccountConnections :: EnvironmentAccountConnectionRequesterAccountType
-> ListEnvironmentAccountConnections
newListEnvironmentAccountConnections EnvironmentAccountConnectionRequesterAccountType
pRequestedBy_ =
  ListEnvironmentAccountConnections' :: Maybe Text
-> Maybe Text
-> Maybe [EnvironmentAccountConnectionStatus]
-> Maybe Natural
-> EnvironmentAccountConnectionRequesterAccountType
-> ListEnvironmentAccountConnections
ListEnvironmentAccountConnections'
    { $sel:nextToken:ListEnvironmentAccountConnections' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:environmentName:ListEnvironmentAccountConnections' :: Maybe Text
environmentName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statuses:ListEnvironmentAccountConnections' :: Maybe [EnvironmentAccountConnectionStatus]
statuses = Maybe [EnvironmentAccountConnectionStatus]
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListEnvironmentAccountConnections' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:requestedBy:ListEnvironmentAccountConnections' :: EnvironmentAccountConnectionRequesterAccountType
requestedBy = EnvironmentAccountConnectionRequesterAccountType
pRequestedBy_
    }

-- | A token to indicate 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 :: (Maybe Text -> f (Maybe Text))
-> ListEnvironmentAccountConnections
-> f ListEnvironmentAccountConnections
listEnvironmentAccountConnections_nextToken = (ListEnvironmentAccountConnections -> Maybe Text)
-> (ListEnvironmentAccountConnections
    -> Maybe Text -> ListEnvironmentAccountConnections)
-> Lens
     ListEnvironmentAccountConnections
     ListEnvironmentAccountConnections
     (Maybe Text)
     (Maybe Text)
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 environment name that\'s associated with each listed environment
-- account connection.
listEnvironmentAccountConnections_environmentName :: Lens.Lens' ListEnvironmentAccountConnections (Prelude.Maybe Prelude.Text)
listEnvironmentAccountConnections_environmentName :: (Maybe Text -> f (Maybe Text))
-> ListEnvironmentAccountConnections
-> f ListEnvironmentAccountConnections
listEnvironmentAccountConnections_environmentName = (ListEnvironmentAccountConnections -> Maybe Text)
-> (ListEnvironmentAccountConnections
    -> Maybe Text -> ListEnvironmentAccountConnections)
-> Lens
     ListEnvironmentAccountConnections
     ListEnvironmentAccountConnections
     (Maybe Text)
     (Maybe Text)
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 status details for each listed environment account connection.
listEnvironmentAccountConnections_statuses :: Lens.Lens' ListEnvironmentAccountConnections (Prelude.Maybe [EnvironmentAccountConnectionStatus])
listEnvironmentAccountConnections_statuses :: (Maybe [EnvironmentAccountConnectionStatus]
 -> f (Maybe [EnvironmentAccountConnectionStatus]))
-> ListEnvironmentAccountConnections
-> f ListEnvironmentAccountConnections
listEnvironmentAccountConnections_statuses = (ListEnvironmentAccountConnections
 -> Maybe [EnvironmentAccountConnectionStatus])
-> (ListEnvironmentAccountConnections
    -> Maybe [EnvironmentAccountConnectionStatus]
    -> ListEnvironmentAccountConnections)
-> Lens
     ListEnvironmentAccountConnections
     ListEnvironmentAccountConnections
     (Maybe [EnvironmentAccountConnectionStatus])
     (Maybe [EnvironmentAccountConnectionStatus])
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) ((Maybe [EnvironmentAccountConnectionStatus]
  -> f (Maybe [EnvironmentAccountConnectionStatus]))
 -> ListEnvironmentAccountConnections
 -> f ListEnvironmentAccountConnections)
-> ((Maybe [EnvironmentAccountConnectionStatus]
     -> f (Maybe [EnvironmentAccountConnectionStatus]))
    -> Maybe [EnvironmentAccountConnectionStatus]
    -> f (Maybe [EnvironmentAccountConnectionStatus]))
-> (Maybe [EnvironmentAccountConnectionStatus]
    -> f (Maybe [EnvironmentAccountConnectionStatus]))
-> ListEnvironmentAccountConnections
-> f ListEnvironmentAccountConnections
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EnvironmentAccountConnectionStatus]
  [EnvironmentAccountConnectionStatus]
  [EnvironmentAccountConnectionStatus]
  [EnvironmentAccountConnectionStatus]
-> Iso
     (Maybe [EnvironmentAccountConnectionStatus])
     (Maybe [EnvironmentAccountConnectionStatus])
     (Maybe [EnvironmentAccountConnectionStatus])
     (Maybe [EnvironmentAccountConnectionStatus])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [EnvironmentAccountConnectionStatus]
  [EnvironmentAccountConnectionStatus]
  [EnvironmentAccountConnectionStatus]
  [EnvironmentAccountConnectionStatus]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The maximum number of environment account connections to list.
listEnvironmentAccountConnections_maxResults :: Lens.Lens' ListEnvironmentAccountConnections (Prelude.Maybe Prelude.Natural)
listEnvironmentAccountConnections_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListEnvironmentAccountConnections
-> f ListEnvironmentAccountConnections
listEnvironmentAccountConnections_maxResults = (ListEnvironmentAccountConnections -> Maybe Natural)
-> (ListEnvironmentAccountConnections
    -> Maybe Natural -> ListEnvironmentAccountConnections)
-> Lens
     ListEnvironmentAccountConnections
     ListEnvironmentAccountConnections
     (Maybe Natural)
     (Maybe Natural)
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)

-- | The type of account making the @ListEnvironmentAccountConnections@
-- request.
listEnvironmentAccountConnections_requestedBy :: Lens.Lens' ListEnvironmentAccountConnections EnvironmentAccountConnectionRequesterAccountType
listEnvironmentAccountConnections_requestedBy :: (EnvironmentAccountConnectionRequesterAccountType
 -> f EnvironmentAccountConnectionRequesterAccountType)
-> ListEnvironmentAccountConnections
-> f ListEnvironmentAccountConnections
listEnvironmentAccountConnections_requestedBy = (ListEnvironmentAccountConnections
 -> EnvironmentAccountConnectionRequesterAccountType)
-> (ListEnvironmentAccountConnections
    -> EnvironmentAccountConnectionRequesterAccountType
    -> ListEnvironmentAccountConnections)
-> Lens
     ListEnvironmentAccountConnections
     ListEnvironmentAccountConnections
     EnvironmentAccountConnectionRequesterAccountType
     EnvironmentAccountConnectionRequesterAccountType
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
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListEnvironmentAccountConnections
ListEnvironmentAccountConnectionsResponse
rs
            ListEnvironmentAccountConnectionsResponse
-> Getting
     (First Text) ListEnvironmentAccountConnectionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListEnvironmentAccountConnectionsResponse
-> Const (First Text) ListEnvironmentAccountConnectionsResponse
Lens' ListEnvironmentAccountConnectionsResponse (Maybe Text)
listEnvironmentAccountConnectionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListEnvironmentAccountConnectionsResponse
 -> Const (First Text) ListEnvironmentAccountConnectionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListEnvironmentAccountConnectionsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListEnvironmentAccountConnections
forall a. Maybe a
Prelude.Nothing
    | [EnvironmentAccountConnectionSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListEnvironmentAccountConnections
ListEnvironmentAccountConnectionsResponse
rs
            ListEnvironmentAccountConnectionsResponse
-> Getting
     [EnvironmentAccountConnectionSummary]
     ListEnvironmentAccountConnectionsResponse
     [EnvironmentAccountConnectionSummary]
-> [EnvironmentAccountConnectionSummary]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
  [EnvironmentAccountConnectionSummary]
  ListEnvironmentAccountConnectionsResponse
  [EnvironmentAccountConnectionSummary]
Lens'
  ListEnvironmentAccountConnectionsResponse
  [EnvironmentAccountConnectionSummary]
listEnvironmentAccountConnectionsResponse_environmentAccountConnections
        ) =
      Maybe ListEnvironmentAccountConnections
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListEnvironmentAccountConnections
-> Maybe ListEnvironmentAccountConnections
forall a. a -> Maybe a
Prelude.Just (ListEnvironmentAccountConnections
 -> Maybe ListEnvironmentAccountConnections)
-> ListEnvironmentAccountConnections
-> Maybe ListEnvironmentAccountConnections
forall a b. (a -> b) -> a -> b
Prelude.$
        ListEnvironmentAccountConnections
rq
          ListEnvironmentAccountConnections
-> (ListEnvironmentAccountConnections
    -> ListEnvironmentAccountConnections)
-> ListEnvironmentAccountConnections
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListEnvironmentAccountConnections
-> Identity ListEnvironmentAccountConnections
Lens
  ListEnvironmentAccountConnections
  ListEnvironmentAccountConnections
  (Maybe Text)
  (Maybe Text)
listEnvironmentAccountConnections_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListEnvironmentAccountConnections
 -> Identity ListEnvironmentAccountConnections)
-> Maybe Text
-> ListEnvironmentAccountConnections
-> ListEnvironmentAccountConnections
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListEnvironmentAccountConnections
ListEnvironmentAccountConnectionsResponse
rs
          ListEnvironmentAccountConnectionsResponse
-> Getting
     (First Text) ListEnvironmentAccountConnectionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListEnvironmentAccountConnectionsResponse
-> Const (First Text) ListEnvironmentAccountConnectionsResponse
Lens' ListEnvironmentAccountConnectionsResponse (Maybe Text)
listEnvironmentAccountConnectionsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListEnvironmentAccountConnectionsResponse
 -> Const (First Text) ListEnvironmentAccountConnectionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListEnvironmentAccountConnectionsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance
  Core.AWSRequest
    ListEnvironmentAccountConnections
  where
  type
    AWSResponse ListEnvironmentAccountConnections =
      ListEnvironmentAccountConnectionsResponse
  request :: ListEnvironmentAccountConnections
-> Request ListEnvironmentAccountConnections
request = Service
-> ListEnvironmentAccountConnections
-> Request ListEnvironmentAccountConnections
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListEnvironmentAccountConnections
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListEnvironmentAccountConnections)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListEnvironmentAccountConnections))
-> Logger
-> Service
-> Proxy ListEnvironmentAccountConnections
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListEnvironmentAccountConnections)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Int
-> [EnvironmentAccountConnectionSummary]
-> ListEnvironmentAccountConnectionsResponse
ListEnvironmentAccountConnectionsResponse'
            (Maybe Text
 -> Int
 -> [EnvironmentAccountConnectionSummary]
 -> ListEnvironmentAccountConnectionsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Int
      -> [EnvironmentAccountConnectionSummary]
      -> ListEnvironmentAccountConnectionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
              Either
  String
  (Int
   -> [EnvironmentAccountConnectionSummary]
   -> ListEnvironmentAccountConnectionsResponse)
-> Either String Int
-> Either
     String
     ([EnvironmentAccountConnectionSummary]
      -> ListEnvironmentAccountConnectionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
              Either
  String
  ([EnvironmentAccountConnectionSummary]
   -> ListEnvironmentAccountConnectionsResponse)
-> Either String [EnvironmentAccountConnectionSummary]
-> Either String ListEnvironmentAccountConnectionsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Either String (Maybe [EnvironmentAccountConnectionSummary])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"environmentAccountConnections"
                              Either String (Maybe [EnvironmentAccountConnectionSummary])
-> [EnvironmentAccountConnectionSummary]
-> Either String [EnvironmentAccountConnectionSummary]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [EnvironmentAccountConnectionSummary]
forall a. Monoid a => a
Prelude.mempty
                          )
      )

instance
  Prelude.Hashable
    ListEnvironmentAccountConnections

instance
  Prelude.NFData
    ListEnvironmentAccountConnections

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

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

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

-- | /See:/ 'newListEnvironmentAccountConnectionsResponse' smart constructor.
data ListEnvironmentAccountConnectionsResponse = ListEnvironmentAccountConnectionsResponse'
  { -- | A token to indicate 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 AWS Proton.
    ListEnvironmentAccountConnectionsResponse
-> [EnvironmentAccountConnectionSummary]
environmentAccountConnections :: [EnvironmentAccountConnectionSummary]
  }
  deriving (ListEnvironmentAccountConnectionsResponse
-> ListEnvironmentAccountConnectionsResponse -> Bool
(ListEnvironmentAccountConnectionsResponse
 -> ListEnvironmentAccountConnectionsResponse -> Bool)
-> (ListEnvironmentAccountConnectionsResponse
    -> ListEnvironmentAccountConnectionsResponse -> Bool)
-> Eq ListEnvironmentAccountConnectionsResponse
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]
(Int -> ReadS ListEnvironmentAccountConnectionsResponse)
-> ReadS [ListEnvironmentAccountConnectionsResponse]
-> ReadPrec ListEnvironmentAccountConnectionsResponse
-> ReadPrec [ListEnvironmentAccountConnectionsResponse]
-> Read 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
(Int -> ListEnvironmentAccountConnectionsResponse -> ShowS)
-> (ListEnvironmentAccountConnectionsResponse -> String)
-> ([ListEnvironmentAccountConnectionsResponse] -> ShowS)
-> Show ListEnvironmentAccountConnectionsResponse
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.
 ListEnvironmentAccountConnectionsResponse
 -> Rep ListEnvironmentAccountConnectionsResponse x)
-> (forall x.
    Rep ListEnvironmentAccountConnectionsResponse x
    -> ListEnvironmentAccountConnectionsResponse)
-> Generic ListEnvironmentAccountConnectionsResponse
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 to indicate 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 AWS Proton.
newListEnvironmentAccountConnectionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListEnvironmentAccountConnectionsResponse
newListEnvironmentAccountConnectionsResponse :: Int -> ListEnvironmentAccountConnectionsResponse
newListEnvironmentAccountConnectionsResponse
  Int
pHttpStatus_ =
    ListEnvironmentAccountConnectionsResponse' :: Maybe Text
-> Int
-> [EnvironmentAccountConnectionSummary]
-> ListEnvironmentAccountConnectionsResponse
ListEnvironmentAccountConnectionsResponse'
      { $sel:nextToken:ListEnvironmentAccountConnectionsResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListEnvironmentAccountConnectionsResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:environmentAccountConnections:ListEnvironmentAccountConnectionsResponse' :: [EnvironmentAccountConnectionSummary]
environmentAccountConnections =
          [EnvironmentAccountConnectionSummary]
forall a. Monoid a => a
Prelude.mempty
      }

-- | A token to indicate 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 :: (Maybe Text -> f (Maybe Text))
-> ListEnvironmentAccountConnectionsResponse
-> f ListEnvironmentAccountConnectionsResponse
listEnvironmentAccountConnectionsResponse_nextToken = (ListEnvironmentAccountConnectionsResponse -> Maybe Text)
-> (ListEnvironmentAccountConnectionsResponse
    -> Maybe Text -> ListEnvironmentAccountConnectionsResponse)
-> Lens' ListEnvironmentAccountConnectionsResponse (Maybe Text)
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 :: (Int -> f Int)
-> ListEnvironmentAccountConnectionsResponse
-> f ListEnvironmentAccountConnectionsResponse
listEnvironmentAccountConnectionsResponse_httpStatus = (ListEnvironmentAccountConnectionsResponse -> Int)
-> (ListEnvironmentAccountConnectionsResponse
    -> Int -> ListEnvironmentAccountConnectionsResponse)
-> Lens
     ListEnvironmentAccountConnectionsResponse
     ListEnvironmentAccountConnectionsResponse
     Int
     Int
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 AWS Proton.
listEnvironmentAccountConnectionsResponse_environmentAccountConnections :: Lens.Lens' ListEnvironmentAccountConnectionsResponse [EnvironmentAccountConnectionSummary]
listEnvironmentAccountConnectionsResponse_environmentAccountConnections :: ([EnvironmentAccountConnectionSummary]
 -> f [EnvironmentAccountConnectionSummary])
-> ListEnvironmentAccountConnectionsResponse
-> f ListEnvironmentAccountConnectionsResponse
listEnvironmentAccountConnectionsResponse_environmentAccountConnections = (ListEnvironmentAccountConnectionsResponse
 -> [EnvironmentAccountConnectionSummary])
-> (ListEnvironmentAccountConnectionsResponse
    -> [EnvironmentAccountConnectionSummary]
    -> ListEnvironmentAccountConnectionsResponse)
-> Lens'
     ListEnvironmentAccountConnectionsResponse
     [EnvironmentAccountConnectionSummary]
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) (([EnvironmentAccountConnectionSummary]
  -> f [EnvironmentAccountConnectionSummary])
 -> ListEnvironmentAccountConnectionsResponse
 -> f ListEnvironmentAccountConnectionsResponse)
-> (([EnvironmentAccountConnectionSummary]
     -> f [EnvironmentAccountConnectionSummary])
    -> [EnvironmentAccountConnectionSummary]
    -> f [EnvironmentAccountConnectionSummary])
-> ([EnvironmentAccountConnectionSummary]
    -> f [EnvironmentAccountConnectionSummary])
-> ListEnvironmentAccountConnectionsResponse
-> f ListEnvironmentAccountConnectionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([EnvironmentAccountConnectionSummary]
 -> f [EnvironmentAccountConnectionSummary])
-> [EnvironmentAccountConnectionSummary]
-> f [EnvironmentAccountConnectionSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.NFData
    ListEnvironmentAccountConnectionsResponse