{-# 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.Greengrass.ResetDeployments
(
ResetDeployments (..),
newResetDeployments,
resetDeployments_amznClientToken,
resetDeployments_force,
resetDeployments_groupId,
ResetDeploymentsResponse (..),
newResetDeploymentsResponse,
resetDeploymentsResponse_deploymentId,
resetDeploymentsResponse_deploymentArn,
resetDeploymentsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Greengrass.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 ResetDeployments = ResetDeployments'
{
ResetDeployments -> Maybe Text
amznClientToken :: Prelude.Maybe Prelude.Text,
ResetDeployments -> Maybe Bool
force :: Prelude.Maybe Prelude.Bool,
ResetDeployments -> Text
groupId :: Prelude.Text
}
deriving (ResetDeployments -> ResetDeployments -> Bool
(ResetDeployments -> ResetDeployments -> Bool)
-> (ResetDeployments -> ResetDeployments -> Bool)
-> Eq ResetDeployments
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResetDeployments -> ResetDeployments -> Bool
$c/= :: ResetDeployments -> ResetDeployments -> Bool
== :: ResetDeployments -> ResetDeployments -> Bool
$c== :: ResetDeployments -> ResetDeployments -> Bool
Prelude.Eq, ReadPrec [ResetDeployments]
ReadPrec ResetDeployments
Int -> ReadS ResetDeployments
ReadS [ResetDeployments]
(Int -> ReadS ResetDeployments)
-> ReadS [ResetDeployments]
-> ReadPrec ResetDeployments
-> ReadPrec [ResetDeployments]
-> Read ResetDeployments
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResetDeployments]
$creadListPrec :: ReadPrec [ResetDeployments]
readPrec :: ReadPrec ResetDeployments
$creadPrec :: ReadPrec ResetDeployments
readList :: ReadS [ResetDeployments]
$creadList :: ReadS [ResetDeployments]
readsPrec :: Int -> ReadS ResetDeployments
$creadsPrec :: Int -> ReadS ResetDeployments
Prelude.Read, Int -> ResetDeployments -> ShowS
[ResetDeployments] -> ShowS
ResetDeployments -> String
(Int -> ResetDeployments -> ShowS)
-> (ResetDeployments -> String)
-> ([ResetDeployments] -> ShowS)
-> Show ResetDeployments
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResetDeployments] -> ShowS
$cshowList :: [ResetDeployments] -> ShowS
show :: ResetDeployments -> String
$cshow :: ResetDeployments -> String
showsPrec :: Int -> ResetDeployments -> ShowS
$cshowsPrec :: Int -> ResetDeployments -> ShowS
Prelude.Show, (forall x. ResetDeployments -> Rep ResetDeployments x)
-> (forall x. Rep ResetDeployments x -> ResetDeployments)
-> Generic ResetDeployments
forall x. Rep ResetDeployments x -> ResetDeployments
forall x. ResetDeployments -> Rep ResetDeployments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResetDeployments x -> ResetDeployments
$cfrom :: forall x. ResetDeployments -> Rep ResetDeployments x
Prelude.Generic)
newResetDeployments ::
Prelude.Text ->
ResetDeployments
newResetDeployments :: Text -> ResetDeployments
newResetDeployments Text
pGroupId_ =
ResetDeployments' :: Maybe Text -> Maybe Bool -> Text -> ResetDeployments
ResetDeployments'
{ $sel:amznClientToken:ResetDeployments' :: Maybe Text
amznClientToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:force:ResetDeployments' :: Maybe Bool
force = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:groupId:ResetDeployments' :: Text
groupId = Text
pGroupId_
}
resetDeployments_amznClientToken :: Lens.Lens' ResetDeployments (Prelude.Maybe Prelude.Text)
resetDeployments_amznClientToken :: (Maybe Text -> f (Maybe Text))
-> ResetDeployments -> f ResetDeployments
resetDeployments_amznClientToken = (ResetDeployments -> Maybe Text)
-> (ResetDeployments -> Maybe Text -> ResetDeployments)
-> Lens ResetDeployments ResetDeployments (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetDeployments' {Maybe Text
amznClientToken :: Maybe Text
$sel:amznClientToken:ResetDeployments' :: ResetDeployments -> Maybe Text
amznClientToken} -> Maybe Text
amznClientToken) (\s :: ResetDeployments
s@ResetDeployments' {} Maybe Text
a -> ResetDeployments
s {$sel:amznClientToken:ResetDeployments' :: Maybe Text
amznClientToken = Maybe Text
a} :: ResetDeployments)
resetDeployments_force :: Lens.Lens' ResetDeployments (Prelude.Maybe Prelude.Bool)
resetDeployments_force :: (Maybe Bool -> f (Maybe Bool))
-> ResetDeployments -> f ResetDeployments
resetDeployments_force = (ResetDeployments -> Maybe Bool)
-> (ResetDeployments -> Maybe Bool -> ResetDeployments)
-> Lens ResetDeployments ResetDeployments (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetDeployments' {Maybe Bool
force :: Maybe Bool
$sel:force:ResetDeployments' :: ResetDeployments -> Maybe Bool
force} -> Maybe Bool
force) (\s :: ResetDeployments
s@ResetDeployments' {} Maybe Bool
a -> ResetDeployments
s {$sel:force:ResetDeployments' :: Maybe Bool
force = Maybe Bool
a} :: ResetDeployments)
resetDeployments_groupId :: Lens.Lens' ResetDeployments Prelude.Text
resetDeployments_groupId :: (Text -> f Text) -> ResetDeployments -> f ResetDeployments
resetDeployments_groupId = (ResetDeployments -> Text)
-> (ResetDeployments -> Text -> ResetDeployments)
-> Lens ResetDeployments ResetDeployments Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetDeployments' {Text
groupId :: Text
$sel:groupId:ResetDeployments' :: ResetDeployments -> Text
groupId} -> Text
groupId) (\s :: ResetDeployments
s@ResetDeployments' {} Text
a -> ResetDeployments
s {$sel:groupId:ResetDeployments' :: Text
groupId = Text
a} :: ResetDeployments)
instance Core.AWSRequest ResetDeployments where
type
AWSResponse ResetDeployments =
ResetDeploymentsResponse
request :: ResetDeployments -> Request ResetDeployments
request = Service -> ResetDeployments -> Request ResetDeployments
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ResetDeployments
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ResetDeployments)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ResetDeployments))
-> Logger
-> Service
-> Proxy ResetDeployments
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ResetDeployments)))
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 -> Int -> ResetDeploymentsResponse
ResetDeploymentsResponse'
(Maybe Text -> Maybe Text -> Int -> ResetDeploymentsResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> ResetDeploymentsResponse)
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
"DeploymentId")
Either String (Maybe Text -> Int -> ResetDeploymentsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ResetDeploymentsResponse)
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
"DeploymentArn")
Either String (Int -> ResetDeploymentsResponse)
-> Either String Int -> Either String ResetDeploymentsResponse
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 ResetDeployments
instance Prelude.NFData ResetDeployments
instance Core.ToHeaders ResetDeployments where
toHeaders :: ResetDeployments -> ResponseHeaders
toHeaders ResetDeployments' {Maybe Bool
Maybe Text
Text
groupId :: Text
force :: Maybe Bool
amznClientToken :: Maybe Text
$sel:groupId:ResetDeployments' :: ResetDeployments -> Text
$sel:force:ResetDeployments' :: ResetDeployments -> Maybe Bool
$sel:amznClientToken:ResetDeployments' :: ResetDeployments -> Maybe Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amzn-Client-Token" HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
amznClientToken,
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 ResetDeployments where
toJSON :: ResetDeployments -> Value
toJSON ResetDeployments' {Maybe Bool
Maybe Text
Text
groupId :: Text
force :: Maybe Bool
amznClientToken :: Maybe Text
$sel:groupId:ResetDeployments' :: ResetDeployments -> Text
$sel:force:ResetDeployments' :: ResetDeployments -> Maybe Bool
$sel:amznClientToken:ResetDeployments' :: ResetDeployments -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"Force" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
force]
)
instance Core.ToPath ResetDeployments where
toPath :: ResetDeployments -> ByteString
toPath ResetDeployments' {Maybe Bool
Maybe Text
Text
groupId :: Text
force :: Maybe Bool
amznClientToken :: Maybe Text
$sel:groupId:ResetDeployments' :: ResetDeployments -> Text
$sel:force:ResetDeployments' :: ResetDeployments -> Maybe Bool
$sel:amznClientToken:ResetDeployments' :: ResetDeployments -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/greengrass/groups/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
groupId,
ByteString
"/deployments/$reset"
]
instance Core.ToQuery ResetDeployments where
toQuery :: ResetDeployments -> QueryString
toQuery = QueryString -> ResetDeployments -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ResetDeploymentsResponse = ResetDeploymentsResponse'
{
ResetDeploymentsResponse -> Maybe Text
deploymentId :: Prelude.Maybe Prelude.Text,
ResetDeploymentsResponse -> Maybe Text
deploymentArn :: Prelude.Maybe Prelude.Text,
ResetDeploymentsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ResetDeploymentsResponse -> ResetDeploymentsResponse -> Bool
(ResetDeploymentsResponse -> ResetDeploymentsResponse -> Bool)
-> (ResetDeploymentsResponse -> ResetDeploymentsResponse -> Bool)
-> Eq ResetDeploymentsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResetDeploymentsResponse -> ResetDeploymentsResponse -> Bool
$c/= :: ResetDeploymentsResponse -> ResetDeploymentsResponse -> Bool
== :: ResetDeploymentsResponse -> ResetDeploymentsResponse -> Bool
$c== :: ResetDeploymentsResponse -> ResetDeploymentsResponse -> Bool
Prelude.Eq, ReadPrec [ResetDeploymentsResponse]
ReadPrec ResetDeploymentsResponse
Int -> ReadS ResetDeploymentsResponse
ReadS [ResetDeploymentsResponse]
(Int -> ReadS ResetDeploymentsResponse)
-> ReadS [ResetDeploymentsResponse]
-> ReadPrec ResetDeploymentsResponse
-> ReadPrec [ResetDeploymentsResponse]
-> Read ResetDeploymentsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResetDeploymentsResponse]
$creadListPrec :: ReadPrec [ResetDeploymentsResponse]
readPrec :: ReadPrec ResetDeploymentsResponse
$creadPrec :: ReadPrec ResetDeploymentsResponse
readList :: ReadS [ResetDeploymentsResponse]
$creadList :: ReadS [ResetDeploymentsResponse]
readsPrec :: Int -> ReadS ResetDeploymentsResponse
$creadsPrec :: Int -> ReadS ResetDeploymentsResponse
Prelude.Read, Int -> ResetDeploymentsResponse -> ShowS
[ResetDeploymentsResponse] -> ShowS
ResetDeploymentsResponse -> String
(Int -> ResetDeploymentsResponse -> ShowS)
-> (ResetDeploymentsResponse -> String)
-> ([ResetDeploymentsResponse] -> ShowS)
-> Show ResetDeploymentsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResetDeploymentsResponse] -> ShowS
$cshowList :: [ResetDeploymentsResponse] -> ShowS
show :: ResetDeploymentsResponse -> String
$cshow :: ResetDeploymentsResponse -> String
showsPrec :: Int -> ResetDeploymentsResponse -> ShowS
$cshowsPrec :: Int -> ResetDeploymentsResponse -> ShowS
Prelude.Show, (forall x.
ResetDeploymentsResponse -> Rep ResetDeploymentsResponse x)
-> (forall x.
Rep ResetDeploymentsResponse x -> ResetDeploymentsResponse)
-> Generic ResetDeploymentsResponse
forall x.
Rep ResetDeploymentsResponse x -> ResetDeploymentsResponse
forall x.
ResetDeploymentsResponse -> Rep ResetDeploymentsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResetDeploymentsResponse x -> ResetDeploymentsResponse
$cfrom :: forall x.
ResetDeploymentsResponse -> Rep ResetDeploymentsResponse x
Prelude.Generic)
newResetDeploymentsResponse ::
Prelude.Int ->
ResetDeploymentsResponse
newResetDeploymentsResponse :: Int -> ResetDeploymentsResponse
newResetDeploymentsResponse Int
pHttpStatus_ =
ResetDeploymentsResponse' :: Maybe Text -> Maybe Text -> Int -> ResetDeploymentsResponse
ResetDeploymentsResponse'
{ $sel:deploymentId:ResetDeploymentsResponse' :: Maybe Text
deploymentId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:deploymentArn:ResetDeploymentsResponse' :: Maybe Text
deploymentArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ResetDeploymentsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
resetDeploymentsResponse_deploymentId :: Lens.Lens' ResetDeploymentsResponse (Prelude.Maybe Prelude.Text)
resetDeploymentsResponse_deploymentId :: (Maybe Text -> f (Maybe Text))
-> ResetDeploymentsResponse -> f ResetDeploymentsResponse
resetDeploymentsResponse_deploymentId = (ResetDeploymentsResponse -> Maybe Text)
-> (ResetDeploymentsResponse
-> Maybe Text -> ResetDeploymentsResponse)
-> Lens
ResetDeploymentsResponse
ResetDeploymentsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetDeploymentsResponse' {Maybe Text
deploymentId :: Maybe Text
$sel:deploymentId:ResetDeploymentsResponse' :: ResetDeploymentsResponse -> Maybe Text
deploymentId} -> Maybe Text
deploymentId) (\s :: ResetDeploymentsResponse
s@ResetDeploymentsResponse' {} Maybe Text
a -> ResetDeploymentsResponse
s {$sel:deploymentId:ResetDeploymentsResponse' :: Maybe Text
deploymentId = Maybe Text
a} :: ResetDeploymentsResponse)
resetDeploymentsResponse_deploymentArn :: Lens.Lens' ResetDeploymentsResponse (Prelude.Maybe Prelude.Text)
resetDeploymentsResponse_deploymentArn :: (Maybe Text -> f (Maybe Text))
-> ResetDeploymentsResponse -> f ResetDeploymentsResponse
resetDeploymentsResponse_deploymentArn = (ResetDeploymentsResponse -> Maybe Text)
-> (ResetDeploymentsResponse
-> Maybe Text -> ResetDeploymentsResponse)
-> Lens
ResetDeploymentsResponse
ResetDeploymentsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetDeploymentsResponse' {Maybe Text
deploymentArn :: Maybe Text
$sel:deploymentArn:ResetDeploymentsResponse' :: ResetDeploymentsResponse -> Maybe Text
deploymentArn} -> Maybe Text
deploymentArn) (\s :: ResetDeploymentsResponse
s@ResetDeploymentsResponse' {} Maybe Text
a -> ResetDeploymentsResponse
s {$sel:deploymentArn:ResetDeploymentsResponse' :: Maybe Text
deploymentArn = Maybe Text
a} :: ResetDeploymentsResponse)
resetDeploymentsResponse_httpStatus :: Lens.Lens' ResetDeploymentsResponse Prelude.Int
resetDeploymentsResponse_httpStatus :: (Int -> f Int)
-> ResetDeploymentsResponse -> f ResetDeploymentsResponse
resetDeploymentsResponse_httpStatus = (ResetDeploymentsResponse -> Int)
-> (ResetDeploymentsResponse -> Int -> ResetDeploymentsResponse)
-> Lens ResetDeploymentsResponse ResetDeploymentsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetDeploymentsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ResetDeploymentsResponse' :: ResetDeploymentsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ResetDeploymentsResponse
s@ResetDeploymentsResponse' {} Int
a -> ResetDeploymentsResponse
s {$sel:httpStatus:ResetDeploymentsResponse' :: Int
httpStatus = Int
a} :: ResetDeploymentsResponse)
instance Prelude.NFData ResetDeploymentsResponse