{-# 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.ListAccountSettings
-- 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 account settings for a specified principal.
--
-- This operation returns paginated results.
module Amazonka.ECS.ListAccountSettings
  ( -- * Creating a Request
    ListAccountSettings (..),
    newListAccountSettings,

    -- * Request Lenses
    listAccountSettings_value,
    listAccountSettings_nextToken,
    listAccountSettings_name,
    listAccountSettings_principalArn,
    listAccountSettings_effectiveSettings,
    listAccountSettings_maxResults,

    -- * Destructuring the Response
    ListAccountSettingsResponse (..),
    newListAccountSettingsResponse,

    -- * Response Lenses
    listAccountSettingsResponse_settings,
    listAccountSettingsResponse_nextToken,
    listAccountSettingsResponse_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:/ 'newListAccountSettings' smart constructor.
data ListAccountSettings = ListAccountSettings'
  { -- | The value of the account settings with which to filter results. You must
    -- also specify an account setting name to use this parameter.
    ListAccountSettings -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
    -- | The @nextToken@ value returned from a @ListAccountSettings@ 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.
    ListAccountSettings -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the account setting you want to list the settings for.
    ListAccountSettings -> Maybe SettingName
name :: Prelude.Maybe SettingName,
    -- | The ARN of the principal, which can be an IAM user, IAM role, or the
    -- root user. If this field is omitted, the account settings are listed
    -- only for the authenticated user.
    --
    -- Federated users assume the account setting of the root user and can\'t
    -- have explicit account settings set for them.
    ListAccountSettings -> Maybe Text
principalArn :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether to return the effective settings. If @true@, the
    -- account settings for the root user or the default setting for the
    -- @principalArn@ are returned. If @false@, the account settings for the
    -- @principalArn@ are returned if they are set. Otherwise, no account
    -- settings are returned.
    ListAccountSettings -> Maybe Bool
effectiveSettings :: Prelude.Maybe Prelude.Bool,
    -- | The maximum number of account setting results returned by
    -- @ListAccountSettings@ in paginated output. When this parameter is used,
    -- @ListAccountSettings@ 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 @ListAccountSettings@
    -- request with the returned @nextToken@ value. This value can be between 1
    -- and 10. If this parameter is not used, then @ListAccountSettings@
    -- returns up to 10 results and a @nextToken@ value if applicable.
    ListAccountSettings -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (ListAccountSettings -> ListAccountSettings -> Bool
(ListAccountSettings -> ListAccountSettings -> Bool)
-> (ListAccountSettings -> ListAccountSettings -> Bool)
-> Eq ListAccountSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccountSettings -> ListAccountSettings -> Bool
$c/= :: ListAccountSettings -> ListAccountSettings -> Bool
== :: ListAccountSettings -> ListAccountSettings -> Bool
$c== :: ListAccountSettings -> ListAccountSettings -> Bool
Prelude.Eq, ReadPrec [ListAccountSettings]
ReadPrec ListAccountSettings
Int -> ReadS ListAccountSettings
ReadS [ListAccountSettings]
(Int -> ReadS ListAccountSettings)
-> ReadS [ListAccountSettings]
-> ReadPrec ListAccountSettings
-> ReadPrec [ListAccountSettings]
-> Read ListAccountSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccountSettings]
$creadListPrec :: ReadPrec [ListAccountSettings]
readPrec :: ReadPrec ListAccountSettings
$creadPrec :: ReadPrec ListAccountSettings
readList :: ReadS [ListAccountSettings]
$creadList :: ReadS [ListAccountSettings]
readsPrec :: Int -> ReadS ListAccountSettings
$creadsPrec :: Int -> ReadS ListAccountSettings
Prelude.Read, Int -> ListAccountSettings -> ShowS
[ListAccountSettings] -> ShowS
ListAccountSettings -> String
(Int -> ListAccountSettings -> ShowS)
-> (ListAccountSettings -> String)
-> ([ListAccountSettings] -> ShowS)
-> Show ListAccountSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccountSettings] -> ShowS
$cshowList :: [ListAccountSettings] -> ShowS
show :: ListAccountSettings -> String
$cshow :: ListAccountSettings -> String
showsPrec :: Int -> ListAccountSettings -> ShowS
$cshowsPrec :: Int -> ListAccountSettings -> ShowS
Prelude.Show, (forall x. ListAccountSettings -> Rep ListAccountSettings x)
-> (forall x. Rep ListAccountSettings x -> ListAccountSettings)
-> Generic ListAccountSettings
forall x. Rep ListAccountSettings x -> ListAccountSettings
forall x. ListAccountSettings -> Rep ListAccountSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAccountSettings x -> ListAccountSettings
$cfrom :: forall x. ListAccountSettings -> Rep ListAccountSettings x
Prelude.Generic)

-- |
-- Create a value of 'ListAccountSettings' 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:
--
-- 'value', 'listAccountSettings_value' - The value of the account settings with which to filter results. You must
-- also specify an account setting name to use this parameter.
--
-- 'nextToken', 'listAccountSettings_nextToken' - The @nextToken@ value returned from a @ListAccountSettings@ 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.
--
-- 'name', 'listAccountSettings_name' - The name of the account setting you want to list the settings for.
--
-- 'principalArn', 'listAccountSettings_principalArn' - The ARN of the principal, which can be an IAM user, IAM role, or the
-- root user. If this field is omitted, the account settings are listed
-- only for the authenticated user.
--
-- Federated users assume the account setting of the root user and can\'t
-- have explicit account settings set for them.
--
-- 'effectiveSettings', 'listAccountSettings_effectiveSettings' - Specifies whether to return the effective settings. If @true@, the
-- account settings for the root user or the default setting for the
-- @principalArn@ are returned. If @false@, the account settings for the
-- @principalArn@ are returned if they are set. Otherwise, no account
-- settings are returned.
--
-- 'maxResults', 'listAccountSettings_maxResults' - The maximum number of account setting results returned by
-- @ListAccountSettings@ in paginated output. When this parameter is used,
-- @ListAccountSettings@ 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 @ListAccountSettings@
-- request with the returned @nextToken@ value. This value can be between 1
-- and 10. If this parameter is not used, then @ListAccountSettings@
-- returns up to 10 results and a @nextToken@ value if applicable.
newListAccountSettings ::
  ListAccountSettings
newListAccountSettings :: ListAccountSettings
newListAccountSettings =
  ListAccountSettings' :: Maybe Text
-> Maybe Text
-> Maybe SettingName
-> Maybe Text
-> Maybe Bool
-> Maybe Int
-> ListAccountSettings
ListAccountSettings'
    { $sel:value:ListAccountSettings' :: Maybe Text
value = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAccountSettings' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ListAccountSettings' :: Maybe SettingName
name = Maybe SettingName
forall a. Maybe a
Prelude.Nothing,
      $sel:principalArn:ListAccountSettings' :: Maybe Text
principalArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:effectiveSettings:ListAccountSettings' :: Maybe Bool
effectiveSettings = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAccountSettings' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The @nextToken@ value returned from a @ListAccountSettings@ 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.
listAccountSettings_nextToken :: Lens.Lens' ListAccountSettings (Prelude.Maybe Prelude.Text)
listAccountSettings_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAccountSettings -> f ListAccountSettings
listAccountSettings_nextToken = (ListAccountSettings -> Maybe Text)
-> (ListAccountSettings -> Maybe Text -> ListAccountSettings)
-> Lens
     ListAccountSettings ListAccountSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountSettings' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccountSettings' :: ListAccountSettings -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccountSettings
s@ListAccountSettings' {} Maybe Text
a -> ListAccountSettings
s {$sel:nextToken:ListAccountSettings' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccountSettings)

-- | The name of the account setting you want to list the settings for.
listAccountSettings_name :: Lens.Lens' ListAccountSettings (Prelude.Maybe SettingName)
listAccountSettings_name :: (Maybe SettingName -> f (Maybe SettingName))
-> ListAccountSettings -> f ListAccountSettings
listAccountSettings_name = (ListAccountSettings -> Maybe SettingName)
-> (ListAccountSettings
    -> Maybe SettingName -> ListAccountSettings)
-> Lens
     ListAccountSettings
     ListAccountSettings
     (Maybe SettingName)
     (Maybe SettingName)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountSettings' {Maybe SettingName
name :: Maybe SettingName
$sel:name:ListAccountSettings' :: ListAccountSettings -> Maybe SettingName
name} -> Maybe SettingName
name) (\s :: ListAccountSettings
s@ListAccountSettings' {} Maybe SettingName
a -> ListAccountSettings
s {$sel:name:ListAccountSettings' :: Maybe SettingName
name = Maybe SettingName
a} :: ListAccountSettings)

-- | The ARN of the principal, which can be an IAM user, IAM role, or the
-- root user. If this field is omitted, the account settings are listed
-- only for the authenticated user.
--
-- Federated users assume the account setting of the root user and can\'t
-- have explicit account settings set for them.
listAccountSettings_principalArn :: Lens.Lens' ListAccountSettings (Prelude.Maybe Prelude.Text)
listAccountSettings_principalArn :: (Maybe Text -> f (Maybe Text))
-> ListAccountSettings -> f ListAccountSettings
listAccountSettings_principalArn = (ListAccountSettings -> Maybe Text)
-> (ListAccountSettings -> Maybe Text -> ListAccountSettings)
-> Lens
     ListAccountSettings ListAccountSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountSettings' {Maybe Text
principalArn :: Maybe Text
$sel:principalArn:ListAccountSettings' :: ListAccountSettings -> Maybe Text
principalArn} -> Maybe Text
principalArn) (\s :: ListAccountSettings
s@ListAccountSettings' {} Maybe Text
a -> ListAccountSettings
s {$sel:principalArn:ListAccountSettings' :: Maybe Text
principalArn = Maybe Text
a} :: ListAccountSettings)

-- | Specifies whether to return the effective settings. If @true@, the
-- account settings for the root user or the default setting for the
-- @principalArn@ are returned. If @false@, the account settings for the
-- @principalArn@ are returned if they are set. Otherwise, no account
-- settings are returned.
listAccountSettings_effectiveSettings :: Lens.Lens' ListAccountSettings (Prelude.Maybe Prelude.Bool)
listAccountSettings_effectiveSettings :: (Maybe Bool -> f (Maybe Bool))
-> ListAccountSettings -> f ListAccountSettings
listAccountSettings_effectiveSettings = (ListAccountSettings -> Maybe Bool)
-> (ListAccountSettings -> Maybe Bool -> ListAccountSettings)
-> Lens
     ListAccountSettings ListAccountSettings (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountSettings' {Maybe Bool
effectiveSettings :: Maybe Bool
$sel:effectiveSettings:ListAccountSettings' :: ListAccountSettings -> Maybe Bool
effectiveSettings} -> Maybe Bool
effectiveSettings) (\s :: ListAccountSettings
s@ListAccountSettings' {} Maybe Bool
a -> ListAccountSettings
s {$sel:effectiveSettings:ListAccountSettings' :: Maybe Bool
effectiveSettings = Maybe Bool
a} :: ListAccountSettings)

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

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

instance Prelude.NFData ListAccountSettings

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

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

-- | /See:/ 'newListAccountSettingsResponse' smart constructor.
data ListAccountSettingsResponse = ListAccountSettingsResponse'
  { -- | The account settings for the resource.
    ListAccountSettingsResponse -> Maybe [Setting]
settings :: Prelude.Maybe [Setting],
    -- | The @nextToken@ value to include in a future @ListAccountSettings@
    -- request. When the results of a @ListAccountSettings@ 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.
    ListAccountSettingsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAccountSettingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAccountSettingsResponse -> ListAccountSettingsResponse -> Bool
(ListAccountSettingsResponse
 -> ListAccountSettingsResponse -> Bool)
-> (ListAccountSettingsResponse
    -> ListAccountSettingsResponse -> Bool)
-> Eq ListAccountSettingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAccountSettingsResponse -> ListAccountSettingsResponse -> Bool
$c/= :: ListAccountSettingsResponse -> ListAccountSettingsResponse -> Bool
== :: ListAccountSettingsResponse -> ListAccountSettingsResponse -> Bool
$c== :: ListAccountSettingsResponse -> ListAccountSettingsResponse -> Bool
Prelude.Eq, ReadPrec [ListAccountSettingsResponse]
ReadPrec ListAccountSettingsResponse
Int -> ReadS ListAccountSettingsResponse
ReadS [ListAccountSettingsResponse]
(Int -> ReadS ListAccountSettingsResponse)
-> ReadS [ListAccountSettingsResponse]
-> ReadPrec ListAccountSettingsResponse
-> ReadPrec [ListAccountSettingsResponse]
-> Read ListAccountSettingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAccountSettingsResponse]
$creadListPrec :: ReadPrec [ListAccountSettingsResponse]
readPrec :: ReadPrec ListAccountSettingsResponse
$creadPrec :: ReadPrec ListAccountSettingsResponse
readList :: ReadS [ListAccountSettingsResponse]
$creadList :: ReadS [ListAccountSettingsResponse]
readsPrec :: Int -> ReadS ListAccountSettingsResponse
$creadsPrec :: Int -> ReadS ListAccountSettingsResponse
Prelude.Read, Int -> ListAccountSettingsResponse -> ShowS
[ListAccountSettingsResponse] -> ShowS
ListAccountSettingsResponse -> String
(Int -> ListAccountSettingsResponse -> ShowS)
-> (ListAccountSettingsResponse -> String)
-> ([ListAccountSettingsResponse] -> ShowS)
-> Show ListAccountSettingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAccountSettingsResponse] -> ShowS
$cshowList :: [ListAccountSettingsResponse] -> ShowS
show :: ListAccountSettingsResponse -> String
$cshow :: ListAccountSettingsResponse -> String
showsPrec :: Int -> ListAccountSettingsResponse -> ShowS
$cshowsPrec :: Int -> ListAccountSettingsResponse -> ShowS
Prelude.Show, (forall x.
 ListAccountSettingsResponse -> Rep ListAccountSettingsResponse x)
-> (forall x.
    Rep ListAccountSettingsResponse x -> ListAccountSettingsResponse)
-> Generic ListAccountSettingsResponse
forall x.
Rep ListAccountSettingsResponse x -> ListAccountSettingsResponse
forall x.
ListAccountSettingsResponse -> Rep ListAccountSettingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAccountSettingsResponse x -> ListAccountSettingsResponse
$cfrom :: forall x.
ListAccountSettingsResponse -> Rep ListAccountSettingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAccountSettingsResponse' 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:
--
-- 'settings', 'listAccountSettingsResponse_settings' - The account settings for the resource.
--
-- 'nextToken', 'listAccountSettingsResponse_nextToken' - The @nextToken@ value to include in a future @ListAccountSettings@
-- request. When the results of a @ListAccountSettings@ request exceed
-- @maxResults@, this value can be used to retrieve the next page of
-- results. This value is @null@ when there are no more results to return.
--
-- 'httpStatus', 'listAccountSettingsResponse_httpStatus' - The response's http status code.
newListAccountSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAccountSettingsResponse
newListAccountSettingsResponse :: Int -> ListAccountSettingsResponse
newListAccountSettingsResponse Int
pHttpStatus_ =
  ListAccountSettingsResponse' :: Maybe [Setting] -> Maybe Text -> Int -> ListAccountSettingsResponse
ListAccountSettingsResponse'
    { $sel:settings:ListAccountSettingsResponse' :: Maybe [Setting]
settings =
        Maybe [Setting]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAccountSettingsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAccountSettingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The account settings for the resource.
listAccountSettingsResponse_settings :: Lens.Lens' ListAccountSettingsResponse (Prelude.Maybe [Setting])
listAccountSettingsResponse_settings :: (Maybe [Setting] -> f (Maybe [Setting]))
-> ListAccountSettingsResponse -> f ListAccountSettingsResponse
listAccountSettingsResponse_settings = (ListAccountSettingsResponse -> Maybe [Setting])
-> (ListAccountSettingsResponse
    -> Maybe [Setting] -> ListAccountSettingsResponse)
-> Lens' ListAccountSettingsResponse (Maybe [Setting])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountSettingsResponse' {Maybe [Setting]
settings :: Maybe [Setting]
$sel:settings:ListAccountSettingsResponse' :: ListAccountSettingsResponse -> Maybe [Setting]
settings} -> Maybe [Setting]
settings) (\s :: ListAccountSettingsResponse
s@ListAccountSettingsResponse' {} Maybe [Setting]
a -> ListAccountSettingsResponse
s {$sel:settings:ListAccountSettingsResponse' :: Maybe [Setting]
settings = Maybe [Setting]
a} :: ListAccountSettingsResponse) ((Maybe [Setting] -> f (Maybe [Setting]))
 -> ListAccountSettingsResponse -> f ListAccountSettingsResponse)
-> ((Maybe [Setting] -> f (Maybe [Setting]))
    -> Maybe [Setting] -> f (Maybe [Setting]))
-> (Maybe [Setting] -> f (Maybe [Setting]))
-> ListAccountSettingsResponse
-> f ListAccountSettingsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Setting] [Setting] [Setting] [Setting]
-> Iso
     (Maybe [Setting])
     (Maybe [Setting])
     (Maybe [Setting])
     (Maybe [Setting])
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 [Setting] [Setting] [Setting] [Setting]
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 @ListAccountSettings@
-- request. When the results of a @ListAccountSettings@ 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.
listAccountSettingsResponse_nextToken :: Lens.Lens' ListAccountSettingsResponse (Prelude.Maybe Prelude.Text)
listAccountSettingsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListAccountSettingsResponse -> f ListAccountSettingsResponse
listAccountSettingsResponse_nextToken = (ListAccountSettingsResponse -> Maybe Text)
-> (ListAccountSettingsResponse
    -> Maybe Text -> ListAccountSettingsResponse)
-> Lens' ListAccountSettingsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAccountSettingsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAccountSettingsResponse' :: ListAccountSettingsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAccountSettingsResponse
s@ListAccountSettingsResponse' {} Maybe Text
a -> ListAccountSettingsResponse
s {$sel:nextToken:ListAccountSettingsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAccountSettingsResponse)

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

instance Prelude.NFData ListAccountSettingsResponse