{-# 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.SSMIncidents.CreateReplicationSet
(
CreateReplicationSet (..),
newCreateReplicationSet,
createReplicationSet_clientToken,
createReplicationSet_regions,
CreateReplicationSetResponse (..),
newCreateReplicationSetResponse,
createReplicationSetResponse_httpStatus,
createReplicationSetResponse_arn,
)
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.SSMIncidents.Types
data CreateReplicationSet = CreateReplicationSet'
{
CreateReplicationSet -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
CreateReplicationSet -> HashMap Text RegionMapInputValue
regions :: Prelude.HashMap Prelude.Text RegionMapInputValue
}
deriving (CreateReplicationSet -> CreateReplicationSet -> Bool
(CreateReplicationSet -> CreateReplicationSet -> Bool)
-> (CreateReplicationSet -> CreateReplicationSet -> Bool)
-> Eq CreateReplicationSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateReplicationSet -> CreateReplicationSet -> Bool
$c/= :: CreateReplicationSet -> CreateReplicationSet -> Bool
== :: CreateReplicationSet -> CreateReplicationSet -> Bool
$c== :: CreateReplicationSet -> CreateReplicationSet -> Bool
Prelude.Eq, ReadPrec [CreateReplicationSet]
ReadPrec CreateReplicationSet
Int -> ReadS CreateReplicationSet
ReadS [CreateReplicationSet]
(Int -> ReadS CreateReplicationSet)
-> ReadS [CreateReplicationSet]
-> ReadPrec CreateReplicationSet
-> ReadPrec [CreateReplicationSet]
-> Read CreateReplicationSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateReplicationSet]
$creadListPrec :: ReadPrec [CreateReplicationSet]
readPrec :: ReadPrec CreateReplicationSet
$creadPrec :: ReadPrec CreateReplicationSet
readList :: ReadS [CreateReplicationSet]
$creadList :: ReadS [CreateReplicationSet]
readsPrec :: Int -> ReadS CreateReplicationSet
$creadsPrec :: Int -> ReadS CreateReplicationSet
Prelude.Read, Int -> CreateReplicationSet -> ShowS
[CreateReplicationSet] -> ShowS
CreateReplicationSet -> String
(Int -> CreateReplicationSet -> ShowS)
-> (CreateReplicationSet -> String)
-> ([CreateReplicationSet] -> ShowS)
-> Show CreateReplicationSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateReplicationSet] -> ShowS
$cshowList :: [CreateReplicationSet] -> ShowS
show :: CreateReplicationSet -> String
$cshow :: CreateReplicationSet -> String
showsPrec :: Int -> CreateReplicationSet -> ShowS
$cshowsPrec :: Int -> CreateReplicationSet -> ShowS
Prelude.Show, (forall x. CreateReplicationSet -> Rep CreateReplicationSet x)
-> (forall x. Rep CreateReplicationSet x -> CreateReplicationSet)
-> Generic CreateReplicationSet
forall x. Rep CreateReplicationSet x -> CreateReplicationSet
forall x. CreateReplicationSet -> Rep CreateReplicationSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateReplicationSet x -> CreateReplicationSet
$cfrom :: forall x. CreateReplicationSet -> Rep CreateReplicationSet x
Prelude.Generic)
newCreateReplicationSet ::
CreateReplicationSet
newCreateReplicationSet :: CreateReplicationSet
newCreateReplicationSet =
CreateReplicationSet' :: Maybe Text
-> HashMap Text RegionMapInputValue -> CreateReplicationSet
CreateReplicationSet'
{ $sel:clientToken:CreateReplicationSet' :: Maybe Text
clientToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:regions:CreateReplicationSet' :: HashMap Text RegionMapInputValue
regions = HashMap Text RegionMapInputValue
forall a. Monoid a => a
Prelude.mempty
}
createReplicationSet_clientToken :: Lens.Lens' CreateReplicationSet (Prelude.Maybe Prelude.Text)
createReplicationSet_clientToken :: (Maybe Text -> f (Maybe Text))
-> CreateReplicationSet -> f CreateReplicationSet
createReplicationSet_clientToken = (CreateReplicationSet -> Maybe Text)
-> (CreateReplicationSet -> Maybe Text -> CreateReplicationSet)
-> Lens
CreateReplicationSet CreateReplicationSet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReplicationSet' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateReplicationSet' :: CreateReplicationSet -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateReplicationSet
s@CreateReplicationSet' {} Maybe Text
a -> CreateReplicationSet
s {$sel:clientToken:CreateReplicationSet' :: Maybe Text
clientToken = Maybe Text
a} :: CreateReplicationSet)
createReplicationSet_regions :: Lens.Lens' CreateReplicationSet (Prelude.HashMap Prelude.Text RegionMapInputValue)
createReplicationSet_regions :: (HashMap Text RegionMapInputValue
-> f (HashMap Text RegionMapInputValue))
-> CreateReplicationSet -> f CreateReplicationSet
createReplicationSet_regions = (CreateReplicationSet -> HashMap Text RegionMapInputValue)
-> (CreateReplicationSet
-> HashMap Text RegionMapInputValue -> CreateReplicationSet)
-> Lens
CreateReplicationSet
CreateReplicationSet
(HashMap Text RegionMapInputValue)
(HashMap Text RegionMapInputValue)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReplicationSet' {HashMap Text RegionMapInputValue
regions :: HashMap Text RegionMapInputValue
$sel:regions:CreateReplicationSet' :: CreateReplicationSet -> HashMap Text RegionMapInputValue
regions} -> HashMap Text RegionMapInputValue
regions) (\s :: CreateReplicationSet
s@CreateReplicationSet' {} HashMap Text RegionMapInputValue
a -> CreateReplicationSet
s {$sel:regions:CreateReplicationSet' :: HashMap Text RegionMapInputValue
regions = HashMap Text RegionMapInputValue
a} :: CreateReplicationSet) ((HashMap Text RegionMapInputValue
-> f (HashMap Text RegionMapInputValue))
-> CreateReplicationSet -> f CreateReplicationSet)
-> ((HashMap Text RegionMapInputValue
-> f (HashMap Text RegionMapInputValue))
-> HashMap Text RegionMapInputValue
-> f (HashMap Text RegionMapInputValue))
-> (HashMap Text RegionMapInputValue
-> f (HashMap Text RegionMapInputValue))
-> CreateReplicationSet
-> f CreateReplicationSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text RegionMapInputValue
-> f (HashMap Text RegionMapInputValue))
-> HashMap Text RegionMapInputValue
-> f (HashMap Text RegionMapInputValue)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateReplicationSet where
type
AWSResponse CreateReplicationSet =
CreateReplicationSetResponse
request :: CreateReplicationSet -> Request CreateReplicationSet
request = Service -> CreateReplicationSet -> Request CreateReplicationSet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateReplicationSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateReplicationSet)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateReplicationSet))
-> Logger
-> Service
-> Proxy CreateReplicationSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateReplicationSet)))
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 ->
Int -> Text -> CreateReplicationSetResponse
CreateReplicationSetResponse'
(Int -> Text -> CreateReplicationSetResponse)
-> Either String Int
-> Either String (Text -> CreateReplicationSetResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (Text -> CreateReplicationSetResponse)
-> Either String Text -> Either String CreateReplicationSetResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"arn")
)
instance Prelude.Hashable CreateReplicationSet
instance Prelude.NFData CreateReplicationSet
instance Core.ToHeaders CreateReplicationSet where
toHeaders :: CreateReplicationSet -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateReplicationSet -> 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 CreateReplicationSet where
toJSON :: CreateReplicationSet -> Value
toJSON CreateReplicationSet' {Maybe Text
HashMap Text RegionMapInputValue
regions :: HashMap Text RegionMapInputValue
clientToken :: Maybe Text
$sel:regions:CreateReplicationSet' :: CreateReplicationSet -> HashMap Text RegionMapInputValue
$sel:clientToken:CreateReplicationSet' :: CreateReplicationSet -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"clientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"regions" Text -> HashMap Text RegionMapInputValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HashMap Text RegionMapInputValue
regions)
]
)
instance Core.ToPath CreateReplicationSet where
toPath :: CreateReplicationSet -> ByteString
toPath = ByteString -> CreateReplicationSet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/createReplicationSet"
instance Core.ToQuery CreateReplicationSet where
toQuery :: CreateReplicationSet -> QueryString
toQuery = QueryString -> CreateReplicationSet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateReplicationSetResponse = CreateReplicationSetResponse'
{
CreateReplicationSetResponse -> Int
httpStatus :: Prelude.Int,
CreateReplicationSetResponse -> Text
arn :: Prelude.Text
}
deriving (CreateReplicationSetResponse
-> CreateReplicationSetResponse -> Bool
(CreateReplicationSetResponse
-> CreateReplicationSetResponse -> Bool)
-> (CreateReplicationSetResponse
-> CreateReplicationSetResponse -> Bool)
-> Eq CreateReplicationSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateReplicationSetResponse
-> CreateReplicationSetResponse -> Bool
$c/= :: CreateReplicationSetResponse
-> CreateReplicationSetResponse -> Bool
== :: CreateReplicationSetResponse
-> CreateReplicationSetResponse -> Bool
$c== :: CreateReplicationSetResponse
-> CreateReplicationSetResponse -> Bool
Prelude.Eq, ReadPrec [CreateReplicationSetResponse]
ReadPrec CreateReplicationSetResponse
Int -> ReadS CreateReplicationSetResponse
ReadS [CreateReplicationSetResponse]
(Int -> ReadS CreateReplicationSetResponse)
-> ReadS [CreateReplicationSetResponse]
-> ReadPrec CreateReplicationSetResponse
-> ReadPrec [CreateReplicationSetResponse]
-> Read CreateReplicationSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateReplicationSetResponse]
$creadListPrec :: ReadPrec [CreateReplicationSetResponse]
readPrec :: ReadPrec CreateReplicationSetResponse
$creadPrec :: ReadPrec CreateReplicationSetResponse
readList :: ReadS [CreateReplicationSetResponse]
$creadList :: ReadS [CreateReplicationSetResponse]
readsPrec :: Int -> ReadS CreateReplicationSetResponse
$creadsPrec :: Int -> ReadS CreateReplicationSetResponse
Prelude.Read, Int -> CreateReplicationSetResponse -> ShowS
[CreateReplicationSetResponse] -> ShowS
CreateReplicationSetResponse -> String
(Int -> CreateReplicationSetResponse -> ShowS)
-> (CreateReplicationSetResponse -> String)
-> ([CreateReplicationSetResponse] -> ShowS)
-> Show CreateReplicationSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateReplicationSetResponse] -> ShowS
$cshowList :: [CreateReplicationSetResponse] -> ShowS
show :: CreateReplicationSetResponse -> String
$cshow :: CreateReplicationSetResponse -> String
showsPrec :: Int -> CreateReplicationSetResponse -> ShowS
$cshowsPrec :: Int -> CreateReplicationSetResponse -> ShowS
Prelude.Show, (forall x.
CreateReplicationSetResponse -> Rep CreateReplicationSetResponse x)
-> (forall x.
Rep CreateReplicationSetResponse x -> CreateReplicationSetResponse)
-> Generic CreateReplicationSetResponse
forall x.
Rep CreateReplicationSetResponse x -> CreateReplicationSetResponse
forall x.
CreateReplicationSetResponse -> Rep CreateReplicationSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateReplicationSetResponse x -> CreateReplicationSetResponse
$cfrom :: forall x.
CreateReplicationSetResponse -> Rep CreateReplicationSetResponse x
Prelude.Generic)
newCreateReplicationSetResponse ::
Prelude.Int ->
Prelude.Text ->
CreateReplicationSetResponse
newCreateReplicationSetResponse :: Int -> Text -> CreateReplicationSetResponse
newCreateReplicationSetResponse Int
pHttpStatus_ Text
pArn_ =
CreateReplicationSetResponse' :: Int -> Text -> CreateReplicationSetResponse
CreateReplicationSetResponse'
{ $sel:httpStatus:CreateReplicationSetResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:arn:CreateReplicationSetResponse' :: Text
arn = Text
pArn_
}
createReplicationSetResponse_httpStatus :: Lens.Lens' CreateReplicationSetResponse Prelude.Int
createReplicationSetResponse_httpStatus :: (Int -> f Int)
-> CreateReplicationSetResponse -> f CreateReplicationSetResponse
createReplicationSetResponse_httpStatus = (CreateReplicationSetResponse -> Int)
-> (CreateReplicationSetResponse
-> Int -> CreateReplicationSetResponse)
-> Lens
CreateReplicationSetResponse CreateReplicationSetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReplicationSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateReplicationSetResponse' :: CreateReplicationSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateReplicationSetResponse
s@CreateReplicationSetResponse' {} Int
a -> CreateReplicationSetResponse
s {$sel:httpStatus:CreateReplicationSetResponse' :: Int
httpStatus = Int
a} :: CreateReplicationSetResponse)
createReplicationSetResponse_arn :: Lens.Lens' CreateReplicationSetResponse Prelude.Text
createReplicationSetResponse_arn :: (Text -> f Text)
-> CreateReplicationSetResponse -> f CreateReplicationSetResponse
createReplicationSetResponse_arn = (CreateReplicationSetResponse -> Text)
-> (CreateReplicationSetResponse
-> Text -> CreateReplicationSetResponse)
-> Lens
CreateReplicationSetResponse CreateReplicationSetResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReplicationSetResponse' {Text
arn :: Text
$sel:arn:CreateReplicationSetResponse' :: CreateReplicationSetResponse -> Text
arn} -> Text
arn) (\s :: CreateReplicationSetResponse
s@CreateReplicationSetResponse' {} Text
a -> CreateReplicationSetResponse
s {$sel:arn:CreateReplicationSetResponse' :: Text
arn = Text
a} :: CreateReplicationSetResponse)
instance Prelude.NFData CreateReplicationSetResponse