{-# 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.DrS.StartFailbackLaunch
(
StartFailbackLaunch (..),
newStartFailbackLaunch,
startFailbackLaunch_tags,
startFailbackLaunch_recoveryInstanceIDs,
StartFailbackLaunchResponse (..),
newStartFailbackLaunchResponse,
startFailbackLaunchResponse_job,
startFailbackLaunchResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DrS.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data StartFailbackLaunch = StartFailbackLaunch'
{
StartFailbackLaunch -> Maybe (Sensitive (HashMap Text Text))
tags :: Prelude.Maybe (Data.Sensitive (Prelude.HashMap Prelude.Text Prelude.Text)),
StartFailbackLaunch -> NonEmpty Text
recoveryInstanceIDs :: Prelude.NonEmpty Prelude.Text
}
deriving (StartFailbackLaunch -> StartFailbackLaunch -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartFailbackLaunch -> StartFailbackLaunch -> Bool
$c/= :: StartFailbackLaunch -> StartFailbackLaunch -> Bool
== :: StartFailbackLaunch -> StartFailbackLaunch -> Bool
$c== :: StartFailbackLaunch -> StartFailbackLaunch -> Bool
Prelude.Eq, Int -> StartFailbackLaunch -> ShowS
[StartFailbackLaunch] -> ShowS
StartFailbackLaunch -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartFailbackLaunch] -> ShowS
$cshowList :: [StartFailbackLaunch] -> ShowS
show :: StartFailbackLaunch -> String
$cshow :: StartFailbackLaunch -> String
showsPrec :: Int -> StartFailbackLaunch -> ShowS
$cshowsPrec :: Int -> StartFailbackLaunch -> ShowS
Prelude.Show, forall x. Rep StartFailbackLaunch x -> StartFailbackLaunch
forall x. StartFailbackLaunch -> Rep StartFailbackLaunch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartFailbackLaunch x -> StartFailbackLaunch
$cfrom :: forall x. StartFailbackLaunch -> Rep StartFailbackLaunch x
Prelude.Generic)
newStartFailbackLaunch ::
Prelude.NonEmpty Prelude.Text ->
StartFailbackLaunch
newStartFailbackLaunch :: NonEmpty Text -> StartFailbackLaunch
newStartFailbackLaunch NonEmpty Text
pRecoveryInstanceIDs_ =
StartFailbackLaunch'
{ $sel:tags:StartFailbackLaunch' :: Maybe (Sensitive (HashMap Text Text))
tags = forall a. Maybe a
Prelude.Nothing,
$sel:recoveryInstanceIDs:StartFailbackLaunch' :: NonEmpty Text
recoveryInstanceIDs =
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pRecoveryInstanceIDs_
}
startFailbackLaunch_tags :: Lens.Lens' StartFailbackLaunch (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
startFailbackLaunch_tags :: Lens' StartFailbackLaunch (Maybe (HashMap Text Text))
startFailbackLaunch_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartFailbackLaunch' {Maybe (Sensitive (HashMap Text Text))
tags :: Maybe (Sensitive (HashMap Text Text))
$sel:tags:StartFailbackLaunch' :: StartFailbackLaunch -> Maybe (Sensitive (HashMap Text Text))
tags} -> Maybe (Sensitive (HashMap Text Text))
tags) (\s :: StartFailbackLaunch
s@StartFailbackLaunch' {} Maybe (Sensitive (HashMap Text Text))
a -> StartFailbackLaunch
s {$sel:tags:StartFailbackLaunch' :: Maybe (Sensitive (HashMap Text Text))
tags = Maybe (Sensitive (HashMap Text Text))
a} :: StartFailbackLaunch) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 (forall a. Iso' (Sensitive a) a
Data._Sensitive forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced)
startFailbackLaunch_recoveryInstanceIDs :: Lens.Lens' StartFailbackLaunch (Prelude.NonEmpty Prelude.Text)
startFailbackLaunch_recoveryInstanceIDs :: Lens' StartFailbackLaunch (NonEmpty Text)
startFailbackLaunch_recoveryInstanceIDs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartFailbackLaunch' {NonEmpty Text
recoveryInstanceIDs :: NonEmpty Text
$sel:recoveryInstanceIDs:StartFailbackLaunch' :: StartFailbackLaunch -> NonEmpty Text
recoveryInstanceIDs} -> NonEmpty Text
recoveryInstanceIDs) (\s :: StartFailbackLaunch
s@StartFailbackLaunch' {} NonEmpty Text
a -> StartFailbackLaunch
s {$sel:recoveryInstanceIDs:StartFailbackLaunch' :: NonEmpty Text
recoveryInstanceIDs = NonEmpty Text
a} :: StartFailbackLaunch) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest StartFailbackLaunch where
type
AWSResponse StartFailbackLaunch =
StartFailbackLaunchResponse
request :: (Service -> Service)
-> StartFailbackLaunch -> Request StartFailbackLaunch
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy StartFailbackLaunch
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartFailbackLaunch)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Job -> Int -> StartFailbackLaunchResponse
StartFailbackLaunchResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"job")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable StartFailbackLaunch where
hashWithSalt :: Int -> StartFailbackLaunch -> Int
hashWithSalt Int
_salt StartFailbackLaunch' {Maybe (Sensitive (HashMap Text Text))
NonEmpty Text
recoveryInstanceIDs :: NonEmpty Text
tags :: Maybe (Sensitive (HashMap Text Text))
$sel:recoveryInstanceIDs:StartFailbackLaunch' :: StartFailbackLaunch -> NonEmpty Text
$sel:tags:StartFailbackLaunch' :: StartFailbackLaunch -> Maybe (Sensitive (HashMap Text Text))
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive (HashMap Text Text))
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
recoveryInstanceIDs
instance Prelude.NFData StartFailbackLaunch where
rnf :: StartFailbackLaunch -> ()
rnf StartFailbackLaunch' {Maybe (Sensitive (HashMap Text Text))
NonEmpty Text
recoveryInstanceIDs :: NonEmpty Text
tags :: Maybe (Sensitive (HashMap Text Text))
$sel:recoveryInstanceIDs:StartFailbackLaunch' :: StartFailbackLaunch -> NonEmpty Text
$sel:tags:StartFailbackLaunch' :: StartFailbackLaunch -> Maybe (Sensitive (HashMap Text Text))
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive (HashMap Text Text))
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
recoveryInstanceIDs
instance Data.ToHeaders StartFailbackLaunch where
toHeaders :: StartFailbackLaunch -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON StartFailbackLaunch where
toJSON :: StartFailbackLaunch -> Value
toJSON StartFailbackLaunch' {Maybe (Sensitive (HashMap Text Text))
NonEmpty Text
recoveryInstanceIDs :: NonEmpty Text
tags :: Maybe (Sensitive (HashMap Text Text))
$sel:recoveryInstanceIDs:StartFailbackLaunch' :: StartFailbackLaunch -> NonEmpty Text
$sel:tags:StartFailbackLaunch' :: StartFailbackLaunch -> Maybe (Sensitive (HashMap Text Text))
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive (HashMap Text Text))
tags,
forall a. a -> Maybe a
Prelude.Just
(Key
"recoveryInstanceIDs" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
recoveryInstanceIDs)
]
)
instance Data.ToPath StartFailbackLaunch where
toPath :: StartFailbackLaunch -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/StartFailbackLaunch"
instance Data.ToQuery StartFailbackLaunch where
toQuery :: StartFailbackLaunch -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data StartFailbackLaunchResponse = StartFailbackLaunchResponse'
{
StartFailbackLaunchResponse -> Maybe Job
job :: Prelude.Maybe Job,
StartFailbackLaunchResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartFailbackLaunchResponse -> StartFailbackLaunchResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartFailbackLaunchResponse -> StartFailbackLaunchResponse -> Bool
$c/= :: StartFailbackLaunchResponse -> StartFailbackLaunchResponse -> Bool
== :: StartFailbackLaunchResponse -> StartFailbackLaunchResponse -> Bool
$c== :: StartFailbackLaunchResponse -> StartFailbackLaunchResponse -> Bool
Prelude.Eq, Int -> StartFailbackLaunchResponse -> ShowS
[StartFailbackLaunchResponse] -> ShowS
StartFailbackLaunchResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartFailbackLaunchResponse] -> ShowS
$cshowList :: [StartFailbackLaunchResponse] -> ShowS
show :: StartFailbackLaunchResponse -> String
$cshow :: StartFailbackLaunchResponse -> String
showsPrec :: Int -> StartFailbackLaunchResponse -> ShowS
$cshowsPrec :: Int -> StartFailbackLaunchResponse -> ShowS
Prelude.Show, forall x.
Rep StartFailbackLaunchResponse x -> StartFailbackLaunchResponse
forall x.
StartFailbackLaunchResponse -> Rep StartFailbackLaunchResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartFailbackLaunchResponse x -> StartFailbackLaunchResponse
$cfrom :: forall x.
StartFailbackLaunchResponse -> Rep StartFailbackLaunchResponse x
Prelude.Generic)
newStartFailbackLaunchResponse ::
Prelude.Int ->
StartFailbackLaunchResponse
newStartFailbackLaunchResponse :: Int -> StartFailbackLaunchResponse
newStartFailbackLaunchResponse Int
pHttpStatus_ =
StartFailbackLaunchResponse'
{ $sel:job:StartFailbackLaunchResponse' :: Maybe Job
job = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartFailbackLaunchResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startFailbackLaunchResponse_job :: Lens.Lens' StartFailbackLaunchResponse (Prelude.Maybe Job)
startFailbackLaunchResponse_job :: Lens' StartFailbackLaunchResponse (Maybe Job)
startFailbackLaunchResponse_job = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartFailbackLaunchResponse' {Maybe Job
job :: Maybe Job
$sel:job:StartFailbackLaunchResponse' :: StartFailbackLaunchResponse -> Maybe Job
job} -> Maybe Job
job) (\s :: StartFailbackLaunchResponse
s@StartFailbackLaunchResponse' {} Maybe Job
a -> StartFailbackLaunchResponse
s {$sel:job:StartFailbackLaunchResponse' :: Maybe Job
job = Maybe Job
a} :: StartFailbackLaunchResponse)
startFailbackLaunchResponse_httpStatus :: Lens.Lens' StartFailbackLaunchResponse Prelude.Int
startFailbackLaunchResponse_httpStatus :: Lens' StartFailbackLaunchResponse Int
startFailbackLaunchResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartFailbackLaunchResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartFailbackLaunchResponse' :: StartFailbackLaunchResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartFailbackLaunchResponse
s@StartFailbackLaunchResponse' {} Int
a -> StartFailbackLaunchResponse
s {$sel:httpStatus:StartFailbackLaunchResponse' :: Int
httpStatus = Int
a} :: StartFailbackLaunchResponse)
instance Prelude.NFData StartFailbackLaunchResponse where
rnf :: StartFailbackLaunchResponse -> ()
rnf StartFailbackLaunchResponse' {Int
Maybe Job
httpStatus :: Int
job :: Maybe Job
$sel:httpStatus:StartFailbackLaunchResponse' :: StartFailbackLaunchResponse -> Int
$sel:job:StartFailbackLaunchResponse' :: StartFailbackLaunchResponse -> Maybe Job
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Job
job
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus