{-# 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.CloudControl.UpdateResource
(
UpdateResource (..),
newUpdateResource,
updateResource_clientToken,
updateResource_typeVersionId,
updateResource_roleArn,
updateResource_typeName,
updateResource_identifier,
updateResource_patchDocument,
UpdateResourceResponse (..),
newUpdateResourceResponse,
updateResourceResponse_progressEvent,
updateResourceResponse_httpStatus,
)
where
import Amazonka.CloudControl.Types
import qualified Amazonka.Core as Core
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 UpdateResource = UpdateResource'
{
UpdateResource -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
UpdateResource -> Maybe Text
typeVersionId :: Prelude.Maybe Prelude.Text,
UpdateResource -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
UpdateResource -> Text
typeName :: Prelude.Text,
UpdateResource -> Text
identifier :: Prelude.Text,
UpdateResource -> Sensitive Text
patchDocument :: Core.Sensitive Prelude.Text
}
deriving (UpdateResource -> UpdateResource -> Bool
(UpdateResource -> UpdateResource -> Bool)
-> (UpdateResource -> UpdateResource -> Bool) -> Eq UpdateResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateResource -> UpdateResource -> Bool
$c/= :: UpdateResource -> UpdateResource -> Bool
== :: UpdateResource -> UpdateResource -> Bool
$c== :: UpdateResource -> UpdateResource -> Bool
Prelude.Eq, Int -> UpdateResource -> ShowS
[UpdateResource] -> ShowS
UpdateResource -> String
(Int -> UpdateResource -> ShowS)
-> (UpdateResource -> String)
-> ([UpdateResource] -> ShowS)
-> Show UpdateResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateResource] -> ShowS
$cshowList :: [UpdateResource] -> ShowS
show :: UpdateResource -> String
$cshow :: UpdateResource -> String
showsPrec :: Int -> UpdateResource -> ShowS
$cshowsPrec :: Int -> UpdateResource -> ShowS
Prelude.Show, (forall x. UpdateResource -> Rep UpdateResource x)
-> (forall x. Rep UpdateResource x -> UpdateResource)
-> Generic UpdateResource
forall x. Rep UpdateResource x -> UpdateResource
forall x. UpdateResource -> Rep UpdateResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateResource x -> UpdateResource
$cfrom :: forall x. UpdateResource -> Rep UpdateResource x
Prelude.Generic)
newUpdateResource ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
UpdateResource
newUpdateResource :: Text -> Text -> Text -> UpdateResource
newUpdateResource
Text
pTypeName_
Text
pIdentifier_
Text
pPatchDocument_ =
UpdateResource' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> Sensitive Text
-> UpdateResource
UpdateResource'
{ $sel:clientToken:UpdateResource' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:typeVersionId:UpdateResource' :: Maybe Text
typeVersionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:UpdateResource' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:typeName:UpdateResource' :: Text
typeName = Text
pTypeName_,
$sel:identifier:UpdateResource' :: Text
identifier = Text
pIdentifier_,
$sel:patchDocument:UpdateResource' :: Sensitive Text
patchDocument =
Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pPatchDocument_
}
updateResource_clientToken :: Lens.Lens' UpdateResource (Prelude.Maybe Prelude.Text)
updateResource_clientToken :: (Maybe Text -> f (Maybe Text))
-> UpdateResource -> f UpdateResource
updateResource_clientToken = (UpdateResource -> Maybe Text)
-> (UpdateResource -> Maybe Text -> UpdateResource)
-> Lens UpdateResource UpdateResource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResource' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:UpdateResource' :: UpdateResource -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: UpdateResource
s@UpdateResource' {} Maybe Text
a -> UpdateResource
s {$sel:clientToken:UpdateResource' :: Maybe Text
clientToken = Maybe Text
a} :: UpdateResource)
updateResource_typeVersionId :: Lens.Lens' UpdateResource (Prelude.Maybe Prelude.Text)
updateResource_typeVersionId :: (Maybe Text -> f (Maybe Text))
-> UpdateResource -> f UpdateResource
updateResource_typeVersionId = (UpdateResource -> Maybe Text)
-> (UpdateResource -> Maybe Text -> UpdateResource)
-> Lens UpdateResource UpdateResource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResource' {Maybe Text
typeVersionId :: Maybe Text
$sel:typeVersionId:UpdateResource' :: UpdateResource -> Maybe Text
typeVersionId} -> Maybe Text
typeVersionId) (\s :: UpdateResource
s@UpdateResource' {} Maybe Text
a -> UpdateResource
s {$sel:typeVersionId:UpdateResource' :: Maybe Text
typeVersionId = Maybe Text
a} :: UpdateResource)
updateResource_roleArn :: Lens.Lens' UpdateResource (Prelude.Maybe Prelude.Text)
updateResource_roleArn :: (Maybe Text -> f (Maybe Text))
-> UpdateResource -> f UpdateResource
updateResource_roleArn = (UpdateResource -> Maybe Text)
-> (UpdateResource -> Maybe Text -> UpdateResource)
-> Lens UpdateResource UpdateResource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResource' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:UpdateResource' :: UpdateResource -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: UpdateResource
s@UpdateResource' {} Maybe Text
a -> UpdateResource
s {$sel:roleArn:UpdateResource' :: Maybe Text
roleArn = Maybe Text
a} :: UpdateResource)
updateResource_typeName :: Lens.Lens' UpdateResource Prelude.Text
updateResource_typeName :: (Text -> f Text) -> UpdateResource -> f UpdateResource
updateResource_typeName = (UpdateResource -> Text)
-> (UpdateResource -> Text -> UpdateResource)
-> Lens UpdateResource UpdateResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResource' {Text
typeName :: Text
$sel:typeName:UpdateResource' :: UpdateResource -> Text
typeName} -> Text
typeName) (\s :: UpdateResource
s@UpdateResource' {} Text
a -> UpdateResource
s {$sel:typeName:UpdateResource' :: Text
typeName = Text
a} :: UpdateResource)
updateResource_identifier :: Lens.Lens' UpdateResource Prelude.Text
updateResource_identifier :: (Text -> f Text) -> UpdateResource -> f UpdateResource
updateResource_identifier = (UpdateResource -> Text)
-> (UpdateResource -> Text -> UpdateResource)
-> Lens UpdateResource UpdateResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResource' {Text
identifier :: Text
$sel:identifier:UpdateResource' :: UpdateResource -> Text
identifier} -> Text
identifier) (\s :: UpdateResource
s@UpdateResource' {} Text
a -> UpdateResource
s {$sel:identifier:UpdateResource' :: Text
identifier = Text
a} :: UpdateResource)
updateResource_patchDocument :: Lens.Lens' UpdateResource Prelude.Text
updateResource_patchDocument :: (Text -> f Text) -> UpdateResource -> f UpdateResource
updateResource_patchDocument = (UpdateResource -> Sensitive Text)
-> (UpdateResource -> Sensitive Text -> UpdateResource)
-> Lens
UpdateResource UpdateResource (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResource' {Sensitive Text
patchDocument :: Sensitive Text
$sel:patchDocument:UpdateResource' :: UpdateResource -> Sensitive Text
patchDocument} -> Sensitive Text
patchDocument) (\s :: UpdateResource
s@UpdateResource' {} Sensitive Text
a -> UpdateResource
s {$sel:patchDocument:UpdateResource' :: Sensitive Text
patchDocument = Sensitive Text
a} :: UpdateResource) ((Sensitive Text -> f (Sensitive Text))
-> UpdateResource -> f UpdateResource)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> UpdateResource
-> f UpdateResource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive
instance Core.AWSRequest UpdateResource where
type
AWSResponse UpdateResource =
UpdateResourceResponse
request :: UpdateResource -> Request UpdateResource
request = Service -> UpdateResource -> Request UpdateResource
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateResource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateResource)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateResource))
-> Logger
-> Service
-> Proxy UpdateResource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateResource)))
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 ProgressEvent -> Int -> UpdateResourceResponse
UpdateResourceResponse'
(Maybe ProgressEvent -> Int -> UpdateResourceResponse)
-> Either String (Maybe ProgressEvent)
-> Either String (Int -> UpdateResourceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ProgressEvent)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProgressEvent")
Either String (Int -> UpdateResourceResponse)
-> Either String Int -> Either String UpdateResourceResponse
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 UpdateResource
instance Prelude.NFData UpdateResource
instance Core.ToHeaders UpdateResource where
toHeaders :: UpdateResource -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateResource -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"CloudApiService.UpdateResource" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON UpdateResource where
toJSON :: UpdateResource -> Value
toJSON UpdateResource' {Maybe Text
Text
Sensitive Text
patchDocument :: Sensitive Text
identifier :: Text
typeName :: Text
roleArn :: Maybe Text
typeVersionId :: Maybe Text
clientToken :: Maybe Text
$sel:patchDocument:UpdateResource' :: UpdateResource -> Sensitive Text
$sel:identifier:UpdateResource' :: UpdateResource -> Text
$sel:typeName:UpdateResource' :: UpdateResource -> Text
$sel:roleArn:UpdateResource' :: UpdateResource -> Maybe Text
$sel:typeVersionId:UpdateResource' :: UpdateResource -> Maybe Text
$sel:clientToken:UpdateResource' :: UpdateResource -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ClientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
(Text
"TypeVersionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
typeVersionId,
(Text
"RoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
roleArn,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TypeName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
typeName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Identifier" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
identifier),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"PatchDocument" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
patchDocument)
]
)
instance Core.ToPath UpdateResource where
toPath :: UpdateResource -> ByteString
toPath = ByteString -> UpdateResource -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateResource where
toQuery :: UpdateResource -> QueryString
toQuery = QueryString -> UpdateResource -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateResourceResponse = UpdateResourceResponse'
{
UpdateResourceResponse -> Maybe ProgressEvent
progressEvent :: Prelude.Maybe ProgressEvent,
UpdateResourceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateResourceResponse -> UpdateResourceResponse -> Bool
(UpdateResourceResponse -> UpdateResourceResponse -> Bool)
-> (UpdateResourceResponse -> UpdateResourceResponse -> Bool)
-> Eq UpdateResourceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateResourceResponse -> UpdateResourceResponse -> Bool
$c/= :: UpdateResourceResponse -> UpdateResourceResponse -> Bool
== :: UpdateResourceResponse -> UpdateResourceResponse -> Bool
$c== :: UpdateResourceResponse -> UpdateResourceResponse -> Bool
Prelude.Eq, Int -> UpdateResourceResponse -> ShowS
[UpdateResourceResponse] -> ShowS
UpdateResourceResponse -> String
(Int -> UpdateResourceResponse -> ShowS)
-> (UpdateResourceResponse -> String)
-> ([UpdateResourceResponse] -> ShowS)
-> Show UpdateResourceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateResourceResponse] -> ShowS
$cshowList :: [UpdateResourceResponse] -> ShowS
show :: UpdateResourceResponse -> String
$cshow :: UpdateResourceResponse -> String
showsPrec :: Int -> UpdateResourceResponse -> ShowS
$cshowsPrec :: Int -> UpdateResourceResponse -> ShowS
Prelude.Show, (forall x. UpdateResourceResponse -> Rep UpdateResourceResponse x)
-> (forall x.
Rep UpdateResourceResponse x -> UpdateResourceResponse)
-> Generic UpdateResourceResponse
forall x. Rep UpdateResourceResponse x -> UpdateResourceResponse
forall x. UpdateResourceResponse -> Rep UpdateResourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateResourceResponse x -> UpdateResourceResponse
$cfrom :: forall x. UpdateResourceResponse -> Rep UpdateResourceResponse x
Prelude.Generic)
newUpdateResourceResponse ::
Prelude.Int ->
UpdateResourceResponse
newUpdateResourceResponse :: Int -> UpdateResourceResponse
newUpdateResourceResponse Int
pHttpStatus_ =
UpdateResourceResponse' :: Maybe ProgressEvent -> Int -> UpdateResourceResponse
UpdateResourceResponse'
{ $sel:progressEvent:UpdateResourceResponse' :: Maybe ProgressEvent
progressEvent =
Maybe ProgressEvent
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateResourceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateResourceResponse_progressEvent :: Lens.Lens' UpdateResourceResponse (Prelude.Maybe ProgressEvent)
updateResourceResponse_progressEvent :: (Maybe ProgressEvent -> f (Maybe ProgressEvent))
-> UpdateResourceResponse -> f UpdateResourceResponse
updateResourceResponse_progressEvent = (UpdateResourceResponse -> Maybe ProgressEvent)
-> (UpdateResourceResponse
-> Maybe ProgressEvent -> UpdateResourceResponse)
-> Lens
UpdateResourceResponse
UpdateResourceResponse
(Maybe ProgressEvent)
(Maybe ProgressEvent)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResourceResponse' {Maybe ProgressEvent
progressEvent :: Maybe ProgressEvent
$sel:progressEvent:UpdateResourceResponse' :: UpdateResourceResponse -> Maybe ProgressEvent
progressEvent} -> Maybe ProgressEvent
progressEvent) (\s :: UpdateResourceResponse
s@UpdateResourceResponse' {} Maybe ProgressEvent
a -> UpdateResourceResponse
s {$sel:progressEvent:UpdateResourceResponse' :: Maybe ProgressEvent
progressEvent = Maybe ProgressEvent
a} :: UpdateResourceResponse)
updateResourceResponse_httpStatus :: Lens.Lens' UpdateResourceResponse Prelude.Int
updateResourceResponse_httpStatus :: (Int -> f Int)
-> UpdateResourceResponse -> f UpdateResourceResponse
updateResourceResponse_httpStatus = (UpdateResourceResponse -> Int)
-> (UpdateResourceResponse -> Int -> UpdateResourceResponse)
-> Lens UpdateResourceResponse UpdateResourceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResourceResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateResourceResponse' :: UpdateResourceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateResourceResponse
s@UpdateResourceResponse' {} Int
a -> UpdateResourceResponse
s {$sel:httpStatus:UpdateResourceResponse' :: Int
httpStatus = Int
a} :: UpdateResourceResponse)
instance Prelude.NFData UpdateResourceResponse