{-# 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.AuditManager.GetAccountStatus
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns the registration status of an account in Audit Manager.
module Amazonka.AuditManager.GetAccountStatus
  ( -- * Creating a Request
    GetAccountStatus (..),
    newGetAccountStatus,

    -- * Destructuring the Response
    GetAccountStatusResponse (..),
    newGetAccountStatusResponse,

    -- * Response Lenses
    getAccountStatusResponse_status,
    getAccountStatusResponse_httpStatus,
  )
where

import Amazonka.AuditManager.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetAccountStatus' smart constructor.
data GetAccountStatus = GetAccountStatus'
  {
  }
  deriving (GetAccountStatus -> GetAccountStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAccountStatus -> GetAccountStatus -> Bool
$c/= :: GetAccountStatus -> GetAccountStatus -> Bool
== :: GetAccountStatus -> GetAccountStatus -> Bool
$c== :: GetAccountStatus -> GetAccountStatus -> Bool
Prelude.Eq, ReadPrec [GetAccountStatus]
ReadPrec GetAccountStatus
Int -> ReadS GetAccountStatus
ReadS [GetAccountStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAccountStatus]
$creadListPrec :: ReadPrec [GetAccountStatus]
readPrec :: ReadPrec GetAccountStatus
$creadPrec :: ReadPrec GetAccountStatus
readList :: ReadS [GetAccountStatus]
$creadList :: ReadS [GetAccountStatus]
readsPrec :: Int -> ReadS GetAccountStatus
$creadsPrec :: Int -> ReadS GetAccountStatus
Prelude.Read, Int -> GetAccountStatus -> ShowS
[GetAccountStatus] -> ShowS
GetAccountStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAccountStatus] -> ShowS
$cshowList :: [GetAccountStatus] -> ShowS
show :: GetAccountStatus -> String
$cshow :: GetAccountStatus -> String
showsPrec :: Int -> GetAccountStatus -> ShowS
$cshowsPrec :: Int -> GetAccountStatus -> ShowS
Prelude.Show, forall x. Rep GetAccountStatus x -> GetAccountStatus
forall x. GetAccountStatus -> Rep GetAccountStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAccountStatus x -> GetAccountStatus
$cfrom :: forall x. GetAccountStatus -> Rep GetAccountStatus x
Prelude.Generic)

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

instance Core.AWSRequest GetAccountStatus where
  type
    AWSResponse GetAccountStatus =
      GetAccountStatusResponse
  request :: (Service -> Service)
-> GetAccountStatus -> Request GetAccountStatus
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetAccountStatus
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAccountStatus)))
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 AccountStatus -> Int -> GetAccountStatusResponse
GetAccountStatusResponse'
            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
"status")
            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 GetAccountStatus where
  hashWithSalt :: Int -> GetAccountStatus -> Int
hashWithSalt Int
_salt GetAccountStatus
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

instance Prelude.NFData GetAccountStatus where
  rnf :: GetAccountStatus -> ()
rnf GetAccountStatus
_ = ()

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

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

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

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

-- |
-- Create a value of 'GetAccountStatusResponse' 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:
--
-- 'status', 'getAccountStatusResponse_status' - The status of the Amazon Web Services account.
--
-- 'httpStatus', 'getAccountStatusResponse_httpStatus' - The response's http status code.
newGetAccountStatusResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetAccountStatusResponse
newGetAccountStatusResponse :: Int -> GetAccountStatusResponse
newGetAccountStatusResponse Int
pHttpStatus_ =
  GetAccountStatusResponse'
    { $sel:status:GetAccountStatusResponse' :: Maybe AccountStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetAccountStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The status of the Amazon Web Services account.
getAccountStatusResponse_status :: Lens.Lens' GetAccountStatusResponse (Prelude.Maybe AccountStatus)
getAccountStatusResponse_status :: Lens' GetAccountStatusResponse (Maybe AccountStatus)
getAccountStatusResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAccountStatusResponse' {Maybe AccountStatus
status :: Maybe AccountStatus
$sel:status:GetAccountStatusResponse' :: GetAccountStatusResponse -> Maybe AccountStatus
status} -> Maybe AccountStatus
status) (\s :: GetAccountStatusResponse
s@GetAccountStatusResponse' {} Maybe AccountStatus
a -> GetAccountStatusResponse
s {$sel:status:GetAccountStatusResponse' :: Maybe AccountStatus
status = Maybe AccountStatus
a} :: GetAccountStatusResponse)

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

instance Prelude.NFData GetAccountStatusResponse where
  rnf :: GetAccountStatusResponse -> ()
rnf GetAccountStatusResponse' {Int
Maybe AccountStatus
httpStatus :: Int
status :: Maybe AccountStatus
$sel:httpStatus:GetAccountStatusResponse' :: GetAccountStatusResponse -> Int
$sel:status:GetAccountStatusResponse' :: GetAccountStatusResponse -> Maybe AccountStatus
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AccountStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus