{-# 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.FMS.GetAdminAccount
-- 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 Organizations account that is associated with Firewall
-- Manager as the Firewall Manager administrator.
module Amazonka.FMS.GetAdminAccount
  ( -- * Creating a Request
    GetAdminAccount (..),
    newGetAdminAccount,

    -- * Destructuring the Response
    GetAdminAccountResponse (..),
    newGetAdminAccountResponse,

    -- * Response Lenses
    getAdminAccountResponse_adminAccount,
    getAdminAccountResponse_roleStatus,
    getAdminAccountResponse_httpStatus,
  )
where

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

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

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

instance Core.AWSRequest GetAdminAccount where
  type
    AWSResponse GetAdminAccount =
      GetAdminAccountResponse
  request :: (Service -> Service) -> GetAdminAccount -> Request GetAdminAccount
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 GetAdminAccount
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAdminAccount)))
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 AccountRoleStatus -> Int -> GetAdminAccountResponse
GetAdminAccountResponse'
            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
"AdminAccount")
            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
"RoleStatus")
            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 GetAdminAccount where
  hashWithSalt :: Int -> GetAdminAccount -> Int
hashWithSalt Int
_salt GetAdminAccount
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

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

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

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

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

-- | /See:/ 'newGetAdminAccountResponse' smart constructor.
data GetAdminAccountResponse = GetAdminAccountResponse'
  { -- | The Amazon Web Services account that is set as the Firewall Manager
    -- administrator.
    GetAdminAccountResponse -> Maybe Text
adminAccount :: Prelude.Maybe Prelude.Text,
    -- | The status of the Amazon Web Services account that you set as the
    -- Firewall Manager administrator.
    GetAdminAccountResponse -> Maybe AccountRoleStatus
roleStatus :: Prelude.Maybe AccountRoleStatus,
    -- | The response's http status code.
    GetAdminAccountResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetAdminAccountResponse -> GetAdminAccountResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAdminAccountResponse -> GetAdminAccountResponse -> Bool
$c/= :: GetAdminAccountResponse -> GetAdminAccountResponse -> Bool
== :: GetAdminAccountResponse -> GetAdminAccountResponse -> Bool
$c== :: GetAdminAccountResponse -> GetAdminAccountResponse -> Bool
Prelude.Eq, ReadPrec [GetAdminAccountResponse]
ReadPrec GetAdminAccountResponse
Int -> ReadS GetAdminAccountResponse
ReadS [GetAdminAccountResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAdminAccountResponse]
$creadListPrec :: ReadPrec [GetAdminAccountResponse]
readPrec :: ReadPrec GetAdminAccountResponse
$creadPrec :: ReadPrec GetAdminAccountResponse
readList :: ReadS [GetAdminAccountResponse]
$creadList :: ReadS [GetAdminAccountResponse]
readsPrec :: Int -> ReadS GetAdminAccountResponse
$creadsPrec :: Int -> ReadS GetAdminAccountResponse
Prelude.Read, Int -> GetAdminAccountResponse -> ShowS
[GetAdminAccountResponse] -> ShowS
GetAdminAccountResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAdminAccountResponse] -> ShowS
$cshowList :: [GetAdminAccountResponse] -> ShowS
show :: GetAdminAccountResponse -> String
$cshow :: GetAdminAccountResponse -> String
showsPrec :: Int -> GetAdminAccountResponse -> ShowS
$cshowsPrec :: Int -> GetAdminAccountResponse -> ShowS
Prelude.Show, forall x. Rep GetAdminAccountResponse x -> GetAdminAccountResponse
forall x. GetAdminAccountResponse -> Rep GetAdminAccountResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAdminAccountResponse x -> GetAdminAccountResponse
$cfrom :: forall x. GetAdminAccountResponse -> Rep GetAdminAccountResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetAdminAccountResponse' 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:
--
-- 'adminAccount', 'getAdminAccountResponse_adminAccount' - The Amazon Web Services account that is set as the Firewall Manager
-- administrator.
--
-- 'roleStatus', 'getAdminAccountResponse_roleStatus' - The status of the Amazon Web Services account that you set as the
-- Firewall Manager administrator.
--
-- 'httpStatus', 'getAdminAccountResponse_httpStatus' - The response's http status code.
newGetAdminAccountResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetAdminAccountResponse
newGetAdminAccountResponse :: Int -> GetAdminAccountResponse
newGetAdminAccountResponse Int
pHttpStatus_ =
  GetAdminAccountResponse'
    { $sel:adminAccount:GetAdminAccountResponse' :: Maybe Text
adminAccount =
        forall a. Maybe a
Prelude.Nothing,
      $sel:roleStatus:GetAdminAccountResponse' :: Maybe AccountRoleStatus
roleStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetAdminAccountResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Web Services account that is set as the Firewall Manager
-- administrator.
getAdminAccountResponse_adminAccount :: Lens.Lens' GetAdminAccountResponse (Prelude.Maybe Prelude.Text)
getAdminAccountResponse_adminAccount :: Lens' GetAdminAccountResponse (Maybe Text)
getAdminAccountResponse_adminAccount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAdminAccountResponse' {Maybe Text
adminAccount :: Maybe Text
$sel:adminAccount:GetAdminAccountResponse' :: GetAdminAccountResponse -> Maybe Text
adminAccount} -> Maybe Text
adminAccount) (\s :: GetAdminAccountResponse
s@GetAdminAccountResponse' {} Maybe Text
a -> GetAdminAccountResponse
s {$sel:adminAccount:GetAdminAccountResponse' :: Maybe Text
adminAccount = Maybe Text
a} :: GetAdminAccountResponse)

-- | The status of the Amazon Web Services account that you set as the
-- Firewall Manager administrator.
getAdminAccountResponse_roleStatus :: Lens.Lens' GetAdminAccountResponse (Prelude.Maybe AccountRoleStatus)
getAdminAccountResponse_roleStatus :: Lens' GetAdminAccountResponse (Maybe AccountRoleStatus)
getAdminAccountResponse_roleStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAdminAccountResponse' {Maybe AccountRoleStatus
roleStatus :: Maybe AccountRoleStatus
$sel:roleStatus:GetAdminAccountResponse' :: GetAdminAccountResponse -> Maybe AccountRoleStatus
roleStatus} -> Maybe AccountRoleStatus
roleStatus) (\s :: GetAdminAccountResponse
s@GetAdminAccountResponse' {} Maybe AccountRoleStatus
a -> GetAdminAccountResponse
s {$sel:roleStatus:GetAdminAccountResponse' :: Maybe AccountRoleStatus
roleStatus = Maybe AccountRoleStatus
a} :: GetAdminAccountResponse)

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

instance Prelude.NFData GetAdminAccountResponse where
  rnf :: GetAdminAccountResponse -> ()
rnf GetAdminAccountResponse' {Int
Maybe Text
Maybe AccountRoleStatus
httpStatus :: Int
roleStatus :: Maybe AccountRoleStatus
adminAccount :: Maybe Text
$sel:httpStatus:GetAdminAccountResponse' :: GetAdminAccountResponse -> Int
$sel:roleStatus:GetAdminAccountResponse' :: GetAdminAccountResponse -> Maybe AccountRoleStatus
$sel:adminAccount:GetAdminAccountResponse' :: GetAdminAccountResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
adminAccount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AccountRoleStatus
roleStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus