{-# 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.MigrationHub.PutResourceAttributes
(
PutResourceAttributes (..),
newPutResourceAttributes,
putResourceAttributes_dryRun,
putResourceAttributes_progressUpdateStream,
putResourceAttributes_migrationTaskName,
putResourceAttributes_resourceAttributeList,
PutResourceAttributesResponse (..),
newPutResourceAttributesResponse,
putResourceAttributesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MigrationHub.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PutResourceAttributes = PutResourceAttributes'
{
PutResourceAttributes -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
PutResourceAttributes -> Text
progressUpdateStream :: Prelude.Text,
PutResourceAttributes -> Text
migrationTaskName :: Prelude.Text,
PutResourceAttributes -> NonEmpty ResourceAttribute
resourceAttributeList :: Prelude.NonEmpty ResourceAttribute
}
deriving (PutResourceAttributes -> PutResourceAttributes -> Bool
(PutResourceAttributes -> PutResourceAttributes -> Bool)
-> (PutResourceAttributes -> PutResourceAttributes -> Bool)
-> Eq PutResourceAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutResourceAttributes -> PutResourceAttributes -> Bool
$c/= :: PutResourceAttributes -> PutResourceAttributes -> Bool
== :: PutResourceAttributes -> PutResourceAttributes -> Bool
$c== :: PutResourceAttributes -> PutResourceAttributes -> Bool
Prelude.Eq, ReadPrec [PutResourceAttributes]
ReadPrec PutResourceAttributes
Int -> ReadS PutResourceAttributes
ReadS [PutResourceAttributes]
(Int -> ReadS PutResourceAttributes)
-> ReadS [PutResourceAttributes]
-> ReadPrec PutResourceAttributes
-> ReadPrec [PutResourceAttributes]
-> Read PutResourceAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutResourceAttributes]
$creadListPrec :: ReadPrec [PutResourceAttributes]
readPrec :: ReadPrec PutResourceAttributes
$creadPrec :: ReadPrec PutResourceAttributes
readList :: ReadS [PutResourceAttributes]
$creadList :: ReadS [PutResourceAttributes]
readsPrec :: Int -> ReadS PutResourceAttributes
$creadsPrec :: Int -> ReadS PutResourceAttributes
Prelude.Read, Int -> PutResourceAttributes -> ShowS
[PutResourceAttributes] -> ShowS
PutResourceAttributes -> String
(Int -> PutResourceAttributes -> ShowS)
-> (PutResourceAttributes -> String)
-> ([PutResourceAttributes] -> ShowS)
-> Show PutResourceAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutResourceAttributes] -> ShowS
$cshowList :: [PutResourceAttributes] -> ShowS
show :: PutResourceAttributes -> String
$cshow :: PutResourceAttributes -> String
showsPrec :: Int -> PutResourceAttributes -> ShowS
$cshowsPrec :: Int -> PutResourceAttributes -> ShowS
Prelude.Show, (forall x. PutResourceAttributes -> Rep PutResourceAttributes x)
-> (forall x. Rep PutResourceAttributes x -> PutResourceAttributes)
-> Generic PutResourceAttributes
forall x. Rep PutResourceAttributes x -> PutResourceAttributes
forall x. PutResourceAttributes -> Rep PutResourceAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutResourceAttributes x -> PutResourceAttributes
$cfrom :: forall x. PutResourceAttributes -> Rep PutResourceAttributes x
Prelude.Generic)
newPutResourceAttributes ::
Prelude.Text ->
Prelude.Text ->
Prelude.NonEmpty ResourceAttribute ->
PutResourceAttributes
newPutResourceAttributes :: Text -> Text -> NonEmpty ResourceAttribute -> PutResourceAttributes
newPutResourceAttributes
Text
pProgressUpdateStream_
Text
pMigrationTaskName_
NonEmpty ResourceAttribute
pResourceAttributeList_ =
PutResourceAttributes' :: Maybe Bool
-> Text
-> Text
-> NonEmpty ResourceAttribute
-> PutResourceAttributes
PutResourceAttributes'
{ $sel:dryRun:PutResourceAttributes' :: Maybe Bool
dryRun = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:progressUpdateStream:PutResourceAttributes' :: Text
progressUpdateStream = Text
pProgressUpdateStream_,
$sel:migrationTaskName:PutResourceAttributes' :: Text
migrationTaskName = Text
pMigrationTaskName_,
$sel:resourceAttributeList:PutResourceAttributes' :: NonEmpty ResourceAttribute
resourceAttributeList =
Tagged
(NonEmpty ResourceAttribute)
(Identity (NonEmpty ResourceAttribute))
-> Tagged
(NonEmpty ResourceAttribute)
(Identity (NonEmpty ResourceAttribute))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty ResourceAttribute)
(Identity (NonEmpty ResourceAttribute))
-> Tagged
(NonEmpty ResourceAttribute)
(Identity (NonEmpty ResourceAttribute)))
-> NonEmpty ResourceAttribute -> NonEmpty ResourceAttribute
forall t b. AReview t b -> b -> t
Lens.# NonEmpty ResourceAttribute
pResourceAttributeList_
}
putResourceAttributes_dryRun :: Lens.Lens' PutResourceAttributes (Prelude.Maybe Prelude.Bool)
putResourceAttributes_dryRun :: (Maybe Bool -> f (Maybe Bool))
-> PutResourceAttributes -> f PutResourceAttributes
putResourceAttributes_dryRun = (PutResourceAttributes -> Maybe Bool)
-> (PutResourceAttributes -> Maybe Bool -> PutResourceAttributes)
-> Lens
PutResourceAttributes
PutResourceAttributes
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutResourceAttributes' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:PutResourceAttributes' :: PutResourceAttributes -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: PutResourceAttributes
s@PutResourceAttributes' {} Maybe Bool
a -> PutResourceAttributes
s {$sel:dryRun:PutResourceAttributes' :: Maybe Bool
dryRun = Maybe Bool
a} :: PutResourceAttributes)
putResourceAttributes_progressUpdateStream :: Lens.Lens' PutResourceAttributes Prelude.Text
putResourceAttributes_progressUpdateStream :: (Text -> f Text)
-> PutResourceAttributes -> f PutResourceAttributes
putResourceAttributes_progressUpdateStream = (PutResourceAttributes -> Text)
-> (PutResourceAttributes -> Text -> PutResourceAttributes)
-> Lens PutResourceAttributes PutResourceAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutResourceAttributes' {Text
progressUpdateStream :: Text
$sel:progressUpdateStream:PutResourceAttributes' :: PutResourceAttributes -> Text
progressUpdateStream} -> Text
progressUpdateStream) (\s :: PutResourceAttributes
s@PutResourceAttributes' {} Text
a -> PutResourceAttributes
s {$sel:progressUpdateStream:PutResourceAttributes' :: Text
progressUpdateStream = Text
a} :: PutResourceAttributes)
putResourceAttributes_migrationTaskName :: Lens.Lens' PutResourceAttributes Prelude.Text
putResourceAttributes_migrationTaskName :: (Text -> f Text)
-> PutResourceAttributes -> f PutResourceAttributes
putResourceAttributes_migrationTaskName = (PutResourceAttributes -> Text)
-> (PutResourceAttributes -> Text -> PutResourceAttributes)
-> Lens PutResourceAttributes PutResourceAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutResourceAttributes' {Text
migrationTaskName :: Text
$sel:migrationTaskName:PutResourceAttributes' :: PutResourceAttributes -> Text
migrationTaskName} -> Text
migrationTaskName) (\s :: PutResourceAttributes
s@PutResourceAttributes' {} Text
a -> PutResourceAttributes
s {$sel:migrationTaskName:PutResourceAttributes' :: Text
migrationTaskName = Text
a} :: PutResourceAttributes)
putResourceAttributes_resourceAttributeList :: Lens.Lens' PutResourceAttributes (Prelude.NonEmpty ResourceAttribute)
putResourceAttributes_resourceAttributeList :: (NonEmpty ResourceAttribute -> f (NonEmpty ResourceAttribute))
-> PutResourceAttributes -> f PutResourceAttributes
putResourceAttributes_resourceAttributeList = (PutResourceAttributes -> NonEmpty ResourceAttribute)
-> (PutResourceAttributes
-> NonEmpty ResourceAttribute -> PutResourceAttributes)
-> Lens
PutResourceAttributes
PutResourceAttributes
(NonEmpty ResourceAttribute)
(NonEmpty ResourceAttribute)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutResourceAttributes' {NonEmpty ResourceAttribute
resourceAttributeList :: NonEmpty ResourceAttribute
$sel:resourceAttributeList:PutResourceAttributes' :: PutResourceAttributes -> NonEmpty ResourceAttribute
resourceAttributeList} -> NonEmpty ResourceAttribute
resourceAttributeList) (\s :: PutResourceAttributes
s@PutResourceAttributes' {} NonEmpty ResourceAttribute
a -> PutResourceAttributes
s {$sel:resourceAttributeList:PutResourceAttributes' :: NonEmpty ResourceAttribute
resourceAttributeList = NonEmpty ResourceAttribute
a} :: PutResourceAttributes) ((NonEmpty ResourceAttribute -> f (NonEmpty ResourceAttribute))
-> PutResourceAttributes -> f PutResourceAttributes)
-> ((NonEmpty ResourceAttribute -> f (NonEmpty ResourceAttribute))
-> NonEmpty ResourceAttribute -> f (NonEmpty ResourceAttribute))
-> (NonEmpty ResourceAttribute -> f (NonEmpty ResourceAttribute))
-> PutResourceAttributes
-> f PutResourceAttributes
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty ResourceAttribute -> f (NonEmpty ResourceAttribute))
-> NonEmpty ResourceAttribute -> f (NonEmpty ResourceAttribute)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest PutResourceAttributes where
type
AWSResponse PutResourceAttributes =
PutResourceAttributesResponse
request :: PutResourceAttributes -> Request PutResourceAttributes
request = Service -> PutResourceAttributes -> Request PutResourceAttributes
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutResourceAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutResourceAttributes)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse PutResourceAttributes))
-> Logger
-> Service
-> Proxy PutResourceAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutResourceAttributes)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> PutResourceAttributesResponse
PutResourceAttributesResponse'
(Int -> PutResourceAttributesResponse)
-> Either String Int -> Either String PutResourceAttributesResponse
forall (f :: * -> *) a b. Functor 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 PutResourceAttributes
instance Prelude.NFData PutResourceAttributes
instance Core.ToHeaders PutResourceAttributes where
toHeaders :: PutResourceAttributes -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutResourceAttributes -> 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
"AWSMigrationHub.PutResourceAttributes" ::
Prelude.ByteString
),
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 PutResourceAttributes where
toJSON :: PutResourceAttributes -> Value
toJSON PutResourceAttributes' {Maybe Bool
NonEmpty ResourceAttribute
Text
resourceAttributeList :: NonEmpty ResourceAttribute
migrationTaskName :: Text
progressUpdateStream :: Text
dryRun :: Maybe Bool
$sel:resourceAttributeList:PutResourceAttributes' :: PutResourceAttributes -> NonEmpty ResourceAttribute
$sel:migrationTaskName:PutResourceAttributes' :: PutResourceAttributes -> Text
$sel:progressUpdateStream:PutResourceAttributes' :: PutResourceAttributes -> Text
$sel:dryRun:PutResourceAttributes' :: PutResourceAttributes -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DryRun" 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
dryRun,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"ProgressUpdateStream"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
progressUpdateStream
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"MigrationTaskName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
migrationTaskName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"ResourceAttributeList"
Text -> NonEmpty ResourceAttribute -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty ResourceAttribute
resourceAttributeList
)
]
)
instance Core.ToPath PutResourceAttributes where
toPath :: PutResourceAttributes -> ByteString
toPath = ByteString -> PutResourceAttributes -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutResourceAttributes where
toQuery :: PutResourceAttributes -> QueryString
toQuery = QueryString -> PutResourceAttributes -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutResourceAttributesResponse = PutResourceAttributesResponse'
{
PutResourceAttributesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutResourceAttributesResponse
-> PutResourceAttributesResponse -> Bool
(PutResourceAttributesResponse
-> PutResourceAttributesResponse -> Bool)
-> (PutResourceAttributesResponse
-> PutResourceAttributesResponse -> Bool)
-> Eq PutResourceAttributesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutResourceAttributesResponse
-> PutResourceAttributesResponse -> Bool
$c/= :: PutResourceAttributesResponse
-> PutResourceAttributesResponse -> Bool
== :: PutResourceAttributesResponse
-> PutResourceAttributesResponse -> Bool
$c== :: PutResourceAttributesResponse
-> PutResourceAttributesResponse -> Bool
Prelude.Eq, ReadPrec [PutResourceAttributesResponse]
ReadPrec PutResourceAttributesResponse
Int -> ReadS PutResourceAttributesResponse
ReadS [PutResourceAttributesResponse]
(Int -> ReadS PutResourceAttributesResponse)
-> ReadS [PutResourceAttributesResponse]
-> ReadPrec PutResourceAttributesResponse
-> ReadPrec [PutResourceAttributesResponse]
-> Read PutResourceAttributesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutResourceAttributesResponse]
$creadListPrec :: ReadPrec [PutResourceAttributesResponse]
readPrec :: ReadPrec PutResourceAttributesResponse
$creadPrec :: ReadPrec PutResourceAttributesResponse
readList :: ReadS [PutResourceAttributesResponse]
$creadList :: ReadS [PutResourceAttributesResponse]
readsPrec :: Int -> ReadS PutResourceAttributesResponse
$creadsPrec :: Int -> ReadS PutResourceAttributesResponse
Prelude.Read, Int -> PutResourceAttributesResponse -> ShowS
[PutResourceAttributesResponse] -> ShowS
PutResourceAttributesResponse -> String
(Int -> PutResourceAttributesResponse -> ShowS)
-> (PutResourceAttributesResponse -> String)
-> ([PutResourceAttributesResponse] -> ShowS)
-> Show PutResourceAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutResourceAttributesResponse] -> ShowS
$cshowList :: [PutResourceAttributesResponse] -> ShowS
show :: PutResourceAttributesResponse -> String
$cshow :: PutResourceAttributesResponse -> String
showsPrec :: Int -> PutResourceAttributesResponse -> ShowS
$cshowsPrec :: Int -> PutResourceAttributesResponse -> ShowS
Prelude.Show, (forall x.
PutResourceAttributesResponse
-> Rep PutResourceAttributesResponse x)
-> (forall x.
Rep PutResourceAttributesResponse x
-> PutResourceAttributesResponse)
-> Generic PutResourceAttributesResponse
forall x.
Rep PutResourceAttributesResponse x
-> PutResourceAttributesResponse
forall x.
PutResourceAttributesResponse
-> Rep PutResourceAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutResourceAttributesResponse x
-> PutResourceAttributesResponse
$cfrom :: forall x.
PutResourceAttributesResponse
-> Rep PutResourceAttributesResponse x
Prelude.Generic)
newPutResourceAttributesResponse ::
Prelude.Int ->
PutResourceAttributesResponse
newPutResourceAttributesResponse :: Int -> PutResourceAttributesResponse
newPutResourceAttributesResponse Int
pHttpStatus_ =
PutResourceAttributesResponse' :: Int -> PutResourceAttributesResponse
PutResourceAttributesResponse'
{ $sel:httpStatus:PutResourceAttributesResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
putResourceAttributesResponse_httpStatus :: Lens.Lens' PutResourceAttributesResponse Prelude.Int
putResourceAttributesResponse_httpStatus :: (Int -> f Int)
-> PutResourceAttributesResponse -> f PutResourceAttributesResponse
putResourceAttributesResponse_httpStatus = (PutResourceAttributesResponse -> Int)
-> (PutResourceAttributesResponse
-> Int -> PutResourceAttributesResponse)
-> Lens
PutResourceAttributesResponse PutResourceAttributesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutResourceAttributesResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutResourceAttributesResponse' :: PutResourceAttributesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutResourceAttributesResponse
s@PutResourceAttributesResponse' {} Int
a -> PutResourceAttributesResponse
s {$sel:httpStatus:PutResourceAttributesResponse' :: Int
httpStatus = Int
a} :: PutResourceAttributesResponse)
instance Prelude.NFData PutResourceAttributesResponse