{-# 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.ListEnvironments
-- 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)
--
-- List environments with detail data summaries.
--
-- This operation returns paginated results.
module Amazonka.Proton.ListEnvironments
  ( -- * Creating a Request
    ListEnvironments (..),
    newListEnvironments,

    -- * Request Lenses
    listEnvironments_environmentTemplates,
    listEnvironments_nextToken,
    listEnvironments_maxResults,

    -- * Destructuring the Response
    ListEnvironmentsResponse (..),
    newListEnvironmentsResponse,

    -- * Response Lenses
    listEnvironmentsResponse_nextToken,
    listEnvironmentsResponse_httpStatus,
    listEnvironmentsResponse_environments,
  )
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:/ 'newListEnvironments' smart constructor.
data ListEnvironments = ListEnvironments'
  { -- | An array of the versions of the environment template.
    ListEnvironments -> Maybe [EnvironmentTemplateFilter]
environmentTemplates :: Prelude.Maybe [EnvironmentTemplateFilter],
    -- | A token to indicate the location of the next environment in the array of
    -- environments, after the list of environments that was previously
    -- requested.
    ListEnvironments -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of environments to list.
    ListEnvironments -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListEnvironments -> ListEnvironments -> Bool
(ListEnvironments -> ListEnvironments -> Bool)
-> (ListEnvironments -> ListEnvironments -> Bool)
-> Eq ListEnvironments
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEnvironments -> ListEnvironments -> Bool
$c/= :: ListEnvironments -> ListEnvironments -> Bool
== :: ListEnvironments -> ListEnvironments -> Bool
$c== :: ListEnvironments -> ListEnvironments -> Bool
Prelude.Eq, ReadPrec [ListEnvironments]
ReadPrec ListEnvironments
Int -> ReadS ListEnvironments
ReadS [ListEnvironments]
(Int -> ReadS ListEnvironments)
-> ReadS [ListEnvironments]
-> ReadPrec ListEnvironments
-> ReadPrec [ListEnvironments]
-> Read ListEnvironments
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEnvironments]
$creadListPrec :: ReadPrec [ListEnvironments]
readPrec :: ReadPrec ListEnvironments
$creadPrec :: ReadPrec ListEnvironments
readList :: ReadS [ListEnvironments]
$creadList :: ReadS [ListEnvironments]
readsPrec :: Int -> ReadS ListEnvironments
$creadsPrec :: Int -> ReadS ListEnvironments
Prelude.Read, Int -> ListEnvironments -> ShowS
[ListEnvironments] -> ShowS
ListEnvironments -> String
(Int -> ListEnvironments -> ShowS)
-> (ListEnvironments -> String)
-> ([ListEnvironments] -> ShowS)
-> Show ListEnvironments
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEnvironments] -> ShowS
$cshowList :: [ListEnvironments] -> ShowS
show :: ListEnvironments -> String
$cshow :: ListEnvironments -> String
showsPrec :: Int -> ListEnvironments -> ShowS
$cshowsPrec :: Int -> ListEnvironments -> ShowS
Prelude.Show, (forall x. ListEnvironments -> Rep ListEnvironments x)
-> (forall x. Rep ListEnvironments x -> ListEnvironments)
-> Generic ListEnvironments
forall x. Rep ListEnvironments x -> ListEnvironments
forall x. ListEnvironments -> Rep ListEnvironments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListEnvironments x -> ListEnvironments
$cfrom :: forall x. ListEnvironments -> Rep ListEnvironments x
Prelude.Generic)

-- |
-- Create a value of 'ListEnvironments' 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:
--
-- 'environmentTemplates', 'listEnvironments_environmentTemplates' - An array of the versions of the environment template.
--
-- 'nextToken', 'listEnvironments_nextToken' - A token to indicate the location of the next environment in the array of
-- environments, after the list of environments that was previously
-- requested.
--
-- 'maxResults', 'listEnvironments_maxResults' - The maximum number of environments to list.
newListEnvironments ::
  ListEnvironments
newListEnvironments :: ListEnvironments
newListEnvironments =
  ListEnvironments' :: Maybe [EnvironmentTemplateFilter]
-> Maybe Text -> Maybe Natural -> ListEnvironments
ListEnvironments'
    { $sel:environmentTemplates:ListEnvironments' :: Maybe [EnvironmentTemplateFilter]
environmentTemplates =
        Maybe [EnvironmentTemplateFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListEnvironments' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListEnvironments' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | An array of the versions of the environment template.
listEnvironments_environmentTemplates :: Lens.Lens' ListEnvironments (Prelude.Maybe [EnvironmentTemplateFilter])
listEnvironments_environmentTemplates :: (Maybe [EnvironmentTemplateFilter]
 -> f (Maybe [EnvironmentTemplateFilter]))
-> ListEnvironments -> f ListEnvironments
listEnvironments_environmentTemplates = (ListEnvironments -> Maybe [EnvironmentTemplateFilter])
-> (ListEnvironments
    -> Maybe [EnvironmentTemplateFilter] -> ListEnvironments)
-> Lens
     ListEnvironments
     ListEnvironments
     (Maybe [EnvironmentTemplateFilter])
     (Maybe [EnvironmentTemplateFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironments' {Maybe [EnvironmentTemplateFilter]
environmentTemplates :: Maybe [EnvironmentTemplateFilter]
$sel:environmentTemplates:ListEnvironments' :: ListEnvironments -> Maybe [EnvironmentTemplateFilter]
environmentTemplates} -> Maybe [EnvironmentTemplateFilter]
environmentTemplates) (\s :: ListEnvironments
s@ListEnvironments' {} Maybe [EnvironmentTemplateFilter]
a -> ListEnvironments
s {$sel:environmentTemplates:ListEnvironments' :: Maybe [EnvironmentTemplateFilter]
environmentTemplates = Maybe [EnvironmentTemplateFilter]
a} :: ListEnvironments) ((Maybe [EnvironmentTemplateFilter]
  -> f (Maybe [EnvironmentTemplateFilter]))
 -> ListEnvironments -> f ListEnvironments)
-> ((Maybe [EnvironmentTemplateFilter]
     -> f (Maybe [EnvironmentTemplateFilter]))
    -> Maybe [EnvironmentTemplateFilter]
    -> f (Maybe [EnvironmentTemplateFilter]))
-> (Maybe [EnvironmentTemplateFilter]
    -> f (Maybe [EnvironmentTemplateFilter]))
-> ListEnvironments
-> f ListEnvironments
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EnvironmentTemplateFilter]
  [EnvironmentTemplateFilter]
  [EnvironmentTemplateFilter]
  [EnvironmentTemplateFilter]
-> Iso
     (Maybe [EnvironmentTemplateFilter])
     (Maybe [EnvironmentTemplateFilter])
     (Maybe [EnvironmentTemplateFilter])
     (Maybe [EnvironmentTemplateFilter])
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
  [EnvironmentTemplateFilter]
  [EnvironmentTemplateFilter]
  [EnvironmentTemplateFilter]
  [EnvironmentTemplateFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A token to indicate the location of the next environment in the array of
-- environments, after the list of environments that was previously
-- requested.
listEnvironments_nextToken :: Lens.Lens' ListEnvironments (Prelude.Maybe Prelude.Text)
listEnvironments_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListEnvironments -> f ListEnvironments
listEnvironments_nextToken = (ListEnvironments -> Maybe Text)
-> (ListEnvironments -> Maybe Text -> ListEnvironments)
-> Lens ListEnvironments ListEnvironments (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironments' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEnvironments' :: ListEnvironments -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEnvironments
s@ListEnvironments' {} Maybe Text
a -> ListEnvironments
s {$sel:nextToken:ListEnvironments' :: Maybe Text
nextToken = Maybe Text
a} :: ListEnvironments)

-- | The maximum number of environments to list.
listEnvironments_maxResults :: Lens.Lens' ListEnvironments (Prelude.Maybe Prelude.Natural)
listEnvironments_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListEnvironments -> f ListEnvironments
listEnvironments_maxResults = (ListEnvironments -> Maybe Natural)
-> (ListEnvironments -> Maybe Natural -> ListEnvironments)
-> Lens
     ListEnvironments ListEnvironments (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironments' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListEnvironments' :: ListEnvironments -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListEnvironments
s@ListEnvironments' {} Maybe Natural
a -> ListEnvironments
s {$sel:maxResults:ListEnvironments' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListEnvironments)

instance Core.AWSPager ListEnvironments where
  page :: ListEnvironments
-> AWSResponse ListEnvironments -> Maybe ListEnvironments
page ListEnvironments
rq AWSResponse ListEnvironments
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListEnvironments
ListEnvironmentsResponse
rs
            ListEnvironmentsResponse
-> Getting (First Text) ListEnvironmentsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListEnvironmentsResponse
-> Const (First Text) ListEnvironmentsResponse
Lens' ListEnvironmentsResponse (Maybe Text)
listEnvironmentsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListEnvironmentsResponse
 -> Const (First Text) ListEnvironmentsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListEnvironmentsResponse 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 ListEnvironments
forall a. Maybe a
Prelude.Nothing
    | [EnvironmentSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        (AWSResponse ListEnvironments
ListEnvironmentsResponse
rs ListEnvironmentsResponse
-> Getting
     [EnvironmentSummary] ListEnvironmentsResponse [EnvironmentSummary]
-> [EnvironmentSummary]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
  [EnvironmentSummary] ListEnvironmentsResponse [EnvironmentSummary]
Lens' ListEnvironmentsResponse [EnvironmentSummary]
listEnvironmentsResponse_environments) =
      Maybe ListEnvironments
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListEnvironments -> Maybe ListEnvironments
forall a. a -> Maybe a
Prelude.Just (ListEnvironments -> Maybe ListEnvironments)
-> ListEnvironments -> Maybe ListEnvironments
forall a b. (a -> b) -> a -> b
Prelude.$
        ListEnvironments
rq
          ListEnvironments
-> (ListEnvironments -> ListEnvironments) -> ListEnvironments
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListEnvironments -> Identity ListEnvironments
Lens ListEnvironments ListEnvironments (Maybe Text) (Maybe Text)
listEnvironments_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListEnvironments -> Identity ListEnvironments)
-> Maybe Text -> ListEnvironments -> ListEnvironments
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListEnvironments
ListEnvironmentsResponse
rs
          ListEnvironmentsResponse
-> Getting (First Text) ListEnvironmentsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListEnvironmentsResponse
-> Const (First Text) ListEnvironmentsResponse
Lens' ListEnvironmentsResponse (Maybe Text)
listEnvironmentsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListEnvironmentsResponse
 -> Const (First Text) ListEnvironmentsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListEnvironmentsResponse 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 ListEnvironments where
  type
    AWSResponse ListEnvironments =
      ListEnvironmentsResponse
  request :: ListEnvironments -> Request ListEnvironments
request = Service -> ListEnvironments -> Request ListEnvironments
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListEnvironments
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListEnvironments)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListEnvironments))
-> Logger
-> Service
-> Proxy ListEnvironments
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListEnvironments)))
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 -> [EnvironmentSummary] -> ListEnvironmentsResponse
ListEnvironmentsResponse'
            (Maybe Text
 -> Int -> [EnvironmentSummary] -> ListEnvironmentsResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> [EnvironmentSummary] -> ListEnvironmentsResponse)
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 -> [EnvironmentSummary] -> ListEnvironmentsResponse)
-> Either String Int
-> Either String ([EnvironmentSummary] -> ListEnvironmentsResponse)
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 ([EnvironmentSummary] -> ListEnvironmentsResponse)
-> Either String [EnvironmentSummary]
-> Either String ListEnvironmentsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [EnvironmentSummary])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"environments" Either String (Maybe [EnvironmentSummary])
-> [EnvironmentSummary] -> Either String [EnvironmentSummary]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [EnvironmentSummary]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ListEnvironments

instance Prelude.NFData ListEnvironments

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

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

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

-- | /See:/ 'newListEnvironmentsResponse' smart constructor.
data ListEnvironmentsResponse = ListEnvironmentsResponse'
  { -- | A token to indicate the location of the next environment in the array of
    -- environments, after the current requested list of environments.
    ListEnvironmentsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListEnvironmentsResponse -> Int
httpStatus :: Prelude.Int,
    -- | An array of environment detail data summaries.
    ListEnvironmentsResponse -> [EnvironmentSummary]
environments :: [EnvironmentSummary]
  }
  deriving (ListEnvironmentsResponse -> ListEnvironmentsResponse -> Bool
(ListEnvironmentsResponse -> ListEnvironmentsResponse -> Bool)
-> (ListEnvironmentsResponse -> ListEnvironmentsResponse -> Bool)
-> Eq ListEnvironmentsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEnvironmentsResponse -> ListEnvironmentsResponse -> Bool
$c/= :: ListEnvironmentsResponse -> ListEnvironmentsResponse -> Bool
== :: ListEnvironmentsResponse -> ListEnvironmentsResponse -> Bool
$c== :: ListEnvironmentsResponse -> ListEnvironmentsResponse -> Bool
Prelude.Eq, Int -> ListEnvironmentsResponse -> ShowS
[ListEnvironmentsResponse] -> ShowS
ListEnvironmentsResponse -> String
(Int -> ListEnvironmentsResponse -> ShowS)
-> (ListEnvironmentsResponse -> String)
-> ([ListEnvironmentsResponse] -> ShowS)
-> Show ListEnvironmentsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEnvironmentsResponse] -> ShowS
$cshowList :: [ListEnvironmentsResponse] -> ShowS
show :: ListEnvironmentsResponse -> String
$cshow :: ListEnvironmentsResponse -> String
showsPrec :: Int -> ListEnvironmentsResponse -> ShowS
$cshowsPrec :: Int -> ListEnvironmentsResponse -> ShowS
Prelude.Show, (forall x.
 ListEnvironmentsResponse -> Rep ListEnvironmentsResponse x)
-> (forall x.
    Rep ListEnvironmentsResponse x -> ListEnvironmentsResponse)
-> Generic ListEnvironmentsResponse
forall x.
Rep ListEnvironmentsResponse x -> ListEnvironmentsResponse
forall x.
ListEnvironmentsResponse -> Rep ListEnvironmentsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListEnvironmentsResponse x -> ListEnvironmentsResponse
$cfrom :: forall x.
ListEnvironmentsResponse -> Rep ListEnvironmentsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListEnvironmentsResponse' 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', 'listEnvironmentsResponse_nextToken' - A token to indicate the location of the next environment in the array of
-- environments, after the current requested list of environments.
--
-- 'httpStatus', 'listEnvironmentsResponse_httpStatus' - The response's http status code.
--
-- 'environments', 'listEnvironmentsResponse_environments' - An array of environment detail data summaries.
newListEnvironmentsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListEnvironmentsResponse
newListEnvironmentsResponse :: Int -> ListEnvironmentsResponse
newListEnvironmentsResponse Int
pHttpStatus_ =
  ListEnvironmentsResponse' :: Maybe Text
-> Int -> [EnvironmentSummary] -> ListEnvironmentsResponse
ListEnvironmentsResponse'
    { $sel:nextToken:ListEnvironmentsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListEnvironmentsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:environments:ListEnvironmentsResponse' :: [EnvironmentSummary]
environments = [EnvironmentSummary]
forall a. Monoid a => a
Prelude.mempty
    }

-- | A token to indicate the location of the next environment in the array of
-- environments, after the current requested list of environments.
listEnvironmentsResponse_nextToken :: Lens.Lens' ListEnvironmentsResponse (Prelude.Maybe Prelude.Text)
listEnvironmentsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListEnvironmentsResponse -> f ListEnvironmentsResponse
listEnvironmentsResponse_nextToken = (ListEnvironmentsResponse -> Maybe Text)
-> (ListEnvironmentsResponse
    -> Maybe Text -> ListEnvironmentsResponse)
-> Lens' ListEnvironmentsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironmentsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEnvironmentsResponse' :: ListEnvironmentsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEnvironmentsResponse
s@ListEnvironmentsResponse' {} Maybe Text
a -> ListEnvironmentsResponse
s {$sel:nextToken:ListEnvironmentsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListEnvironmentsResponse)

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

-- | An array of environment detail data summaries.
listEnvironmentsResponse_environments :: Lens.Lens' ListEnvironmentsResponse [EnvironmentSummary]
listEnvironmentsResponse_environments :: ([EnvironmentSummary] -> f [EnvironmentSummary])
-> ListEnvironmentsResponse -> f ListEnvironmentsResponse
listEnvironmentsResponse_environments = (ListEnvironmentsResponse -> [EnvironmentSummary])
-> (ListEnvironmentsResponse
    -> [EnvironmentSummary] -> ListEnvironmentsResponse)
-> Lens' ListEnvironmentsResponse [EnvironmentSummary]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEnvironmentsResponse' {[EnvironmentSummary]
environments :: [EnvironmentSummary]
$sel:environments:ListEnvironmentsResponse' :: ListEnvironmentsResponse -> [EnvironmentSummary]
environments} -> [EnvironmentSummary]
environments) (\s :: ListEnvironmentsResponse
s@ListEnvironmentsResponse' {} [EnvironmentSummary]
a -> ListEnvironmentsResponse
s {$sel:environments:ListEnvironmentsResponse' :: [EnvironmentSummary]
environments = [EnvironmentSummary]
a} :: ListEnvironmentsResponse) (([EnvironmentSummary] -> f [EnvironmentSummary])
 -> ListEnvironmentsResponse -> f ListEnvironmentsResponse)
-> (([EnvironmentSummary] -> f [EnvironmentSummary])
    -> [EnvironmentSummary] -> f [EnvironmentSummary])
-> ([EnvironmentSummary] -> f [EnvironmentSummary])
-> ListEnvironmentsResponse
-> f ListEnvironmentsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([EnvironmentSummary] -> f [EnvironmentSummary])
-> [EnvironmentSummary] -> f [EnvironmentSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListEnvironmentsResponse