{-# 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.MGN.StartCutover
(
StartCutover (..),
newStartCutover,
startCutover_tags,
startCutover_sourceServerIDs,
StartCutoverResponse (..),
newStartCutoverResponse,
startCutoverResponse_job,
startCutoverResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MGN.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data StartCutover = StartCutover'
{
StartCutover -> Maybe (Sensitive (HashMap Text Text))
tags :: Prelude.Maybe (Core.Sensitive (Prelude.HashMap Prelude.Text Prelude.Text)),
StartCutover -> NonEmpty Text
sourceServerIDs :: Prelude.NonEmpty Prelude.Text
}
deriving (StartCutover -> StartCutover -> Bool
(StartCutover -> StartCutover -> Bool)
-> (StartCutover -> StartCutover -> Bool) -> Eq StartCutover
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartCutover -> StartCutover -> Bool
$c/= :: StartCutover -> StartCutover -> Bool
== :: StartCutover -> StartCutover -> Bool
$c== :: StartCutover -> StartCutover -> Bool
Prelude.Eq, Int -> StartCutover -> ShowS
[StartCutover] -> ShowS
StartCutover -> String
(Int -> StartCutover -> ShowS)
-> (StartCutover -> String)
-> ([StartCutover] -> ShowS)
-> Show StartCutover
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartCutover] -> ShowS
$cshowList :: [StartCutover] -> ShowS
show :: StartCutover -> String
$cshow :: StartCutover -> String
showsPrec :: Int -> StartCutover -> ShowS
$cshowsPrec :: Int -> StartCutover -> ShowS
Prelude.Show, (forall x. StartCutover -> Rep StartCutover x)
-> (forall x. Rep StartCutover x -> StartCutover)
-> Generic StartCutover
forall x. Rep StartCutover x -> StartCutover
forall x. StartCutover -> Rep StartCutover x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartCutover x -> StartCutover
$cfrom :: forall x. StartCutover -> Rep StartCutover x
Prelude.Generic)
newStartCutover ::
Prelude.NonEmpty Prelude.Text ->
StartCutover
newStartCutover :: NonEmpty Text -> StartCutover
newStartCutover NonEmpty Text
pSourceServerIDs_ =
StartCutover' :: Maybe (Sensitive (HashMap Text Text))
-> NonEmpty Text -> StartCutover
StartCutover'
{ $sel:tags:StartCutover' :: Maybe (Sensitive (HashMap Text Text))
tags = Maybe (Sensitive (HashMap Text Text))
forall a. Maybe a
Prelude.Nothing,
$sel:sourceServerIDs:StartCutover' :: NonEmpty Text
sourceServerIDs =
Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pSourceServerIDs_
}
startCutover_tags :: Lens.Lens' StartCutover (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
startCutover_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> StartCutover -> f StartCutover
startCutover_tags = (StartCutover -> Maybe (Sensitive (HashMap Text Text)))
-> (StartCutover
-> Maybe (Sensitive (HashMap Text Text)) -> StartCutover)
-> Lens
StartCutover
StartCutover
(Maybe (Sensitive (HashMap Text Text)))
(Maybe (Sensitive (HashMap Text Text)))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartCutover' {Maybe (Sensitive (HashMap Text Text))
tags :: Maybe (Sensitive (HashMap Text Text))
$sel:tags:StartCutover' :: StartCutover -> Maybe (Sensitive (HashMap Text Text))
tags} -> Maybe (Sensitive (HashMap Text Text))
tags) (\s :: StartCutover
s@StartCutover' {} Maybe (Sensitive (HashMap Text Text))
a -> StartCutover
s {$sel:tags:StartCutover' :: Maybe (Sensitive (HashMap Text Text))
tags = Maybe (Sensitive (HashMap Text Text))
a} :: StartCutover) ((Maybe (Sensitive (HashMap Text Text))
-> f (Maybe (Sensitive (HashMap Text Text))))
-> StartCutover -> f StartCutover)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (Sensitive (HashMap Text Text))
-> f (Maybe (Sensitive (HashMap Text Text))))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> StartCutover
-> f StartCutover
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(Sensitive (HashMap Text Text))
(Sensitive (HashMap Text Text))
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (Sensitive (HashMap Text Text)))
(Maybe (Sensitive (HashMap Text Text)))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping (AnIso
(Sensitive (HashMap Text Text))
(Sensitive (HashMap Text Text))
(HashMap Text Text)
(HashMap Text Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive AnIso
(Sensitive (HashMap Text Text))
(Sensitive (HashMap Text Text))
(HashMap Text Text)
(HashMap Text Text)
-> (Exchange
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(Identity (HashMap Text Text))
-> Exchange
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(Identity (HashMap Text Text)))
-> AnIso
(Sensitive (HashMap Text Text))
(Sensitive (HashMap Text Text))
(HashMap Text Text)
(HashMap Text Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Exchange
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(Identity (HashMap Text Text))
-> Exchange
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(Identity (HashMap Text Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced)
startCutover_sourceServerIDs :: Lens.Lens' StartCutover (Prelude.NonEmpty Prelude.Text)
startCutover_sourceServerIDs :: (NonEmpty Text -> f (NonEmpty Text))
-> StartCutover -> f StartCutover
startCutover_sourceServerIDs = (StartCutover -> NonEmpty Text)
-> (StartCutover -> NonEmpty Text -> StartCutover)
-> Lens StartCutover StartCutover (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartCutover' {NonEmpty Text
sourceServerIDs :: NonEmpty Text
$sel:sourceServerIDs:StartCutover' :: StartCutover -> NonEmpty Text
sourceServerIDs} -> NonEmpty Text
sourceServerIDs) (\s :: StartCutover
s@StartCutover' {} NonEmpty Text
a -> StartCutover
s {$sel:sourceServerIDs:StartCutover' :: NonEmpty Text
sourceServerIDs = NonEmpty Text
a} :: StartCutover) ((NonEmpty Text -> f (NonEmpty Text))
-> StartCutover -> f StartCutover)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> StartCutover
-> f StartCutover
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest StartCutover where
type AWSResponse StartCutover = StartCutoverResponse
request :: StartCutover -> Request StartCutover
request = Service -> StartCutover -> Request StartCutover
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartCutover
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartCutover)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartCutover))
-> Logger
-> Service
-> Proxy StartCutover
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartCutover)))
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 Job -> Int -> StartCutoverResponse
StartCutoverResponse'
(Maybe Job -> Int -> StartCutoverResponse)
-> Either String (Maybe Job)
-> Either String (Int -> StartCutoverResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Job)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"job")
Either String (Int -> StartCutoverResponse)
-> Either String Int -> Either String StartCutoverResponse
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 StartCutover
instance Prelude.NFData StartCutover
instance Core.ToHeaders StartCutover where
toHeaders :: StartCutover -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartCutover -> 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 StartCutover where
toJSON :: StartCutover -> Value
toJSON StartCutover' {Maybe (Sensitive (HashMap Text Text))
NonEmpty Text
sourceServerIDs :: NonEmpty Text
tags :: Maybe (Sensitive (HashMap Text Text))
$sel:sourceServerIDs:StartCutover' :: StartCutover -> NonEmpty Text
$sel:tags:StartCutover' :: StartCutover -> Maybe (Sensitive (HashMap Text Text))
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"tags" Text -> Sensitive (HashMap Text Text) -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive (HashMap Text Text) -> Pair)
-> Maybe (Sensitive (HashMap Text Text)) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive (HashMap Text Text))
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"sourceServerIDs" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
sourceServerIDs)
]
)
instance Core.ToPath StartCutover where
toPath :: StartCutover -> ByteString
toPath = ByteString -> StartCutover -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/StartCutover"
instance Core.ToQuery StartCutover where
toQuery :: StartCutover -> QueryString
toQuery = QueryString -> StartCutover -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartCutoverResponse = StartCutoverResponse'
{
StartCutoverResponse -> Maybe Job
job :: Prelude.Maybe Job,
StartCutoverResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartCutoverResponse -> StartCutoverResponse -> Bool
(StartCutoverResponse -> StartCutoverResponse -> Bool)
-> (StartCutoverResponse -> StartCutoverResponse -> Bool)
-> Eq StartCutoverResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartCutoverResponse -> StartCutoverResponse -> Bool
$c/= :: StartCutoverResponse -> StartCutoverResponse -> Bool
== :: StartCutoverResponse -> StartCutoverResponse -> Bool
$c== :: StartCutoverResponse -> StartCutoverResponse -> Bool
Prelude.Eq, Int -> StartCutoverResponse -> ShowS
[StartCutoverResponse] -> ShowS
StartCutoverResponse -> String
(Int -> StartCutoverResponse -> ShowS)
-> (StartCutoverResponse -> String)
-> ([StartCutoverResponse] -> ShowS)
-> Show StartCutoverResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartCutoverResponse] -> ShowS
$cshowList :: [StartCutoverResponse] -> ShowS
show :: StartCutoverResponse -> String
$cshow :: StartCutoverResponse -> String
showsPrec :: Int -> StartCutoverResponse -> ShowS
$cshowsPrec :: Int -> StartCutoverResponse -> ShowS
Prelude.Show, (forall x. StartCutoverResponse -> Rep StartCutoverResponse x)
-> (forall x. Rep StartCutoverResponse x -> StartCutoverResponse)
-> Generic StartCutoverResponse
forall x. Rep StartCutoverResponse x -> StartCutoverResponse
forall x. StartCutoverResponse -> Rep StartCutoverResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartCutoverResponse x -> StartCutoverResponse
$cfrom :: forall x. StartCutoverResponse -> Rep StartCutoverResponse x
Prelude.Generic)
newStartCutoverResponse ::
Prelude.Int ->
StartCutoverResponse
newStartCutoverResponse :: Int -> StartCutoverResponse
newStartCutoverResponse Int
pHttpStatus_ =
StartCutoverResponse' :: Maybe Job -> Int -> StartCutoverResponse
StartCutoverResponse'
{ $sel:job:StartCutoverResponse' :: Maybe Job
job = Maybe Job
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartCutoverResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startCutoverResponse_job :: Lens.Lens' StartCutoverResponse (Prelude.Maybe Job)
startCutoverResponse_job :: (Maybe Job -> f (Maybe Job))
-> StartCutoverResponse -> f StartCutoverResponse
startCutoverResponse_job = (StartCutoverResponse -> Maybe Job)
-> (StartCutoverResponse -> Maybe Job -> StartCutoverResponse)
-> Lens
StartCutoverResponse StartCutoverResponse (Maybe Job) (Maybe Job)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartCutoverResponse' {Maybe Job
job :: Maybe Job
$sel:job:StartCutoverResponse' :: StartCutoverResponse -> Maybe Job
job} -> Maybe Job
job) (\s :: StartCutoverResponse
s@StartCutoverResponse' {} Maybe Job
a -> StartCutoverResponse
s {$sel:job:StartCutoverResponse' :: Maybe Job
job = Maybe Job
a} :: StartCutoverResponse)
startCutoverResponse_httpStatus :: Lens.Lens' StartCutoverResponse Prelude.Int
startCutoverResponse_httpStatus :: (Int -> f Int) -> StartCutoverResponse -> f StartCutoverResponse
startCutoverResponse_httpStatus = (StartCutoverResponse -> Int)
-> (StartCutoverResponse -> Int -> StartCutoverResponse)
-> Lens StartCutoverResponse StartCutoverResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartCutoverResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartCutoverResponse' :: StartCutoverResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartCutoverResponse
s@StartCutoverResponse' {} Int
a -> StartCutoverResponse
s {$sel:httpStatus:StartCutoverResponse' :: Int
httpStatus = Int
a} :: StartCutoverResponse)
instance Prelude.NFData StartCutoverResponse