{-# 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.ECS.DescribeCapacityProviders
-- 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 capacity providers.
module Amazonka.ECS.DescribeCapacityProviders
  ( -- * Creating a Request
    DescribeCapacityProviders (..),
    newDescribeCapacityProviders,

    -- * Request Lenses
    describeCapacityProviders_include,
    describeCapacityProviders_nextToken,
    describeCapacityProviders_capacityProviders,
    describeCapacityProviders_maxResults,

    -- * Destructuring the Response
    DescribeCapacityProvidersResponse (..),
    newDescribeCapacityProvidersResponse,

    -- * Response Lenses
    describeCapacityProvidersResponse_failures,
    describeCapacityProvidersResponse_nextToken,
    describeCapacityProvidersResponse_capacityProviders,
    describeCapacityProvidersResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ECS.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

-- | /See:/ 'newDescribeCapacityProviders' smart constructor.
data DescribeCapacityProviders = DescribeCapacityProviders'
  { -- | Specifies whether or not you want to see the resource tags for the
    -- capacity provider. If @TAGS@ is specified, the tags are included in the
    -- response. If this field is omitted, tags are not included in the
    -- response.
    DescribeCapacityProviders -> Maybe [CapacityProviderField]
include :: Prelude.Maybe [CapacityProviderField],
    -- | The @nextToken@ value returned from a previous paginated
    -- @DescribeCapacityProviders@ 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 token should be treated as an opaque identifier that is only used
    -- to retrieve the next items in a list and not for other programmatic
    -- purposes.
    DescribeCapacityProviders -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The short name or full Amazon Resource Name (ARN) of one or more
    -- capacity providers. Up to @100@ capacity providers can be described in
    -- an action.
    DescribeCapacityProviders -> Maybe [Text]
capacityProviders :: Prelude.Maybe [Prelude.Text],
    -- | The maximum number of account setting results returned by
    -- @DescribeCapacityProviders@ in paginated output. When this parameter is
    -- used, @DescribeCapacityProviders@ 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
    -- @DescribeCapacityProviders@ request with the returned @nextToken@ value.
    -- This value can be between 1 and 10. If this parameter is not used, then
    -- @DescribeCapacityProviders@ returns up to 10 results and a @nextToken@
    -- value if applicable.
    DescribeCapacityProviders -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeCapacityProviders -> DescribeCapacityProviders -> Bool
(DescribeCapacityProviders -> DescribeCapacityProviders -> Bool)
-> (DescribeCapacityProviders -> DescribeCapacityProviders -> Bool)
-> Eq DescribeCapacityProviders
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCapacityProviders -> DescribeCapacityProviders -> Bool
$c/= :: DescribeCapacityProviders -> DescribeCapacityProviders -> Bool
== :: DescribeCapacityProviders -> DescribeCapacityProviders -> Bool
$c== :: DescribeCapacityProviders -> DescribeCapacityProviders -> Bool
Prelude.Eq, ReadPrec [DescribeCapacityProviders]
ReadPrec DescribeCapacityProviders
Int -> ReadS DescribeCapacityProviders
ReadS [DescribeCapacityProviders]
(Int -> ReadS DescribeCapacityProviders)
-> ReadS [DescribeCapacityProviders]
-> ReadPrec DescribeCapacityProviders
-> ReadPrec [DescribeCapacityProviders]
-> Read DescribeCapacityProviders
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCapacityProviders]
$creadListPrec :: ReadPrec [DescribeCapacityProviders]
readPrec :: ReadPrec DescribeCapacityProviders
$creadPrec :: ReadPrec DescribeCapacityProviders
readList :: ReadS [DescribeCapacityProviders]
$creadList :: ReadS [DescribeCapacityProviders]
readsPrec :: Int -> ReadS DescribeCapacityProviders
$creadsPrec :: Int -> ReadS DescribeCapacityProviders
Prelude.Read, Int -> DescribeCapacityProviders -> ShowS
[DescribeCapacityProviders] -> ShowS
DescribeCapacityProviders -> String
(Int -> DescribeCapacityProviders -> ShowS)
-> (DescribeCapacityProviders -> String)
-> ([DescribeCapacityProviders] -> ShowS)
-> Show DescribeCapacityProviders
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCapacityProviders] -> ShowS
$cshowList :: [DescribeCapacityProviders] -> ShowS
show :: DescribeCapacityProviders -> String
$cshow :: DescribeCapacityProviders -> String
showsPrec :: Int -> DescribeCapacityProviders -> ShowS
$cshowsPrec :: Int -> DescribeCapacityProviders -> ShowS
Prelude.Show, (forall x.
 DescribeCapacityProviders -> Rep DescribeCapacityProviders x)
-> (forall x.
    Rep DescribeCapacityProviders x -> DescribeCapacityProviders)
-> Generic DescribeCapacityProviders
forall x.
Rep DescribeCapacityProviders x -> DescribeCapacityProviders
forall x.
DescribeCapacityProviders -> Rep DescribeCapacityProviders x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCapacityProviders x -> DescribeCapacityProviders
$cfrom :: forall x.
DescribeCapacityProviders -> Rep DescribeCapacityProviders x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCapacityProviders' 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:
--
-- 'include', 'describeCapacityProviders_include' - Specifies whether or not you want to see the resource tags for the
-- capacity provider. If @TAGS@ is specified, the tags are included in the
-- response. If this field is omitted, tags are not included in the
-- response.
--
-- 'nextToken', 'describeCapacityProviders_nextToken' - The @nextToken@ value returned from a previous paginated
-- @DescribeCapacityProviders@ 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 token should be treated as an opaque identifier that is only used
-- to retrieve the next items in a list and not for other programmatic
-- purposes.
--
-- 'capacityProviders', 'describeCapacityProviders_capacityProviders' - The short name or full Amazon Resource Name (ARN) of one or more
-- capacity providers. Up to @100@ capacity providers can be described in
-- an action.
--
-- 'maxResults', 'describeCapacityProviders_maxResults' - The maximum number of account setting results returned by
-- @DescribeCapacityProviders@ in paginated output. When this parameter is
-- used, @DescribeCapacityProviders@ 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
-- @DescribeCapacityProviders@ request with the returned @nextToken@ value.
-- This value can be between 1 and 10. If this parameter is not used, then
-- @DescribeCapacityProviders@ returns up to 10 results and a @nextToken@
-- value if applicable.
newDescribeCapacityProviders ::
  DescribeCapacityProviders
newDescribeCapacityProviders :: DescribeCapacityProviders
newDescribeCapacityProviders =
  DescribeCapacityProviders' :: Maybe [CapacityProviderField]
-> Maybe Text
-> Maybe [Text]
-> Maybe Int
-> DescribeCapacityProviders
DescribeCapacityProviders'
    { $sel:include:DescribeCapacityProviders' :: Maybe [CapacityProviderField]
include =
        Maybe [CapacityProviderField]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeCapacityProviders' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:capacityProviders:DescribeCapacityProviders' :: Maybe [Text]
capacityProviders = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeCapacityProviders' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies whether or not you want to see the resource tags for the
-- capacity provider. If @TAGS@ is specified, the tags are included in the
-- response. If this field is omitted, tags are not included in the
-- response.
describeCapacityProviders_include :: Lens.Lens' DescribeCapacityProviders (Prelude.Maybe [CapacityProviderField])
describeCapacityProviders_include :: (Maybe [CapacityProviderField]
 -> f (Maybe [CapacityProviderField]))
-> DescribeCapacityProviders -> f DescribeCapacityProviders
describeCapacityProviders_include = (DescribeCapacityProviders -> Maybe [CapacityProviderField])
-> (DescribeCapacityProviders
    -> Maybe [CapacityProviderField] -> DescribeCapacityProviders)
-> Lens
     DescribeCapacityProviders
     DescribeCapacityProviders
     (Maybe [CapacityProviderField])
     (Maybe [CapacityProviderField])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCapacityProviders' {Maybe [CapacityProviderField]
include :: Maybe [CapacityProviderField]
$sel:include:DescribeCapacityProviders' :: DescribeCapacityProviders -> Maybe [CapacityProviderField]
include} -> Maybe [CapacityProviderField]
include) (\s :: DescribeCapacityProviders
s@DescribeCapacityProviders' {} Maybe [CapacityProviderField]
a -> DescribeCapacityProviders
s {$sel:include:DescribeCapacityProviders' :: Maybe [CapacityProviderField]
include = Maybe [CapacityProviderField]
a} :: DescribeCapacityProviders) ((Maybe [CapacityProviderField]
  -> f (Maybe [CapacityProviderField]))
 -> DescribeCapacityProviders -> f DescribeCapacityProviders)
-> ((Maybe [CapacityProviderField]
     -> f (Maybe [CapacityProviderField]))
    -> Maybe [CapacityProviderField]
    -> f (Maybe [CapacityProviderField]))
-> (Maybe [CapacityProviderField]
    -> f (Maybe [CapacityProviderField]))
-> DescribeCapacityProviders
-> f DescribeCapacityProviders
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CapacityProviderField]
  [CapacityProviderField]
  [CapacityProviderField]
  [CapacityProviderField]
-> Iso
     (Maybe [CapacityProviderField])
     (Maybe [CapacityProviderField])
     (Maybe [CapacityProviderField])
     (Maybe [CapacityProviderField])
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
  [CapacityProviderField]
  [CapacityProviderField]
  [CapacityProviderField]
  [CapacityProviderField]
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
-- @DescribeCapacityProviders@ 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 token should be treated as an opaque identifier that is only used
-- to retrieve the next items in a list and not for other programmatic
-- purposes.
describeCapacityProviders_nextToken :: Lens.Lens' DescribeCapacityProviders (Prelude.Maybe Prelude.Text)
describeCapacityProviders_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeCapacityProviders -> f DescribeCapacityProviders
describeCapacityProviders_nextToken = (DescribeCapacityProviders -> Maybe Text)
-> (DescribeCapacityProviders
    -> Maybe Text -> DescribeCapacityProviders)
-> Lens
     DescribeCapacityProviders
     DescribeCapacityProviders
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCapacityProviders' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeCapacityProviders' :: DescribeCapacityProviders -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeCapacityProviders
s@DescribeCapacityProviders' {} Maybe Text
a -> DescribeCapacityProviders
s {$sel:nextToken:DescribeCapacityProviders' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeCapacityProviders)

-- | The short name or full Amazon Resource Name (ARN) of one or more
-- capacity providers. Up to @100@ capacity providers can be described in
-- an action.
describeCapacityProviders_capacityProviders :: Lens.Lens' DescribeCapacityProviders (Prelude.Maybe [Prelude.Text])
describeCapacityProviders_capacityProviders :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeCapacityProviders -> f DescribeCapacityProviders
describeCapacityProviders_capacityProviders = (DescribeCapacityProviders -> Maybe [Text])
-> (DescribeCapacityProviders
    -> Maybe [Text] -> DescribeCapacityProviders)
-> Lens
     DescribeCapacityProviders
     DescribeCapacityProviders
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCapacityProviders' {Maybe [Text]
capacityProviders :: Maybe [Text]
$sel:capacityProviders:DescribeCapacityProviders' :: DescribeCapacityProviders -> Maybe [Text]
capacityProviders} -> Maybe [Text]
capacityProviders) (\s :: DescribeCapacityProviders
s@DescribeCapacityProviders' {} Maybe [Text]
a -> DescribeCapacityProviders
s {$sel:capacityProviders:DescribeCapacityProviders' :: Maybe [Text]
capacityProviders = Maybe [Text]
a} :: DescribeCapacityProviders) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeCapacityProviders -> f DescribeCapacityProviders)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeCapacityProviders
-> f DescribeCapacityProviders
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 maximum number of account setting results returned by
-- @DescribeCapacityProviders@ in paginated output. When this parameter is
-- used, @DescribeCapacityProviders@ 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
-- @DescribeCapacityProviders@ request with the returned @nextToken@ value.
-- This value can be between 1 and 10. If this parameter is not used, then
-- @DescribeCapacityProviders@ returns up to 10 results and a @nextToken@
-- value if applicable.
describeCapacityProviders_maxResults :: Lens.Lens' DescribeCapacityProviders (Prelude.Maybe Prelude.Int)
describeCapacityProviders_maxResults :: (Maybe Int -> f (Maybe Int))
-> DescribeCapacityProviders -> f DescribeCapacityProviders
describeCapacityProviders_maxResults = (DescribeCapacityProviders -> Maybe Int)
-> (DescribeCapacityProviders
    -> Maybe Int -> DescribeCapacityProviders)
-> Lens
     DescribeCapacityProviders
     DescribeCapacityProviders
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCapacityProviders' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:DescribeCapacityProviders' :: DescribeCapacityProviders -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: DescribeCapacityProviders
s@DescribeCapacityProviders' {} Maybe Int
a -> DescribeCapacityProviders
s {$sel:maxResults:DescribeCapacityProviders' :: Maybe Int
maxResults = Maybe Int
a} :: DescribeCapacityProviders)

instance Core.AWSRequest DescribeCapacityProviders where
  type
    AWSResponse DescribeCapacityProviders =
      DescribeCapacityProvidersResponse
  request :: DescribeCapacityProviders -> Request DescribeCapacityProviders
request = Service
-> DescribeCapacityProviders -> Request DescribeCapacityProviders
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeCapacityProviders
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeCapacityProviders)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeCapacityProviders))
-> Logger
-> Service
-> Proxy DescribeCapacityProviders
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeCapacityProviders)))
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 [Failure]
-> Maybe Text
-> Maybe [CapacityProvider]
-> Int
-> DescribeCapacityProvidersResponse
DescribeCapacityProvidersResponse'
            (Maybe [Failure]
 -> Maybe Text
 -> Maybe [CapacityProvider]
 -> Int
 -> DescribeCapacityProvidersResponse)
-> Either String (Maybe [Failure])
-> Either
     String
     (Maybe Text
      -> Maybe [CapacityProvider]
      -> Int
      -> DescribeCapacityProvidersResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Failure]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"failures" Either String (Maybe (Maybe [Failure]))
-> Maybe [Failure] -> Either String (Maybe [Failure])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Failure]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe Text
   -> Maybe [CapacityProvider]
   -> Int
   -> DescribeCapacityProvidersResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [CapacityProvider]
      -> Int -> DescribeCapacityProvidersResponse)
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
  (Maybe [CapacityProvider]
   -> Int -> DescribeCapacityProvidersResponse)
-> Either String (Maybe [CapacityProvider])
-> Either String (Int -> DescribeCapacityProvidersResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [CapacityProvider]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"capacityProviders"
                            Either String (Maybe (Maybe [CapacityProvider]))
-> Maybe [CapacityProvider]
-> Either String (Maybe [CapacityProvider])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [CapacityProvider]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> DescribeCapacityProvidersResponse)
-> Either String Int
-> Either String DescribeCapacityProvidersResponse
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 DescribeCapacityProviders

instance Prelude.NFData DescribeCapacityProviders

instance Core.ToHeaders DescribeCapacityProviders where
  toHeaders :: DescribeCapacityProviders -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeCapacityProviders -> 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
"AmazonEC2ContainerServiceV20141113.DescribeCapacityProviders" ::
                          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 DescribeCapacityProviders where
  toJSON :: DescribeCapacityProviders -> Value
toJSON DescribeCapacityProviders' {Maybe Int
Maybe [Text]
Maybe [CapacityProviderField]
Maybe Text
maxResults :: Maybe Int
capacityProviders :: Maybe [Text]
nextToken :: Maybe Text
include :: Maybe [CapacityProviderField]
$sel:maxResults:DescribeCapacityProviders' :: DescribeCapacityProviders -> Maybe Int
$sel:capacityProviders:DescribeCapacityProviders' :: DescribeCapacityProviders -> Maybe [Text]
$sel:nextToken:DescribeCapacityProviders' :: DescribeCapacityProviders -> Maybe Text
$sel:include:DescribeCapacityProviders' :: DescribeCapacityProviders -> Maybe [CapacityProviderField]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"include" Text -> [CapacityProviderField] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([CapacityProviderField] -> Pair)
-> Maybe [CapacityProviderField] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CapacityProviderField]
include,
            (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
"capacityProviders" 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]
capacityProviders,
            (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 DescribeCapacityProviders where
  toPath :: DescribeCapacityProviders -> ByteString
toPath = ByteString -> DescribeCapacityProviders -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newDescribeCapacityProvidersResponse' smart constructor.
data DescribeCapacityProvidersResponse = DescribeCapacityProvidersResponse'
  { -- | Any failures associated with the call.
    DescribeCapacityProvidersResponse -> Maybe [Failure]
failures :: Prelude.Maybe [Failure],
    -- | The @nextToken@ value to include in a future @DescribeCapacityProviders@
    -- request. When the results of a @DescribeCapacityProviders@ 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.
    DescribeCapacityProvidersResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list of capacity providers.
    DescribeCapacityProvidersResponse -> Maybe [CapacityProvider]
capacityProviders :: Prelude.Maybe [CapacityProvider],
    -- | The response's http status code.
    DescribeCapacityProvidersResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeCapacityProvidersResponse
-> DescribeCapacityProvidersResponse -> Bool
(DescribeCapacityProvidersResponse
 -> DescribeCapacityProvidersResponse -> Bool)
-> (DescribeCapacityProvidersResponse
    -> DescribeCapacityProvidersResponse -> Bool)
-> Eq DescribeCapacityProvidersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCapacityProvidersResponse
-> DescribeCapacityProvidersResponse -> Bool
$c/= :: DescribeCapacityProvidersResponse
-> DescribeCapacityProvidersResponse -> Bool
== :: DescribeCapacityProvidersResponse
-> DescribeCapacityProvidersResponse -> Bool
$c== :: DescribeCapacityProvidersResponse
-> DescribeCapacityProvidersResponse -> Bool
Prelude.Eq, ReadPrec [DescribeCapacityProvidersResponse]
ReadPrec DescribeCapacityProvidersResponse
Int -> ReadS DescribeCapacityProvidersResponse
ReadS [DescribeCapacityProvidersResponse]
(Int -> ReadS DescribeCapacityProvidersResponse)
-> ReadS [DescribeCapacityProvidersResponse]
-> ReadPrec DescribeCapacityProvidersResponse
-> ReadPrec [DescribeCapacityProvidersResponse]
-> Read DescribeCapacityProvidersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCapacityProvidersResponse]
$creadListPrec :: ReadPrec [DescribeCapacityProvidersResponse]
readPrec :: ReadPrec DescribeCapacityProvidersResponse
$creadPrec :: ReadPrec DescribeCapacityProvidersResponse
readList :: ReadS [DescribeCapacityProvidersResponse]
$creadList :: ReadS [DescribeCapacityProvidersResponse]
readsPrec :: Int -> ReadS DescribeCapacityProvidersResponse
$creadsPrec :: Int -> ReadS DescribeCapacityProvidersResponse
Prelude.Read, Int -> DescribeCapacityProvidersResponse -> ShowS
[DescribeCapacityProvidersResponse] -> ShowS
DescribeCapacityProvidersResponse -> String
(Int -> DescribeCapacityProvidersResponse -> ShowS)
-> (DescribeCapacityProvidersResponse -> String)
-> ([DescribeCapacityProvidersResponse] -> ShowS)
-> Show DescribeCapacityProvidersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCapacityProvidersResponse] -> ShowS
$cshowList :: [DescribeCapacityProvidersResponse] -> ShowS
show :: DescribeCapacityProvidersResponse -> String
$cshow :: DescribeCapacityProvidersResponse -> String
showsPrec :: Int -> DescribeCapacityProvidersResponse -> ShowS
$cshowsPrec :: Int -> DescribeCapacityProvidersResponse -> ShowS
Prelude.Show, (forall x.
 DescribeCapacityProvidersResponse
 -> Rep DescribeCapacityProvidersResponse x)
-> (forall x.
    Rep DescribeCapacityProvidersResponse x
    -> DescribeCapacityProvidersResponse)
-> Generic DescribeCapacityProvidersResponse
forall x.
Rep DescribeCapacityProvidersResponse x
-> DescribeCapacityProvidersResponse
forall x.
DescribeCapacityProvidersResponse
-> Rep DescribeCapacityProvidersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCapacityProvidersResponse x
-> DescribeCapacityProvidersResponse
$cfrom :: forall x.
DescribeCapacityProvidersResponse
-> Rep DescribeCapacityProvidersResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCapacityProvidersResponse' 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:
--
-- 'failures', 'describeCapacityProvidersResponse_failures' - Any failures associated with the call.
--
-- 'nextToken', 'describeCapacityProvidersResponse_nextToken' - The @nextToken@ value to include in a future @DescribeCapacityProviders@
-- request. When the results of a @DescribeCapacityProviders@ 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.
--
-- 'capacityProviders', 'describeCapacityProvidersResponse_capacityProviders' - The list of capacity providers.
--
-- 'httpStatus', 'describeCapacityProvidersResponse_httpStatus' - The response's http status code.
newDescribeCapacityProvidersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeCapacityProvidersResponse
newDescribeCapacityProvidersResponse :: Int -> DescribeCapacityProvidersResponse
newDescribeCapacityProvidersResponse Int
pHttpStatus_ =
  DescribeCapacityProvidersResponse' :: Maybe [Failure]
-> Maybe Text
-> Maybe [CapacityProvider]
-> Int
-> DescribeCapacityProvidersResponse
DescribeCapacityProvidersResponse'
    { $sel:failures:DescribeCapacityProvidersResponse' :: Maybe [Failure]
failures =
        Maybe [Failure]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeCapacityProvidersResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:capacityProviders:DescribeCapacityProvidersResponse' :: Maybe [CapacityProvider]
capacityProviders = Maybe [CapacityProvider]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeCapacityProvidersResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Any failures associated with the call.
describeCapacityProvidersResponse_failures :: Lens.Lens' DescribeCapacityProvidersResponse (Prelude.Maybe [Failure])
describeCapacityProvidersResponse_failures :: (Maybe [Failure] -> f (Maybe [Failure]))
-> DescribeCapacityProvidersResponse
-> f DescribeCapacityProvidersResponse
describeCapacityProvidersResponse_failures = (DescribeCapacityProvidersResponse -> Maybe [Failure])
-> (DescribeCapacityProvidersResponse
    -> Maybe [Failure] -> DescribeCapacityProvidersResponse)
-> Lens
     DescribeCapacityProvidersResponse
     DescribeCapacityProvidersResponse
     (Maybe [Failure])
     (Maybe [Failure])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCapacityProvidersResponse' {Maybe [Failure]
failures :: Maybe [Failure]
$sel:failures:DescribeCapacityProvidersResponse' :: DescribeCapacityProvidersResponse -> Maybe [Failure]
failures} -> Maybe [Failure]
failures) (\s :: DescribeCapacityProvidersResponse
s@DescribeCapacityProvidersResponse' {} Maybe [Failure]
a -> DescribeCapacityProvidersResponse
s {$sel:failures:DescribeCapacityProvidersResponse' :: Maybe [Failure]
failures = Maybe [Failure]
a} :: DescribeCapacityProvidersResponse) ((Maybe [Failure] -> f (Maybe [Failure]))
 -> DescribeCapacityProvidersResponse
 -> f DescribeCapacityProvidersResponse)
-> ((Maybe [Failure] -> f (Maybe [Failure]))
    -> Maybe [Failure] -> f (Maybe [Failure]))
-> (Maybe [Failure] -> f (Maybe [Failure]))
-> DescribeCapacityProvidersResponse
-> f DescribeCapacityProvidersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Failure] [Failure] [Failure] [Failure]
-> Iso
     (Maybe [Failure])
     (Maybe [Failure])
     (Maybe [Failure])
     (Maybe [Failure])
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 [Failure] [Failure] [Failure] [Failure]
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 @DescribeCapacityProviders@
-- request. When the results of a @DescribeCapacityProviders@ 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.
describeCapacityProvidersResponse_nextToken :: Lens.Lens' DescribeCapacityProvidersResponse (Prelude.Maybe Prelude.Text)
describeCapacityProvidersResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeCapacityProvidersResponse
-> f DescribeCapacityProvidersResponse
describeCapacityProvidersResponse_nextToken = (DescribeCapacityProvidersResponse -> Maybe Text)
-> (DescribeCapacityProvidersResponse
    -> Maybe Text -> DescribeCapacityProvidersResponse)
-> Lens
     DescribeCapacityProvidersResponse
     DescribeCapacityProvidersResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCapacityProvidersResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeCapacityProvidersResponse' :: DescribeCapacityProvidersResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeCapacityProvidersResponse
s@DescribeCapacityProvidersResponse' {} Maybe Text
a -> DescribeCapacityProvidersResponse
s {$sel:nextToken:DescribeCapacityProvidersResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeCapacityProvidersResponse)

-- | The list of capacity providers.
describeCapacityProvidersResponse_capacityProviders :: Lens.Lens' DescribeCapacityProvidersResponse (Prelude.Maybe [CapacityProvider])
describeCapacityProvidersResponse_capacityProviders :: (Maybe [CapacityProvider] -> f (Maybe [CapacityProvider]))
-> DescribeCapacityProvidersResponse
-> f DescribeCapacityProvidersResponse
describeCapacityProvidersResponse_capacityProviders = (DescribeCapacityProvidersResponse -> Maybe [CapacityProvider])
-> (DescribeCapacityProvidersResponse
    -> Maybe [CapacityProvider] -> DescribeCapacityProvidersResponse)
-> Lens
     DescribeCapacityProvidersResponse
     DescribeCapacityProvidersResponse
     (Maybe [CapacityProvider])
     (Maybe [CapacityProvider])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCapacityProvidersResponse' {Maybe [CapacityProvider]
capacityProviders :: Maybe [CapacityProvider]
$sel:capacityProviders:DescribeCapacityProvidersResponse' :: DescribeCapacityProvidersResponse -> Maybe [CapacityProvider]
capacityProviders} -> Maybe [CapacityProvider]
capacityProviders) (\s :: DescribeCapacityProvidersResponse
s@DescribeCapacityProvidersResponse' {} Maybe [CapacityProvider]
a -> DescribeCapacityProvidersResponse
s {$sel:capacityProviders:DescribeCapacityProvidersResponse' :: Maybe [CapacityProvider]
capacityProviders = Maybe [CapacityProvider]
a} :: DescribeCapacityProvidersResponse) ((Maybe [CapacityProvider] -> f (Maybe [CapacityProvider]))
 -> DescribeCapacityProvidersResponse
 -> f DescribeCapacityProvidersResponse)
-> ((Maybe [CapacityProvider] -> f (Maybe [CapacityProvider]))
    -> Maybe [CapacityProvider] -> f (Maybe [CapacityProvider]))
-> (Maybe [CapacityProvider] -> f (Maybe [CapacityProvider]))
-> DescribeCapacityProvidersResponse
-> f DescribeCapacityProvidersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CapacityProvider]
  [CapacityProvider]
  [CapacityProvider]
  [CapacityProvider]
-> Iso
     (Maybe [CapacityProvider])
     (Maybe [CapacityProvider])
     (Maybe [CapacityProvider])
     (Maybe [CapacityProvider])
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
  [CapacityProvider]
  [CapacityProvider]
  [CapacityProvider]
  [CapacityProvider]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeCapacityProvidersResponse