{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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_effectiveSettings,
    listAccountSettings_maxResults,
    listAccountSettings_name,
    listAccountSettings_nextToken,
    listAccountSettings_principalArn,
    listAccountSettings_value,

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

    -- * Response Lenses
    listAccountSettingsResponse_nextToken,
    listAccountSettingsResponse_settings,
    listAccountSettingsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ECS.Types
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'
  { -- | Determines 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\'re 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 isn\'t used, then @ListAccountSettings@
    -- returns up to 10 results and a @nextToken@ value if applicable.
    ListAccountSettings -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | The name of the account setting you want to list the settings for.
    ListAccountSettings -> Maybe SettingName
name :: Prelude.Maybe SettingName,
    -- | 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\'s
    -- 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 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,
    -- | The value of the account settings to filter results with. You must also
    -- specify an account setting name to use this parameter.
    ListAccountSettings -> Maybe Text
value :: Prelude.Maybe Prelude.Text
  }
  deriving (ListAccountSettings -> ListAccountSettings -> Bool
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]
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
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. 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:
--
-- 'effectiveSettings', 'listAccountSettings_effectiveSettings' - Determines 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\'re 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 isn\'t used, then @ListAccountSettings@
-- returns up to 10 results and a @nextToken@ value if applicable.
--
-- 'name', 'listAccountSettings_name' - The name of the account setting you want to list the settings for.
--
-- '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\'s
-- 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.
--
-- '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.
--
-- 'value', 'listAccountSettings_value' - The value of the account settings to filter results with. You must also
-- specify an account setting name to use this parameter.
newListAccountSettings ::
  ListAccountSettings
newListAccountSettings :: ListAccountSettings
newListAccountSettings =
  ListAccountSettings'
    { $sel:effectiveSettings:ListAccountSettings' :: Maybe Bool
effectiveSettings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAccountSettings' :: Maybe Int
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ListAccountSettings' :: Maybe SettingName
name = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAccountSettings' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:principalArn:ListAccountSettings' :: Maybe Text
principalArn = forall a. Maybe a
Prelude.Nothing,
      $sel:value:ListAccountSettings' :: Maybe Text
value = forall a. Maybe a
Prelude.Nothing
    }

-- | Determines 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\'re set. Otherwise, no account
-- settings are returned.
listAccountSettings_effectiveSettings :: Lens.Lens' ListAccountSettings (Prelude.Maybe Prelude.Bool)
listAccountSettings_effectiveSettings :: Lens' ListAccountSettings (Maybe Bool)
listAccountSettings_effectiveSettings = 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 isn\'t 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 :: Lens' ListAccountSettings (Maybe Int)
listAccountSettings_maxResults = 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)

-- | The name of the account setting you want to list the settings for.
listAccountSettings_name :: Lens.Lens' ListAccountSettings (Prelude.Maybe SettingName)
listAccountSettings_name :: Lens' ListAccountSettings (Maybe SettingName)
listAccountSettings_name = 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 @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\'s
-- 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 :: Lens' ListAccountSettings (Maybe Text)
listAccountSettings_nextToken = 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 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 :: Lens' ListAccountSettings (Maybe Text)
listAccountSettings_principalArn = 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)

-- | The value of the account settings to filter results with. You must also
-- specify an account setting name to use this parameter.
listAccountSettings_value :: Lens.Lens' ListAccountSettings (Prelude.Maybe Prelude.Text)
listAccountSettings_value :: Lens' ListAccountSettings (Maybe Text)
listAccountSettings_value = 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)

instance Core.AWSPager ListAccountSettings where
  page :: ListAccountSettings
-> AWSResponse ListAccountSettings -> Maybe ListAccountSettings
page ListAccountSettings
rq AWSResponse ListAccountSettings
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAccountSettings
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAccountSettingsResponse (Maybe Text)
listAccountSettingsResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAccountSettings
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAccountSettingsResponse (Maybe [Setting])
listAccountSettingsResponse_settings
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListAccountSettings
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListAccountSettings (Maybe Text)
listAccountSettings_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAccountSettings
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAccountSettingsResponse (Maybe Text)
listAccountSettingsResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListAccountSettings where
  type
    AWSResponse ListAccountSettings =
      ListAccountSettingsResponse
  request :: (Service -> Service)
-> ListAccountSettings -> Request ListAccountSettings
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListAccountSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListAccountSettings)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Maybe [Setting] -> Int -> ListAccountSettingsResponse
ListAccountSettingsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"settings" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListAccountSettings where
  hashWithSalt :: Int -> ListAccountSettings -> Int
hashWithSalt Int
_salt ListAccountSettings' {Maybe Bool
Maybe Int
Maybe Text
Maybe SettingName
value :: Maybe Text
principalArn :: Maybe Text
nextToken :: Maybe Text
name :: Maybe SettingName
maxResults :: Maybe Int
effectiveSettings :: Maybe Bool
$sel:value:ListAccountSettings' :: ListAccountSettings -> Maybe Text
$sel:principalArn:ListAccountSettings' :: ListAccountSettings -> Maybe Text
$sel:nextToken:ListAccountSettings' :: ListAccountSettings -> Maybe Text
$sel:name:ListAccountSettings' :: ListAccountSettings -> Maybe SettingName
$sel:maxResults:ListAccountSettings' :: ListAccountSettings -> Maybe Int
$sel:effectiveSettings:ListAccountSettings' :: ListAccountSettings -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
effectiveSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SettingName
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
principalArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
value

instance Prelude.NFData ListAccountSettings where
  rnf :: ListAccountSettings -> ()
rnf ListAccountSettings' {Maybe Bool
Maybe Int
Maybe Text
Maybe SettingName
value :: Maybe Text
principalArn :: Maybe Text
nextToken :: Maybe Text
name :: Maybe SettingName
maxResults :: Maybe Int
effectiveSettings :: Maybe Bool
$sel:value:ListAccountSettings' :: ListAccountSettings -> Maybe Text
$sel:principalArn:ListAccountSettings' :: ListAccountSettings -> Maybe Text
$sel:nextToken:ListAccountSettings' :: ListAccountSettings -> Maybe Text
$sel:name:ListAccountSettings' :: ListAccountSettings -> Maybe SettingName
$sel:maxResults:ListAccountSettings' :: ListAccountSettings -> Maybe Int
$sel:effectiveSettings:ListAccountSettings' :: ListAccountSettings -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
effectiveSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SettingName
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
principalArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
value

instance Data.ToHeaders ListAccountSettings where
  toHeaders :: ListAccountSettings -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AmazonEC2ContainerServiceV20141113.ListAccountSettings" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON ListAccountSettings where
  toJSON :: ListAccountSettings -> Value
toJSON ListAccountSettings' {Maybe Bool
Maybe Int
Maybe Text
Maybe SettingName
value :: Maybe Text
principalArn :: Maybe Text
nextToken :: Maybe Text
name :: Maybe SettingName
maxResults :: Maybe Int
effectiveSettings :: Maybe Bool
$sel:value:ListAccountSettings' :: ListAccountSettings -> Maybe Text
$sel:principalArn:ListAccountSettings' :: ListAccountSettings -> Maybe Text
$sel:nextToken:ListAccountSettings' :: ListAccountSettings -> Maybe Text
$sel:name:ListAccountSettings' :: ListAccountSettings -> Maybe SettingName
$sel:maxResults:ListAccountSettings' :: ListAccountSettings -> Maybe Int
$sel:effectiveSettings:ListAccountSettings' :: ListAccountSettings -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"effectiveSettings" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
effectiveSettings,
            (Key
"maxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults,
            (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SettingName
name,
            (Key
"nextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Key
"principalArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
principalArn,
            (Key
"value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
value
          ]
      )

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

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

-- | /See:/ 'newListAccountSettingsResponse' smart constructor.
data ListAccountSettingsResponse = ListAccountSettingsResponse'
  { -- | 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 account settings for the resource.
    ListAccountSettingsResponse -> Maybe [Setting]
settings :: Prelude.Maybe [Setting],
    -- | The response's http status code.
    ListAccountSettingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAccountSettingsResponse -> ListAccountSettingsResponse -> Bool
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]
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
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.
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:
--
-- '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.
--
-- 'settings', 'listAccountSettingsResponse_settings' - The account settings for the resource.
--
-- 'httpStatus', 'listAccountSettingsResponse_httpStatus' - The response's http status code.
newListAccountSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAccountSettingsResponse
newListAccountSettingsResponse :: Int -> ListAccountSettingsResponse
newListAccountSettingsResponse Int
pHttpStatus_ =
  ListAccountSettingsResponse'
    { $sel:nextToken:ListAccountSettingsResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:settings:ListAccountSettingsResponse' :: Maybe [Setting]
settings = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAccountSettingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | 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 :: Lens' ListAccountSettingsResponse (Maybe Text)
listAccountSettingsResponse_nextToken = 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 account settings for the resource.
listAccountSettingsResponse_settings :: Lens.Lens' ListAccountSettingsResponse (Prelude.Maybe [Setting])
listAccountSettingsResponse_settings :: Lens' ListAccountSettingsResponse (Maybe [Setting])
listAccountSettingsResponse_settings = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
listAccountSettingsResponse_httpStatus :: Lens.Lens' ListAccountSettingsResponse Prelude.Int
listAccountSettingsResponse_httpStatus :: Lens' ListAccountSettingsResponse Int
listAccountSettingsResponse_httpStatus = 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 where
  rnf :: ListAccountSettingsResponse -> ()
rnf ListAccountSettingsResponse' {Int
Maybe [Setting]
Maybe Text
httpStatus :: Int
settings :: Maybe [Setting]
nextToken :: Maybe Text
$sel:httpStatus:ListAccountSettingsResponse' :: ListAccountSettingsResponse -> Int
$sel:settings:ListAccountSettingsResponse' :: ListAccountSettingsResponse -> Maybe [Setting]
$sel:nextToken:ListAccountSettingsResponse' :: ListAccountSettingsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Setting]
settings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus