{-# 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.ListAttributes
-- 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)
--
-- Lists the attributes for Amazon ECS resources within a specified target
-- type and cluster. When you specify a target type and cluster,
-- @ListAttributes@ returns a list of attribute objects, one for each
-- attribute on each resource. You can filter the list of results to a
-- single attribute name to only return results that have that name. You
-- can also filter the results by attribute name and value, for example, to
-- see which container instances in a cluster are running a Linux AMI
-- (@ecs.os-type=linux@).
--
-- This operation returns paginated results.
module Amazonka.ECS.ListAttributes
  ( -- * Creating a Request
    ListAttributes (..),
    newListAttributes,

    -- * Request Lenses
    listAttributes_attributeValue,
    listAttributes_cluster,
    listAttributes_nextToken,
    listAttributes_attributeName,
    listAttributes_maxResults,
    listAttributes_targetType,

    -- * Destructuring the Response
    ListAttributesResponse (..),
    newListAttributesResponse,

    -- * Response Lenses
    listAttributesResponse_nextToken,
    listAttributesResponse_attributes,
    listAttributesResponse_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:/ 'newListAttributes' smart constructor.
data ListAttributes = ListAttributes'
  { -- | The value of the attribute with which to filter results. You must also
    -- specify an attribute name to use this parameter.
    ListAttributes -> Maybe Text
attributeValue :: Prelude.Maybe Prelude.Text,
    -- | The short name or full Amazon Resource Name (ARN) of the cluster to list
    -- attributes. If you do not specify a cluster, the default cluster is
    -- assumed.
    ListAttributes -> Maybe Text
cluster :: Prelude.Maybe Prelude.Text,
    -- | The @nextToken@ value returned from a @ListAttributes@ request
    -- indicating that more results are available to fulfill the request and
    -- further calls will be needed. If @maxResults@ was provided, it is
    -- possible the number of results to be fewer than @maxResults@.
    --
    -- 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.
    ListAttributes -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the attribute with which to filter the results.
    ListAttributes -> Maybe Text
attributeName :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of cluster results returned by @ListAttributes@ in
    -- paginated output. When this parameter is used, @ListAttributes@ 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 @ListAttributes@ request with the returned
    -- @nextToken@ value. This value can be between 1 and 100. If this
    -- parameter is not used, then @ListAttributes@ returns up to 100 results
    -- and a @nextToken@ value if applicable.
    ListAttributes -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | The type of the target with which to list attributes.
    ListAttributes -> TargetType
targetType :: TargetType
  }
  deriving (ListAttributes -> ListAttributes -> Bool
(ListAttributes -> ListAttributes -> Bool)
-> (ListAttributes -> ListAttributes -> Bool) -> Eq ListAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAttributes -> ListAttributes -> Bool
$c/= :: ListAttributes -> ListAttributes -> Bool
== :: ListAttributes -> ListAttributes -> Bool
$c== :: ListAttributes -> ListAttributes -> Bool
Prelude.Eq, ReadPrec [ListAttributes]
ReadPrec ListAttributes
Int -> ReadS ListAttributes
ReadS [ListAttributes]
(Int -> ReadS ListAttributes)
-> ReadS [ListAttributes]
-> ReadPrec ListAttributes
-> ReadPrec [ListAttributes]
-> Read ListAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAttributes]
$creadListPrec :: ReadPrec [ListAttributes]
readPrec :: ReadPrec ListAttributes
$creadPrec :: ReadPrec ListAttributes
readList :: ReadS [ListAttributes]
$creadList :: ReadS [ListAttributes]
readsPrec :: Int -> ReadS ListAttributes
$creadsPrec :: Int -> ReadS ListAttributes
Prelude.Read, Int -> ListAttributes -> ShowS
[ListAttributes] -> ShowS
ListAttributes -> String
(Int -> ListAttributes -> ShowS)
-> (ListAttributes -> String)
-> ([ListAttributes] -> ShowS)
-> Show ListAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAttributes] -> ShowS
$cshowList :: [ListAttributes] -> ShowS
show :: ListAttributes -> String
$cshow :: ListAttributes -> String
showsPrec :: Int -> ListAttributes -> ShowS
$cshowsPrec :: Int -> ListAttributes -> ShowS
Prelude.Show, (forall x. ListAttributes -> Rep ListAttributes x)
-> (forall x. Rep ListAttributes x -> ListAttributes)
-> Generic ListAttributes
forall x. Rep ListAttributes x -> ListAttributes
forall x. ListAttributes -> Rep ListAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAttributes x -> ListAttributes
$cfrom :: forall x. ListAttributes -> Rep ListAttributes x
Prelude.Generic)

-- |
-- Create a value of 'ListAttributes' 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:
--
-- 'attributeValue', 'listAttributes_attributeValue' - The value of the attribute with which to filter results. You must also
-- specify an attribute name to use this parameter.
--
-- 'cluster', 'listAttributes_cluster' - The short name or full Amazon Resource Name (ARN) of the cluster to list
-- attributes. If you do not specify a cluster, the default cluster is
-- assumed.
--
-- 'nextToken', 'listAttributes_nextToken' - The @nextToken@ value returned from a @ListAttributes@ request
-- indicating that more results are available to fulfill the request and
-- further calls will be needed. If @maxResults@ was provided, it is
-- possible the number of results to be fewer than @maxResults@.
--
-- 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.
--
-- 'attributeName', 'listAttributes_attributeName' - The name of the attribute with which to filter the results.
--
-- 'maxResults', 'listAttributes_maxResults' - The maximum number of cluster results returned by @ListAttributes@ in
-- paginated output. When this parameter is used, @ListAttributes@ 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 @ListAttributes@ request with the returned
-- @nextToken@ value. This value can be between 1 and 100. If this
-- parameter is not used, then @ListAttributes@ returns up to 100 results
-- and a @nextToken@ value if applicable.
--
-- 'targetType', 'listAttributes_targetType' - The type of the target with which to list attributes.
newListAttributes ::
  -- | 'targetType'
  TargetType ->
  ListAttributes
newListAttributes :: TargetType -> ListAttributes
newListAttributes TargetType
pTargetType_ =
  ListAttributes' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> TargetType
-> ListAttributes
ListAttributes'
    { $sel:attributeValue:ListAttributes' :: Maybe Text
attributeValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cluster:ListAttributes' :: Maybe Text
cluster = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAttributes' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:attributeName:ListAttributes' :: Maybe Text
attributeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAttributes' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:targetType:ListAttributes' :: TargetType
targetType = TargetType
pTargetType_
    }

-- | The value of the attribute with which to filter results. You must also
-- specify an attribute name to use this parameter.
listAttributes_attributeValue :: Lens.Lens' ListAttributes (Prelude.Maybe Prelude.Text)
listAttributes_attributeValue :: (Maybe Text -> f (Maybe Text))
-> ListAttributes -> f ListAttributes
listAttributes_attributeValue = (ListAttributes -> Maybe Text)
-> (ListAttributes -> Maybe Text -> ListAttributes)
-> Lens ListAttributes ListAttributes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttributes' {Maybe Text
attributeValue :: Maybe Text
$sel:attributeValue:ListAttributes' :: ListAttributes -> Maybe Text
attributeValue} -> Maybe Text
attributeValue) (\s :: ListAttributes
s@ListAttributes' {} Maybe Text
a -> ListAttributes
s {$sel:attributeValue:ListAttributes' :: Maybe Text
attributeValue = Maybe Text
a} :: ListAttributes)

-- | The short name or full Amazon Resource Name (ARN) of the cluster to list
-- attributes. If you do not specify a cluster, the default cluster is
-- assumed.
listAttributes_cluster :: Lens.Lens' ListAttributes (Prelude.Maybe Prelude.Text)
listAttributes_cluster :: (Maybe Text -> f (Maybe Text))
-> ListAttributes -> f ListAttributes
listAttributes_cluster = (ListAttributes -> Maybe Text)
-> (ListAttributes -> Maybe Text -> ListAttributes)
-> Lens ListAttributes ListAttributes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttributes' {Maybe Text
cluster :: Maybe Text
$sel:cluster:ListAttributes' :: ListAttributes -> Maybe Text
cluster} -> Maybe Text
cluster) (\s :: ListAttributes
s@ListAttributes' {} Maybe Text
a -> ListAttributes
s {$sel:cluster:ListAttributes' :: Maybe Text
cluster = Maybe Text
a} :: ListAttributes)

-- | The @nextToken@ value returned from a @ListAttributes@ request
-- indicating that more results are available to fulfill the request and
-- further calls will be needed. If @maxResults@ was provided, it is
-- possible the number of results to be fewer than @maxResults@.
--
-- 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.
listAttributes_nextToken :: Lens.Lens' ListAttributes (Prelude.Maybe Prelude.Text)
listAttributes_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAttributes -> f ListAttributes
listAttributes_nextToken = (ListAttributes -> Maybe Text)
-> (ListAttributes -> Maybe Text -> ListAttributes)
-> Lens ListAttributes ListAttributes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttributes' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAttributes' :: ListAttributes -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAttributes
s@ListAttributes' {} Maybe Text
a -> ListAttributes
s {$sel:nextToken:ListAttributes' :: Maybe Text
nextToken = Maybe Text
a} :: ListAttributes)

-- | The name of the attribute with which to filter the results.
listAttributes_attributeName :: Lens.Lens' ListAttributes (Prelude.Maybe Prelude.Text)
listAttributes_attributeName :: (Maybe Text -> f (Maybe Text))
-> ListAttributes -> f ListAttributes
listAttributes_attributeName = (ListAttributes -> Maybe Text)
-> (ListAttributes -> Maybe Text -> ListAttributes)
-> Lens ListAttributes ListAttributes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttributes' {Maybe Text
attributeName :: Maybe Text
$sel:attributeName:ListAttributes' :: ListAttributes -> Maybe Text
attributeName} -> Maybe Text
attributeName) (\s :: ListAttributes
s@ListAttributes' {} Maybe Text
a -> ListAttributes
s {$sel:attributeName:ListAttributes' :: Maybe Text
attributeName = Maybe Text
a} :: ListAttributes)

-- | The maximum number of cluster results returned by @ListAttributes@ in
-- paginated output. When this parameter is used, @ListAttributes@ 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 @ListAttributes@ request with the returned
-- @nextToken@ value. This value can be between 1 and 100. If this
-- parameter is not used, then @ListAttributes@ returns up to 100 results
-- and a @nextToken@ value if applicable.
listAttributes_maxResults :: Lens.Lens' ListAttributes (Prelude.Maybe Prelude.Int)
listAttributes_maxResults :: (Maybe Int -> f (Maybe Int)) -> ListAttributes -> f ListAttributes
listAttributes_maxResults = (ListAttributes -> Maybe Int)
-> (ListAttributes -> Maybe Int -> ListAttributes)
-> Lens ListAttributes ListAttributes (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttributes' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListAttributes' :: ListAttributes -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListAttributes
s@ListAttributes' {} Maybe Int
a -> ListAttributes
s {$sel:maxResults:ListAttributes' :: Maybe Int
maxResults = Maybe Int
a} :: ListAttributes)

-- | The type of the target with which to list attributes.
listAttributes_targetType :: Lens.Lens' ListAttributes TargetType
listAttributes_targetType :: (TargetType -> f TargetType) -> ListAttributes -> f ListAttributes
listAttributes_targetType = (ListAttributes -> TargetType)
-> (ListAttributes -> TargetType -> ListAttributes)
-> Lens ListAttributes ListAttributes TargetType TargetType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttributes' {TargetType
targetType :: TargetType
$sel:targetType:ListAttributes' :: ListAttributes -> TargetType
targetType} -> TargetType
targetType) (\s :: ListAttributes
s@ListAttributes' {} TargetType
a -> ListAttributes
s {$sel:targetType:ListAttributes' :: TargetType
targetType = TargetType
a} :: ListAttributes)

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

instance Prelude.NFData ListAttributes

instance Core.ToHeaders ListAttributes where
  toHeaders :: ListAttributes -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListAttributes -> 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.ListAttributes" ::
                          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 ListAttributes where
  toJSON :: ListAttributes -> Value
toJSON ListAttributes' {Maybe Int
Maybe Text
TargetType
targetType :: TargetType
maxResults :: Maybe Int
attributeName :: Maybe Text
nextToken :: Maybe Text
cluster :: Maybe Text
attributeValue :: Maybe Text
$sel:targetType:ListAttributes' :: ListAttributes -> TargetType
$sel:maxResults:ListAttributes' :: ListAttributes -> Maybe Int
$sel:attributeName:ListAttributes' :: ListAttributes -> Maybe Text
$sel:nextToken:ListAttributes' :: ListAttributes -> Maybe Text
$sel:cluster:ListAttributes' :: ListAttributes -> Maybe Text
$sel:attributeValue:ListAttributes' :: ListAttributes -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"attributeValue" 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
attributeValue,
            (Text
"cluster" 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
cluster,
            (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
"attributeName" 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
attributeName,
            (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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"targetType" Text -> TargetType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TargetType
targetType)
          ]
      )

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

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

-- | /See:/ 'newListAttributesResponse' smart constructor.
data ListAttributesResponse = ListAttributesResponse'
  { -- | The @nextToken@ value to include in a future @ListAttributes@ request.
    -- When the results of a @ListAttributes@ 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.
    ListAttributesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of attribute objects that meet the criteria of the request.
    ListAttributesResponse -> Maybe [Attribute]
attributes :: Prelude.Maybe [Attribute],
    -- | The response's http status code.
    ListAttributesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAttributesResponse -> ListAttributesResponse -> Bool
(ListAttributesResponse -> ListAttributesResponse -> Bool)
-> (ListAttributesResponse -> ListAttributesResponse -> Bool)
-> Eq ListAttributesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAttributesResponse -> ListAttributesResponse -> Bool
$c/= :: ListAttributesResponse -> ListAttributesResponse -> Bool
== :: ListAttributesResponse -> ListAttributesResponse -> Bool
$c== :: ListAttributesResponse -> ListAttributesResponse -> Bool
Prelude.Eq, ReadPrec [ListAttributesResponse]
ReadPrec ListAttributesResponse
Int -> ReadS ListAttributesResponse
ReadS [ListAttributesResponse]
(Int -> ReadS ListAttributesResponse)
-> ReadS [ListAttributesResponse]
-> ReadPrec ListAttributesResponse
-> ReadPrec [ListAttributesResponse]
-> Read ListAttributesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAttributesResponse]
$creadListPrec :: ReadPrec [ListAttributesResponse]
readPrec :: ReadPrec ListAttributesResponse
$creadPrec :: ReadPrec ListAttributesResponse
readList :: ReadS [ListAttributesResponse]
$creadList :: ReadS [ListAttributesResponse]
readsPrec :: Int -> ReadS ListAttributesResponse
$creadsPrec :: Int -> ReadS ListAttributesResponse
Prelude.Read, Int -> ListAttributesResponse -> ShowS
[ListAttributesResponse] -> ShowS
ListAttributesResponse -> String
(Int -> ListAttributesResponse -> ShowS)
-> (ListAttributesResponse -> String)
-> ([ListAttributesResponse] -> ShowS)
-> Show ListAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAttributesResponse] -> ShowS
$cshowList :: [ListAttributesResponse] -> ShowS
show :: ListAttributesResponse -> String
$cshow :: ListAttributesResponse -> String
showsPrec :: Int -> ListAttributesResponse -> ShowS
$cshowsPrec :: Int -> ListAttributesResponse -> ShowS
Prelude.Show, (forall x. ListAttributesResponse -> Rep ListAttributesResponse x)
-> (forall x.
    Rep ListAttributesResponse x -> ListAttributesResponse)
-> Generic ListAttributesResponse
forall x. Rep ListAttributesResponse x -> ListAttributesResponse
forall x. ListAttributesResponse -> Rep ListAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAttributesResponse x -> ListAttributesResponse
$cfrom :: forall x. ListAttributesResponse -> Rep ListAttributesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAttributesResponse' 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', 'listAttributesResponse_nextToken' - The @nextToken@ value to include in a future @ListAttributes@ request.
-- When the results of a @ListAttributes@ 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.
--
-- 'attributes', 'listAttributesResponse_attributes' - A list of attribute objects that meet the criteria of the request.
--
-- 'httpStatus', 'listAttributesResponse_httpStatus' - The response's http status code.
newListAttributesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAttributesResponse
newListAttributesResponse :: Int -> ListAttributesResponse
newListAttributesResponse Int
pHttpStatus_ =
  ListAttributesResponse' :: Maybe Text -> Maybe [Attribute] -> Int -> ListAttributesResponse
ListAttributesResponse'
    { $sel:nextToken:ListAttributesResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:attributes:ListAttributesResponse' :: Maybe [Attribute]
attributes = Maybe [Attribute]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAttributesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The @nextToken@ value to include in a future @ListAttributes@ request.
-- When the results of a @ListAttributes@ 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.
listAttributesResponse_nextToken :: Lens.Lens' ListAttributesResponse (Prelude.Maybe Prelude.Text)
listAttributesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAttributesResponse -> f ListAttributesResponse
listAttributesResponse_nextToken = (ListAttributesResponse -> Maybe Text)
-> (ListAttributesResponse -> Maybe Text -> ListAttributesResponse)
-> Lens' ListAttributesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttributesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAttributesResponse' :: ListAttributesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAttributesResponse
s@ListAttributesResponse' {} Maybe Text
a -> ListAttributesResponse
s {$sel:nextToken:ListAttributesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAttributesResponse)

-- | A list of attribute objects that meet the criteria of the request.
listAttributesResponse_attributes :: Lens.Lens' ListAttributesResponse (Prelude.Maybe [Attribute])
listAttributesResponse_attributes :: (Maybe [Attribute] -> f (Maybe [Attribute]))
-> ListAttributesResponse -> f ListAttributesResponse
listAttributesResponse_attributes = (ListAttributesResponse -> Maybe [Attribute])
-> (ListAttributesResponse
    -> Maybe [Attribute] -> ListAttributesResponse)
-> Lens' ListAttributesResponse (Maybe [Attribute])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttributesResponse' {Maybe [Attribute]
attributes :: Maybe [Attribute]
$sel:attributes:ListAttributesResponse' :: ListAttributesResponse -> Maybe [Attribute]
attributes} -> Maybe [Attribute]
attributes) (\s :: ListAttributesResponse
s@ListAttributesResponse' {} Maybe [Attribute]
a -> ListAttributesResponse
s {$sel:attributes:ListAttributesResponse' :: Maybe [Attribute]
attributes = Maybe [Attribute]
a} :: ListAttributesResponse) ((Maybe [Attribute] -> f (Maybe [Attribute]))
 -> ListAttributesResponse -> f ListAttributesResponse)
-> ((Maybe [Attribute] -> f (Maybe [Attribute]))
    -> Maybe [Attribute] -> f (Maybe [Attribute]))
-> (Maybe [Attribute] -> f (Maybe [Attribute]))
-> ListAttributesResponse
-> f ListAttributesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Attribute] [Attribute] [Attribute] [Attribute]
-> Iso
     (Maybe [Attribute])
     (Maybe [Attribute])
     (Maybe [Attribute])
     (Maybe [Attribute])
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 [Attribute] [Attribute] [Attribute] [Attribute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListAttributesResponse