{-# 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.TerminateTargetInstances
(
TerminateTargetInstances (..),
newTerminateTargetInstances,
terminateTargetInstances_tags,
terminateTargetInstances_sourceServerIDs,
TerminateTargetInstancesResponse (..),
newTerminateTargetInstancesResponse,
terminateTargetInstancesResponse_job,
terminateTargetInstancesResponse_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 TerminateTargetInstances = TerminateTargetInstances'
{
TerminateTargetInstances -> Maybe (Sensitive (HashMap Text Text))
tags :: Prelude.Maybe (Core.Sensitive (Prelude.HashMap Prelude.Text Prelude.Text)),
TerminateTargetInstances -> NonEmpty Text
sourceServerIDs :: Prelude.NonEmpty Prelude.Text
}
deriving (TerminateTargetInstances -> TerminateTargetInstances -> Bool
(TerminateTargetInstances -> TerminateTargetInstances -> Bool)
-> (TerminateTargetInstances -> TerminateTargetInstances -> Bool)
-> Eq TerminateTargetInstances
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TerminateTargetInstances -> TerminateTargetInstances -> Bool
$c/= :: TerminateTargetInstances -> TerminateTargetInstances -> Bool
== :: TerminateTargetInstances -> TerminateTargetInstances -> Bool
$c== :: TerminateTargetInstances -> TerminateTargetInstances -> Bool
Prelude.Eq, Int -> TerminateTargetInstances -> ShowS
[TerminateTargetInstances] -> ShowS
TerminateTargetInstances -> String
(Int -> TerminateTargetInstances -> ShowS)
-> (TerminateTargetInstances -> String)
-> ([TerminateTargetInstances] -> ShowS)
-> Show TerminateTargetInstances
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TerminateTargetInstances] -> ShowS
$cshowList :: [TerminateTargetInstances] -> ShowS
show :: TerminateTargetInstances -> String
$cshow :: TerminateTargetInstances -> String
showsPrec :: Int -> TerminateTargetInstances -> ShowS
$cshowsPrec :: Int -> TerminateTargetInstances -> ShowS
Prelude.Show, (forall x.
TerminateTargetInstances -> Rep TerminateTargetInstances x)
-> (forall x.
Rep TerminateTargetInstances x -> TerminateTargetInstances)
-> Generic TerminateTargetInstances
forall x.
Rep TerminateTargetInstances x -> TerminateTargetInstances
forall x.
TerminateTargetInstances -> Rep TerminateTargetInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TerminateTargetInstances x -> TerminateTargetInstances
$cfrom :: forall x.
TerminateTargetInstances -> Rep TerminateTargetInstances x
Prelude.Generic)
newTerminateTargetInstances ::
Prelude.NonEmpty Prelude.Text ->
TerminateTargetInstances
newTerminateTargetInstances :: NonEmpty Text -> TerminateTargetInstances
newTerminateTargetInstances NonEmpty Text
pSourceServerIDs_ =
TerminateTargetInstances' :: Maybe (Sensitive (HashMap Text Text))
-> NonEmpty Text -> TerminateTargetInstances
TerminateTargetInstances'
{ $sel:tags:TerminateTargetInstances' :: Maybe (Sensitive (HashMap Text Text))
tags = Maybe (Sensitive (HashMap Text Text))
forall a. Maybe a
Prelude.Nothing,
$sel:sourceServerIDs:TerminateTargetInstances' :: 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_
}
terminateTargetInstances_tags :: Lens.Lens' TerminateTargetInstances (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
terminateTargetInstances_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> TerminateTargetInstances -> f TerminateTargetInstances
terminateTargetInstances_tags = (TerminateTargetInstances -> Maybe (Sensitive (HashMap Text Text)))
-> (TerminateTargetInstances
-> Maybe (Sensitive (HashMap Text Text))
-> TerminateTargetInstances)
-> Lens
TerminateTargetInstances
TerminateTargetInstances
(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 (\TerminateTargetInstances' {Maybe (Sensitive (HashMap Text Text))
tags :: Maybe (Sensitive (HashMap Text Text))
$sel:tags:TerminateTargetInstances' :: TerminateTargetInstances -> Maybe (Sensitive (HashMap Text Text))
tags} -> Maybe (Sensitive (HashMap Text Text))
tags) (\s :: TerminateTargetInstances
s@TerminateTargetInstances' {} Maybe (Sensitive (HashMap Text Text))
a -> TerminateTargetInstances
s {$sel:tags:TerminateTargetInstances' :: Maybe (Sensitive (HashMap Text Text))
tags = Maybe (Sensitive (HashMap Text Text))
a} :: TerminateTargetInstances) ((Maybe (Sensitive (HashMap Text Text))
-> f (Maybe (Sensitive (HashMap Text Text))))
-> TerminateTargetInstances -> f TerminateTargetInstances)
-> ((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)))
-> TerminateTargetInstances
-> f TerminateTargetInstances
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)
terminateTargetInstances_sourceServerIDs :: Lens.Lens' TerminateTargetInstances (Prelude.NonEmpty Prelude.Text)
terminateTargetInstances_sourceServerIDs :: (NonEmpty Text -> f (NonEmpty Text))
-> TerminateTargetInstances -> f TerminateTargetInstances
terminateTargetInstances_sourceServerIDs = (TerminateTargetInstances -> NonEmpty Text)
-> (TerminateTargetInstances
-> NonEmpty Text -> TerminateTargetInstances)
-> Lens
TerminateTargetInstances
TerminateTargetInstances
(NonEmpty Text)
(NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminateTargetInstances' {NonEmpty Text
sourceServerIDs :: NonEmpty Text
$sel:sourceServerIDs:TerminateTargetInstances' :: TerminateTargetInstances -> NonEmpty Text
sourceServerIDs} -> NonEmpty Text
sourceServerIDs) (\s :: TerminateTargetInstances
s@TerminateTargetInstances' {} NonEmpty Text
a -> TerminateTargetInstances
s {$sel:sourceServerIDs:TerminateTargetInstances' :: NonEmpty Text
sourceServerIDs = NonEmpty Text
a} :: TerminateTargetInstances) ((NonEmpty Text -> f (NonEmpty Text))
-> TerminateTargetInstances -> f TerminateTargetInstances)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> TerminateTargetInstances
-> f TerminateTargetInstances
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 TerminateTargetInstances where
type
AWSResponse TerminateTargetInstances =
TerminateTargetInstancesResponse
request :: TerminateTargetInstances -> Request TerminateTargetInstances
request = Service
-> TerminateTargetInstances -> Request TerminateTargetInstances
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy TerminateTargetInstances
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse TerminateTargetInstances)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse TerminateTargetInstances))
-> Logger
-> Service
-> Proxy TerminateTargetInstances
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse TerminateTargetInstances)))
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 -> TerminateTargetInstancesResponse
TerminateTargetInstancesResponse'
(Maybe Job -> Int -> TerminateTargetInstancesResponse)
-> Either String (Maybe Job)
-> Either String (Int -> TerminateTargetInstancesResponse)
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 -> TerminateTargetInstancesResponse)
-> Either String Int
-> Either String TerminateTargetInstancesResponse
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 TerminateTargetInstances
instance Prelude.NFData TerminateTargetInstances
instance Core.ToHeaders TerminateTargetInstances where
toHeaders :: TerminateTargetInstances -> ResponseHeaders
toHeaders =
ResponseHeaders -> TerminateTargetInstances -> 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 TerminateTargetInstances where
toJSON :: TerminateTargetInstances -> Value
toJSON TerminateTargetInstances' {Maybe (Sensitive (HashMap Text Text))
NonEmpty Text
sourceServerIDs :: NonEmpty Text
tags :: Maybe (Sensitive (HashMap Text Text))
$sel:sourceServerIDs:TerminateTargetInstances' :: TerminateTargetInstances -> NonEmpty Text
$sel:tags:TerminateTargetInstances' :: TerminateTargetInstances -> 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 TerminateTargetInstances where
toPath :: TerminateTargetInstances -> ByteString
toPath = ByteString -> TerminateTargetInstances -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/TerminateTargetInstances"
instance Core.ToQuery TerminateTargetInstances where
toQuery :: TerminateTargetInstances -> QueryString
toQuery = QueryString -> TerminateTargetInstances -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data TerminateTargetInstancesResponse = TerminateTargetInstancesResponse'
{
TerminateTargetInstancesResponse -> Maybe Job
job :: Prelude.Maybe Job,
TerminateTargetInstancesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (TerminateTargetInstancesResponse
-> TerminateTargetInstancesResponse -> Bool
(TerminateTargetInstancesResponse
-> TerminateTargetInstancesResponse -> Bool)
-> (TerminateTargetInstancesResponse
-> TerminateTargetInstancesResponse -> Bool)
-> Eq TerminateTargetInstancesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TerminateTargetInstancesResponse
-> TerminateTargetInstancesResponse -> Bool
$c/= :: TerminateTargetInstancesResponse
-> TerminateTargetInstancesResponse -> Bool
== :: TerminateTargetInstancesResponse
-> TerminateTargetInstancesResponse -> Bool
$c== :: TerminateTargetInstancesResponse
-> TerminateTargetInstancesResponse -> Bool
Prelude.Eq, Int -> TerminateTargetInstancesResponse -> ShowS
[TerminateTargetInstancesResponse] -> ShowS
TerminateTargetInstancesResponse -> String
(Int -> TerminateTargetInstancesResponse -> ShowS)
-> (TerminateTargetInstancesResponse -> String)
-> ([TerminateTargetInstancesResponse] -> ShowS)
-> Show TerminateTargetInstancesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TerminateTargetInstancesResponse] -> ShowS
$cshowList :: [TerminateTargetInstancesResponse] -> ShowS
show :: TerminateTargetInstancesResponse -> String
$cshow :: TerminateTargetInstancesResponse -> String
showsPrec :: Int -> TerminateTargetInstancesResponse -> ShowS
$cshowsPrec :: Int -> TerminateTargetInstancesResponse -> ShowS
Prelude.Show, (forall x.
TerminateTargetInstancesResponse
-> Rep TerminateTargetInstancesResponse x)
-> (forall x.
Rep TerminateTargetInstancesResponse x
-> TerminateTargetInstancesResponse)
-> Generic TerminateTargetInstancesResponse
forall x.
Rep TerminateTargetInstancesResponse x
-> TerminateTargetInstancesResponse
forall x.
TerminateTargetInstancesResponse
-> Rep TerminateTargetInstancesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TerminateTargetInstancesResponse x
-> TerminateTargetInstancesResponse
$cfrom :: forall x.
TerminateTargetInstancesResponse
-> Rep TerminateTargetInstancesResponse x
Prelude.Generic)
newTerminateTargetInstancesResponse ::
Prelude.Int ->
TerminateTargetInstancesResponse
newTerminateTargetInstancesResponse :: Int -> TerminateTargetInstancesResponse
newTerminateTargetInstancesResponse Int
pHttpStatus_ =
TerminateTargetInstancesResponse' :: Maybe Job -> Int -> TerminateTargetInstancesResponse
TerminateTargetInstancesResponse'
{ $sel:job:TerminateTargetInstancesResponse' :: Maybe Job
job =
Maybe Job
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:TerminateTargetInstancesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
terminateTargetInstancesResponse_job :: Lens.Lens' TerminateTargetInstancesResponse (Prelude.Maybe Job)
terminateTargetInstancesResponse_job :: (Maybe Job -> f (Maybe Job))
-> TerminateTargetInstancesResponse
-> f TerminateTargetInstancesResponse
terminateTargetInstancesResponse_job = (TerminateTargetInstancesResponse -> Maybe Job)
-> (TerminateTargetInstancesResponse
-> Maybe Job -> TerminateTargetInstancesResponse)
-> Lens
TerminateTargetInstancesResponse
TerminateTargetInstancesResponse
(Maybe Job)
(Maybe Job)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminateTargetInstancesResponse' {Maybe Job
job :: Maybe Job
$sel:job:TerminateTargetInstancesResponse' :: TerminateTargetInstancesResponse -> Maybe Job
job} -> Maybe Job
job) (\s :: TerminateTargetInstancesResponse
s@TerminateTargetInstancesResponse' {} Maybe Job
a -> TerminateTargetInstancesResponse
s {$sel:job:TerminateTargetInstancesResponse' :: Maybe Job
job = Maybe Job
a} :: TerminateTargetInstancesResponse)
terminateTargetInstancesResponse_httpStatus :: Lens.Lens' TerminateTargetInstancesResponse Prelude.Int
terminateTargetInstancesResponse_httpStatus :: (Int -> f Int)
-> TerminateTargetInstancesResponse
-> f TerminateTargetInstancesResponse
terminateTargetInstancesResponse_httpStatus = (TerminateTargetInstancesResponse -> Int)
-> (TerminateTargetInstancesResponse
-> Int -> TerminateTargetInstancesResponse)
-> Lens
TerminateTargetInstancesResponse
TerminateTargetInstancesResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminateTargetInstancesResponse' {Int
httpStatus :: Int
$sel:httpStatus:TerminateTargetInstancesResponse' :: TerminateTargetInstancesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: TerminateTargetInstancesResponse
s@TerminateTargetInstancesResponse' {} Int
a -> TerminateTargetInstancesResponse
s {$sel:httpStatus:TerminateTargetInstancesResponse' :: Int
httpStatus = Int
a} :: TerminateTargetInstancesResponse)
instance
Prelude.NFData
TerminateTargetInstancesResponse