{-# 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.Batch.DescribeComputeEnvironments
-- 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)
--
-- Describes one or more of your compute environments.
--
-- If you\'re using an unmanaged compute environment, you can use the
-- @DescribeComputeEnvironment@ operation to determine the @ecsClusterArn@
-- that you should launch your Amazon ECS container instances into.
--
-- This operation returns paginated results.
module Amazonka.Batch.DescribeComputeEnvironments
  ( -- * Creating a Request
    DescribeComputeEnvironments (..),
    newDescribeComputeEnvironments,

    -- * Request Lenses
    describeComputeEnvironments_computeEnvironments,
    describeComputeEnvironments_nextToken,
    describeComputeEnvironments_maxResults,

    -- * Destructuring the Response
    DescribeComputeEnvironmentsResponse (..),
    newDescribeComputeEnvironmentsResponse,

    -- * Response Lenses
    describeComputeEnvironmentsResponse_computeEnvironments,
    describeComputeEnvironmentsResponse_nextToken,
    describeComputeEnvironmentsResponse_httpStatus,
  )
where

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

-- | Contains the parameters for @DescribeComputeEnvironments@.
--
-- /See:/ 'newDescribeComputeEnvironments' smart constructor.
data DescribeComputeEnvironments = DescribeComputeEnvironments'
  { -- | A list of up to 100 compute environment names or full Amazon Resource
    -- Name (ARN) entries.
    DescribeComputeEnvironments -> Maybe [Text]
computeEnvironments :: Prelude.Maybe [Prelude.Text],
    -- | The @nextToken@ value returned from a previous paginated
    -- @DescribeComputeEnvironments@ request where @maxResults@ was used and
    -- the results exceeded the value of that parameter. Pagination continues
    -- from the end of the previous results that returned the @nextToken@
    -- value. This value is @null@ when there are no more results to return.
    --
    -- This token should be treated as an opaque identifier that\'s only used
    -- to retrieve the next items in a list and not for other programmatic
    -- purposes.
    DescribeComputeEnvironments -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of cluster results returned by
    -- @DescribeComputeEnvironments@ in paginated output. When this parameter
    -- is used, @DescribeComputeEnvironments@ only returns @maxResults@ results
    -- in a single page along with a @nextToken@ response element. The
    -- remaining results of the initial request can be seen by sending another
    -- @DescribeComputeEnvironments@ request with the returned @nextToken@
    -- value. This value can be between 1 and 100. If this parameter isn\'t
    -- used, then @DescribeComputeEnvironments@ returns up to 100 results and a
    -- @nextToken@ value if applicable.
    DescribeComputeEnvironments -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeComputeEnvironments -> DescribeComputeEnvironments -> Bool
(DescribeComputeEnvironments
 -> DescribeComputeEnvironments -> Bool)
-> (DescribeComputeEnvironments
    -> DescribeComputeEnvironments -> Bool)
-> Eq DescribeComputeEnvironments
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeComputeEnvironments -> DescribeComputeEnvironments -> Bool
$c/= :: DescribeComputeEnvironments -> DescribeComputeEnvironments -> Bool
== :: DescribeComputeEnvironments -> DescribeComputeEnvironments -> Bool
$c== :: DescribeComputeEnvironments -> DescribeComputeEnvironments -> Bool
Prelude.Eq, ReadPrec [DescribeComputeEnvironments]
ReadPrec DescribeComputeEnvironments
Int -> ReadS DescribeComputeEnvironments
ReadS [DescribeComputeEnvironments]
(Int -> ReadS DescribeComputeEnvironments)
-> ReadS [DescribeComputeEnvironments]
-> ReadPrec DescribeComputeEnvironments
-> ReadPrec [DescribeComputeEnvironments]
-> Read DescribeComputeEnvironments
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeComputeEnvironments]
$creadListPrec :: ReadPrec [DescribeComputeEnvironments]
readPrec :: ReadPrec DescribeComputeEnvironments
$creadPrec :: ReadPrec DescribeComputeEnvironments
readList :: ReadS [DescribeComputeEnvironments]
$creadList :: ReadS [DescribeComputeEnvironments]
readsPrec :: Int -> ReadS DescribeComputeEnvironments
$creadsPrec :: Int -> ReadS DescribeComputeEnvironments
Prelude.Read, Int -> DescribeComputeEnvironments -> ShowS
[DescribeComputeEnvironments] -> ShowS
DescribeComputeEnvironments -> String
(Int -> DescribeComputeEnvironments -> ShowS)
-> (DescribeComputeEnvironments -> String)
-> ([DescribeComputeEnvironments] -> ShowS)
-> Show DescribeComputeEnvironments
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeComputeEnvironments] -> ShowS
$cshowList :: [DescribeComputeEnvironments] -> ShowS
show :: DescribeComputeEnvironments -> String
$cshow :: DescribeComputeEnvironments -> String
showsPrec :: Int -> DescribeComputeEnvironments -> ShowS
$cshowsPrec :: Int -> DescribeComputeEnvironments -> ShowS
Prelude.Show, (forall x.
 DescribeComputeEnvironments -> Rep DescribeComputeEnvironments x)
-> (forall x.
    Rep DescribeComputeEnvironments x -> DescribeComputeEnvironments)
-> Generic DescribeComputeEnvironments
forall x.
Rep DescribeComputeEnvironments x -> DescribeComputeEnvironments
forall x.
DescribeComputeEnvironments -> Rep DescribeComputeEnvironments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeComputeEnvironments x -> DescribeComputeEnvironments
$cfrom :: forall x.
DescribeComputeEnvironments -> Rep DescribeComputeEnvironments x
Prelude.Generic)

-- |
-- Create a value of 'DescribeComputeEnvironments' 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:
--
-- 'computeEnvironments', 'describeComputeEnvironments_computeEnvironments' - A list of up to 100 compute environment names or full Amazon Resource
-- Name (ARN) entries.
--
-- 'nextToken', 'describeComputeEnvironments_nextToken' - The @nextToken@ value returned from a previous paginated
-- @DescribeComputeEnvironments@ request where @maxResults@ was used and
-- the results exceeded the value of that parameter. Pagination continues
-- from the end of the previous results that returned the @nextToken@
-- value. This value is @null@ when there are no more results to return.
--
-- This token should be treated as an opaque identifier that\'s only used
-- to retrieve the next items in a list and not for other programmatic
-- purposes.
--
-- 'maxResults', 'describeComputeEnvironments_maxResults' - The maximum number of cluster results returned by
-- @DescribeComputeEnvironments@ in paginated output. When this parameter
-- is used, @DescribeComputeEnvironments@ only returns @maxResults@ results
-- in a single page along with a @nextToken@ response element. The
-- remaining results of the initial request can be seen by sending another
-- @DescribeComputeEnvironments@ request with the returned @nextToken@
-- value. This value can be between 1 and 100. If this parameter isn\'t
-- used, then @DescribeComputeEnvironments@ returns up to 100 results and a
-- @nextToken@ value if applicable.
newDescribeComputeEnvironments ::
  DescribeComputeEnvironments
newDescribeComputeEnvironments :: DescribeComputeEnvironments
newDescribeComputeEnvironments =
  DescribeComputeEnvironments' :: Maybe [Text]
-> Maybe Text -> Maybe Int -> DescribeComputeEnvironments
DescribeComputeEnvironments'
    { $sel:computeEnvironments:DescribeComputeEnvironments' :: Maybe [Text]
computeEnvironments =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeComputeEnvironments' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeComputeEnvironments' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | A list of up to 100 compute environment names or full Amazon Resource
-- Name (ARN) entries.
describeComputeEnvironments_computeEnvironments :: Lens.Lens' DescribeComputeEnvironments (Prelude.Maybe [Prelude.Text])
describeComputeEnvironments_computeEnvironments :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeComputeEnvironments -> f DescribeComputeEnvironments
describeComputeEnvironments_computeEnvironments = (DescribeComputeEnvironments -> Maybe [Text])
-> (DescribeComputeEnvironments
    -> Maybe [Text] -> DescribeComputeEnvironments)
-> Lens
     DescribeComputeEnvironments
     DescribeComputeEnvironments
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeComputeEnvironments' {Maybe [Text]
computeEnvironments :: Maybe [Text]
$sel:computeEnvironments:DescribeComputeEnvironments' :: DescribeComputeEnvironments -> Maybe [Text]
computeEnvironments} -> Maybe [Text]
computeEnvironments) (\s :: DescribeComputeEnvironments
s@DescribeComputeEnvironments' {} Maybe [Text]
a -> DescribeComputeEnvironments
s {$sel:computeEnvironments:DescribeComputeEnvironments' :: Maybe [Text]
computeEnvironments = Maybe [Text]
a} :: DescribeComputeEnvironments) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeComputeEnvironments -> f DescribeComputeEnvironments)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeComputeEnvironments
-> f DescribeComputeEnvironments
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

-- | The @nextToken@ value returned from a previous paginated
-- @DescribeComputeEnvironments@ request where @maxResults@ was used and
-- the results exceeded the value of that parameter. Pagination continues
-- from the end of the previous results that returned the @nextToken@
-- value. This value is @null@ when there are no more results to return.
--
-- This token should be treated as an opaque identifier that\'s only used
-- to retrieve the next items in a list and not for other programmatic
-- purposes.
describeComputeEnvironments_nextToken :: Lens.Lens' DescribeComputeEnvironments (Prelude.Maybe Prelude.Text)
describeComputeEnvironments_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeComputeEnvironments -> f DescribeComputeEnvironments
describeComputeEnvironments_nextToken = (DescribeComputeEnvironments -> Maybe Text)
-> (DescribeComputeEnvironments
    -> Maybe Text -> DescribeComputeEnvironments)
-> Lens
     DescribeComputeEnvironments
     DescribeComputeEnvironments
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeComputeEnvironments' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeComputeEnvironments' :: DescribeComputeEnvironments -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeComputeEnvironments
s@DescribeComputeEnvironments' {} Maybe Text
a -> DescribeComputeEnvironments
s {$sel:nextToken:DescribeComputeEnvironments' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeComputeEnvironments)

-- | The maximum number of cluster results returned by
-- @DescribeComputeEnvironments@ in paginated output. When this parameter
-- is used, @DescribeComputeEnvironments@ only returns @maxResults@ results
-- in a single page along with a @nextToken@ response element. The
-- remaining results of the initial request can be seen by sending another
-- @DescribeComputeEnvironments@ request with the returned @nextToken@
-- value. This value can be between 1 and 100. If this parameter isn\'t
-- used, then @DescribeComputeEnvironments@ returns up to 100 results and a
-- @nextToken@ value if applicable.
describeComputeEnvironments_maxResults :: Lens.Lens' DescribeComputeEnvironments (Prelude.Maybe Prelude.Int)
describeComputeEnvironments_maxResults :: (Maybe Int -> f (Maybe Int))
-> DescribeComputeEnvironments -> f DescribeComputeEnvironments
describeComputeEnvironments_maxResults = (DescribeComputeEnvironments -> Maybe Int)
-> (DescribeComputeEnvironments
    -> Maybe Int -> DescribeComputeEnvironments)
-> Lens
     DescribeComputeEnvironments
     DescribeComputeEnvironments
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeComputeEnvironments' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:DescribeComputeEnvironments' :: DescribeComputeEnvironments -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: DescribeComputeEnvironments
s@DescribeComputeEnvironments' {} Maybe Int
a -> DescribeComputeEnvironments
s {$sel:maxResults:DescribeComputeEnvironments' :: Maybe Int
maxResults = Maybe Int
a} :: DescribeComputeEnvironments)

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

instance Prelude.Hashable DescribeComputeEnvironments

instance Prelude.NFData DescribeComputeEnvironments

instance Core.ToHeaders DescribeComputeEnvironments where
  toHeaders :: DescribeComputeEnvironments -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeComputeEnvironments -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

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

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

-- | /See:/ 'newDescribeComputeEnvironmentsResponse' smart constructor.
data DescribeComputeEnvironmentsResponse = DescribeComputeEnvironmentsResponse'
  { -- | The list of compute environments.
    DescribeComputeEnvironmentsResponse
-> Maybe [ComputeEnvironmentDetail]
computeEnvironments :: Prelude.Maybe [ComputeEnvironmentDetail],
    -- | The @nextToken@ value to include in a future
    -- @DescribeComputeEnvironments@ request. When the results of a
    -- @DescribeJobDefinitions@ request exceed @maxResults@, this value can be
    -- used to retrieve the next page of results. This value is @null@ when
    -- there are no more results to return.
    DescribeComputeEnvironmentsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeComputeEnvironmentsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeComputeEnvironmentsResponse
-> DescribeComputeEnvironmentsResponse -> Bool
(DescribeComputeEnvironmentsResponse
 -> DescribeComputeEnvironmentsResponse -> Bool)
-> (DescribeComputeEnvironmentsResponse
    -> DescribeComputeEnvironmentsResponse -> Bool)
-> Eq DescribeComputeEnvironmentsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeComputeEnvironmentsResponse
-> DescribeComputeEnvironmentsResponse -> Bool
$c/= :: DescribeComputeEnvironmentsResponse
-> DescribeComputeEnvironmentsResponse -> Bool
== :: DescribeComputeEnvironmentsResponse
-> DescribeComputeEnvironmentsResponse -> Bool
$c== :: DescribeComputeEnvironmentsResponse
-> DescribeComputeEnvironmentsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeComputeEnvironmentsResponse]
ReadPrec DescribeComputeEnvironmentsResponse
Int -> ReadS DescribeComputeEnvironmentsResponse
ReadS [DescribeComputeEnvironmentsResponse]
(Int -> ReadS DescribeComputeEnvironmentsResponse)
-> ReadS [DescribeComputeEnvironmentsResponse]
-> ReadPrec DescribeComputeEnvironmentsResponse
-> ReadPrec [DescribeComputeEnvironmentsResponse]
-> Read DescribeComputeEnvironmentsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeComputeEnvironmentsResponse]
$creadListPrec :: ReadPrec [DescribeComputeEnvironmentsResponse]
readPrec :: ReadPrec DescribeComputeEnvironmentsResponse
$creadPrec :: ReadPrec DescribeComputeEnvironmentsResponse
readList :: ReadS [DescribeComputeEnvironmentsResponse]
$creadList :: ReadS [DescribeComputeEnvironmentsResponse]
readsPrec :: Int -> ReadS DescribeComputeEnvironmentsResponse
$creadsPrec :: Int -> ReadS DescribeComputeEnvironmentsResponse
Prelude.Read, Int -> DescribeComputeEnvironmentsResponse -> ShowS
[DescribeComputeEnvironmentsResponse] -> ShowS
DescribeComputeEnvironmentsResponse -> String
(Int -> DescribeComputeEnvironmentsResponse -> ShowS)
-> (DescribeComputeEnvironmentsResponse -> String)
-> ([DescribeComputeEnvironmentsResponse] -> ShowS)
-> Show DescribeComputeEnvironmentsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeComputeEnvironmentsResponse] -> ShowS
$cshowList :: [DescribeComputeEnvironmentsResponse] -> ShowS
show :: DescribeComputeEnvironmentsResponse -> String
$cshow :: DescribeComputeEnvironmentsResponse -> String
showsPrec :: Int -> DescribeComputeEnvironmentsResponse -> ShowS
$cshowsPrec :: Int -> DescribeComputeEnvironmentsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeComputeEnvironmentsResponse
 -> Rep DescribeComputeEnvironmentsResponse x)
-> (forall x.
    Rep DescribeComputeEnvironmentsResponse x
    -> DescribeComputeEnvironmentsResponse)
-> Generic DescribeComputeEnvironmentsResponse
forall x.
Rep DescribeComputeEnvironmentsResponse x
-> DescribeComputeEnvironmentsResponse
forall x.
DescribeComputeEnvironmentsResponse
-> Rep DescribeComputeEnvironmentsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeComputeEnvironmentsResponse x
-> DescribeComputeEnvironmentsResponse
$cfrom :: forall x.
DescribeComputeEnvironmentsResponse
-> Rep DescribeComputeEnvironmentsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeComputeEnvironmentsResponse' 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:
--
-- 'computeEnvironments', 'describeComputeEnvironmentsResponse_computeEnvironments' - The list of compute environments.
--
-- 'nextToken', 'describeComputeEnvironmentsResponse_nextToken' - The @nextToken@ value to include in a future
-- @DescribeComputeEnvironments@ request. When the results of a
-- @DescribeJobDefinitions@ request exceed @maxResults@, this value can be
-- used to retrieve the next page of results. This value is @null@ when
-- there are no more results to return.
--
-- 'httpStatus', 'describeComputeEnvironmentsResponse_httpStatus' - The response's http status code.
newDescribeComputeEnvironmentsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeComputeEnvironmentsResponse
newDescribeComputeEnvironmentsResponse :: Int -> DescribeComputeEnvironmentsResponse
newDescribeComputeEnvironmentsResponse Int
pHttpStatus_ =
  DescribeComputeEnvironmentsResponse' :: Maybe [ComputeEnvironmentDetail]
-> Maybe Text -> Int -> DescribeComputeEnvironmentsResponse
DescribeComputeEnvironmentsResponse'
    { $sel:computeEnvironments:DescribeComputeEnvironmentsResponse' :: Maybe [ComputeEnvironmentDetail]
computeEnvironments =
        Maybe [ComputeEnvironmentDetail]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeComputeEnvironmentsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeComputeEnvironmentsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of compute environments.
describeComputeEnvironmentsResponse_computeEnvironments :: Lens.Lens' DescribeComputeEnvironmentsResponse (Prelude.Maybe [ComputeEnvironmentDetail])
describeComputeEnvironmentsResponse_computeEnvironments :: (Maybe [ComputeEnvironmentDetail]
 -> f (Maybe [ComputeEnvironmentDetail]))
-> DescribeComputeEnvironmentsResponse
-> f DescribeComputeEnvironmentsResponse
describeComputeEnvironmentsResponse_computeEnvironments = (DescribeComputeEnvironmentsResponse
 -> Maybe [ComputeEnvironmentDetail])
-> (DescribeComputeEnvironmentsResponse
    -> Maybe [ComputeEnvironmentDetail]
    -> DescribeComputeEnvironmentsResponse)
-> Lens'
     DescribeComputeEnvironmentsResponse
     (Maybe [ComputeEnvironmentDetail])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeComputeEnvironmentsResponse' {Maybe [ComputeEnvironmentDetail]
computeEnvironments :: Maybe [ComputeEnvironmentDetail]
$sel:computeEnvironments:DescribeComputeEnvironmentsResponse' :: DescribeComputeEnvironmentsResponse
-> Maybe [ComputeEnvironmentDetail]
computeEnvironments} -> Maybe [ComputeEnvironmentDetail]
computeEnvironments) (\s :: DescribeComputeEnvironmentsResponse
s@DescribeComputeEnvironmentsResponse' {} Maybe [ComputeEnvironmentDetail]
a -> DescribeComputeEnvironmentsResponse
s {$sel:computeEnvironments:DescribeComputeEnvironmentsResponse' :: Maybe [ComputeEnvironmentDetail]
computeEnvironments = Maybe [ComputeEnvironmentDetail]
a} :: DescribeComputeEnvironmentsResponse) ((Maybe [ComputeEnvironmentDetail]
  -> f (Maybe [ComputeEnvironmentDetail]))
 -> DescribeComputeEnvironmentsResponse
 -> f DescribeComputeEnvironmentsResponse)
-> ((Maybe [ComputeEnvironmentDetail]
     -> f (Maybe [ComputeEnvironmentDetail]))
    -> Maybe [ComputeEnvironmentDetail]
    -> f (Maybe [ComputeEnvironmentDetail]))
-> (Maybe [ComputeEnvironmentDetail]
    -> f (Maybe [ComputeEnvironmentDetail]))
-> DescribeComputeEnvironmentsResponse
-> f DescribeComputeEnvironmentsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ComputeEnvironmentDetail]
  [ComputeEnvironmentDetail]
  [ComputeEnvironmentDetail]
  [ComputeEnvironmentDetail]
-> Iso
     (Maybe [ComputeEnvironmentDetail])
     (Maybe [ComputeEnvironmentDetail])
     (Maybe [ComputeEnvironmentDetail])
     (Maybe [ComputeEnvironmentDetail])
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
  [ComputeEnvironmentDetail]
  [ComputeEnvironmentDetail]
  [ComputeEnvironmentDetail]
  [ComputeEnvironmentDetail]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The @nextToken@ value to include in a future
-- @DescribeComputeEnvironments@ request. When the results of a
-- @DescribeJobDefinitions@ request exceed @maxResults@, this value can be
-- used to retrieve the next page of results. This value is @null@ when
-- there are no more results to return.
describeComputeEnvironmentsResponse_nextToken :: Lens.Lens' DescribeComputeEnvironmentsResponse (Prelude.Maybe Prelude.Text)
describeComputeEnvironmentsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeComputeEnvironmentsResponse
-> f DescribeComputeEnvironmentsResponse
describeComputeEnvironmentsResponse_nextToken = (DescribeComputeEnvironmentsResponse -> Maybe Text)
-> (DescribeComputeEnvironmentsResponse
    -> Maybe Text -> DescribeComputeEnvironmentsResponse)
-> Lens' DescribeComputeEnvironmentsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeComputeEnvironmentsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeComputeEnvironmentsResponse' :: DescribeComputeEnvironmentsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeComputeEnvironmentsResponse
s@DescribeComputeEnvironmentsResponse' {} Maybe Text
a -> DescribeComputeEnvironmentsResponse
s {$sel:nextToken:DescribeComputeEnvironmentsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeComputeEnvironmentsResponse)

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

instance
  Prelude.NFData
    DescribeComputeEnvironmentsResponse