{-# 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-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 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 Amazonka.FMS.Types
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:/ 'newGetAdminAccount' smart constructor.
data GetAdminAccount = GetAdminAccount'
  {
  }
  deriving (GetAdminAccount -> GetAdminAccount -> Bool
(GetAdminAccount -> GetAdminAccount -> Bool)
-> (GetAdminAccount -> GetAdminAccount -> Bool)
-> Eq GetAdminAccount
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]
(Int -> ReadS GetAdminAccount)
-> ReadS [GetAdminAccount]
-> ReadPrec GetAdminAccount
-> ReadPrec [GetAdminAccount]
-> Read 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
(Int -> GetAdminAccount -> ShowS)
-> (GetAdminAccount -> String)
-> ([GetAdminAccount] -> ShowS)
-> Show GetAdminAccount
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. GetAdminAccount -> Rep GetAdminAccount x)
-> (forall x. Rep GetAdminAccount x -> GetAdminAccount)
-> Generic GetAdminAccount
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 :: GetAdminAccount -> Request GetAdminAccount
request = Service -> GetAdminAccount -> Request GetAdminAccount
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetAdminAccount
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAdminAccount)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetAdminAccount))
-> Logger
-> Service
-> Proxy GetAdminAccount
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAdminAccount)))
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 AccountRoleStatus -> Int -> GetAdminAccountResponse
GetAdminAccountResponse'
            (Maybe Text
 -> Maybe AccountRoleStatus -> Int -> GetAdminAccountResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe AccountRoleStatus -> Int -> GetAdminAccountResponse)
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
"AdminAccount")
            Either
  String (Maybe AccountRoleStatus -> Int -> GetAdminAccountResponse)
-> Either String (Maybe AccountRoleStatus)
-> Either String (Int -> GetAdminAccountResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe AccountRoleStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RoleStatus")
            Either String (Int -> GetAdminAccountResponse)
-> Either String Int -> Either String GetAdminAccountResponse
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 GetAdminAccount

instance Prelude.NFData GetAdminAccount

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

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

instance Core.ToQuery GetAdminAccount where
  toQuery :: GetAdminAccount -> QueryString
toQuery = QueryString -> GetAdminAccount -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetAdminAccountResponse -> GetAdminAccountResponse -> Bool)
-> (GetAdminAccountResponse -> GetAdminAccountResponse -> Bool)
-> Eq GetAdminAccountResponse
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]
(Int -> ReadS GetAdminAccountResponse)
-> ReadS [GetAdminAccountResponse]
-> ReadPrec GetAdminAccountResponse
-> ReadPrec [GetAdminAccountResponse]
-> Read 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
(Int -> GetAdminAccountResponse -> ShowS)
-> (GetAdminAccountResponse -> String)
-> ([GetAdminAccountResponse] -> ShowS)
-> Show GetAdminAccountResponse
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.
 GetAdminAccountResponse -> Rep GetAdminAccountResponse x)
-> (forall x.
    Rep GetAdminAccountResponse x -> GetAdminAccountResponse)
-> Generic GetAdminAccountResponse
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' :: Maybe Text
-> Maybe AccountRoleStatus -> Int -> GetAdminAccountResponse
GetAdminAccountResponse'
    { $sel:adminAccount:GetAdminAccountResponse' :: Maybe Text
adminAccount =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleStatus:GetAdminAccountResponse' :: Maybe AccountRoleStatus
roleStatus = Maybe AccountRoleStatus
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 :: (Maybe Text -> f (Maybe Text))
-> GetAdminAccountResponse -> f GetAdminAccountResponse
getAdminAccountResponse_adminAccount = (GetAdminAccountResponse -> Maybe Text)
-> (GetAdminAccountResponse
    -> Maybe Text -> GetAdminAccountResponse)
-> Lens
     GetAdminAccountResponse
     GetAdminAccountResponse
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe AccountRoleStatus -> f (Maybe AccountRoleStatus))
-> GetAdminAccountResponse -> f GetAdminAccountResponse
getAdminAccountResponse_roleStatus = (GetAdminAccountResponse -> Maybe AccountRoleStatus)
-> (GetAdminAccountResponse
    -> Maybe AccountRoleStatus -> GetAdminAccountResponse)
-> Lens
     GetAdminAccountResponse
     GetAdminAccountResponse
     (Maybe AccountRoleStatus)
     (Maybe AccountRoleStatus)
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 :: (Int -> f Int)
-> GetAdminAccountResponse -> f GetAdminAccountResponse
getAdminAccountResponse_httpStatus = (GetAdminAccountResponse -> Int)
-> (GetAdminAccountResponse -> Int -> GetAdminAccountResponse)
-> Lens GetAdminAccountResponse GetAdminAccountResponse Int Int
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