{-# 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.UpdateLinkAttributes
(
UpdateLinkAttributes (..),
newUpdateLinkAttributes,
updateLinkAttributes_directoryArn,
updateLinkAttributes_typedLinkSpecifier,
updateLinkAttributes_attributeUpdates,
UpdateLinkAttributesResponse (..),
newUpdateLinkAttributesResponse,
updateLinkAttributesResponse_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 UpdateLinkAttributes = UpdateLinkAttributes'
{
UpdateLinkAttributes -> Text
directoryArn :: Prelude.Text,
UpdateLinkAttributes -> TypedLinkSpecifier
typedLinkSpecifier :: TypedLinkSpecifier,
UpdateLinkAttributes -> [LinkAttributeUpdate]
attributeUpdates :: [LinkAttributeUpdate]
}
deriving (UpdateLinkAttributes -> UpdateLinkAttributes -> Bool
(UpdateLinkAttributes -> UpdateLinkAttributes -> Bool)
-> (UpdateLinkAttributes -> UpdateLinkAttributes -> Bool)
-> Eq UpdateLinkAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateLinkAttributes -> UpdateLinkAttributes -> Bool
$c/= :: UpdateLinkAttributes -> UpdateLinkAttributes -> Bool
== :: UpdateLinkAttributes -> UpdateLinkAttributes -> Bool
$c== :: UpdateLinkAttributes -> UpdateLinkAttributes -> Bool
Prelude.Eq, ReadPrec [UpdateLinkAttributes]
ReadPrec UpdateLinkAttributes
Int -> ReadS UpdateLinkAttributes
ReadS [UpdateLinkAttributes]
(Int -> ReadS UpdateLinkAttributes)
-> ReadS [UpdateLinkAttributes]
-> ReadPrec UpdateLinkAttributes
-> ReadPrec [UpdateLinkAttributes]
-> Read UpdateLinkAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateLinkAttributes]
$creadListPrec :: ReadPrec [UpdateLinkAttributes]
readPrec :: ReadPrec UpdateLinkAttributes
$creadPrec :: ReadPrec UpdateLinkAttributes
readList :: ReadS [UpdateLinkAttributes]
$creadList :: ReadS [UpdateLinkAttributes]
readsPrec :: Int -> ReadS UpdateLinkAttributes
$creadsPrec :: Int -> ReadS UpdateLinkAttributes
Prelude.Read, Int -> UpdateLinkAttributes -> ShowS
[UpdateLinkAttributes] -> ShowS
UpdateLinkAttributes -> String
(Int -> UpdateLinkAttributes -> ShowS)
-> (UpdateLinkAttributes -> String)
-> ([UpdateLinkAttributes] -> ShowS)
-> Show UpdateLinkAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateLinkAttributes] -> ShowS
$cshowList :: [UpdateLinkAttributes] -> ShowS
show :: UpdateLinkAttributes -> String
$cshow :: UpdateLinkAttributes -> String
showsPrec :: Int -> UpdateLinkAttributes -> ShowS
$cshowsPrec :: Int -> UpdateLinkAttributes -> ShowS
Prelude.Show, (forall x. UpdateLinkAttributes -> Rep UpdateLinkAttributes x)
-> (forall x. Rep UpdateLinkAttributes x -> UpdateLinkAttributes)
-> Generic UpdateLinkAttributes
forall x. Rep UpdateLinkAttributes x -> UpdateLinkAttributes
forall x. UpdateLinkAttributes -> Rep UpdateLinkAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateLinkAttributes x -> UpdateLinkAttributes
$cfrom :: forall x. UpdateLinkAttributes -> Rep UpdateLinkAttributes x
Prelude.Generic)
newUpdateLinkAttributes ::
Prelude.Text ->
TypedLinkSpecifier ->
UpdateLinkAttributes
newUpdateLinkAttributes :: Text -> TypedLinkSpecifier -> UpdateLinkAttributes
newUpdateLinkAttributes
Text
pDirectoryArn_
TypedLinkSpecifier
pTypedLinkSpecifier_ =
UpdateLinkAttributes' :: Text
-> TypedLinkSpecifier
-> [LinkAttributeUpdate]
-> UpdateLinkAttributes
UpdateLinkAttributes'
{ $sel:directoryArn:UpdateLinkAttributes' :: Text
directoryArn =
Text
pDirectoryArn_,
$sel:typedLinkSpecifier:UpdateLinkAttributes' :: TypedLinkSpecifier
typedLinkSpecifier = TypedLinkSpecifier
pTypedLinkSpecifier_,
$sel:attributeUpdates:UpdateLinkAttributes' :: [LinkAttributeUpdate]
attributeUpdates = [LinkAttributeUpdate]
forall a. Monoid a => a
Prelude.mempty
}
updateLinkAttributes_directoryArn :: Lens.Lens' UpdateLinkAttributes Prelude.Text
updateLinkAttributes_directoryArn :: (Text -> f Text) -> UpdateLinkAttributes -> f UpdateLinkAttributes
updateLinkAttributes_directoryArn = (UpdateLinkAttributes -> Text)
-> (UpdateLinkAttributes -> Text -> UpdateLinkAttributes)
-> Lens UpdateLinkAttributes UpdateLinkAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateLinkAttributes' {Text
directoryArn :: Text
$sel:directoryArn:UpdateLinkAttributes' :: UpdateLinkAttributes -> Text
directoryArn} -> Text
directoryArn) (\s :: UpdateLinkAttributes
s@UpdateLinkAttributes' {} Text
a -> UpdateLinkAttributes
s {$sel:directoryArn:UpdateLinkAttributes' :: Text
directoryArn = Text
a} :: UpdateLinkAttributes)
updateLinkAttributes_typedLinkSpecifier :: Lens.Lens' UpdateLinkAttributes TypedLinkSpecifier
updateLinkAttributes_typedLinkSpecifier :: (TypedLinkSpecifier -> f TypedLinkSpecifier)
-> UpdateLinkAttributes -> f UpdateLinkAttributes
updateLinkAttributes_typedLinkSpecifier = (UpdateLinkAttributes -> TypedLinkSpecifier)
-> (UpdateLinkAttributes
-> TypedLinkSpecifier -> UpdateLinkAttributes)
-> Lens
UpdateLinkAttributes
UpdateLinkAttributes
TypedLinkSpecifier
TypedLinkSpecifier
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateLinkAttributes' {TypedLinkSpecifier
typedLinkSpecifier :: TypedLinkSpecifier
$sel:typedLinkSpecifier:UpdateLinkAttributes' :: UpdateLinkAttributes -> TypedLinkSpecifier
typedLinkSpecifier} -> TypedLinkSpecifier
typedLinkSpecifier) (\s :: UpdateLinkAttributes
s@UpdateLinkAttributes' {} TypedLinkSpecifier
a -> UpdateLinkAttributes
s {$sel:typedLinkSpecifier:UpdateLinkAttributes' :: TypedLinkSpecifier
typedLinkSpecifier = TypedLinkSpecifier
a} :: UpdateLinkAttributes)
updateLinkAttributes_attributeUpdates :: Lens.Lens' UpdateLinkAttributes [LinkAttributeUpdate]
updateLinkAttributes_attributeUpdates :: ([LinkAttributeUpdate] -> f [LinkAttributeUpdate])
-> UpdateLinkAttributes -> f UpdateLinkAttributes
updateLinkAttributes_attributeUpdates = (UpdateLinkAttributes -> [LinkAttributeUpdate])
-> (UpdateLinkAttributes
-> [LinkAttributeUpdate] -> UpdateLinkAttributes)
-> Lens
UpdateLinkAttributes
UpdateLinkAttributes
[LinkAttributeUpdate]
[LinkAttributeUpdate]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateLinkAttributes' {[LinkAttributeUpdate]
attributeUpdates :: [LinkAttributeUpdate]
$sel:attributeUpdates:UpdateLinkAttributes' :: UpdateLinkAttributes -> [LinkAttributeUpdate]
attributeUpdates} -> [LinkAttributeUpdate]
attributeUpdates) (\s :: UpdateLinkAttributes
s@UpdateLinkAttributes' {} [LinkAttributeUpdate]
a -> UpdateLinkAttributes
s {$sel:attributeUpdates:UpdateLinkAttributes' :: [LinkAttributeUpdate]
attributeUpdates = [LinkAttributeUpdate]
a} :: UpdateLinkAttributes) (([LinkAttributeUpdate] -> f [LinkAttributeUpdate])
-> UpdateLinkAttributes -> f UpdateLinkAttributes)
-> (([LinkAttributeUpdate] -> f [LinkAttributeUpdate])
-> [LinkAttributeUpdate] -> f [LinkAttributeUpdate])
-> ([LinkAttributeUpdate] -> f [LinkAttributeUpdate])
-> UpdateLinkAttributes
-> f UpdateLinkAttributes
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([LinkAttributeUpdate] -> f [LinkAttributeUpdate])
-> [LinkAttributeUpdate] -> f [LinkAttributeUpdate]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest UpdateLinkAttributes where
type
AWSResponse UpdateLinkAttributes =
UpdateLinkAttributesResponse
request :: UpdateLinkAttributes -> Request UpdateLinkAttributes
request = Service -> UpdateLinkAttributes -> Request UpdateLinkAttributes
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateLinkAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateLinkAttributes)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateLinkAttributes))
-> Logger
-> Service
-> Proxy UpdateLinkAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateLinkAttributes)))
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 -> UpdateLinkAttributesResponse
UpdateLinkAttributesResponse'
(Int -> UpdateLinkAttributesResponse)
-> Either String Int -> Either String UpdateLinkAttributesResponse
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 UpdateLinkAttributes
instance Prelude.NFData UpdateLinkAttributes
instance Core.ToHeaders UpdateLinkAttributes where
toHeaders :: UpdateLinkAttributes -> ResponseHeaders
toHeaders UpdateLinkAttributes' {[LinkAttributeUpdate]
Text
TypedLinkSpecifier
attributeUpdates :: [LinkAttributeUpdate]
typedLinkSpecifier :: TypedLinkSpecifier
directoryArn :: Text
$sel:attributeUpdates:UpdateLinkAttributes' :: UpdateLinkAttributes -> [LinkAttributeUpdate]
$sel:typedLinkSpecifier:UpdateLinkAttributes' :: UpdateLinkAttributes -> TypedLinkSpecifier
$sel:directoryArn:UpdateLinkAttributes' :: UpdateLinkAttributes -> 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 UpdateLinkAttributes where
toJSON :: UpdateLinkAttributes -> Value
toJSON UpdateLinkAttributes' {[LinkAttributeUpdate]
Text
TypedLinkSpecifier
attributeUpdates :: [LinkAttributeUpdate]
typedLinkSpecifier :: TypedLinkSpecifier
directoryArn :: Text
$sel:attributeUpdates:UpdateLinkAttributes' :: UpdateLinkAttributes -> [LinkAttributeUpdate]
$sel:typedLinkSpecifier:UpdateLinkAttributes' :: UpdateLinkAttributes -> TypedLinkSpecifier
$sel:directoryArn:UpdateLinkAttributes' :: UpdateLinkAttributes -> 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
"TypedLinkSpecifier" Text -> TypedLinkSpecifier -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TypedLinkSpecifier
typedLinkSpecifier),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"AttributeUpdates" Text -> [LinkAttributeUpdate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [LinkAttributeUpdate]
attributeUpdates)
]
)
instance Core.ToPath UpdateLinkAttributes where
toPath :: UpdateLinkAttributes -> ByteString
toPath =
ByteString -> UpdateLinkAttributes -> ByteString
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/typedlink/attributes/update"
instance Core.ToQuery UpdateLinkAttributes where
toQuery :: UpdateLinkAttributes -> QueryString
toQuery = QueryString -> UpdateLinkAttributes -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateLinkAttributesResponse = UpdateLinkAttributesResponse'
{
UpdateLinkAttributesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateLinkAttributesResponse
-> UpdateLinkAttributesResponse -> Bool
(UpdateLinkAttributesResponse
-> UpdateLinkAttributesResponse -> Bool)
-> (UpdateLinkAttributesResponse
-> UpdateLinkAttributesResponse -> Bool)
-> Eq UpdateLinkAttributesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateLinkAttributesResponse
-> UpdateLinkAttributesResponse -> Bool
$c/= :: UpdateLinkAttributesResponse
-> UpdateLinkAttributesResponse -> Bool
== :: UpdateLinkAttributesResponse
-> UpdateLinkAttributesResponse -> Bool
$c== :: UpdateLinkAttributesResponse
-> UpdateLinkAttributesResponse -> Bool
Prelude.Eq, ReadPrec [UpdateLinkAttributesResponse]
ReadPrec UpdateLinkAttributesResponse
Int -> ReadS UpdateLinkAttributesResponse
ReadS [UpdateLinkAttributesResponse]
(Int -> ReadS UpdateLinkAttributesResponse)
-> ReadS [UpdateLinkAttributesResponse]
-> ReadPrec UpdateLinkAttributesResponse
-> ReadPrec [UpdateLinkAttributesResponse]
-> Read UpdateLinkAttributesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateLinkAttributesResponse]
$creadListPrec :: ReadPrec [UpdateLinkAttributesResponse]
readPrec :: ReadPrec UpdateLinkAttributesResponse
$creadPrec :: ReadPrec UpdateLinkAttributesResponse
readList :: ReadS [UpdateLinkAttributesResponse]
$creadList :: ReadS [UpdateLinkAttributesResponse]
readsPrec :: Int -> ReadS UpdateLinkAttributesResponse
$creadsPrec :: Int -> ReadS UpdateLinkAttributesResponse
Prelude.Read, Int -> UpdateLinkAttributesResponse -> ShowS
[UpdateLinkAttributesResponse] -> ShowS
UpdateLinkAttributesResponse -> String
(Int -> UpdateLinkAttributesResponse -> ShowS)
-> (UpdateLinkAttributesResponse -> String)
-> ([UpdateLinkAttributesResponse] -> ShowS)
-> Show UpdateLinkAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateLinkAttributesResponse] -> ShowS
$cshowList :: [UpdateLinkAttributesResponse] -> ShowS
show :: UpdateLinkAttributesResponse -> String
$cshow :: UpdateLinkAttributesResponse -> String
showsPrec :: Int -> UpdateLinkAttributesResponse -> ShowS
$cshowsPrec :: Int -> UpdateLinkAttributesResponse -> ShowS
Prelude.Show, (forall x.
UpdateLinkAttributesResponse -> Rep UpdateLinkAttributesResponse x)
-> (forall x.
Rep UpdateLinkAttributesResponse x -> UpdateLinkAttributesResponse)
-> Generic UpdateLinkAttributesResponse
forall x.
Rep UpdateLinkAttributesResponse x -> UpdateLinkAttributesResponse
forall x.
UpdateLinkAttributesResponse -> Rep UpdateLinkAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateLinkAttributesResponse x -> UpdateLinkAttributesResponse
$cfrom :: forall x.
UpdateLinkAttributesResponse -> Rep UpdateLinkAttributesResponse x
Prelude.Generic)
newUpdateLinkAttributesResponse ::
Prelude.Int ->
UpdateLinkAttributesResponse
newUpdateLinkAttributesResponse :: Int -> UpdateLinkAttributesResponse
newUpdateLinkAttributesResponse Int
pHttpStatus_ =
UpdateLinkAttributesResponse' :: Int -> UpdateLinkAttributesResponse
UpdateLinkAttributesResponse'
{ $sel:httpStatus:UpdateLinkAttributesResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateLinkAttributesResponse_httpStatus :: Lens.Lens' UpdateLinkAttributesResponse Prelude.Int
updateLinkAttributesResponse_httpStatus :: (Int -> f Int)
-> UpdateLinkAttributesResponse -> f UpdateLinkAttributesResponse
updateLinkAttributesResponse_httpStatus = (UpdateLinkAttributesResponse -> Int)
-> (UpdateLinkAttributesResponse
-> Int -> UpdateLinkAttributesResponse)
-> Lens
UpdateLinkAttributesResponse UpdateLinkAttributesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateLinkAttributesResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateLinkAttributesResponse' :: UpdateLinkAttributesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateLinkAttributesResponse
s@UpdateLinkAttributesResponse' {} Int
a -> UpdateLinkAttributesResponse
s {$sel:httpStatus:UpdateLinkAttributesResponse' :: Int
httpStatus = Int
a} :: UpdateLinkAttributesResponse)
instance Prelude.NFData UpdateLinkAttributesResponse