{-# 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.ImageBuilder.CancelImageCreation
(
CancelImageCreation (..),
newCancelImageCreation,
cancelImageCreation_imageBuildVersionArn,
cancelImageCreation_clientToken,
CancelImageCreationResponse (..),
newCancelImageCreationResponse,
cancelImageCreationResponse_requestId,
cancelImageCreationResponse_clientToken,
cancelImageCreationResponse_imageBuildVersionArn,
cancelImageCreationResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ImageBuilder.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CancelImageCreation = CancelImageCreation'
{
CancelImageCreation -> Text
imageBuildVersionArn :: Prelude.Text,
CancelImageCreation -> Text
clientToken :: Prelude.Text
}
deriving (CancelImageCreation -> CancelImageCreation -> Bool
(CancelImageCreation -> CancelImageCreation -> Bool)
-> (CancelImageCreation -> CancelImageCreation -> Bool)
-> Eq CancelImageCreation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelImageCreation -> CancelImageCreation -> Bool
$c/= :: CancelImageCreation -> CancelImageCreation -> Bool
== :: CancelImageCreation -> CancelImageCreation -> Bool
$c== :: CancelImageCreation -> CancelImageCreation -> Bool
Prelude.Eq, ReadPrec [CancelImageCreation]
ReadPrec CancelImageCreation
Int -> ReadS CancelImageCreation
ReadS [CancelImageCreation]
(Int -> ReadS CancelImageCreation)
-> ReadS [CancelImageCreation]
-> ReadPrec CancelImageCreation
-> ReadPrec [CancelImageCreation]
-> Read CancelImageCreation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelImageCreation]
$creadListPrec :: ReadPrec [CancelImageCreation]
readPrec :: ReadPrec CancelImageCreation
$creadPrec :: ReadPrec CancelImageCreation
readList :: ReadS [CancelImageCreation]
$creadList :: ReadS [CancelImageCreation]
readsPrec :: Int -> ReadS CancelImageCreation
$creadsPrec :: Int -> ReadS CancelImageCreation
Prelude.Read, Int -> CancelImageCreation -> ShowS
[CancelImageCreation] -> ShowS
CancelImageCreation -> String
(Int -> CancelImageCreation -> ShowS)
-> (CancelImageCreation -> String)
-> ([CancelImageCreation] -> ShowS)
-> Show CancelImageCreation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelImageCreation] -> ShowS
$cshowList :: [CancelImageCreation] -> ShowS
show :: CancelImageCreation -> String
$cshow :: CancelImageCreation -> String
showsPrec :: Int -> CancelImageCreation -> ShowS
$cshowsPrec :: Int -> CancelImageCreation -> ShowS
Prelude.Show, (forall x. CancelImageCreation -> Rep CancelImageCreation x)
-> (forall x. Rep CancelImageCreation x -> CancelImageCreation)
-> Generic CancelImageCreation
forall x. Rep CancelImageCreation x -> CancelImageCreation
forall x. CancelImageCreation -> Rep CancelImageCreation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CancelImageCreation x -> CancelImageCreation
$cfrom :: forall x. CancelImageCreation -> Rep CancelImageCreation x
Prelude.Generic)
newCancelImageCreation ::
Prelude.Text ->
Prelude.Text ->
CancelImageCreation
newCancelImageCreation :: Text -> Text -> CancelImageCreation
newCancelImageCreation
Text
pImageBuildVersionArn_
Text
pClientToken_ =
CancelImageCreation' :: Text -> Text -> CancelImageCreation
CancelImageCreation'
{ $sel:imageBuildVersionArn:CancelImageCreation' :: Text
imageBuildVersionArn =
Text
pImageBuildVersionArn_,
$sel:clientToken:CancelImageCreation' :: Text
clientToken = Text
pClientToken_
}
cancelImageCreation_imageBuildVersionArn :: Lens.Lens' CancelImageCreation Prelude.Text
cancelImageCreation_imageBuildVersionArn :: (Text -> f Text) -> CancelImageCreation -> f CancelImageCreation
cancelImageCreation_imageBuildVersionArn = (CancelImageCreation -> Text)
-> (CancelImageCreation -> Text -> CancelImageCreation)
-> Lens CancelImageCreation CancelImageCreation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelImageCreation' {Text
imageBuildVersionArn :: Text
$sel:imageBuildVersionArn:CancelImageCreation' :: CancelImageCreation -> Text
imageBuildVersionArn} -> Text
imageBuildVersionArn) (\s :: CancelImageCreation
s@CancelImageCreation' {} Text
a -> CancelImageCreation
s {$sel:imageBuildVersionArn:CancelImageCreation' :: Text
imageBuildVersionArn = Text
a} :: CancelImageCreation)
cancelImageCreation_clientToken :: Lens.Lens' CancelImageCreation Prelude.Text
cancelImageCreation_clientToken :: (Text -> f Text) -> CancelImageCreation -> f CancelImageCreation
cancelImageCreation_clientToken = (CancelImageCreation -> Text)
-> (CancelImageCreation -> Text -> CancelImageCreation)
-> Lens CancelImageCreation CancelImageCreation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelImageCreation' {Text
clientToken :: Text
$sel:clientToken:CancelImageCreation' :: CancelImageCreation -> Text
clientToken} -> Text
clientToken) (\s :: CancelImageCreation
s@CancelImageCreation' {} Text
a -> CancelImageCreation
s {$sel:clientToken:CancelImageCreation' :: Text
clientToken = Text
a} :: CancelImageCreation)
instance Core.AWSRequest CancelImageCreation where
type
AWSResponse CancelImageCreation =
CancelImageCreationResponse
request :: CancelImageCreation -> Request CancelImageCreation
request = Service -> CancelImageCreation -> Request CancelImageCreation
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CancelImageCreation
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CancelImageCreation)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CancelImageCreation))
-> Logger
-> Service
-> Proxy CancelImageCreation
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CancelImageCreation)))
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
-> Maybe Text -> Maybe Text -> Int -> CancelImageCreationResponse
CancelImageCreationResponse'
(Maybe Text
-> Maybe Text -> Maybe Text -> Int -> CancelImageCreationResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe Text -> Maybe Text -> Int -> CancelImageCreationResponse)
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
"requestId")
Either
String
(Maybe Text -> Maybe Text -> Int -> CancelImageCreationResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> CancelImageCreationResponse)
forall (f :: * -> *) a b. Applicative f => 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
"clientToken")
Either String (Maybe Text -> Int -> CancelImageCreationResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CancelImageCreationResponse)
forall (f :: * -> *) a b. Applicative f => 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
"imageBuildVersionArn")
Either String (Int -> CancelImageCreationResponse)
-> Either String Int -> Either String CancelImageCreationResponse
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 CancelImageCreation
instance Prelude.NFData CancelImageCreation
instance Core.ToHeaders CancelImageCreation where
toHeaders :: CancelImageCreation -> ResponseHeaders
toHeaders =
ResponseHeaders -> CancelImageCreation -> 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 CancelImageCreation where
toJSON :: CancelImageCreation -> Value
toJSON CancelImageCreation' {Text
clientToken :: Text
imageBuildVersionArn :: Text
$sel:clientToken:CancelImageCreation' :: CancelImageCreation -> Text
$sel:imageBuildVersionArn:CancelImageCreation' :: CancelImageCreation -> 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
"imageBuildVersionArn"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
imageBuildVersionArn
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"clientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientToken)
]
)
instance Core.ToPath CancelImageCreation where
toPath :: CancelImageCreation -> ByteString
toPath = ByteString -> CancelImageCreation -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/CancelImageCreation"
instance Core.ToQuery CancelImageCreation where
toQuery :: CancelImageCreation -> QueryString
toQuery = QueryString -> CancelImageCreation -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CancelImageCreationResponse = CancelImageCreationResponse'
{
CancelImageCreationResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
CancelImageCreationResponse -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
CancelImageCreationResponse -> Maybe Text
imageBuildVersionArn :: Prelude.Maybe Prelude.Text,
CancelImageCreationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CancelImageCreationResponse -> CancelImageCreationResponse -> Bool
(CancelImageCreationResponse
-> CancelImageCreationResponse -> Bool)
-> (CancelImageCreationResponse
-> CancelImageCreationResponse -> Bool)
-> Eq CancelImageCreationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelImageCreationResponse -> CancelImageCreationResponse -> Bool
$c/= :: CancelImageCreationResponse -> CancelImageCreationResponse -> Bool
== :: CancelImageCreationResponse -> CancelImageCreationResponse -> Bool
$c== :: CancelImageCreationResponse -> CancelImageCreationResponse -> Bool
Prelude.Eq, ReadPrec [CancelImageCreationResponse]
ReadPrec CancelImageCreationResponse
Int -> ReadS CancelImageCreationResponse
ReadS [CancelImageCreationResponse]
(Int -> ReadS CancelImageCreationResponse)
-> ReadS [CancelImageCreationResponse]
-> ReadPrec CancelImageCreationResponse
-> ReadPrec [CancelImageCreationResponse]
-> Read CancelImageCreationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelImageCreationResponse]
$creadListPrec :: ReadPrec [CancelImageCreationResponse]
readPrec :: ReadPrec CancelImageCreationResponse
$creadPrec :: ReadPrec CancelImageCreationResponse
readList :: ReadS [CancelImageCreationResponse]
$creadList :: ReadS [CancelImageCreationResponse]
readsPrec :: Int -> ReadS CancelImageCreationResponse
$creadsPrec :: Int -> ReadS CancelImageCreationResponse
Prelude.Read, Int -> CancelImageCreationResponse -> ShowS
[CancelImageCreationResponse] -> ShowS
CancelImageCreationResponse -> String
(Int -> CancelImageCreationResponse -> ShowS)
-> (CancelImageCreationResponse -> String)
-> ([CancelImageCreationResponse] -> ShowS)
-> Show CancelImageCreationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelImageCreationResponse] -> ShowS
$cshowList :: [CancelImageCreationResponse] -> ShowS
show :: CancelImageCreationResponse -> String
$cshow :: CancelImageCreationResponse -> String
showsPrec :: Int -> CancelImageCreationResponse -> ShowS
$cshowsPrec :: Int -> CancelImageCreationResponse -> ShowS
Prelude.Show, (forall x.
CancelImageCreationResponse -> Rep CancelImageCreationResponse x)
-> (forall x.
Rep CancelImageCreationResponse x -> CancelImageCreationResponse)
-> Generic CancelImageCreationResponse
forall x.
Rep CancelImageCreationResponse x -> CancelImageCreationResponse
forall x.
CancelImageCreationResponse -> Rep CancelImageCreationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CancelImageCreationResponse x -> CancelImageCreationResponse
$cfrom :: forall x.
CancelImageCreationResponse -> Rep CancelImageCreationResponse x
Prelude.Generic)
newCancelImageCreationResponse ::
Prelude.Int ->
CancelImageCreationResponse
newCancelImageCreationResponse :: Int -> CancelImageCreationResponse
newCancelImageCreationResponse Int
pHttpStatus_ =
CancelImageCreationResponse' :: Maybe Text
-> Maybe Text -> Maybe Text -> Int -> CancelImageCreationResponse
CancelImageCreationResponse'
{ $sel:requestId:CancelImageCreationResponse' :: Maybe Text
requestId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:clientToken:CancelImageCreationResponse' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:imageBuildVersionArn:CancelImageCreationResponse' :: Maybe Text
imageBuildVersionArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CancelImageCreationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
cancelImageCreationResponse_requestId :: Lens.Lens' CancelImageCreationResponse (Prelude.Maybe Prelude.Text)
cancelImageCreationResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> CancelImageCreationResponse -> f CancelImageCreationResponse
cancelImageCreationResponse_requestId = (CancelImageCreationResponse -> Maybe Text)
-> (CancelImageCreationResponse
-> Maybe Text -> CancelImageCreationResponse)
-> Lens
CancelImageCreationResponse
CancelImageCreationResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelImageCreationResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:CancelImageCreationResponse' :: CancelImageCreationResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: CancelImageCreationResponse
s@CancelImageCreationResponse' {} Maybe Text
a -> CancelImageCreationResponse
s {$sel:requestId:CancelImageCreationResponse' :: Maybe Text
requestId = Maybe Text
a} :: CancelImageCreationResponse)
cancelImageCreationResponse_clientToken :: Lens.Lens' CancelImageCreationResponse (Prelude.Maybe Prelude.Text)
cancelImageCreationResponse_clientToken :: (Maybe Text -> f (Maybe Text))
-> CancelImageCreationResponse -> f CancelImageCreationResponse
cancelImageCreationResponse_clientToken = (CancelImageCreationResponse -> Maybe Text)
-> (CancelImageCreationResponse
-> Maybe Text -> CancelImageCreationResponse)
-> Lens
CancelImageCreationResponse
CancelImageCreationResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelImageCreationResponse' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CancelImageCreationResponse' :: CancelImageCreationResponse -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CancelImageCreationResponse
s@CancelImageCreationResponse' {} Maybe Text
a -> CancelImageCreationResponse
s {$sel:clientToken:CancelImageCreationResponse' :: Maybe Text
clientToken = Maybe Text
a} :: CancelImageCreationResponse)
cancelImageCreationResponse_imageBuildVersionArn :: Lens.Lens' CancelImageCreationResponse (Prelude.Maybe Prelude.Text)
cancelImageCreationResponse_imageBuildVersionArn :: (Maybe Text -> f (Maybe Text))
-> CancelImageCreationResponse -> f CancelImageCreationResponse
cancelImageCreationResponse_imageBuildVersionArn = (CancelImageCreationResponse -> Maybe Text)
-> (CancelImageCreationResponse
-> Maybe Text -> CancelImageCreationResponse)
-> Lens
CancelImageCreationResponse
CancelImageCreationResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelImageCreationResponse' {Maybe Text
imageBuildVersionArn :: Maybe Text
$sel:imageBuildVersionArn:CancelImageCreationResponse' :: CancelImageCreationResponse -> Maybe Text
imageBuildVersionArn} -> Maybe Text
imageBuildVersionArn) (\s :: CancelImageCreationResponse
s@CancelImageCreationResponse' {} Maybe Text
a -> CancelImageCreationResponse
s {$sel:imageBuildVersionArn:CancelImageCreationResponse' :: Maybe Text
imageBuildVersionArn = Maybe Text
a} :: CancelImageCreationResponse)
cancelImageCreationResponse_httpStatus :: Lens.Lens' CancelImageCreationResponse Prelude.Int
cancelImageCreationResponse_httpStatus :: (Int -> f Int)
-> CancelImageCreationResponse -> f CancelImageCreationResponse
cancelImageCreationResponse_httpStatus = (CancelImageCreationResponse -> Int)
-> (CancelImageCreationResponse
-> Int -> CancelImageCreationResponse)
-> Lens
CancelImageCreationResponse CancelImageCreationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelImageCreationResponse' {Int
httpStatus :: Int
$sel:httpStatus:CancelImageCreationResponse' :: CancelImageCreationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CancelImageCreationResponse
s@CancelImageCreationResponse' {} Int
a -> CancelImageCreationResponse
s {$sel:httpStatus:CancelImageCreationResponse' :: Int
httpStatus = Int
a} :: CancelImageCreationResponse)
instance Prelude.NFData CancelImageCreationResponse