{-# 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 #-}
module Amazonka.MacieV2.GetMasterAccount
(
GetMasterAccount (..),
newGetMasterAccount,
GetMasterAccountResponse (..),
newGetMasterAccountResponse,
getMasterAccountResponse_master,
getMasterAccountResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetMasterAccount = GetMasterAccount'
{
}
deriving (GetMasterAccount -> GetMasterAccount -> Bool
(GetMasterAccount -> GetMasterAccount -> Bool)
-> (GetMasterAccount -> GetMasterAccount -> Bool)
-> Eq GetMasterAccount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMasterAccount -> GetMasterAccount -> Bool
$c/= :: GetMasterAccount -> GetMasterAccount -> Bool
== :: GetMasterAccount -> GetMasterAccount -> Bool
$c== :: GetMasterAccount -> GetMasterAccount -> Bool
Prelude.Eq, ReadPrec [GetMasterAccount]
ReadPrec GetMasterAccount
Int -> ReadS GetMasterAccount
ReadS [GetMasterAccount]
(Int -> ReadS GetMasterAccount)
-> ReadS [GetMasterAccount]
-> ReadPrec GetMasterAccount
-> ReadPrec [GetMasterAccount]
-> Read GetMasterAccount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMasterAccount]
$creadListPrec :: ReadPrec [GetMasterAccount]
readPrec :: ReadPrec GetMasterAccount
$creadPrec :: ReadPrec GetMasterAccount
readList :: ReadS [GetMasterAccount]
$creadList :: ReadS [GetMasterAccount]
readsPrec :: Int -> ReadS GetMasterAccount
$creadsPrec :: Int -> ReadS GetMasterAccount
Prelude.Read, Int -> GetMasterAccount -> ShowS
[GetMasterAccount] -> ShowS
GetMasterAccount -> String
(Int -> GetMasterAccount -> ShowS)
-> (GetMasterAccount -> String)
-> ([GetMasterAccount] -> ShowS)
-> Show GetMasterAccount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMasterAccount] -> ShowS
$cshowList :: [GetMasterAccount] -> ShowS
show :: GetMasterAccount -> String
$cshow :: GetMasterAccount -> String
showsPrec :: Int -> GetMasterAccount -> ShowS
$cshowsPrec :: Int -> GetMasterAccount -> ShowS
Prelude.Show, (forall x. GetMasterAccount -> Rep GetMasterAccount x)
-> (forall x. Rep GetMasterAccount x -> GetMasterAccount)
-> Generic GetMasterAccount
forall x. Rep GetMasterAccount x -> GetMasterAccount
forall x. GetMasterAccount -> Rep GetMasterAccount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMasterAccount x -> GetMasterAccount
$cfrom :: forall x. GetMasterAccount -> Rep GetMasterAccount x
Prelude.Generic)
newGetMasterAccount ::
GetMasterAccount
newGetMasterAccount :: GetMasterAccount
newGetMasterAccount = GetMasterAccount
GetMasterAccount'
instance Core.AWSRequest GetMasterAccount where
type
AWSResponse GetMasterAccount =
GetMasterAccountResponse
request :: GetMasterAccount -> Request GetMasterAccount
request = Service -> GetMasterAccount -> Request GetMasterAccount
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetMasterAccount
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMasterAccount)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetMasterAccount))
-> Logger
-> Service
-> Proxy GetMasterAccount
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMasterAccount)))
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 Invitation -> Int -> GetMasterAccountResponse
GetMasterAccountResponse'
(Maybe Invitation -> Int -> GetMasterAccountResponse)
-> Either String (Maybe Invitation)
-> Either String (Int -> GetMasterAccountResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe Invitation)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"master")
Either String (Int -> GetMasterAccountResponse)
-> Either String Int -> Either String GetMasterAccountResponse
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 GetMasterAccount
instance Prelude.NFData GetMasterAccount
instance Core.ToHeaders GetMasterAccount where
toHeaders :: GetMasterAccount -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetMasterAccount -> 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.1" ::
Prelude.ByteString
)
]
)
instance Core.ToPath GetMasterAccount where
toPath :: GetMasterAccount -> ByteString
toPath = ByteString -> GetMasterAccount -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/master"
instance Core.ToQuery GetMasterAccount where
toQuery :: GetMasterAccount -> QueryString
toQuery = QueryString -> GetMasterAccount -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetMasterAccountResponse = GetMasterAccountResponse'
{
GetMasterAccountResponse -> Maybe Invitation
master :: Prelude.Maybe Invitation,
GetMasterAccountResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetMasterAccountResponse -> GetMasterAccountResponse -> Bool
(GetMasterAccountResponse -> GetMasterAccountResponse -> Bool)
-> (GetMasterAccountResponse -> GetMasterAccountResponse -> Bool)
-> Eq GetMasterAccountResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMasterAccountResponse -> GetMasterAccountResponse -> Bool
$c/= :: GetMasterAccountResponse -> GetMasterAccountResponse -> Bool
== :: GetMasterAccountResponse -> GetMasterAccountResponse -> Bool
$c== :: GetMasterAccountResponse -> GetMasterAccountResponse -> Bool
Prelude.Eq, ReadPrec [GetMasterAccountResponse]
ReadPrec GetMasterAccountResponse
Int -> ReadS GetMasterAccountResponse
ReadS [GetMasterAccountResponse]
(Int -> ReadS GetMasterAccountResponse)
-> ReadS [GetMasterAccountResponse]
-> ReadPrec GetMasterAccountResponse
-> ReadPrec [GetMasterAccountResponse]
-> Read GetMasterAccountResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMasterAccountResponse]
$creadListPrec :: ReadPrec [GetMasterAccountResponse]
readPrec :: ReadPrec GetMasterAccountResponse
$creadPrec :: ReadPrec GetMasterAccountResponse
readList :: ReadS [GetMasterAccountResponse]
$creadList :: ReadS [GetMasterAccountResponse]
readsPrec :: Int -> ReadS GetMasterAccountResponse
$creadsPrec :: Int -> ReadS GetMasterAccountResponse
Prelude.Read, Int -> GetMasterAccountResponse -> ShowS
[GetMasterAccountResponse] -> ShowS
GetMasterAccountResponse -> String
(Int -> GetMasterAccountResponse -> ShowS)
-> (GetMasterAccountResponse -> String)
-> ([GetMasterAccountResponse] -> ShowS)
-> Show GetMasterAccountResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMasterAccountResponse] -> ShowS
$cshowList :: [GetMasterAccountResponse] -> ShowS
show :: GetMasterAccountResponse -> String
$cshow :: GetMasterAccountResponse -> String
showsPrec :: Int -> GetMasterAccountResponse -> ShowS
$cshowsPrec :: Int -> GetMasterAccountResponse -> ShowS
Prelude.Show, (forall x.
GetMasterAccountResponse -> Rep GetMasterAccountResponse x)
-> (forall x.
Rep GetMasterAccountResponse x -> GetMasterAccountResponse)
-> Generic GetMasterAccountResponse
forall x.
Rep GetMasterAccountResponse x -> GetMasterAccountResponse
forall x.
GetMasterAccountResponse -> Rep GetMasterAccountResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetMasterAccountResponse x -> GetMasterAccountResponse
$cfrom :: forall x.
GetMasterAccountResponse -> Rep GetMasterAccountResponse x
Prelude.Generic)
newGetMasterAccountResponse ::
Prelude.Int ->
GetMasterAccountResponse
newGetMasterAccountResponse :: Int -> GetMasterAccountResponse
newGetMasterAccountResponse Int
pHttpStatus_ =
GetMasterAccountResponse' :: Maybe Invitation -> Int -> GetMasterAccountResponse
GetMasterAccountResponse'
{ $sel:master:GetMasterAccountResponse' :: Maybe Invitation
master = Maybe Invitation
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetMasterAccountResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getMasterAccountResponse_master :: Lens.Lens' GetMasterAccountResponse (Prelude.Maybe Invitation)
getMasterAccountResponse_master :: (Maybe Invitation -> f (Maybe Invitation))
-> GetMasterAccountResponse -> f GetMasterAccountResponse
getMasterAccountResponse_master = (GetMasterAccountResponse -> Maybe Invitation)
-> (GetMasterAccountResponse
-> Maybe Invitation -> GetMasterAccountResponse)
-> Lens
GetMasterAccountResponse
GetMasterAccountResponse
(Maybe Invitation)
(Maybe Invitation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMasterAccountResponse' {Maybe Invitation
master :: Maybe Invitation
$sel:master:GetMasterAccountResponse' :: GetMasterAccountResponse -> Maybe Invitation
master} -> Maybe Invitation
master) (\s :: GetMasterAccountResponse
s@GetMasterAccountResponse' {} Maybe Invitation
a -> GetMasterAccountResponse
s {$sel:master:GetMasterAccountResponse' :: Maybe Invitation
master = Maybe Invitation
a} :: GetMasterAccountResponse)
getMasterAccountResponse_httpStatus :: Lens.Lens' GetMasterAccountResponse Prelude.Int
getMasterAccountResponse_httpStatus :: (Int -> f Int)
-> GetMasterAccountResponse -> f GetMasterAccountResponse
getMasterAccountResponse_httpStatus = (GetMasterAccountResponse -> Int)
-> (GetMasterAccountResponse -> Int -> GetMasterAccountResponse)
-> Lens GetMasterAccountResponse GetMasterAccountResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMasterAccountResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetMasterAccountResponse' :: GetMasterAccountResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetMasterAccountResponse
s@GetMasterAccountResponse' {} Int
a -> GetMasterAccountResponse
s {$sel:httpStatus:GetMasterAccountResponse' :: Int
httpStatus = Int
a} :: GetMasterAccountResponse)
instance Prelude.NFData GetMasterAccountResponse