{-# 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.GreengrassV2.CancelDeployment
(
CancelDeployment (..),
newCancelDeployment,
cancelDeployment_deploymentId,
CancelDeploymentResponse (..),
newCancelDeploymentResponse,
cancelDeploymentResponse_message,
cancelDeploymentResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.GreengrassV2.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 CancelDeployment = CancelDeployment'
{
CancelDeployment -> Text
deploymentId :: Prelude.Text
}
deriving (CancelDeployment -> CancelDeployment -> Bool
(CancelDeployment -> CancelDeployment -> Bool)
-> (CancelDeployment -> CancelDeployment -> Bool)
-> Eq CancelDeployment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelDeployment -> CancelDeployment -> Bool
$c/= :: CancelDeployment -> CancelDeployment -> Bool
== :: CancelDeployment -> CancelDeployment -> Bool
$c== :: CancelDeployment -> CancelDeployment -> Bool
Prelude.Eq, ReadPrec [CancelDeployment]
ReadPrec CancelDeployment
Int -> ReadS CancelDeployment
ReadS [CancelDeployment]
(Int -> ReadS CancelDeployment)
-> ReadS [CancelDeployment]
-> ReadPrec CancelDeployment
-> ReadPrec [CancelDeployment]
-> Read CancelDeployment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelDeployment]
$creadListPrec :: ReadPrec [CancelDeployment]
readPrec :: ReadPrec CancelDeployment
$creadPrec :: ReadPrec CancelDeployment
readList :: ReadS [CancelDeployment]
$creadList :: ReadS [CancelDeployment]
readsPrec :: Int -> ReadS CancelDeployment
$creadsPrec :: Int -> ReadS CancelDeployment
Prelude.Read, Int -> CancelDeployment -> ShowS
[CancelDeployment] -> ShowS
CancelDeployment -> String
(Int -> CancelDeployment -> ShowS)
-> (CancelDeployment -> String)
-> ([CancelDeployment] -> ShowS)
-> Show CancelDeployment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelDeployment] -> ShowS
$cshowList :: [CancelDeployment] -> ShowS
show :: CancelDeployment -> String
$cshow :: CancelDeployment -> String
showsPrec :: Int -> CancelDeployment -> ShowS
$cshowsPrec :: Int -> CancelDeployment -> ShowS
Prelude.Show, (forall x. CancelDeployment -> Rep CancelDeployment x)
-> (forall x. Rep CancelDeployment x -> CancelDeployment)
-> Generic CancelDeployment
forall x. Rep CancelDeployment x -> CancelDeployment
forall x. CancelDeployment -> Rep CancelDeployment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CancelDeployment x -> CancelDeployment
$cfrom :: forall x. CancelDeployment -> Rep CancelDeployment x
Prelude.Generic)
newCancelDeployment ::
Prelude.Text ->
CancelDeployment
newCancelDeployment :: Text -> CancelDeployment
newCancelDeployment Text
pDeploymentId_ =
CancelDeployment' :: Text -> CancelDeployment
CancelDeployment' {$sel:deploymentId:CancelDeployment' :: Text
deploymentId = Text
pDeploymentId_}
cancelDeployment_deploymentId :: Lens.Lens' CancelDeployment Prelude.Text
cancelDeployment_deploymentId :: (Text -> f Text) -> CancelDeployment -> f CancelDeployment
cancelDeployment_deploymentId = (CancelDeployment -> Text)
-> (CancelDeployment -> Text -> CancelDeployment)
-> Lens CancelDeployment CancelDeployment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelDeployment' {Text
deploymentId :: Text
$sel:deploymentId:CancelDeployment' :: CancelDeployment -> Text
deploymentId} -> Text
deploymentId) (\s :: CancelDeployment
s@CancelDeployment' {} Text
a -> CancelDeployment
s {$sel:deploymentId:CancelDeployment' :: Text
deploymentId = Text
a} :: CancelDeployment)
instance Core.AWSRequest CancelDeployment where
type
AWSResponse CancelDeployment =
CancelDeploymentResponse
request :: CancelDeployment -> Request CancelDeployment
request = Service -> CancelDeployment -> Request CancelDeployment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CancelDeployment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CancelDeployment)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CancelDeployment))
-> Logger
-> Service
-> Proxy CancelDeployment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CancelDeployment)))
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 -> Int -> CancelDeploymentResponse
CancelDeploymentResponse'
(Maybe Text -> Int -> CancelDeploymentResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CancelDeploymentResponse)
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
"message")
Either String (Int -> CancelDeploymentResponse)
-> Either String Int -> Either String CancelDeploymentResponse
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 CancelDeployment
instance Prelude.NFData CancelDeployment
instance Core.ToHeaders CancelDeployment where
toHeaders :: CancelDeployment -> ResponseHeaders
toHeaders =
ResponseHeaders -> CancelDeployment -> 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 CancelDeployment where
toJSON :: CancelDeployment -> Value
toJSON = Value -> CancelDeployment -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath CancelDeployment where
toPath :: CancelDeployment -> ByteString
toPath CancelDeployment' {Text
deploymentId :: Text
$sel:deploymentId:CancelDeployment' :: CancelDeployment -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/greengrass/v2/deployments/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
deploymentId,
ByteString
"/cancel"
]
instance Core.ToQuery CancelDeployment where
toQuery :: CancelDeployment -> QueryString
toQuery = QueryString -> CancelDeployment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CancelDeploymentResponse = CancelDeploymentResponse'
{
CancelDeploymentResponse -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
CancelDeploymentResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CancelDeploymentResponse -> CancelDeploymentResponse -> Bool
(CancelDeploymentResponse -> CancelDeploymentResponse -> Bool)
-> (CancelDeploymentResponse -> CancelDeploymentResponse -> Bool)
-> Eq CancelDeploymentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelDeploymentResponse -> CancelDeploymentResponse -> Bool
$c/= :: CancelDeploymentResponse -> CancelDeploymentResponse -> Bool
== :: CancelDeploymentResponse -> CancelDeploymentResponse -> Bool
$c== :: CancelDeploymentResponse -> CancelDeploymentResponse -> Bool
Prelude.Eq, ReadPrec [CancelDeploymentResponse]
ReadPrec CancelDeploymentResponse
Int -> ReadS CancelDeploymentResponse
ReadS [CancelDeploymentResponse]
(Int -> ReadS CancelDeploymentResponse)
-> ReadS [CancelDeploymentResponse]
-> ReadPrec CancelDeploymentResponse
-> ReadPrec [CancelDeploymentResponse]
-> Read CancelDeploymentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelDeploymentResponse]
$creadListPrec :: ReadPrec [CancelDeploymentResponse]
readPrec :: ReadPrec CancelDeploymentResponse
$creadPrec :: ReadPrec CancelDeploymentResponse
readList :: ReadS [CancelDeploymentResponse]
$creadList :: ReadS [CancelDeploymentResponse]
readsPrec :: Int -> ReadS CancelDeploymentResponse
$creadsPrec :: Int -> ReadS CancelDeploymentResponse
Prelude.Read, Int -> CancelDeploymentResponse -> ShowS
[CancelDeploymentResponse] -> ShowS
CancelDeploymentResponse -> String
(Int -> CancelDeploymentResponse -> ShowS)
-> (CancelDeploymentResponse -> String)
-> ([CancelDeploymentResponse] -> ShowS)
-> Show CancelDeploymentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelDeploymentResponse] -> ShowS
$cshowList :: [CancelDeploymentResponse] -> ShowS
show :: CancelDeploymentResponse -> String
$cshow :: CancelDeploymentResponse -> String
showsPrec :: Int -> CancelDeploymentResponse -> ShowS
$cshowsPrec :: Int -> CancelDeploymentResponse -> ShowS
Prelude.Show, (forall x.
CancelDeploymentResponse -> Rep CancelDeploymentResponse x)
-> (forall x.
Rep CancelDeploymentResponse x -> CancelDeploymentResponse)
-> Generic CancelDeploymentResponse
forall x.
Rep CancelDeploymentResponse x -> CancelDeploymentResponse
forall x.
CancelDeploymentResponse -> Rep CancelDeploymentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CancelDeploymentResponse x -> CancelDeploymentResponse
$cfrom :: forall x.
CancelDeploymentResponse -> Rep CancelDeploymentResponse x
Prelude.Generic)
newCancelDeploymentResponse ::
Prelude.Int ->
CancelDeploymentResponse
newCancelDeploymentResponse :: Int -> CancelDeploymentResponse
newCancelDeploymentResponse Int
pHttpStatus_ =
CancelDeploymentResponse' :: Maybe Text -> Int -> CancelDeploymentResponse
CancelDeploymentResponse'
{ $sel:message:CancelDeploymentResponse' :: Maybe Text
message =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CancelDeploymentResponse' :: Int
httpStatus = Int
pHttpStatus_
}
cancelDeploymentResponse_message :: Lens.Lens' CancelDeploymentResponse (Prelude.Maybe Prelude.Text)
cancelDeploymentResponse_message :: (Maybe Text -> f (Maybe Text))
-> CancelDeploymentResponse -> f CancelDeploymentResponse
cancelDeploymentResponse_message = (CancelDeploymentResponse -> Maybe Text)
-> (CancelDeploymentResponse
-> Maybe Text -> CancelDeploymentResponse)
-> Lens
CancelDeploymentResponse
CancelDeploymentResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelDeploymentResponse' {Maybe Text
message :: Maybe Text
$sel:message:CancelDeploymentResponse' :: CancelDeploymentResponse -> Maybe Text
message} -> Maybe Text
message) (\s :: CancelDeploymentResponse
s@CancelDeploymentResponse' {} Maybe Text
a -> CancelDeploymentResponse
s {$sel:message:CancelDeploymentResponse' :: Maybe Text
message = Maybe Text
a} :: CancelDeploymentResponse)
cancelDeploymentResponse_httpStatus :: Lens.Lens' CancelDeploymentResponse Prelude.Int
cancelDeploymentResponse_httpStatus :: (Int -> f Int)
-> CancelDeploymentResponse -> f CancelDeploymentResponse
cancelDeploymentResponse_httpStatus = (CancelDeploymentResponse -> Int)
-> (CancelDeploymentResponse -> Int -> CancelDeploymentResponse)
-> Lens CancelDeploymentResponse CancelDeploymentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelDeploymentResponse' {Int
httpStatus :: Int
$sel:httpStatus:CancelDeploymentResponse' :: CancelDeploymentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CancelDeploymentResponse
s@CancelDeploymentResponse' {} Int
a -> CancelDeploymentResponse
s {$sel:httpStatus:CancelDeploymentResponse' :: Int
httpStatus = Int
a} :: CancelDeploymentResponse)
instance Prelude.NFData CancelDeploymentResponse