{-# 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.QuickSight.DescribeAccountSettings
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes the settings that were used when your Amazon QuickSight
-- subscription was first created in this Amazon Web Services account.
module Amazonka.QuickSight.DescribeAccountSettings
  ( -- * Creating a Request
    DescribeAccountSettings (..),
    newDescribeAccountSettings,

    -- * Request Lenses
    describeAccountSettings_awsAccountId,

    -- * Destructuring the Response
    DescribeAccountSettingsResponse (..),
    newDescribeAccountSettingsResponse,

    -- * Response Lenses
    describeAccountSettingsResponse_requestId,
    describeAccountSettingsResponse_accountSettings,
    describeAccountSettingsResponse_status,
  )
where

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

-- | /See:/ 'newDescribeAccountSettings' smart constructor.
data DescribeAccountSettings = DescribeAccountSettings'
  { -- | The ID for the Amazon Web Services account that contains the settings
    -- that you want to list.
    DescribeAccountSettings -> Text
awsAccountId :: Prelude.Text
  }
  deriving (DescribeAccountSettings -> DescribeAccountSettings -> Bool
(DescribeAccountSettings -> DescribeAccountSettings -> Bool)
-> (DescribeAccountSettings -> DescribeAccountSettings -> Bool)
-> Eq DescribeAccountSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAccountSettings -> DescribeAccountSettings -> Bool
$c/= :: DescribeAccountSettings -> DescribeAccountSettings -> Bool
== :: DescribeAccountSettings -> DescribeAccountSettings -> Bool
$c== :: DescribeAccountSettings -> DescribeAccountSettings -> Bool
Prelude.Eq, ReadPrec [DescribeAccountSettings]
ReadPrec DescribeAccountSettings
Int -> ReadS DescribeAccountSettings
ReadS [DescribeAccountSettings]
(Int -> ReadS DescribeAccountSettings)
-> ReadS [DescribeAccountSettings]
-> ReadPrec DescribeAccountSettings
-> ReadPrec [DescribeAccountSettings]
-> Read DescribeAccountSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAccountSettings]
$creadListPrec :: ReadPrec [DescribeAccountSettings]
readPrec :: ReadPrec DescribeAccountSettings
$creadPrec :: ReadPrec DescribeAccountSettings
readList :: ReadS [DescribeAccountSettings]
$creadList :: ReadS [DescribeAccountSettings]
readsPrec :: Int -> ReadS DescribeAccountSettings
$creadsPrec :: Int -> ReadS DescribeAccountSettings
Prelude.Read, Int -> DescribeAccountSettings -> ShowS
[DescribeAccountSettings] -> ShowS
DescribeAccountSettings -> String
(Int -> DescribeAccountSettings -> ShowS)
-> (DescribeAccountSettings -> String)
-> ([DescribeAccountSettings] -> ShowS)
-> Show DescribeAccountSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAccountSettings] -> ShowS
$cshowList :: [DescribeAccountSettings] -> ShowS
show :: DescribeAccountSettings -> String
$cshow :: DescribeAccountSettings -> String
showsPrec :: Int -> DescribeAccountSettings -> ShowS
$cshowsPrec :: Int -> DescribeAccountSettings -> ShowS
Prelude.Show, (forall x.
 DescribeAccountSettings -> Rep DescribeAccountSettings x)
-> (forall x.
    Rep DescribeAccountSettings x -> DescribeAccountSettings)
-> Generic DescribeAccountSettings
forall x. Rep DescribeAccountSettings x -> DescribeAccountSettings
forall x. DescribeAccountSettings -> Rep DescribeAccountSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeAccountSettings x -> DescribeAccountSettings
$cfrom :: forall x. DescribeAccountSettings -> Rep DescribeAccountSettings x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAccountSettings' 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:
--
-- 'awsAccountId', 'describeAccountSettings_awsAccountId' - The ID for the Amazon Web Services account that contains the settings
-- that you want to list.
newDescribeAccountSettings ::
  -- | 'awsAccountId'
  Prelude.Text ->
  DescribeAccountSettings
newDescribeAccountSettings :: Text -> DescribeAccountSettings
newDescribeAccountSettings Text
pAwsAccountId_ =
  DescribeAccountSettings' :: Text -> DescribeAccountSettings
DescribeAccountSettings'
    { $sel:awsAccountId:DescribeAccountSettings' :: Text
awsAccountId =
        Text
pAwsAccountId_
    }

-- | The ID for the Amazon Web Services account that contains the settings
-- that you want to list.
describeAccountSettings_awsAccountId :: Lens.Lens' DescribeAccountSettings Prelude.Text
describeAccountSettings_awsAccountId :: (Text -> f Text)
-> DescribeAccountSettings -> f DescribeAccountSettings
describeAccountSettings_awsAccountId = (DescribeAccountSettings -> Text)
-> (DescribeAccountSettings -> Text -> DescribeAccountSettings)
-> Lens DescribeAccountSettings DescribeAccountSettings Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccountSettings' {Text
awsAccountId :: Text
$sel:awsAccountId:DescribeAccountSettings' :: DescribeAccountSettings -> Text
awsAccountId} -> Text
awsAccountId) (\s :: DescribeAccountSettings
s@DescribeAccountSettings' {} Text
a -> DescribeAccountSettings
s {$sel:awsAccountId:DescribeAccountSettings' :: Text
awsAccountId = Text
a} :: DescribeAccountSettings)

instance Core.AWSRequest DescribeAccountSettings where
  type
    AWSResponse DescribeAccountSettings =
      DescribeAccountSettingsResponse
  request :: DescribeAccountSettings -> Request DescribeAccountSettings
request = Service
-> DescribeAccountSettings -> Request DescribeAccountSettings
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeAccountSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAccountSettings)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeAccountSettings))
-> Logger
-> Service
-> Proxy DescribeAccountSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeAccountSettings)))
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 AccountSettings -> Int -> DescribeAccountSettingsResponse
DescribeAccountSettingsResponse'
            (Maybe Text
 -> Maybe AccountSettings -> Int -> DescribeAccountSettingsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe AccountSettings -> Int -> DescribeAccountSettingsResponse)
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
"RequestId")
            Either
  String
  (Maybe AccountSettings -> Int -> DescribeAccountSettingsResponse)
-> Either String (Maybe AccountSettings)
-> Either String (Int -> DescribeAccountSettingsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe AccountSettings)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AccountSettings")
            Either String (Int -> DescribeAccountSettingsResponse)
-> Either String Int
-> Either String DescribeAccountSettingsResponse
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 DescribeAccountSettings

instance Prelude.NFData DescribeAccountSettings

instance Core.ToHeaders DescribeAccountSettings where
  toHeaders :: DescribeAccountSettings -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeAccountSettings -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath DescribeAccountSettings where
  toPath :: DescribeAccountSettings -> ByteString
toPath DescribeAccountSettings' {Text
awsAccountId :: Text
$sel:awsAccountId:DescribeAccountSettings' :: DescribeAccountSettings -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/accounts/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
awsAccountId, ByteString
"/settings"]

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

-- | /See:/ 'newDescribeAccountSettingsResponse' smart constructor.
data DescribeAccountSettingsResponse = DescribeAccountSettingsResponse'
  { -- | The Amazon Web Services request ID for this operation.
    DescribeAccountSettingsResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon QuickSight settings for this Amazon Web Services account.
    -- This information includes the edition of Amazon Amazon QuickSight that
    -- you subscribed to (Standard or Enterprise) and the notification email
    -- for the Amazon QuickSight subscription. In the Amazon QuickSight
    -- console, the Amazon QuickSight subscription is sometimes referred to as
    -- a Amazon QuickSight \"account\" even though it\'s technically not an
    -- account by itself. Instead, it\'s a subscription to the Amazon
    -- QuickSight service for your Amazon Web Services account. The edition
    -- that you subscribe to applies to Amazon QuickSight in every Amazon Web
    -- Services Region where you use it.
    DescribeAccountSettingsResponse -> Maybe AccountSettings
accountSettings :: Prelude.Maybe AccountSettings,
    -- | The HTTP status of the request.
    DescribeAccountSettingsResponse -> Int
status :: Prelude.Int
  }
  deriving (DescribeAccountSettingsResponse
-> DescribeAccountSettingsResponse -> Bool
(DescribeAccountSettingsResponse
 -> DescribeAccountSettingsResponse -> Bool)
-> (DescribeAccountSettingsResponse
    -> DescribeAccountSettingsResponse -> Bool)
-> Eq DescribeAccountSettingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAccountSettingsResponse
-> DescribeAccountSettingsResponse -> Bool
$c/= :: DescribeAccountSettingsResponse
-> DescribeAccountSettingsResponse -> Bool
== :: DescribeAccountSettingsResponse
-> DescribeAccountSettingsResponse -> Bool
$c== :: DescribeAccountSettingsResponse
-> DescribeAccountSettingsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAccountSettingsResponse]
ReadPrec DescribeAccountSettingsResponse
Int -> ReadS DescribeAccountSettingsResponse
ReadS [DescribeAccountSettingsResponse]
(Int -> ReadS DescribeAccountSettingsResponse)
-> ReadS [DescribeAccountSettingsResponse]
-> ReadPrec DescribeAccountSettingsResponse
-> ReadPrec [DescribeAccountSettingsResponse]
-> Read DescribeAccountSettingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAccountSettingsResponse]
$creadListPrec :: ReadPrec [DescribeAccountSettingsResponse]
readPrec :: ReadPrec DescribeAccountSettingsResponse
$creadPrec :: ReadPrec DescribeAccountSettingsResponse
readList :: ReadS [DescribeAccountSettingsResponse]
$creadList :: ReadS [DescribeAccountSettingsResponse]
readsPrec :: Int -> ReadS DescribeAccountSettingsResponse
$creadsPrec :: Int -> ReadS DescribeAccountSettingsResponse
Prelude.Read, Int -> DescribeAccountSettingsResponse -> ShowS
[DescribeAccountSettingsResponse] -> ShowS
DescribeAccountSettingsResponse -> String
(Int -> DescribeAccountSettingsResponse -> ShowS)
-> (DescribeAccountSettingsResponse -> String)
-> ([DescribeAccountSettingsResponse] -> ShowS)
-> Show DescribeAccountSettingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAccountSettingsResponse] -> ShowS
$cshowList :: [DescribeAccountSettingsResponse] -> ShowS
show :: DescribeAccountSettingsResponse -> String
$cshow :: DescribeAccountSettingsResponse -> String
showsPrec :: Int -> DescribeAccountSettingsResponse -> ShowS
$cshowsPrec :: Int -> DescribeAccountSettingsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeAccountSettingsResponse
 -> Rep DescribeAccountSettingsResponse x)
-> (forall x.
    Rep DescribeAccountSettingsResponse x
    -> DescribeAccountSettingsResponse)
-> Generic DescribeAccountSettingsResponse
forall x.
Rep DescribeAccountSettingsResponse x
-> DescribeAccountSettingsResponse
forall x.
DescribeAccountSettingsResponse
-> Rep DescribeAccountSettingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAccountSettingsResponse x
-> DescribeAccountSettingsResponse
$cfrom :: forall x.
DescribeAccountSettingsResponse
-> Rep DescribeAccountSettingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAccountSettingsResponse' 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:
--
-- 'requestId', 'describeAccountSettingsResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'accountSettings', 'describeAccountSettingsResponse_accountSettings' - The Amazon QuickSight settings for this Amazon Web Services account.
-- This information includes the edition of Amazon Amazon QuickSight that
-- you subscribed to (Standard or Enterprise) and the notification email
-- for the Amazon QuickSight subscription. In the Amazon QuickSight
-- console, the Amazon QuickSight subscription is sometimes referred to as
-- a Amazon QuickSight \"account\" even though it\'s technically not an
-- account by itself. Instead, it\'s a subscription to the Amazon
-- QuickSight service for your Amazon Web Services account. The edition
-- that you subscribe to applies to Amazon QuickSight in every Amazon Web
-- Services Region where you use it.
--
-- 'status', 'describeAccountSettingsResponse_status' - The HTTP status of the request.
newDescribeAccountSettingsResponse ::
  -- | 'status'
  Prelude.Int ->
  DescribeAccountSettingsResponse
newDescribeAccountSettingsResponse :: Int -> DescribeAccountSettingsResponse
newDescribeAccountSettingsResponse Int
pStatus_ =
  DescribeAccountSettingsResponse' :: Maybe Text
-> Maybe AccountSettings -> Int -> DescribeAccountSettingsResponse
DescribeAccountSettingsResponse'
    { $sel:requestId:DescribeAccountSettingsResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:accountSettings:DescribeAccountSettingsResponse' :: Maybe AccountSettings
accountSettings = Maybe AccountSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:status:DescribeAccountSettingsResponse' :: Int
status = Int
pStatus_
    }

-- | The Amazon Web Services request ID for this operation.
describeAccountSettingsResponse_requestId :: Lens.Lens' DescribeAccountSettingsResponse (Prelude.Maybe Prelude.Text)
describeAccountSettingsResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> DescribeAccountSettingsResponse
-> f DescribeAccountSettingsResponse
describeAccountSettingsResponse_requestId = (DescribeAccountSettingsResponse -> Maybe Text)
-> (DescribeAccountSettingsResponse
    -> Maybe Text -> DescribeAccountSettingsResponse)
-> Lens
     DescribeAccountSettingsResponse
     DescribeAccountSettingsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccountSettingsResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:DescribeAccountSettingsResponse' :: DescribeAccountSettingsResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: DescribeAccountSettingsResponse
s@DescribeAccountSettingsResponse' {} Maybe Text
a -> DescribeAccountSettingsResponse
s {$sel:requestId:DescribeAccountSettingsResponse' :: Maybe Text
requestId = Maybe Text
a} :: DescribeAccountSettingsResponse)

-- | The Amazon QuickSight settings for this Amazon Web Services account.
-- This information includes the edition of Amazon Amazon QuickSight that
-- you subscribed to (Standard or Enterprise) and the notification email
-- for the Amazon QuickSight subscription. In the Amazon QuickSight
-- console, the Amazon QuickSight subscription is sometimes referred to as
-- a Amazon QuickSight \"account\" even though it\'s technically not an
-- account by itself. Instead, it\'s a subscription to the Amazon
-- QuickSight service for your Amazon Web Services account. The edition
-- that you subscribe to applies to Amazon QuickSight in every Amazon Web
-- Services Region where you use it.
describeAccountSettingsResponse_accountSettings :: Lens.Lens' DescribeAccountSettingsResponse (Prelude.Maybe AccountSettings)
describeAccountSettingsResponse_accountSettings :: (Maybe AccountSettings -> f (Maybe AccountSettings))
-> DescribeAccountSettingsResponse
-> f DescribeAccountSettingsResponse
describeAccountSettingsResponse_accountSettings = (DescribeAccountSettingsResponse -> Maybe AccountSettings)
-> (DescribeAccountSettingsResponse
    -> Maybe AccountSettings -> DescribeAccountSettingsResponse)
-> Lens
     DescribeAccountSettingsResponse
     DescribeAccountSettingsResponse
     (Maybe AccountSettings)
     (Maybe AccountSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccountSettingsResponse' {Maybe AccountSettings
accountSettings :: Maybe AccountSettings
$sel:accountSettings:DescribeAccountSettingsResponse' :: DescribeAccountSettingsResponse -> Maybe AccountSettings
accountSettings} -> Maybe AccountSettings
accountSettings) (\s :: DescribeAccountSettingsResponse
s@DescribeAccountSettingsResponse' {} Maybe AccountSettings
a -> DescribeAccountSettingsResponse
s {$sel:accountSettings:DescribeAccountSettingsResponse' :: Maybe AccountSettings
accountSettings = Maybe AccountSettings
a} :: DescribeAccountSettingsResponse)

-- | The HTTP status of the request.
describeAccountSettingsResponse_status :: Lens.Lens' DescribeAccountSettingsResponse Prelude.Int
describeAccountSettingsResponse_status :: (Int -> f Int)
-> DescribeAccountSettingsResponse
-> f DescribeAccountSettingsResponse
describeAccountSettingsResponse_status = (DescribeAccountSettingsResponse -> Int)
-> (DescribeAccountSettingsResponse
    -> Int -> DescribeAccountSettingsResponse)
-> Lens
     DescribeAccountSettingsResponse
     DescribeAccountSettingsResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAccountSettingsResponse' {Int
status :: Int
$sel:status:DescribeAccountSettingsResponse' :: DescribeAccountSettingsResponse -> Int
status} -> Int
status) (\s :: DescribeAccountSettingsResponse
s@DescribeAccountSettingsResponse' {} Int
a -> DescribeAccountSettingsResponse
s {$sel:status:DescribeAccountSettingsResponse' :: Int
status = Int
a} :: DescribeAccountSettingsResponse)

instance
  Prelude.NFData
    DescribeAccountSettingsResponse