{-# 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.OpsWorks.DescribeEcsClusters
-- 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 Amazon ECS clusters that are registered with a stack. If you
-- specify only a stack ID, you can use the @MaxResults@ and @NextToken@
-- parameters to paginate the response. However, AWS OpsWorks Stacks
-- currently supports only one cluster per layer, so the result set has a
-- maximum of one element.
--
-- __Required Permissions__: To use this action, an IAM user must have a
-- Show, Deploy, or Manage permissions level for the stack or an attached
-- policy that explicitly grants permission. For more information about
-- user permissions, see
-- <https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html Managing User Permissions>.
--
-- This call accepts only one resource-identifying parameter.
--
-- This operation returns paginated results.
module Amazonka.OpsWorks.DescribeEcsClusters
  ( -- * Creating a Request
    DescribeEcsClusters (..),
    newDescribeEcsClusters,

    -- * Request Lenses
    describeEcsClusters_nextToken,
    describeEcsClusters_stackId,
    describeEcsClusters_maxResults,
    describeEcsClusters_ecsClusterArns,

    -- * Destructuring the Response
    DescribeEcsClustersResponse (..),
    newDescribeEcsClustersResponse,

    -- * Response Lenses
    describeEcsClustersResponse_nextToken,
    describeEcsClustersResponse_ecsClusters,
    describeEcsClustersResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDescribeEcsClusters' smart constructor.
data DescribeEcsClusters = DescribeEcsClusters'
  { -- | If the previous paginated request did not return all of the remaining
    -- results, the response object\'s@NextToken@ parameter value is set to a
    -- token. To retrieve the next set of results, call @DescribeEcsClusters@
    -- again and assign that token to the request object\'s @NextToken@
    -- parameter. If there are no remaining results, the previous response
    -- object\'s @NextToken@ parameter is set to @null@.
    DescribeEcsClusters -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A stack ID. @DescribeEcsClusters@ returns a description of the cluster
    -- that is registered with the stack.
    DescribeEcsClusters -> Maybe Text
stackId :: Prelude.Maybe Prelude.Text,
    -- | To receive a paginated response, use this parameter to specify the
    -- maximum number of results to be returned with a single call. If the
    -- number of available results exceeds this maximum, the response includes
    -- a @NextToken@ value that you can assign to the @NextToken@ request
    -- parameter to get the next set of results.
    DescribeEcsClusters -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | A list of ARNs, one for each cluster to be described.
    DescribeEcsClusters -> Maybe [Text]
ecsClusterArns :: Prelude.Maybe [Prelude.Text]
  }
  deriving (DescribeEcsClusters -> DescribeEcsClusters -> Bool
(DescribeEcsClusters -> DescribeEcsClusters -> Bool)
-> (DescribeEcsClusters -> DescribeEcsClusters -> Bool)
-> Eq DescribeEcsClusters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEcsClusters -> DescribeEcsClusters -> Bool
$c/= :: DescribeEcsClusters -> DescribeEcsClusters -> Bool
== :: DescribeEcsClusters -> DescribeEcsClusters -> Bool
$c== :: DescribeEcsClusters -> DescribeEcsClusters -> Bool
Prelude.Eq, ReadPrec [DescribeEcsClusters]
ReadPrec DescribeEcsClusters
Int -> ReadS DescribeEcsClusters
ReadS [DescribeEcsClusters]
(Int -> ReadS DescribeEcsClusters)
-> ReadS [DescribeEcsClusters]
-> ReadPrec DescribeEcsClusters
-> ReadPrec [DescribeEcsClusters]
-> Read DescribeEcsClusters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEcsClusters]
$creadListPrec :: ReadPrec [DescribeEcsClusters]
readPrec :: ReadPrec DescribeEcsClusters
$creadPrec :: ReadPrec DescribeEcsClusters
readList :: ReadS [DescribeEcsClusters]
$creadList :: ReadS [DescribeEcsClusters]
readsPrec :: Int -> ReadS DescribeEcsClusters
$creadsPrec :: Int -> ReadS DescribeEcsClusters
Prelude.Read, Int -> DescribeEcsClusters -> ShowS
[DescribeEcsClusters] -> ShowS
DescribeEcsClusters -> String
(Int -> DescribeEcsClusters -> ShowS)
-> (DescribeEcsClusters -> String)
-> ([DescribeEcsClusters] -> ShowS)
-> Show DescribeEcsClusters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEcsClusters] -> ShowS
$cshowList :: [DescribeEcsClusters] -> ShowS
show :: DescribeEcsClusters -> String
$cshow :: DescribeEcsClusters -> String
showsPrec :: Int -> DescribeEcsClusters -> ShowS
$cshowsPrec :: Int -> DescribeEcsClusters -> ShowS
Prelude.Show, (forall x. DescribeEcsClusters -> Rep DescribeEcsClusters x)
-> (forall x. Rep DescribeEcsClusters x -> DescribeEcsClusters)
-> Generic DescribeEcsClusters
forall x. Rep DescribeEcsClusters x -> DescribeEcsClusters
forall x. DescribeEcsClusters -> Rep DescribeEcsClusters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeEcsClusters x -> DescribeEcsClusters
$cfrom :: forall x. DescribeEcsClusters -> Rep DescribeEcsClusters x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEcsClusters' 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', 'describeEcsClusters_nextToken' - If the previous paginated request did not return all of the remaining
-- results, the response object\'s@NextToken@ parameter value is set to a
-- token. To retrieve the next set of results, call @DescribeEcsClusters@
-- again and assign that token to the request object\'s @NextToken@
-- parameter. If there are no remaining results, the previous response
-- object\'s @NextToken@ parameter is set to @null@.
--
-- 'stackId', 'describeEcsClusters_stackId' - A stack ID. @DescribeEcsClusters@ returns a description of the cluster
-- that is registered with the stack.
--
-- 'maxResults', 'describeEcsClusters_maxResults' - To receive a paginated response, use this parameter to specify the
-- maximum number of results to be returned with a single call. If the
-- number of available results exceeds this maximum, the response includes
-- a @NextToken@ value that you can assign to the @NextToken@ request
-- parameter to get the next set of results.
--
-- 'ecsClusterArns', 'describeEcsClusters_ecsClusterArns' - A list of ARNs, one for each cluster to be described.
newDescribeEcsClusters ::
  DescribeEcsClusters
newDescribeEcsClusters :: DescribeEcsClusters
newDescribeEcsClusters =
  DescribeEcsClusters' :: Maybe Text
-> Maybe Text -> Maybe Int -> Maybe [Text] -> DescribeEcsClusters
DescribeEcsClusters'
    { $sel:nextToken:DescribeEcsClusters' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:stackId:DescribeEcsClusters' :: Maybe Text
stackId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeEcsClusters' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:ecsClusterArns:DescribeEcsClusters' :: Maybe [Text]
ecsClusterArns = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | If the previous paginated request did not return all of the remaining
-- results, the response object\'s@NextToken@ parameter value is set to a
-- token. To retrieve the next set of results, call @DescribeEcsClusters@
-- again and assign that token to the request object\'s @NextToken@
-- parameter. If there are no remaining results, the previous response
-- object\'s @NextToken@ parameter is set to @null@.
describeEcsClusters_nextToken :: Lens.Lens' DescribeEcsClusters (Prelude.Maybe Prelude.Text)
describeEcsClusters_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeEcsClusters -> f DescribeEcsClusters
describeEcsClusters_nextToken = (DescribeEcsClusters -> Maybe Text)
-> (DescribeEcsClusters -> Maybe Text -> DescribeEcsClusters)
-> Lens
     DescribeEcsClusters DescribeEcsClusters (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEcsClusters' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeEcsClusters' :: DescribeEcsClusters -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeEcsClusters
s@DescribeEcsClusters' {} Maybe Text
a -> DescribeEcsClusters
s {$sel:nextToken:DescribeEcsClusters' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeEcsClusters)

-- | A stack ID. @DescribeEcsClusters@ returns a description of the cluster
-- that is registered with the stack.
describeEcsClusters_stackId :: Lens.Lens' DescribeEcsClusters (Prelude.Maybe Prelude.Text)
describeEcsClusters_stackId :: (Maybe Text -> f (Maybe Text))
-> DescribeEcsClusters -> f DescribeEcsClusters
describeEcsClusters_stackId = (DescribeEcsClusters -> Maybe Text)
-> (DescribeEcsClusters -> Maybe Text -> DescribeEcsClusters)
-> Lens
     DescribeEcsClusters DescribeEcsClusters (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEcsClusters' {Maybe Text
stackId :: Maybe Text
$sel:stackId:DescribeEcsClusters' :: DescribeEcsClusters -> Maybe Text
stackId} -> Maybe Text
stackId) (\s :: DescribeEcsClusters
s@DescribeEcsClusters' {} Maybe Text
a -> DescribeEcsClusters
s {$sel:stackId:DescribeEcsClusters' :: Maybe Text
stackId = Maybe Text
a} :: DescribeEcsClusters)

-- | To receive a paginated response, use this parameter to specify the
-- maximum number of results to be returned with a single call. If the
-- number of available results exceeds this maximum, the response includes
-- a @NextToken@ value that you can assign to the @NextToken@ request
-- parameter to get the next set of results.
describeEcsClusters_maxResults :: Lens.Lens' DescribeEcsClusters (Prelude.Maybe Prelude.Int)
describeEcsClusters_maxResults :: (Maybe Int -> f (Maybe Int))
-> DescribeEcsClusters -> f DescribeEcsClusters
describeEcsClusters_maxResults = (DescribeEcsClusters -> Maybe Int)
-> (DescribeEcsClusters -> Maybe Int -> DescribeEcsClusters)
-> Lens
     DescribeEcsClusters DescribeEcsClusters (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEcsClusters' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:DescribeEcsClusters' :: DescribeEcsClusters -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: DescribeEcsClusters
s@DescribeEcsClusters' {} Maybe Int
a -> DescribeEcsClusters
s {$sel:maxResults:DescribeEcsClusters' :: Maybe Int
maxResults = Maybe Int
a} :: DescribeEcsClusters)

-- | A list of ARNs, one for each cluster to be described.
describeEcsClusters_ecsClusterArns :: Lens.Lens' DescribeEcsClusters (Prelude.Maybe [Prelude.Text])
describeEcsClusters_ecsClusterArns :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeEcsClusters -> f DescribeEcsClusters
describeEcsClusters_ecsClusterArns = (DescribeEcsClusters -> Maybe [Text])
-> (DescribeEcsClusters -> Maybe [Text] -> DescribeEcsClusters)
-> Lens
     DescribeEcsClusters
     DescribeEcsClusters
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEcsClusters' {Maybe [Text]
ecsClusterArns :: Maybe [Text]
$sel:ecsClusterArns:DescribeEcsClusters' :: DescribeEcsClusters -> Maybe [Text]
ecsClusterArns} -> Maybe [Text]
ecsClusterArns) (\s :: DescribeEcsClusters
s@DescribeEcsClusters' {} Maybe [Text]
a -> DescribeEcsClusters
s {$sel:ecsClusterArns:DescribeEcsClusters' :: Maybe [Text]
ecsClusterArns = Maybe [Text]
a} :: DescribeEcsClusters) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeEcsClusters -> f DescribeEcsClusters)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeEcsClusters
-> f DescribeEcsClusters
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

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

instance Prelude.NFData DescribeEcsClusters

instance Core.ToHeaders DescribeEcsClusters where
  toHeaders :: DescribeEcsClusters -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeEcsClusters -> 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
"OpsWorks_20130218.DescribeEcsClusters" ::
                          Prelude.ByteString
                      ),
            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 DescribeEcsClusters where
  toJSON :: DescribeEcsClusters -> Value
toJSON DescribeEcsClusters' {Maybe Int
Maybe [Text]
Maybe Text
ecsClusterArns :: Maybe [Text]
maxResults :: Maybe Int
stackId :: Maybe Text
nextToken :: Maybe Text
$sel:ecsClusterArns:DescribeEcsClusters' :: DescribeEcsClusters -> Maybe [Text]
$sel:maxResults:DescribeEcsClusters' :: DescribeEcsClusters -> Maybe Int
$sel:stackId:DescribeEcsClusters' :: DescribeEcsClusters -> Maybe Text
$sel:nextToken:DescribeEcsClusters' :: DescribeEcsClusters -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"StackId" 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
stackId,
            (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,
            (Text
"EcsClusterArns" 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]
ecsClusterArns
          ]
      )

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

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

-- | Contains the response to a @DescribeEcsClusters@ request.
--
-- /See:/ 'newDescribeEcsClustersResponse' smart constructor.
data DescribeEcsClustersResponse = DescribeEcsClustersResponse'
  { -- | If a paginated request does not return all of the remaining results,
    -- this parameter is set to a token that you can assign to the request
    -- object\'s @NextToken@ parameter to retrieve the next set of results. If
    -- the previous paginated request returned all of the remaining results,
    -- this parameter is set to @null@.
    DescribeEcsClustersResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of @EcsCluster@ objects containing the cluster descriptions.
    DescribeEcsClustersResponse -> Maybe [EcsCluster]
ecsClusters :: Prelude.Maybe [EcsCluster],
    -- | The response's http status code.
    DescribeEcsClustersResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeEcsClustersResponse -> DescribeEcsClustersResponse -> Bool
(DescribeEcsClustersResponse
 -> DescribeEcsClustersResponse -> Bool)
-> (DescribeEcsClustersResponse
    -> DescribeEcsClustersResponse -> Bool)
-> Eq DescribeEcsClustersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEcsClustersResponse -> DescribeEcsClustersResponse -> Bool
$c/= :: DescribeEcsClustersResponse -> DescribeEcsClustersResponse -> Bool
== :: DescribeEcsClustersResponse -> DescribeEcsClustersResponse -> Bool
$c== :: DescribeEcsClustersResponse -> DescribeEcsClustersResponse -> Bool
Prelude.Eq, ReadPrec [DescribeEcsClustersResponse]
ReadPrec DescribeEcsClustersResponse
Int -> ReadS DescribeEcsClustersResponse
ReadS [DescribeEcsClustersResponse]
(Int -> ReadS DescribeEcsClustersResponse)
-> ReadS [DescribeEcsClustersResponse]
-> ReadPrec DescribeEcsClustersResponse
-> ReadPrec [DescribeEcsClustersResponse]
-> Read DescribeEcsClustersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEcsClustersResponse]
$creadListPrec :: ReadPrec [DescribeEcsClustersResponse]
readPrec :: ReadPrec DescribeEcsClustersResponse
$creadPrec :: ReadPrec DescribeEcsClustersResponse
readList :: ReadS [DescribeEcsClustersResponse]
$creadList :: ReadS [DescribeEcsClustersResponse]
readsPrec :: Int -> ReadS DescribeEcsClustersResponse
$creadsPrec :: Int -> ReadS DescribeEcsClustersResponse
Prelude.Read, Int -> DescribeEcsClustersResponse -> ShowS
[DescribeEcsClustersResponse] -> ShowS
DescribeEcsClustersResponse -> String
(Int -> DescribeEcsClustersResponse -> ShowS)
-> (DescribeEcsClustersResponse -> String)
-> ([DescribeEcsClustersResponse] -> ShowS)
-> Show DescribeEcsClustersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEcsClustersResponse] -> ShowS
$cshowList :: [DescribeEcsClustersResponse] -> ShowS
show :: DescribeEcsClustersResponse -> String
$cshow :: DescribeEcsClustersResponse -> String
showsPrec :: Int -> DescribeEcsClustersResponse -> ShowS
$cshowsPrec :: Int -> DescribeEcsClustersResponse -> ShowS
Prelude.Show, (forall x.
 DescribeEcsClustersResponse -> Rep DescribeEcsClustersResponse x)
-> (forall x.
    Rep DescribeEcsClustersResponse x -> DescribeEcsClustersResponse)
-> Generic DescribeEcsClustersResponse
forall x.
Rep DescribeEcsClustersResponse x -> DescribeEcsClustersResponse
forall x.
DescribeEcsClustersResponse -> Rep DescribeEcsClustersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEcsClustersResponse x -> DescribeEcsClustersResponse
$cfrom :: forall x.
DescribeEcsClustersResponse -> Rep DescribeEcsClustersResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEcsClustersResponse' 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', 'describeEcsClustersResponse_nextToken' - If a paginated request does not return all of the remaining results,
-- this parameter is set to a token that you can assign to the request
-- object\'s @NextToken@ parameter to retrieve the next set of results. If
-- the previous paginated request returned all of the remaining results,
-- this parameter is set to @null@.
--
-- 'ecsClusters', 'describeEcsClustersResponse_ecsClusters' - A list of @EcsCluster@ objects containing the cluster descriptions.
--
-- 'httpStatus', 'describeEcsClustersResponse_httpStatus' - The response's http status code.
newDescribeEcsClustersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeEcsClustersResponse
newDescribeEcsClustersResponse :: Int -> DescribeEcsClustersResponse
newDescribeEcsClustersResponse Int
pHttpStatus_ =
  DescribeEcsClustersResponse' :: Maybe Text
-> Maybe [EcsCluster] -> Int -> DescribeEcsClustersResponse
DescribeEcsClustersResponse'
    { $sel:nextToken:DescribeEcsClustersResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ecsClusters:DescribeEcsClustersResponse' :: Maybe [EcsCluster]
ecsClusters = Maybe [EcsCluster]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeEcsClustersResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If a paginated request does not return all of the remaining results,
-- this parameter is set to a token that you can assign to the request
-- object\'s @NextToken@ parameter to retrieve the next set of results. If
-- the previous paginated request returned all of the remaining results,
-- this parameter is set to @null@.
describeEcsClustersResponse_nextToken :: Lens.Lens' DescribeEcsClustersResponse (Prelude.Maybe Prelude.Text)
describeEcsClustersResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeEcsClustersResponse -> f DescribeEcsClustersResponse
describeEcsClustersResponse_nextToken = (DescribeEcsClustersResponse -> Maybe Text)
-> (DescribeEcsClustersResponse
    -> Maybe Text -> DescribeEcsClustersResponse)
-> Lens' DescribeEcsClustersResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEcsClustersResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeEcsClustersResponse' :: DescribeEcsClustersResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeEcsClustersResponse
s@DescribeEcsClustersResponse' {} Maybe Text
a -> DescribeEcsClustersResponse
s {$sel:nextToken:DescribeEcsClustersResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeEcsClustersResponse)

-- | A list of @EcsCluster@ objects containing the cluster descriptions.
describeEcsClustersResponse_ecsClusters :: Lens.Lens' DescribeEcsClustersResponse (Prelude.Maybe [EcsCluster])
describeEcsClustersResponse_ecsClusters :: (Maybe [EcsCluster] -> f (Maybe [EcsCluster]))
-> DescribeEcsClustersResponse -> f DescribeEcsClustersResponse
describeEcsClustersResponse_ecsClusters = (DescribeEcsClustersResponse -> Maybe [EcsCluster])
-> (DescribeEcsClustersResponse
    -> Maybe [EcsCluster] -> DescribeEcsClustersResponse)
-> Lens' DescribeEcsClustersResponse (Maybe [EcsCluster])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEcsClustersResponse' {Maybe [EcsCluster]
ecsClusters :: Maybe [EcsCluster]
$sel:ecsClusters:DescribeEcsClustersResponse' :: DescribeEcsClustersResponse -> Maybe [EcsCluster]
ecsClusters} -> Maybe [EcsCluster]
ecsClusters) (\s :: DescribeEcsClustersResponse
s@DescribeEcsClustersResponse' {} Maybe [EcsCluster]
a -> DescribeEcsClustersResponse
s {$sel:ecsClusters:DescribeEcsClustersResponse' :: Maybe [EcsCluster]
ecsClusters = Maybe [EcsCluster]
a} :: DescribeEcsClustersResponse) ((Maybe [EcsCluster] -> f (Maybe [EcsCluster]))
 -> DescribeEcsClustersResponse -> f DescribeEcsClustersResponse)
-> ((Maybe [EcsCluster] -> f (Maybe [EcsCluster]))
    -> Maybe [EcsCluster] -> f (Maybe [EcsCluster]))
-> (Maybe [EcsCluster] -> f (Maybe [EcsCluster]))
-> DescribeEcsClustersResponse
-> f DescribeEcsClustersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [EcsCluster] [EcsCluster] [EcsCluster] [EcsCluster]
-> Iso
     (Maybe [EcsCluster])
     (Maybe [EcsCluster])
     (Maybe [EcsCluster])
     (Maybe [EcsCluster])
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 [EcsCluster] [EcsCluster] [EcsCluster] [EcsCluster]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData DescribeEcsClustersResponse