{-# 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.CloudDirectory.UpdateObjectAttributes
(
UpdateObjectAttributes (..),
newUpdateObjectAttributes,
updateObjectAttributes_directoryArn,
updateObjectAttributes_objectReference,
updateObjectAttributes_attributeUpdates,
UpdateObjectAttributesResponse (..),
newUpdateObjectAttributesResponse,
updateObjectAttributesResponse_objectIdentifier,
updateObjectAttributesResponse_httpStatus,
)
where
import Amazonka.CloudDirectory.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 UpdateObjectAttributes = UpdateObjectAttributes'
{
UpdateObjectAttributes -> Text
directoryArn :: Prelude.Text,
UpdateObjectAttributes -> ObjectReference
objectReference :: ObjectReference,
UpdateObjectAttributes -> [ObjectAttributeUpdate]
attributeUpdates :: [ObjectAttributeUpdate]
}
deriving (UpdateObjectAttributes -> UpdateObjectAttributes -> Bool
(UpdateObjectAttributes -> UpdateObjectAttributes -> Bool)
-> (UpdateObjectAttributes -> UpdateObjectAttributes -> Bool)
-> Eq UpdateObjectAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateObjectAttributes -> UpdateObjectAttributes -> Bool
$c/= :: UpdateObjectAttributes -> UpdateObjectAttributes -> Bool
== :: UpdateObjectAttributes -> UpdateObjectAttributes -> Bool
$c== :: UpdateObjectAttributes -> UpdateObjectAttributes -> Bool
Prelude.Eq, ReadPrec [UpdateObjectAttributes]
ReadPrec UpdateObjectAttributes
Int -> ReadS UpdateObjectAttributes
ReadS [UpdateObjectAttributes]
(Int -> ReadS UpdateObjectAttributes)
-> ReadS [UpdateObjectAttributes]
-> ReadPrec UpdateObjectAttributes
-> ReadPrec [UpdateObjectAttributes]
-> Read UpdateObjectAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateObjectAttributes]
$creadListPrec :: ReadPrec [UpdateObjectAttributes]
readPrec :: ReadPrec UpdateObjectAttributes
$creadPrec :: ReadPrec UpdateObjectAttributes
readList :: ReadS [UpdateObjectAttributes]
$creadList :: ReadS [UpdateObjectAttributes]
readsPrec :: Int -> ReadS UpdateObjectAttributes
$creadsPrec :: Int -> ReadS UpdateObjectAttributes
Prelude.Read, Int -> UpdateObjectAttributes -> ShowS
[UpdateObjectAttributes] -> ShowS
UpdateObjectAttributes -> String
(Int -> UpdateObjectAttributes -> ShowS)
-> (UpdateObjectAttributes -> String)
-> ([UpdateObjectAttributes] -> ShowS)
-> Show UpdateObjectAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateObjectAttributes] -> ShowS
$cshowList :: [UpdateObjectAttributes] -> ShowS
show :: UpdateObjectAttributes -> String
$cshow :: UpdateObjectAttributes -> String
showsPrec :: Int -> UpdateObjectAttributes -> ShowS
$cshowsPrec :: Int -> UpdateObjectAttributes -> ShowS
Prelude.Show, (forall x. UpdateObjectAttributes -> Rep UpdateObjectAttributes x)
-> (forall x.
Rep UpdateObjectAttributes x -> UpdateObjectAttributes)
-> Generic UpdateObjectAttributes
forall x. Rep UpdateObjectAttributes x -> UpdateObjectAttributes
forall x. UpdateObjectAttributes -> Rep UpdateObjectAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateObjectAttributes x -> UpdateObjectAttributes
$cfrom :: forall x. UpdateObjectAttributes -> Rep UpdateObjectAttributes x
Prelude.Generic)
newUpdateObjectAttributes ::
Prelude.Text ->
ObjectReference ->
UpdateObjectAttributes
newUpdateObjectAttributes :: Text -> ObjectReference -> UpdateObjectAttributes
newUpdateObjectAttributes
Text
pDirectoryArn_
ObjectReference
pObjectReference_ =
UpdateObjectAttributes' :: Text
-> ObjectReference
-> [ObjectAttributeUpdate]
-> UpdateObjectAttributes
UpdateObjectAttributes'
{ $sel:directoryArn:UpdateObjectAttributes' :: Text
directoryArn =
Text
pDirectoryArn_,
$sel:objectReference:UpdateObjectAttributes' :: ObjectReference
objectReference = ObjectReference
pObjectReference_,
$sel:attributeUpdates:UpdateObjectAttributes' :: [ObjectAttributeUpdate]
attributeUpdates = [ObjectAttributeUpdate]
forall a. Monoid a => a
Prelude.mempty
}
updateObjectAttributes_directoryArn :: Lens.Lens' UpdateObjectAttributes Prelude.Text
updateObjectAttributes_directoryArn :: (Text -> f Text)
-> UpdateObjectAttributes -> f UpdateObjectAttributes
updateObjectAttributes_directoryArn = (UpdateObjectAttributes -> Text)
-> (UpdateObjectAttributes -> Text -> UpdateObjectAttributes)
-> Lens UpdateObjectAttributes UpdateObjectAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateObjectAttributes' {Text
directoryArn :: Text
$sel:directoryArn:UpdateObjectAttributes' :: UpdateObjectAttributes -> Text
directoryArn} -> Text
directoryArn) (\s :: UpdateObjectAttributes
s@UpdateObjectAttributes' {} Text
a -> UpdateObjectAttributes
s {$sel:directoryArn:UpdateObjectAttributes' :: Text
directoryArn = Text
a} :: UpdateObjectAttributes)
updateObjectAttributes_objectReference :: Lens.Lens' UpdateObjectAttributes ObjectReference
updateObjectAttributes_objectReference :: (ObjectReference -> f ObjectReference)
-> UpdateObjectAttributes -> f UpdateObjectAttributes
updateObjectAttributes_objectReference = (UpdateObjectAttributes -> ObjectReference)
-> (UpdateObjectAttributes
-> ObjectReference -> UpdateObjectAttributes)
-> Lens
UpdateObjectAttributes
UpdateObjectAttributes
ObjectReference
ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateObjectAttributes' {ObjectReference
objectReference :: ObjectReference
$sel:objectReference:UpdateObjectAttributes' :: UpdateObjectAttributes -> ObjectReference
objectReference} -> ObjectReference
objectReference) (\s :: UpdateObjectAttributes
s@UpdateObjectAttributes' {} ObjectReference
a -> UpdateObjectAttributes
s {$sel:objectReference:UpdateObjectAttributes' :: ObjectReference
objectReference = ObjectReference
a} :: UpdateObjectAttributes)
updateObjectAttributes_attributeUpdates :: Lens.Lens' UpdateObjectAttributes [ObjectAttributeUpdate]
updateObjectAttributes_attributeUpdates :: ([ObjectAttributeUpdate] -> f [ObjectAttributeUpdate])
-> UpdateObjectAttributes -> f UpdateObjectAttributes
updateObjectAttributes_attributeUpdates = (UpdateObjectAttributes -> [ObjectAttributeUpdate])
-> (UpdateObjectAttributes
-> [ObjectAttributeUpdate] -> UpdateObjectAttributes)
-> Lens
UpdateObjectAttributes
UpdateObjectAttributes
[ObjectAttributeUpdate]
[ObjectAttributeUpdate]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateObjectAttributes' {[ObjectAttributeUpdate]
attributeUpdates :: [ObjectAttributeUpdate]
$sel:attributeUpdates:UpdateObjectAttributes' :: UpdateObjectAttributes -> [ObjectAttributeUpdate]
attributeUpdates} -> [ObjectAttributeUpdate]
attributeUpdates) (\s :: UpdateObjectAttributes
s@UpdateObjectAttributes' {} [ObjectAttributeUpdate]
a -> UpdateObjectAttributes
s {$sel:attributeUpdates:UpdateObjectAttributes' :: [ObjectAttributeUpdate]
attributeUpdates = [ObjectAttributeUpdate]
a} :: UpdateObjectAttributes) (([ObjectAttributeUpdate] -> f [ObjectAttributeUpdate])
-> UpdateObjectAttributes -> f UpdateObjectAttributes)
-> (([ObjectAttributeUpdate] -> f [ObjectAttributeUpdate])
-> [ObjectAttributeUpdate] -> f [ObjectAttributeUpdate])
-> ([ObjectAttributeUpdate] -> f [ObjectAttributeUpdate])
-> UpdateObjectAttributes
-> f UpdateObjectAttributes
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ObjectAttributeUpdate] -> f [ObjectAttributeUpdate])
-> [ObjectAttributeUpdate] -> f [ObjectAttributeUpdate]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest UpdateObjectAttributes where
type
AWSResponse UpdateObjectAttributes =
UpdateObjectAttributesResponse
request :: UpdateObjectAttributes -> Request UpdateObjectAttributes
request = Service -> UpdateObjectAttributes -> Request UpdateObjectAttributes
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateObjectAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateObjectAttributes)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateObjectAttributes))
-> Logger
-> Service
-> Proxy UpdateObjectAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateObjectAttributes)))
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 -> UpdateObjectAttributesResponse
UpdateObjectAttributesResponse'
(Maybe Text -> Int -> UpdateObjectAttributesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateObjectAttributesResponse)
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
"ObjectIdentifier")
Either String (Int -> UpdateObjectAttributesResponse)
-> Either String Int
-> Either String UpdateObjectAttributesResponse
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 UpdateObjectAttributes
instance Prelude.NFData UpdateObjectAttributes
instance Core.ToHeaders UpdateObjectAttributes where
toHeaders :: UpdateObjectAttributes -> ResponseHeaders
toHeaders UpdateObjectAttributes' {[ObjectAttributeUpdate]
Text
ObjectReference
attributeUpdates :: [ObjectAttributeUpdate]
objectReference :: ObjectReference
directoryArn :: Text
$sel:attributeUpdates:UpdateObjectAttributes' :: UpdateObjectAttributes -> [ObjectAttributeUpdate]
$sel:objectReference:UpdateObjectAttributes' :: UpdateObjectAttributes -> ObjectReference
$sel:directoryArn:UpdateObjectAttributes' :: UpdateObjectAttributes -> Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[HeaderName
"x-amz-data-partition" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
directoryArn]
instance Core.ToJSON UpdateObjectAttributes where
toJSON :: UpdateObjectAttributes -> Value
toJSON UpdateObjectAttributes' {[ObjectAttributeUpdate]
Text
ObjectReference
attributeUpdates :: [ObjectAttributeUpdate]
objectReference :: ObjectReference
directoryArn :: Text
$sel:attributeUpdates:UpdateObjectAttributes' :: UpdateObjectAttributes -> [ObjectAttributeUpdate]
$sel:objectReference:UpdateObjectAttributes' :: UpdateObjectAttributes -> ObjectReference
$sel:directoryArn:UpdateObjectAttributes' :: UpdateObjectAttributes -> 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
"ObjectReference" Text -> ObjectReference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ObjectReference
objectReference),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"AttributeUpdates" Text -> [ObjectAttributeUpdate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [ObjectAttributeUpdate]
attributeUpdates)
]
)
instance Core.ToPath UpdateObjectAttributes where
toPath :: UpdateObjectAttributes -> ByteString
toPath =
ByteString -> UpdateObjectAttributes -> ByteString
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/object/update"
instance Core.ToQuery UpdateObjectAttributes where
toQuery :: UpdateObjectAttributes -> QueryString
toQuery = QueryString -> UpdateObjectAttributes -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateObjectAttributesResponse = UpdateObjectAttributesResponse'
{
UpdateObjectAttributesResponse -> Maybe Text
objectIdentifier :: Prelude.Maybe Prelude.Text,
UpdateObjectAttributesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateObjectAttributesResponse
-> UpdateObjectAttributesResponse -> Bool
(UpdateObjectAttributesResponse
-> UpdateObjectAttributesResponse -> Bool)
-> (UpdateObjectAttributesResponse
-> UpdateObjectAttributesResponse -> Bool)
-> Eq UpdateObjectAttributesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateObjectAttributesResponse
-> UpdateObjectAttributesResponse -> Bool
$c/= :: UpdateObjectAttributesResponse
-> UpdateObjectAttributesResponse -> Bool
== :: UpdateObjectAttributesResponse
-> UpdateObjectAttributesResponse -> Bool
$c== :: UpdateObjectAttributesResponse
-> UpdateObjectAttributesResponse -> Bool
Prelude.Eq, ReadPrec [UpdateObjectAttributesResponse]
ReadPrec UpdateObjectAttributesResponse
Int -> ReadS UpdateObjectAttributesResponse
ReadS [UpdateObjectAttributesResponse]
(Int -> ReadS UpdateObjectAttributesResponse)
-> ReadS [UpdateObjectAttributesResponse]
-> ReadPrec UpdateObjectAttributesResponse
-> ReadPrec [UpdateObjectAttributesResponse]
-> Read UpdateObjectAttributesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateObjectAttributesResponse]
$creadListPrec :: ReadPrec [UpdateObjectAttributesResponse]
readPrec :: ReadPrec UpdateObjectAttributesResponse
$creadPrec :: ReadPrec UpdateObjectAttributesResponse
readList :: ReadS [UpdateObjectAttributesResponse]
$creadList :: ReadS [UpdateObjectAttributesResponse]
readsPrec :: Int -> ReadS UpdateObjectAttributesResponse
$creadsPrec :: Int -> ReadS UpdateObjectAttributesResponse
Prelude.Read, Int -> UpdateObjectAttributesResponse -> ShowS
[UpdateObjectAttributesResponse] -> ShowS
UpdateObjectAttributesResponse -> String
(Int -> UpdateObjectAttributesResponse -> ShowS)
-> (UpdateObjectAttributesResponse -> String)
-> ([UpdateObjectAttributesResponse] -> ShowS)
-> Show UpdateObjectAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateObjectAttributesResponse] -> ShowS
$cshowList :: [UpdateObjectAttributesResponse] -> ShowS
show :: UpdateObjectAttributesResponse -> String
$cshow :: UpdateObjectAttributesResponse -> String
showsPrec :: Int -> UpdateObjectAttributesResponse -> ShowS
$cshowsPrec :: Int -> UpdateObjectAttributesResponse -> ShowS
Prelude.Show, (forall x.
UpdateObjectAttributesResponse
-> Rep UpdateObjectAttributesResponse x)
-> (forall x.
Rep UpdateObjectAttributesResponse x
-> UpdateObjectAttributesResponse)
-> Generic UpdateObjectAttributesResponse
forall x.
Rep UpdateObjectAttributesResponse x
-> UpdateObjectAttributesResponse
forall x.
UpdateObjectAttributesResponse
-> Rep UpdateObjectAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateObjectAttributesResponse x
-> UpdateObjectAttributesResponse
$cfrom :: forall x.
UpdateObjectAttributesResponse
-> Rep UpdateObjectAttributesResponse x
Prelude.Generic)
newUpdateObjectAttributesResponse ::
Prelude.Int ->
UpdateObjectAttributesResponse
newUpdateObjectAttributesResponse :: Int -> UpdateObjectAttributesResponse
newUpdateObjectAttributesResponse Int
pHttpStatus_ =
UpdateObjectAttributesResponse' :: Maybe Text -> Int -> UpdateObjectAttributesResponse
UpdateObjectAttributesResponse'
{ $sel:objectIdentifier:UpdateObjectAttributesResponse' :: Maybe Text
objectIdentifier =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateObjectAttributesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateObjectAttributesResponse_objectIdentifier :: Lens.Lens' UpdateObjectAttributesResponse (Prelude.Maybe Prelude.Text)
updateObjectAttributesResponse_objectIdentifier :: (Maybe Text -> f (Maybe Text))
-> UpdateObjectAttributesResponse
-> f UpdateObjectAttributesResponse
updateObjectAttributesResponse_objectIdentifier = (UpdateObjectAttributesResponse -> Maybe Text)
-> (UpdateObjectAttributesResponse
-> Maybe Text -> UpdateObjectAttributesResponse)
-> Lens
UpdateObjectAttributesResponse
UpdateObjectAttributesResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateObjectAttributesResponse' {Maybe Text
objectIdentifier :: Maybe Text
$sel:objectIdentifier:UpdateObjectAttributesResponse' :: UpdateObjectAttributesResponse -> Maybe Text
objectIdentifier} -> Maybe Text
objectIdentifier) (\s :: UpdateObjectAttributesResponse
s@UpdateObjectAttributesResponse' {} Maybe Text
a -> UpdateObjectAttributesResponse
s {$sel:objectIdentifier:UpdateObjectAttributesResponse' :: Maybe Text
objectIdentifier = Maybe Text
a} :: UpdateObjectAttributesResponse)
updateObjectAttributesResponse_httpStatus :: Lens.Lens' UpdateObjectAttributesResponse Prelude.Int
updateObjectAttributesResponse_httpStatus :: (Int -> f Int)
-> UpdateObjectAttributesResponse
-> f UpdateObjectAttributesResponse
updateObjectAttributesResponse_httpStatus = (UpdateObjectAttributesResponse -> Int)
-> (UpdateObjectAttributesResponse
-> Int -> UpdateObjectAttributesResponse)
-> Lens
UpdateObjectAttributesResponse
UpdateObjectAttributesResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateObjectAttributesResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateObjectAttributesResponse' :: UpdateObjectAttributesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateObjectAttributesResponse
s@UpdateObjectAttributesResponse' {} Int
a -> UpdateObjectAttributesResponse
s {$sel:httpStatus:UpdateObjectAttributesResponse' :: Int
httpStatus = Int
a} :: UpdateObjectAttributesResponse)
instance
Prelude.NFData
UpdateObjectAttributesResponse