{-# 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.Route53RecoveryReadiness.CreateCrossAccountAuthorization
(
CreateCrossAccountAuthorization (..),
newCreateCrossAccountAuthorization,
createCrossAccountAuthorization_crossAccountAuthorization,
CreateCrossAccountAuthorizationResponse (..),
newCreateCrossAccountAuthorizationResponse,
createCrossAccountAuthorizationResponse_crossAccountAuthorization,
createCrossAccountAuthorizationResponse_httpStatus,
)
where
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
import Amazonka.Route53RecoveryReadiness.Types
data CreateCrossAccountAuthorization = CreateCrossAccountAuthorization'
{
CreateCrossAccountAuthorization -> Text
crossAccountAuthorization :: Prelude.Text
}
deriving (CreateCrossAccountAuthorization
-> CreateCrossAccountAuthorization -> Bool
(CreateCrossAccountAuthorization
-> CreateCrossAccountAuthorization -> Bool)
-> (CreateCrossAccountAuthorization
-> CreateCrossAccountAuthorization -> Bool)
-> Eq CreateCrossAccountAuthorization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCrossAccountAuthorization
-> CreateCrossAccountAuthorization -> Bool
$c/= :: CreateCrossAccountAuthorization
-> CreateCrossAccountAuthorization -> Bool
== :: CreateCrossAccountAuthorization
-> CreateCrossAccountAuthorization -> Bool
$c== :: CreateCrossAccountAuthorization
-> CreateCrossAccountAuthorization -> Bool
Prelude.Eq, ReadPrec [CreateCrossAccountAuthorization]
ReadPrec CreateCrossAccountAuthorization
Int -> ReadS CreateCrossAccountAuthorization
ReadS [CreateCrossAccountAuthorization]
(Int -> ReadS CreateCrossAccountAuthorization)
-> ReadS [CreateCrossAccountAuthorization]
-> ReadPrec CreateCrossAccountAuthorization
-> ReadPrec [CreateCrossAccountAuthorization]
-> Read CreateCrossAccountAuthorization
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCrossAccountAuthorization]
$creadListPrec :: ReadPrec [CreateCrossAccountAuthorization]
readPrec :: ReadPrec CreateCrossAccountAuthorization
$creadPrec :: ReadPrec CreateCrossAccountAuthorization
readList :: ReadS [CreateCrossAccountAuthorization]
$creadList :: ReadS [CreateCrossAccountAuthorization]
readsPrec :: Int -> ReadS CreateCrossAccountAuthorization
$creadsPrec :: Int -> ReadS CreateCrossAccountAuthorization
Prelude.Read, Int -> CreateCrossAccountAuthorization -> ShowS
[CreateCrossAccountAuthorization] -> ShowS
CreateCrossAccountAuthorization -> String
(Int -> CreateCrossAccountAuthorization -> ShowS)
-> (CreateCrossAccountAuthorization -> String)
-> ([CreateCrossAccountAuthorization] -> ShowS)
-> Show CreateCrossAccountAuthorization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCrossAccountAuthorization] -> ShowS
$cshowList :: [CreateCrossAccountAuthorization] -> ShowS
show :: CreateCrossAccountAuthorization -> String
$cshow :: CreateCrossAccountAuthorization -> String
showsPrec :: Int -> CreateCrossAccountAuthorization -> ShowS
$cshowsPrec :: Int -> CreateCrossAccountAuthorization -> ShowS
Prelude.Show, (forall x.
CreateCrossAccountAuthorization
-> Rep CreateCrossAccountAuthorization x)
-> (forall x.
Rep CreateCrossAccountAuthorization x
-> CreateCrossAccountAuthorization)
-> Generic CreateCrossAccountAuthorization
forall x.
Rep CreateCrossAccountAuthorization x
-> CreateCrossAccountAuthorization
forall x.
CreateCrossAccountAuthorization
-> Rep CreateCrossAccountAuthorization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCrossAccountAuthorization x
-> CreateCrossAccountAuthorization
$cfrom :: forall x.
CreateCrossAccountAuthorization
-> Rep CreateCrossAccountAuthorization x
Prelude.Generic)
newCreateCrossAccountAuthorization ::
Prelude.Text ->
CreateCrossAccountAuthorization
newCreateCrossAccountAuthorization :: Text -> CreateCrossAccountAuthorization
newCreateCrossAccountAuthorization
Text
pCrossAccountAuthorization_ =
CreateCrossAccountAuthorization' :: Text -> CreateCrossAccountAuthorization
CreateCrossAccountAuthorization'
{ $sel:crossAccountAuthorization:CreateCrossAccountAuthorization' :: Text
crossAccountAuthorization =
Text
pCrossAccountAuthorization_
}
createCrossAccountAuthorization_crossAccountAuthorization :: Lens.Lens' CreateCrossAccountAuthorization Prelude.Text
createCrossAccountAuthorization_crossAccountAuthorization :: (Text -> f Text)
-> CreateCrossAccountAuthorization
-> f CreateCrossAccountAuthorization
createCrossAccountAuthorization_crossAccountAuthorization = (CreateCrossAccountAuthorization -> Text)
-> (CreateCrossAccountAuthorization
-> Text -> CreateCrossAccountAuthorization)
-> Lens
CreateCrossAccountAuthorization
CreateCrossAccountAuthorization
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCrossAccountAuthorization' {Text
crossAccountAuthorization :: Text
$sel:crossAccountAuthorization:CreateCrossAccountAuthorization' :: CreateCrossAccountAuthorization -> Text
crossAccountAuthorization} -> Text
crossAccountAuthorization) (\s :: CreateCrossAccountAuthorization
s@CreateCrossAccountAuthorization' {} Text
a -> CreateCrossAccountAuthorization
s {$sel:crossAccountAuthorization:CreateCrossAccountAuthorization' :: Text
crossAccountAuthorization = Text
a} :: CreateCrossAccountAuthorization)
instance
Core.AWSRequest
CreateCrossAccountAuthorization
where
type
AWSResponse CreateCrossAccountAuthorization =
CreateCrossAccountAuthorizationResponse
request :: CreateCrossAccountAuthorization
-> Request CreateCrossAccountAuthorization
request = Service
-> CreateCrossAccountAuthorization
-> Request CreateCrossAccountAuthorization
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateCrossAccountAuthorization
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse CreateCrossAccountAuthorization)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateCrossAccountAuthorization))
-> Logger
-> Service
-> Proxy CreateCrossAccountAuthorization
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse CreateCrossAccountAuthorization)))
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 -> Int -> CreateCrossAccountAuthorizationResponse
CreateCrossAccountAuthorizationResponse'
(Maybe Text -> Int -> CreateCrossAccountAuthorizationResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateCrossAccountAuthorizationResponse)
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
"crossAccountAuthorization")
Either String (Int -> CreateCrossAccountAuthorizationResponse)
-> Either String Int
-> Either String CreateCrossAccountAuthorizationResponse
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
CreateCrossAccountAuthorization
instance
Prelude.NFData
CreateCrossAccountAuthorization
instance
Core.ToHeaders
CreateCrossAccountAuthorization
where
toHeaders :: CreateCrossAccountAuthorization -> ResponseHeaders
toHeaders =
ResponseHeaders
-> CreateCrossAccountAuthorization -> 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.ToJSON CreateCrossAccountAuthorization where
toJSON :: CreateCrossAccountAuthorization -> Value
toJSON CreateCrossAccountAuthorization' {Text
crossAccountAuthorization :: Text
$sel:crossAccountAuthorization:CreateCrossAccountAuthorization' :: CreateCrossAccountAuthorization -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"crossAccountAuthorization"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
crossAccountAuthorization
)
]
)
instance Core.ToPath CreateCrossAccountAuthorization where
toPath :: CreateCrossAccountAuthorization -> ByteString
toPath = ByteString -> CreateCrossAccountAuthorization -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/crossaccountauthorizations"
instance Core.ToQuery CreateCrossAccountAuthorization where
toQuery :: CreateCrossAccountAuthorization -> QueryString
toQuery = QueryString -> CreateCrossAccountAuthorization -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateCrossAccountAuthorizationResponse = CreateCrossAccountAuthorizationResponse'
{
CreateCrossAccountAuthorizationResponse -> Maybe Text
crossAccountAuthorization :: Prelude.Maybe Prelude.Text,
CreateCrossAccountAuthorizationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateCrossAccountAuthorizationResponse
-> CreateCrossAccountAuthorizationResponse -> Bool
(CreateCrossAccountAuthorizationResponse
-> CreateCrossAccountAuthorizationResponse -> Bool)
-> (CreateCrossAccountAuthorizationResponse
-> CreateCrossAccountAuthorizationResponse -> Bool)
-> Eq CreateCrossAccountAuthorizationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCrossAccountAuthorizationResponse
-> CreateCrossAccountAuthorizationResponse -> Bool
$c/= :: CreateCrossAccountAuthorizationResponse
-> CreateCrossAccountAuthorizationResponse -> Bool
== :: CreateCrossAccountAuthorizationResponse
-> CreateCrossAccountAuthorizationResponse -> Bool
$c== :: CreateCrossAccountAuthorizationResponse
-> CreateCrossAccountAuthorizationResponse -> Bool
Prelude.Eq, ReadPrec [CreateCrossAccountAuthorizationResponse]
ReadPrec CreateCrossAccountAuthorizationResponse
Int -> ReadS CreateCrossAccountAuthorizationResponse
ReadS [CreateCrossAccountAuthorizationResponse]
(Int -> ReadS CreateCrossAccountAuthorizationResponse)
-> ReadS [CreateCrossAccountAuthorizationResponse]
-> ReadPrec CreateCrossAccountAuthorizationResponse
-> ReadPrec [CreateCrossAccountAuthorizationResponse]
-> Read CreateCrossAccountAuthorizationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCrossAccountAuthorizationResponse]
$creadListPrec :: ReadPrec [CreateCrossAccountAuthorizationResponse]
readPrec :: ReadPrec CreateCrossAccountAuthorizationResponse
$creadPrec :: ReadPrec CreateCrossAccountAuthorizationResponse
readList :: ReadS [CreateCrossAccountAuthorizationResponse]
$creadList :: ReadS [CreateCrossAccountAuthorizationResponse]
readsPrec :: Int -> ReadS CreateCrossAccountAuthorizationResponse
$creadsPrec :: Int -> ReadS CreateCrossAccountAuthorizationResponse
Prelude.Read, Int -> CreateCrossAccountAuthorizationResponse -> ShowS
[CreateCrossAccountAuthorizationResponse] -> ShowS
CreateCrossAccountAuthorizationResponse -> String
(Int -> CreateCrossAccountAuthorizationResponse -> ShowS)
-> (CreateCrossAccountAuthorizationResponse -> String)
-> ([CreateCrossAccountAuthorizationResponse] -> ShowS)
-> Show CreateCrossAccountAuthorizationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCrossAccountAuthorizationResponse] -> ShowS
$cshowList :: [CreateCrossAccountAuthorizationResponse] -> ShowS
show :: CreateCrossAccountAuthorizationResponse -> String
$cshow :: CreateCrossAccountAuthorizationResponse -> String
showsPrec :: Int -> CreateCrossAccountAuthorizationResponse -> ShowS
$cshowsPrec :: Int -> CreateCrossAccountAuthorizationResponse -> ShowS
Prelude.Show, (forall x.
CreateCrossAccountAuthorizationResponse
-> Rep CreateCrossAccountAuthorizationResponse x)
-> (forall x.
Rep CreateCrossAccountAuthorizationResponse x
-> CreateCrossAccountAuthorizationResponse)
-> Generic CreateCrossAccountAuthorizationResponse
forall x.
Rep CreateCrossAccountAuthorizationResponse x
-> CreateCrossAccountAuthorizationResponse
forall x.
CreateCrossAccountAuthorizationResponse
-> Rep CreateCrossAccountAuthorizationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCrossAccountAuthorizationResponse x
-> CreateCrossAccountAuthorizationResponse
$cfrom :: forall x.
CreateCrossAccountAuthorizationResponse
-> Rep CreateCrossAccountAuthorizationResponse x
Prelude.Generic)
newCreateCrossAccountAuthorizationResponse ::
Prelude.Int ->
CreateCrossAccountAuthorizationResponse
newCreateCrossAccountAuthorizationResponse :: Int -> CreateCrossAccountAuthorizationResponse
newCreateCrossAccountAuthorizationResponse
Int
pHttpStatus_ =
CreateCrossAccountAuthorizationResponse' :: Maybe Text -> Int -> CreateCrossAccountAuthorizationResponse
CreateCrossAccountAuthorizationResponse'
{ $sel:crossAccountAuthorization:CreateCrossAccountAuthorizationResponse' :: Maybe Text
crossAccountAuthorization =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateCrossAccountAuthorizationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createCrossAccountAuthorizationResponse_crossAccountAuthorization :: Lens.Lens' CreateCrossAccountAuthorizationResponse (Prelude.Maybe Prelude.Text)
createCrossAccountAuthorizationResponse_crossAccountAuthorization :: (Maybe Text -> f (Maybe Text))
-> CreateCrossAccountAuthorizationResponse
-> f CreateCrossAccountAuthorizationResponse
createCrossAccountAuthorizationResponse_crossAccountAuthorization = (CreateCrossAccountAuthorizationResponse -> Maybe Text)
-> (CreateCrossAccountAuthorizationResponse
-> Maybe Text -> CreateCrossAccountAuthorizationResponse)
-> Lens
CreateCrossAccountAuthorizationResponse
CreateCrossAccountAuthorizationResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCrossAccountAuthorizationResponse' {Maybe Text
crossAccountAuthorization :: Maybe Text
$sel:crossAccountAuthorization:CreateCrossAccountAuthorizationResponse' :: CreateCrossAccountAuthorizationResponse -> Maybe Text
crossAccountAuthorization} -> Maybe Text
crossAccountAuthorization) (\s :: CreateCrossAccountAuthorizationResponse
s@CreateCrossAccountAuthorizationResponse' {} Maybe Text
a -> CreateCrossAccountAuthorizationResponse
s {$sel:crossAccountAuthorization:CreateCrossAccountAuthorizationResponse' :: Maybe Text
crossAccountAuthorization = Maybe Text
a} :: CreateCrossAccountAuthorizationResponse)
createCrossAccountAuthorizationResponse_httpStatus :: Lens.Lens' CreateCrossAccountAuthorizationResponse Prelude.Int
createCrossAccountAuthorizationResponse_httpStatus :: (Int -> f Int)
-> CreateCrossAccountAuthorizationResponse
-> f CreateCrossAccountAuthorizationResponse
createCrossAccountAuthorizationResponse_httpStatus = (CreateCrossAccountAuthorizationResponse -> Int)
-> (CreateCrossAccountAuthorizationResponse
-> Int -> CreateCrossAccountAuthorizationResponse)
-> Lens
CreateCrossAccountAuthorizationResponse
CreateCrossAccountAuthorizationResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCrossAccountAuthorizationResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateCrossAccountAuthorizationResponse' :: CreateCrossAccountAuthorizationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateCrossAccountAuthorizationResponse
s@CreateCrossAccountAuthorizationResponse' {} Int
a -> CreateCrossAccountAuthorizationResponse
s {$sel:httpStatus:CreateCrossAccountAuthorizationResponse' :: Int
httpStatus = Int
a} :: CreateCrossAccountAuthorizationResponse)
instance
Prelude.NFData
CreateCrossAccountAuthorizationResponse