{-# 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.ElasticBeanstalk.DescribeEnvironments
-- 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)
--
-- Returns descriptions for existing environments.
--
-- This operation returns paginated results.
module Amazonka.ElasticBeanstalk.DescribeEnvironments
  ( -- * Creating a Request
    DescribeEnvironments (..),
    newDescribeEnvironments,

    -- * Request Lenses
    describeEnvironments_environmentIds,
    describeEnvironments_environmentNames,
    describeEnvironments_nextToken,
    describeEnvironments_versionLabel,
    describeEnvironments_maxRecords,
    describeEnvironments_applicationName,
    describeEnvironments_includedDeletedBackTo,
    describeEnvironments_includeDeleted,

    -- * Destructuring the Response
    EnvironmentDescriptionsMessage (..),
    newEnvironmentDescriptionsMessage,

    -- * Response Lenses
    environmentDescriptionsMessage_nextToken,
    environmentDescriptionsMessage_environments,
  )
where

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

-- | Request to describe one or more environments.
--
-- /See:/ 'newDescribeEnvironments' smart constructor.
data DescribeEnvironments = DescribeEnvironments'
  { -- | If specified, AWS Elastic Beanstalk restricts the returned descriptions
    -- to include only those that have the specified IDs.
    DescribeEnvironments -> Maybe [Text]
environmentIds :: Prelude.Maybe [Prelude.Text],
    -- | If specified, AWS Elastic Beanstalk restricts the returned descriptions
    -- to include only those that have the specified names.
    DescribeEnvironments -> Maybe [Text]
environmentNames :: Prelude.Maybe [Prelude.Text],
    -- | For a paginated request. Specify a token from a previous response page
    -- to retrieve the next response page. All other parameter values must be
    -- identical to the ones specified in the initial request.
    --
    -- If no @NextToken@ is specified, the first page is retrieved.
    DescribeEnvironments -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | If specified, AWS Elastic Beanstalk restricts the returned descriptions
    -- to include only those that are associated with this application version.
    DescribeEnvironments -> Maybe Text
versionLabel :: Prelude.Maybe Prelude.Text,
    -- | For a paginated request. Specify a maximum number of environments to
    -- include in each response.
    --
    -- If no @MaxRecords@ is specified, all available environments are
    -- retrieved in a single response.
    DescribeEnvironments -> Maybe Natural
maxRecords :: Prelude.Maybe Prelude.Natural,
    -- | If specified, AWS Elastic Beanstalk restricts the returned descriptions
    -- to include only those that are associated with this application.
    DescribeEnvironments -> Maybe Text
applicationName :: Prelude.Maybe Prelude.Text,
    -- | If specified when @IncludeDeleted@ is set to @true@, then environments
    -- deleted after this date are displayed.
    DescribeEnvironments -> Maybe ISO8601
includedDeletedBackTo :: Prelude.Maybe Core.ISO8601,
    -- | Indicates whether to include deleted environments:
    --
    -- @true@: Environments that have been deleted after
    -- @IncludedDeletedBackTo@ are displayed.
    --
    -- @false@: Do not include deleted environments.
    DescribeEnvironments -> Maybe Bool
includeDeleted :: Prelude.Maybe Prelude.Bool
  }
  deriving (DescribeEnvironments -> DescribeEnvironments -> Bool
(DescribeEnvironments -> DescribeEnvironments -> Bool)
-> (DescribeEnvironments -> DescribeEnvironments -> Bool)
-> Eq DescribeEnvironments
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEnvironments -> DescribeEnvironments -> Bool
$c/= :: DescribeEnvironments -> DescribeEnvironments -> Bool
== :: DescribeEnvironments -> DescribeEnvironments -> Bool
$c== :: DescribeEnvironments -> DescribeEnvironments -> Bool
Prelude.Eq, ReadPrec [DescribeEnvironments]
ReadPrec DescribeEnvironments
Int -> ReadS DescribeEnvironments
ReadS [DescribeEnvironments]
(Int -> ReadS DescribeEnvironments)
-> ReadS [DescribeEnvironments]
-> ReadPrec DescribeEnvironments
-> ReadPrec [DescribeEnvironments]
-> Read DescribeEnvironments
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEnvironments]
$creadListPrec :: ReadPrec [DescribeEnvironments]
readPrec :: ReadPrec DescribeEnvironments
$creadPrec :: ReadPrec DescribeEnvironments
readList :: ReadS [DescribeEnvironments]
$creadList :: ReadS [DescribeEnvironments]
readsPrec :: Int -> ReadS DescribeEnvironments
$creadsPrec :: Int -> ReadS DescribeEnvironments
Prelude.Read, Int -> DescribeEnvironments -> ShowS
[DescribeEnvironments] -> ShowS
DescribeEnvironments -> String
(Int -> DescribeEnvironments -> ShowS)
-> (DescribeEnvironments -> String)
-> ([DescribeEnvironments] -> ShowS)
-> Show DescribeEnvironments
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEnvironments] -> ShowS
$cshowList :: [DescribeEnvironments] -> ShowS
show :: DescribeEnvironments -> String
$cshow :: DescribeEnvironments -> String
showsPrec :: Int -> DescribeEnvironments -> ShowS
$cshowsPrec :: Int -> DescribeEnvironments -> ShowS
Prelude.Show, (forall x. DescribeEnvironments -> Rep DescribeEnvironments x)
-> (forall x. Rep DescribeEnvironments x -> DescribeEnvironments)
-> Generic DescribeEnvironments
forall x. Rep DescribeEnvironments x -> DescribeEnvironments
forall x. DescribeEnvironments -> Rep DescribeEnvironments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeEnvironments x -> DescribeEnvironments
$cfrom :: forall x. DescribeEnvironments -> Rep DescribeEnvironments x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEnvironments' 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:
--
-- 'environmentIds', 'describeEnvironments_environmentIds' - If specified, AWS Elastic Beanstalk restricts the returned descriptions
-- to include only those that have the specified IDs.
--
-- 'environmentNames', 'describeEnvironments_environmentNames' - If specified, AWS Elastic Beanstalk restricts the returned descriptions
-- to include only those that have the specified names.
--
-- 'nextToken', 'describeEnvironments_nextToken' - For a paginated request. Specify a token from a previous response page
-- to retrieve the next response page. All other parameter values must be
-- identical to the ones specified in the initial request.
--
-- If no @NextToken@ is specified, the first page is retrieved.
--
-- 'versionLabel', 'describeEnvironments_versionLabel' - If specified, AWS Elastic Beanstalk restricts the returned descriptions
-- to include only those that are associated with this application version.
--
-- 'maxRecords', 'describeEnvironments_maxRecords' - For a paginated request. Specify a maximum number of environments to
-- include in each response.
--
-- If no @MaxRecords@ is specified, all available environments are
-- retrieved in a single response.
--
-- 'applicationName', 'describeEnvironments_applicationName' - If specified, AWS Elastic Beanstalk restricts the returned descriptions
-- to include only those that are associated with this application.
--
-- 'includedDeletedBackTo', 'describeEnvironments_includedDeletedBackTo' - If specified when @IncludeDeleted@ is set to @true@, then environments
-- deleted after this date are displayed.
--
-- 'includeDeleted', 'describeEnvironments_includeDeleted' - Indicates whether to include deleted environments:
--
-- @true@: Environments that have been deleted after
-- @IncludedDeletedBackTo@ are displayed.
--
-- @false@: Do not include deleted environments.
newDescribeEnvironments ::
  DescribeEnvironments
newDescribeEnvironments :: DescribeEnvironments
newDescribeEnvironments =
  DescribeEnvironments' :: Maybe [Text]
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe ISO8601
-> Maybe Bool
-> DescribeEnvironments
DescribeEnvironments'
    { $sel:environmentIds:DescribeEnvironments' :: Maybe [Text]
environmentIds =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:environmentNames:DescribeEnvironments' :: Maybe [Text]
environmentNames = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeEnvironments' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:versionLabel:DescribeEnvironments' :: Maybe Text
versionLabel = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeEnvironments' :: Maybe Natural
maxRecords = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:applicationName:DescribeEnvironments' :: Maybe Text
applicationName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:includedDeletedBackTo:DescribeEnvironments' :: Maybe ISO8601
includedDeletedBackTo = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:includeDeleted:DescribeEnvironments' :: Maybe Bool
includeDeleted = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | If specified, AWS Elastic Beanstalk restricts the returned descriptions
-- to include only those that have the specified IDs.
describeEnvironments_environmentIds :: Lens.Lens' DescribeEnvironments (Prelude.Maybe [Prelude.Text])
describeEnvironments_environmentIds :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeEnvironments -> f DescribeEnvironments
describeEnvironments_environmentIds = (DescribeEnvironments -> Maybe [Text])
-> (DescribeEnvironments -> Maybe [Text] -> DescribeEnvironments)
-> Lens
     DescribeEnvironments
     DescribeEnvironments
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironments' {Maybe [Text]
environmentIds :: Maybe [Text]
$sel:environmentIds:DescribeEnvironments' :: DescribeEnvironments -> Maybe [Text]
environmentIds} -> Maybe [Text]
environmentIds) (\s :: DescribeEnvironments
s@DescribeEnvironments' {} Maybe [Text]
a -> DescribeEnvironments
s {$sel:environmentIds:DescribeEnvironments' :: Maybe [Text]
environmentIds = Maybe [Text]
a} :: DescribeEnvironments) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeEnvironments -> f DescribeEnvironments)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeEnvironments
-> f DescribeEnvironments
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If specified, AWS Elastic Beanstalk restricts the returned descriptions
-- to include only those that have the specified names.
describeEnvironments_environmentNames :: Lens.Lens' DescribeEnvironments (Prelude.Maybe [Prelude.Text])
describeEnvironments_environmentNames :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeEnvironments -> f DescribeEnvironments
describeEnvironments_environmentNames = (DescribeEnvironments -> Maybe [Text])
-> (DescribeEnvironments -> Maybe [Text] -> DescribeEnvironments)
-> Lens
     DescribeEnvironments
     DescribeEnvironments
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironments' {Maybe [Text]
environmentNames :: Maybe [Text]
$sel:environmentNames:DescribeEnvironments' :: DescribeEnvironments -> Maybe [Text]
environmentNames} -> Maybe [Text]
environmentNames) (\s :: DescribeEnvironments
s@DescribeEnvironments' {} Maybe [Text]
a -> DescribeEnvironments
s {$sel:environmentNames:DescribeEnvironments' :: Maybe [Text]
environmentNames = Maybe [Text]
a} :: DescribeEnvironments) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeEnvironments -> f DescribeEnvironments)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeEnvironments
-> f DescribeEnvironments
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | For a paginated request. Specify a token from a previous response page
-- to retrieve the next response page. All other parameter values must be
-- identical to the ones specified in the initial request.
--
-- If no @NextToken@ is specified, the first page is retrieved.
describeEnvironments_nextToken :: Lens.Lens' DescribeEnvironments (Prelude.Maybe Prelude.Text)
describeEnvironments_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeEnvironments -> f DescribeEnvironments
describeEnvironments_nextToken = (DescribeEnvironments -> Maybe Text)
-> (DescribeEnvironments -> Maybe Text -> DescribeEnvironments)
-> Lens
     DescribeEnvironments DescribeEnvironments (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironments' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeEnvironments' :: DescribeEnvironments -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeEnvironments
s@DescribeEnvironments' {} Maybe Text
a -> DescribeEnvironments
s {$sel:nextToken:DescribeEnvironments' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeEnvironments)

-- | If specified, AWS Elastic Beanstalk restricts the returned descriptions
-- to include only those that are associated with this application version.
describeEnvironments_versionLabel :: Lens.Lens' DescribeEnvironments (Prelude.Maybe Prelude.Text)
describeEnvironments_versionLabel :: (Maybe Text -> f (Maybe Text))
-> DescribeEnvironments -> f DescribeEnvironments
describeEnvironments_versionLabel = (DescribeEnvironments -> Maybe Text)
-> (DescribeEnvironments -> Maybe Text -> DescribeEnvironments)
-> Lens
     DescribeEnvironments DescribeEnvironments (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironments' {Maybe Text
versionLabel :: Maybe Text
$sel:versionLabel:DescribeEnvironments' :: DescribeEnvironments -> Maybe Text
versionLabel} -> Maybe Text
versionLabel) (\s :: DescribeEnvironments
s@DescribeEnvironments' {} Maybe Text
a -> DescribeEnvironments
s {$sel:versionLabel:DescribeEnvironments' :: Maybe Text
versionLabel = Maybe Text
a} :: DescribeEnvironments)

-- | For a paginated request. Specify a maximum number of environments to
-- include in each response.
--
-- If no @MaxRecords@ is specified, all available environments are
-- retrieved in a single response.
describeEnvironments_maxRecords :: Lens.Lens' DescribeEnvironments (Prelude.Maybe Prelude.Natural)
describeEnvironments_maxRecords :: (Maybe Natural -> f (Maybe Natural))
-> DescribeEnvironments -> f DescribeEnvironments
describeEnvironments_maxRecords = (DescribeEnvironments -> Maybe Natural)
-> (DescribeEnvironments -> Maybe Natural -> DescribeEnvironments)
-> Lens
     DescribeEnvironments
     DescribeEnvironments
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironments' {Maybe Natural
maxRecords :: Maybe Natural
$sel:maxRecords:DescribeEnvironments' :: DescribeEnvironments -> Maybe Natural
maxRecords} -> Maybe Natural
maxRecords) (\s :: DescribeEnvironments
s@DescribeEnvironments' {} Maybe Natural
a -> DescribeEnvironments
s {$sel:maxRecords:DescribeEnvironments' :: Maybe Natural
maxRecords = Maybe Natural
a} :: DescribeEnvironments)

-- | If specified, AWS Elastic Beanstalk restricts the returned descriptions
-- to include only those that are associated with this application.
describeEnvironments_applicationName :: Lens.Lens' DescribeEnvironments (Prelude.Maybe Prelude.Text)
describeEnvironments_applicationName :: (Maybe Text -> f (Maybe Text))
-> DescribeEnvironments -> f DescribeEnvironments
describeEnvironments_applicationName = (DescribeEnvironments -> Maybe Text)
-> (DescribeEnvironments -> Maybe Text -> DescribeEnvironments)
-> Lens
     DescribeEnvironments DescribeEnvironments (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironments' {Maybe Text
applicationName :: Maybe Text
$sel:applicationName:DescribeEnvironments' :: DescribeEnvironments -> Maybe Text
applicationName} -> Maybe Text
applicationName) (\s :: DescribeEnvironments
s@DescribeEnvironments' {} Maybe Text
a -> DescribeEnvironments
s {$sel:applicationName:DescribeEnvironments' :: Maybe Text
applicationName = Maybe Text
a} :: DescribeEnvironments)

-- | If specified when @IncludeDeleted@ is set to @true@, then environments
-- deleted after this date are displayed.
describeEnvironments_includedDeletedBackTo :: Lens.Lens' DescribeEnvironments (Prelude.Maybe Prelude.UTCTime)
describeEnvironments_includedDeletedBackTo :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeEnvironments -> f DescribeEnvironments
describeEnvironments_includedDeletedBackTo = (DescribeEnvironments -> Maybe ISO8601)
-> (DescribeEnvironments -> Maybe ISO8601 -> DescribeEnvironments)
-> Lens
     DescribeEnvironments
     DescribeEnvironments
     (Maybe ISO8601)
     (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironments' {Maybe ISO8601
includedDeletedBackTo :: Maybe ISO8601
$sel:includedDeletedBackTo:DescribeEnvironments' :: DescribeEnvironments -> Maybe ISO8601
includedDeletedBackTo} -> Maybe ISO8601
includedDeletedBackTo) (\s :: DescribeEnvironments
s@DescribeEnvironments' {} Maybe ISO8601
a -> DescribeEnvironments
s {$sel:includedDeletedBackTo:DescribeEnvironments' :: Maybe ISO8601
includedDeletedBackTo = Maybe ISO8601
a} :: DescribeEnvironments) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> DescribeEnvironments -> f DescribeEnvironments)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeEnvironments
-> f DescribeEnvironments
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Indicates whether to include deleted environments:
--
-- @true@: Environments that have been deleted after
-- @IncludedDeletedBackTo@ are displayed.
--
-- @false@: Do not include deleted environments.
describeEnvironments_includeDeleted :: Lens.Lens' DescribeEnvironments (Prelude.Maybe Prelude.Bool)
describeEnvironments_includeDeleted :: (Maybe Bool -> f (Maybe Bool))
-> DescribeEnvironments -> f DescribeEnvironments
describeEnvironments_includeDeleted = (DescribeEnvironments -> Maybe Bool)
-> (DescribeEnvironments -> Maybe Bool -> DescribeEnvironments)
-> Lens
     DescribeEnvironments DescribeEnvironments (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironments' {Maybe Bool
includeDeleted :: Maybe Bool
$sel:includeDeleted:DescribeEnvironments' :: DescribeEnvironments -> Maybe Bool
includeDeleted} -> Maybe Bool
includeDeleted) (\s :: DescribeEnvironments
s@DescribeEnvironments' {} Maybe Bool
a -> DescribeEnvironments
s {$sel:includeDeleted:DescribeEnvironments' :: Maybe Bool
includeDeleted = Maybe Bool
a} :: DescribeEnvironments)

instance Core.AWSPager DescribeEnvironments where
  page :: DescribeEnvironments
-> AWSResponse DescribeEnvironments -> Maybe DescribeEnvironments
page DescribeEnvironments
rq AWSResponse DescribeEnvironments
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeEnvironments
EnvironmentDescriptionsMessage
rs
            EnvironmentDescriptionsMessage
-> Getting (First Text) EnvironmentDescriptionsMessage Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> EnvironmentDescriptionsMessage
-> Const (First Text) EnvironmentDescriptionsMessage
Lens' EnvironmentDescriptionsMessage (Maybe Text)
environmentDescriptionsMessage_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> EnvironmentDescriptionsMessage
 -> Const (First Text) EnvironmentDescriptionsMessage)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) EnvironmentDescriptionsMessage 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 DescribeEnvironments
forall a. Maybe a
Prelude.Nothing
    | Maybe [EnvironmentDescription] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeEnvironments
EnvironmentDescriptionsMessage
rs
            EnvironmentDescriptionsMessage
-> Getting
     (First [EnvironmentDescription])
     EnvironmentDescriptionsMessage
     [EnvironmentDescription]
-> Maybe [EnvironmentDescription]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [EnvironmentDescription]
 -> Const
      (First [EnvironmentDescription]) (Maybe [EnvironmentDescription]))
-> EnvironmentDescriptionsMessage
-> Const
     (First [EnvironmentDescription]) EnvironmentDescriptionsMessage
Lens'
  EnvironmentDescriptionsMessage (Maybe [EnvironmentDescription])
environmentDescriptionsMessage_environments
              ((Maybe [EnvironmentDescription]
  -> Const
       (First [EnvironmentDescription]) (Maybe [EnvironmentDescription]))
 -> EnvironmentDescriptionsMessage
 -> Const
      (First [EnvironmentDescription]) EnvironmentDescriptionsMessage)
-> (([EnvironmentDescription]
     -> Const (First [EnvironmentDescription]) [EnvironmentDescription])
    -> Maybe [EnvironmentDescription]
    -> Const
         (First [EnvironmentDescription]) (Maybe [EnvironmentDescription]))
-> Getting
     (First [EnvironmentDescription])
     EnvironmentDescriptionsMessage
     [EnvironmentDescription]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([EnvironmentDescription]
 -> Const (First [EnvironmentDescription]) [EnvironmentDescription])
-> Maybe [EnvironmentDescription]
-> Const
     (First [EnvironmentDescription]) (Maybe [EnvironmentDescription])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeEnvironments
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeEnvironments -> Maybe DescribeEnvironments
forall a. a -> Maybe a
Prelude.Just (DescribeEnvironments -> Maybe DescribeEnvironments)
-> DescribeEnvironments -> Maybe DescribeEnvironments
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeEnvironments
rq
          DescribeEnvironments
-> (DescribeEnvironments -> DescribeEnvironments)
-> DescribeEnvironments
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeEnvironments -> Identity DescribeEnvironments
Lens
  DescribeEnvironments DescribeEnvironments (Maybe Text) (Maybe Text)
describeEnvironments_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeEnvironments -> Identity DescribeEnvironments)
-> Maybe Text -> DescribeEnvironments -> DescribeEnvironments
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeEnvironments
EnvironmentDescriptionsMessage
rs
          EnvironmentDescriptionsMessage
-> Getting (First Text) EnvironmentDescriptionsMessage Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> EnvironmentDescriptionsMessage
-> Const (First Text) EnvironmentDescriptionsMessage
Lens' EnvironmentDescriptionsMessage (Maybe Text)
environmentDescriptionsMessage_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> EnvironmentDescriptionsMessage
 -> Const (First Text) EnvironmentDescriptionsMessage)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) EnvironmentDescriptionsMessage 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 DescribeEnvironments where
  type
    AWSResponse DescribeEnvironments =
      EnvironmentDescriptionsMessage
  request :: DescribeEnvironments -> Request DescribeEnvironments
request = Service -> DescribeEnvironments -> Request DescribeEnvironments
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeEnvironments
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeEnvironments)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeEnvironments))
-> Logger
-> Service
-> Proxy DescribeEnvironments
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeEnvironments)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DescribeEnvironmentsResult"
      (\Int
s ResponseHeaders
h [Node]
x -> [Node] -> Either String EnvironmentDescriptionsMessage
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)

instance Prelude.Hashable DescribeEnvironments

instance Prelude.NFData DescribeEnvironments

instance Core.ToHeaders DescribeEnvironments where
  toHeaders :: DescribeEnvironments -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeEnvironments -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery DescribeEnvironments where
  toQuery :: DescribeEnvironments -> QueryString
toQuery DescribeEnvironments' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe Text
Maybe ISO8601
includeDeleted :: Maybe Bool
includedDeletedBackTo :: Maybe ISO8601
applicationName :: Maybe Text
maxRecords :: Maybe Natural
versionLabel :: Maybe Text
nextToken :: Maybe Text
environmentNames :: Maybe [Text]
environmentIds :: Maybe [Text]
$sel:includeDeleted:DescribeEnvironments' :: DescribeEnvironments -> Maybe Bool
$sel:includedDeletedBackTo:DescribeEnvironments' :: DescribeEnvironments -> Maybe ISO8601
$sel:applicationName:DescribeEnvironments' :: DescribeEnvironments -> Maybe Text
$sel:maxRecords:DescribeEnvironments' :: DescribeEnvironments -> Maybe Natural
$sel:versionLabel:DescribeEnvironments' :: DescribeEnvironments -> Maybe Text
$sel:nextToken:DescribeEnvironments' :: DescribeEnvironments -> Maybe Text
$sel:environmentNames:DescribeEnvironments' :: DescribeEnvironments -> Maybe [Text]
$sel:environmentIds:DescribeEnvironments' :: DescribeEnvironments -> Maybe [Text]
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeEnvironments" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"EnvironmentIds"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member"
                ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
environmentIds
            ),
        ByteString
"EnvironmentNames"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member"
                ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
environmentNames
            ),
        ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"VersionLabel" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
versionLabel,
        ByteString
"MaxRecords" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxRecords,
        ByteString
"ApplicationName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
applicationName,
        ByteString
"IncludedDeletedBackTo"
          ByteString -> Maybe ISO8601 -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe ISO8601
includedDeletedBackTo,
        ByteString
"IncludeDeleted" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
includeDeleted
      ]