{-# 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.CertificateManager.GetAccountConfiguration
-- 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)
--
-- Returns the account configuration options associated with an Amazon Web
-- Services account.
module Amazonka.CertificateManager.GetAccountConfiguration
  ( -- * Creating a Request
    GetAccountConfiguration (..),
    newGetAccountConfiguration,

    -- * Destructuring the Response
    GetAccountConfigurationResponse (..),
    newGetAccountConfigurationResponse,

    -- * Response Lenses
    getAccountConfigurationResponse_expiryEvents,
    getAccountConfigurationResponse_httpStatus,
  )
where

import Amazonka.CertificateManager.Types
import qualified Amazonka.Core as Core
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:/ 'newGetAccountConfiguration' smart constructor.
data GetAccountConfiguration = GetAccountConfiguration'
  {
  }
  deriving (GetAccountConfiguration -> GetAccountConfiguration -> Bool
(GetAccountConfiguration -> GetAccountConfiguration -> Bool)
-> (GetAccountConfiguration -> GetAccountConfiguration -> Bool)
-> Eq GetAccountConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAccountConfiguration -> GetAccountConfiguration -> Bool
$c/= :: GetAccountConfiguration -> GetAccountConfiguration -> Bool
== :: GetAccountConfiguration -> GetAccountConfiguration -> Bool
$c== :: GetAccountConfiguration -> GetAccountConfiguration -> Bool
Prelude.Eq, ReadPrec [GetAccountConfiguration]
ReadPrec GetAccountConfiguration
Int -> ReadS GetAccountConfiguration
ReadS [GetAccountConfiguration]
(Int -> ReadS GetAccountConfiguration)
-> ReadS [GetAccountConfiguration]
-> ReadPrec GetAccountConfiguration
-> ReadPrec [GetAccountConfiguration]
-> Read GetAccountConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAccountConfiguration]
$creadListPrec :: ReadPrec [GetAccountConfiguration]
readPrec :: ReadPrec GetAccountConfiguration
$creadPrec :: ReadPrec GetAccountConfiguration
readList :: ReadS [GetAccountConfiguration]
$creadList :: ReadS [GetAccountConfiguration]
readsPrec :: Int -> ReadS GetAccountConfiguration
$creadsPrec :: Int -> ReadS GetAccountConfiguration
Prelude.Read, Int -> GetAccountConfiguration -> ShowS
[GetAccountConfiguration] -> ShowS
GetAccountConfiguration -> String
(Int -> GetAccountConfiguration -> ShowS)
-> (GetAccountConfiguration -> String)
-> ([GetAccountConfiguration] -> ShowS)
-> Show GetAccountConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAccountConfiguration] -> ShowS
$cshowList :: [GetAccountConfiguration] -> ShowS
show :: GetAccountConfiguration -> String
$cshow :: GetAccountConfiguration -> String
showsPrec :: Int -> GetAccountConfiguration -> ShowS
$cshowsPrec :: Int -> GetAccountConfiguration -> ShowS
Prelude.Show, (forall x.
 GetAccountConfiguration -> Rep GetAccountConfiguration x)
-> (forall x.
    Rep GetAccountConfiguration x -> GetAccountConfiguration)
-> Generic GetAccountConfiguration
forall x. Rep GetAccountConfiguration x -> GetAccountConfiguration
forall x. GetAccountConfiguration -> Rep GetAccountConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAccountConfiguration x -> GetAccountConfiguration
$cfrom :: forall x. GetAccountConfiguration -> Rep GetAccountConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'GetAccountConfiguration' 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.
newGetAccountConfiguration ::
  GetAccountConfiguration
newGetAccountConfiguration :: GetAccountConfiguration
newGetAccountConfiguration = GetAccountConfiguration
GetAccountConfiguration'

instance Core.AWSRequest GetAccountConfiguration where
  type
    AWSResponse GetAccountConfiguration =
      GetAccountConfigurationResponse
  request :: GetAccountConfiguration -> Request GetAccountConfiguration
request = Service
-> GetAccountConfiguration -> Request GetAccountConfiguration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetAccountConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetAccountConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetAccountConfiguration))
-> Logger
-> Service
-> Proxy GetAccountConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetAccountConfiguration)))
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 ExpiryEventsConfiguration
-> Int -> GetAccountConfigurationResponse
GetAccountConfigurationResponse'
            (Maybe ExpiryEventsConfiguration
 -> Int -> GetAccountConfigurationResponse)
-> Either String (Maybe ExpiryEventsConfiguration)
-> Either String (Int -> GetAccountConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe ExpiryEventsConfiguration)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"ExpiryEvents")
            Either String (Int -> GetAccountConfigurationResponse)
-> Either String Int
-> Either String GetAccountConfigurationResponse
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 GetAccountConfiguration

instance Prelude.NFData GetAccountConfiguration

instance Core.ToHeaders GetAccountConfiguration where
  toHeaders :: GetAccountConfiguration -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetAccountConfiguration -> 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
"CertificateManager.GetAccountConfiguration" ::
                          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 GetAccountConfiguration where
  toJSON :: GetAccountConfiguration -> Value
toJSON = Value -> GetAccountConfiguration -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

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

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

-- | /See:/ 'newGetAccountConfigurationResponse' smart constructor.
data GetAccountConfigurationResponse = GetAccountConfigurationResponse'
  { -- | Expiration events configuration options associated with the Amazon Web
    -- Services account.
    GetAccountConfigurationResponse -> Maybe ExpiryEventsConfiguration
expiryEvents :: Prelude.Maybe ExpiryEventsConfiguration,
    -- | The response's http status code.
    GetAccountConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetAccountConfigurationResponse
-> GetAccountConfigurationResponse -> Bool
(GetAccountConfigurationResponse
 -> GetAccountConfigurationResponse -> Bool)
-> (GetAccountConfigurationResponse
    -> GetAccountConfigurationResponse -> Bool)
-> Eq GetAccountConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAccountConfigurationResponse
-> GetAccountConfigurationResponse -> Bool
$c/= :: GetAccountConfigurationResponse
-> GetAccountConfigurationResponse -> Bool
== :: GetAccountConfigurationResponse
-> GetAccountConfigurationResponse -> Bool
$c== :: GetAccountConfigurationResponse
-> GetAccountConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [GetAccountConfigurationResponse]
ReadPrec GetAccountConfigurationResponse
Int -> ReadS GetAccountConfigurationResponse
ReadS [GetAccountConfigurationResponse]
(Int -> ReadS GetAccountConfigurationResponse)
-> ReadS [GetAccountConfigurationResponse]
-> ReadPrec GetAccountConfigurationResponse
-> ReadPrec [GetAccountConfigurationResponse]
-> Read GetAccountConfigurationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAccountConfigurationResponse]
$creadListPrec :: ReadPrec [GetAccountConfigurationResponse]
readPrec :: ReadPrec GetAccountConfigurationResponse
$creadPrec :: ReadPrec GetAccountConfigurationResponse
readList :: ReadS [GetAccountConfigurationResponse]
$creadList :: ReadS [GetAccountConfigurationResponse]
readsPrec :: Int -> ReadS GetAccountConfigurationResponse
$creadsPrec :: Int -> ReadS GetAccountConfigurationResponse
Prelude.Read, Int -> GetAccountConfigurationResponse -> ShowS
[GetAccountConfigurationResponse] -> ShowS
GetAccountConfigurationResponse -> String
(Int -> GetAccountConfigurationResponse -> ShowS)
-> (GetAccountConfigurationResponse -> String)
-> ([GetAccountConfigurationResponse] -> ShowS)
-> Show GetAccountConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAccountConfigurationResponse] -> ShowS
$cshowList :: [GetAccountConfigurationResponse] -> ShowS
show :: GetAccountConfigurationResponse -> String
$cshow :: GetAccountConfigurationResponse -> String
showsPrec :: Int -> GetAccountConfigurationResponse -> ShowS
$cshowsPrec :: Int -> GetAccountConfigurationResponse -> ShowS
Prelude.Show, (forall x.
 GetAccountConfigurationResponse
 -> Rep GetAccountConfigurationResponse x)
-> (forall x.
    Rep GetAccountConfigurationResponse x
    -> GetAccountConfigurationResponse)
-> Generic GetAccountConfigurationResponse
forall x.
Rep GetAccountConfigurationResponse x
-> GetAccountConfigurationResponse
forall x.
GetAccountConfigurationResponse
-> Rep GetAccountConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetAccountConfigurationResponse x
-> GetAccountConfigurationResponse
$cfrom :: forall x.
GetAccountConfigurationResponse
-> Rep GetAccountConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetAccountConfigurationResponse' 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:
--
-- 'expiryEvents', 'getAccountConfigurationResponse_expiryEvents' - Expiration events configuration options associated with the Amazon Web
-- Services account.
--
-- 'httpStatus', 'getAccountConfigurationResponse_httpStatus' - The response's http status code.
newGetAccountConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetAccountConfigurationResponse
newGetAccountConfigurationResponse :: Int -> GetAccountConfigurationResponse
newGetAccountConfigurationResponse Int
pHttpStatus_ =
  GetAccountConfigurationResponse' :: Maybe ExpiryEventsConfiguration
-> Int -> GetAccountConfigurationResponse
GetAccountConfigurationResponse'
    { $sel:expiryEvents:GetAccountConfigurationResponse' :: Maybe ExpiryEventsConfiguration
expiryEvents =
        Maybe ExpiryEventsConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetAccountConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Expiration events configuration options associated with the Amazon Web
-- Services account.
getAccountConfigurationResponse_expiryEvents :: Lens.Lens' GetAccountConfigurationResponse (Prelude.Maybe ExpiryEventsConfiguration)
getAccountConfigurationResponse_expiryEvents :: (Maybe ExpiryEventsConfiguration
 -> f (Maybe ExpiryEventsConfiguration))
-> GetAccountConfigurationResponse
-> f GetAccountConfigurationResponse
getAccountConfigurationResponse_expiryEvents = (GetAccountConfigurationResponse
 -> Maybe ExpiryEventsConfiguration)
-> (GetAccountConfigurationResponse
    -> Maybe ExpiryEventsConfiguration
    -> GetAccountConfigurationResponse)
-> Lens
     GetAccountConfigurationResponse
     GetAccountConfigurationResponse
     (Maybe ExpiryEventsConfiguration)
     (Maybe ExpiryEventsConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAccountConfigurationResponse' {Maybe ExpiryEventsConfiguration
expiryEvents :: Maybe ExpiryEventsConfiguration
$sel:expiryEvents:GetAccountConfigurationResponse' :: GetAccountConfigurationResponse -> Maybe ExpiryEventsConfiguration
expiryEvents} -> Maybe ExpiryEventsConfiguration
expiryEvents) (\s :: GetAccountConfigurationResponse
s@GetAccountConfigurationResponse' {} Maybe ExpiryEventsConfiguration
a -> GetAccountConfigurationResponse
s {$sel:expiryEvents:GetAccountConfigurationResponse' :: Maybe ExpiryEventsConfiguration
expiryEvents = Maybe ExpiryEventsConfiguration
a} :: GetAccountConfigurationResponse)

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

instance
  Prelude.NFData
    GetAccountConfigurationResponse