{-# 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.UpdateFacet
(
UpdateFacet (..),
newUpdateFacet,
updateFacet_objectType,
updateFacet_attributeUpdates,
updateFacet_schemaArn,
updateFacet_name,
UpdateFacetResponse (..),
newUpdateFacetResponse,
updateFacetResponse_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 UpdateFacet = UpdateFacet'
{
UpdateFacet -> Maybe ObjectType
objectType :: Prelude.Maybe ObjectType,
UpdateFacet -> Maybe [FacetAttributeUpdate]
attributeUpdates :: Prelude.Maybe [FacetAttributeUpdate],
UpdateFacet -> Text
schemaArn :: Prelude.Text,
UpdateFacet -> Text
name :: Prelude.Text
}
deriving (UpdateFacet -> UpdateFacet -> Bool
(UpdateFacet -> UpdateFacet -> Bool)
-> (UpdateFacet -> UpdateFacet -> Bool) -> Eq UpdateFacet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFacet -> UpdateFacet -> Bool
$c/= :: UpdateFacet -> UpdateFacet -> Bool
== :: UpdateFacet -> UpdateFacet -> Bool
$c== :: UpdateFacet -> UpdateFacet -> Bool
Prelude.Eq, ReadPrec [UpdateFacet]
ReadPrec UpdateFacet
Int -> ReadS UpdateFacet
ReadS [UpdateFacet]
(Int -> ReadS UpdateFacet)
-> ReadS [UpdateFacet]
-> ReadPrec UpdateFacet
-> ReadPrec [UpdateFacet]
-> Read UpdateFacet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFacet]
$creadListPrec :: ReadPrec [UpdateFacet]
readPrec :: ReadPrec UpdateFacet
$creadPrec :: ReadPrec UpdateFacet
readList :: ReadS [UpdateFacet]
$creadList :: ReadS [UpdateFacet]
readsPrec :: Int -> ReadS UpdateFacet
$creadsPrec :: Int -> ReadS UpdateFacet
Prelude.Read, Int -> UpdateFacet -> ShowS
[UpdateFacet] -> ShowS
UpdateFacet -> String
(Int -> UpdateFacet -> ShowS)
-> (UpdateFacet -> String)
-> ([UpdateFacet] -> ShowS)
-> Show UpdateFacet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFacet] -> ShowS
$cshowList :: [UpdateFacet] -> ShowS
show :: UpdateFacet -> String
$cshow :: UpdateFacet -> String
showsPrec :: Int -> UpdateFacet -> ShowS
$cshowsPrec :: Int -> UpdateFacet -> ShowS
Prelude.Show, (forall x. UpdateFacet -> Rep UpdateFacet x)
-> (forall x. Rep UpdateFacet x -> UpdateFacet)
-> Generic UpdateFacet
forall x. Rep UpdateFacet x -> UpdateFacet
forall x. UpdateFacet -> Rep UpdateFacet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFacet x -> UpdateFacet
$cfrom :: forall x. UpdateFacet -> Rep UpdateFacet x
Prelude.Generic)
newUpdateFacet ::
Prelude.Text ->
Prelude.Text ->
UpdateFacet
newUpdateFacet :: Text -> Text -> UpdateFacet
newUpdateFacet Text
pSchemaArn_ Text
pName_ =
UpdateFacet' :: Maybe ObjectType
-> Maybe [FacetAttributeUpdate] -> Text -> Text -> UpdateFacet
UpdateFacet'
{ $sel:objectType:UpdateFacet' :: Maybe ObjectType
objectType = Maybe ObjectType
forall a. Maybe a
Prelude.Nothing,
$sel:attributeUpdates:UpdateFacet' :: Maybe [FacetAttributeUpdate]
attributeUpdates = Maybe [FacetAttributeUpdate]
forall a. Maybe a
Prelude.Nothing,
$sel:schemaArn:UpdateFacet' :: Text
schemaArn = Text
pSchemaArn_,
$sel:name:UpdateFacet' :: Text
name = Text
pName_
}
updateFacet_objectType :: Lens.Lens' UpdateFacet (Prelude.Maybe ObjectType)
updateFacet_objectType :: (Maybe ObjectType -> f (Maybe ObjectType))
-> UpdateFacet -> f UpdateFacet
updateFacet_objectType = (UpdateFacet -> Maybe ObjectType)
-> (UpdateFacet -> Maybe ObjectType -> UpdateFacet)
-> Lens
UpdateFacet UpdateFacet (Maybe ObjectType) (Maybe ObjectType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFacet' {Maybe ObjectType
objectType :: Maybe ObjectType
$sel:objectType:UpdateFacet' :: UpdateFacet -> Maybe ObjectType
objectType} -> Maybe ObjectType
objectType) (\s :: UpdateFacet
s@UpdateFacet' {} Maybe ObjectType
a -> UpdateFacet
s {$sel:objectType:UpdateFacet' :: Maybe ObjectType
objectType = Maybe ObjectType
a} :: UpdateFacet)
updateFacet_attributeUpdates :: Lens.Lens' UpdateFacet (Prelude.Maybe [FacetAttributeUpdate])
updateFacet_attributeUpdates :: (Maybe [FacetAttributeUpdate] -> f (Maybe [FacetAttributeUpdate]))
-> UpdateFacet -> f UpdateFacet
updateFacet_attributeUpdates = (UpdateFacet -> Maybe [FacetAttributeUpdate])
-> (UpdateFacet -> Maybe [FacetAttributeUpdate] -> UpdateFacet)
-> Lens
UpdateFacet
UpdateFacet
(Maybe [FacetAttributeUpdate])
(Maybe [FacetAttributeUpdate])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFacet' {Maybe [FacetAttributeUpdate]
attributeUpdates :: Maybe [FacetAttributeUpdate]
$sel:attributeUpdates:UpdateFacet' :: UpdateFacet -> Maybe [FacetAttributeUpdate]
attributeUpdates} -> Maybe [FacetAttributeUpdate]
attributeUpdates) (\s :: UpdateFacet
s@UpdateFacet' {} Maybe [FacetAttributeUpdate]
a -> UpdateFacet
s {$sel:attributeUpdates:UpdateFacet' :: Maybe [FacetAttributeUpdate]
attributeUpdates = Maybe [FacetAttributeUpdate]
a} :: UpdateFacet) ((Maybe [FacetAttributeUpdate] -> f (Maybe [FacetAttributeUpdate]))
-> UpdateFacet -> f UpdateFacet)
-> ((Maybe [FacetAttributeUpdate]
-> f (Maybe [FacetAttributeUpdate]))
-> Maybe [FacetAttributeUpdate]
-> f (Maybe [FacetAttributeUpdate]))
-> (Maybe [FacetAttributeUpdate]
-> f (Maybe [FacetAttributeUpdate]))
-> UpdateFacet
-> f UpdateFacet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[FacetAttributeUpdate]
[FacetAttributeUpdate]
[FacetAttributeUpdate]
[FacetAttributeUpdate]
-> Iso
(Maybe [FacetAttributeUpdate])
(Maybe [FacetAttributeUpdate])
(Maybe [FacetAttributeUpdate])
(Maybe [FacetAttributeUpdate])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[FacetAttributeUpdate]
[FacetAttributeUpdate]
[FacetAttributeUpdate]
[FacetAttributeUpdate]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateFacet_schemaArn :: Lens.Lens' UpdateFacet Prelude.Text
updateFacet_schemaArn :: (Text -> f Text) -> UpdateFacet -> f UpdateFacet
updateFacet_schemaArn = (UpdateFacet -> Text)
-> (UpdateFacet -> Text -> UpdateFacet)
-> Lens UpdateFacet UpdateFacet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFacet' {Text
schemaArn :: Text
$sel:schemaArn:UpdateFacet' :: UpdateFacet -> Text
schemaArn} -> Text
schemaArn) (\s :: UpdateFacet
s@UpdateFacet' {} Text
a -> UpdateFacet
s {$sel:schemaArn:UpdateFacet' :: Text
schemaArn = Text
a} :: UpdateFacet)
updateFacet_name :: Lens.Lens' UpdateFacet Prelude.Text
updateFacet_name :: (Text -> f Text) -> UpdateFacet -> f UpdateFacet
updateFacet_name = (UpdateFacet -> Text)
-> (UpdateFacet -> Text -> UpdateFacet)
-> Lens UpdateFacet UpdateFacet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFacet' {Text
name :: Text
$sel:name:UpdateFacet' :: UpdateFacet -> Text
name} -> Text
name) (\s :: UpdateFacet
s@UpdateFacet' {} Text
a -> UpdateFacet
s {$sel:name:UpdateFacet' :: Text
name = Text
a} :: UpdateFacet)
instance Core.AWSRequest UpdateFacet where
type AWSResponse UpdateFacet = UpdateFacetResponse
request :: UpdateFacet -> Request UpdateFacet
request = Service -> UpdateFacet -> Request UpdateFacet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateFacet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateFacet)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateFacet))
-> Logger
-> Service
-> Proxy UpdateFacet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateFacet)))
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 -> UpdateFacetResponse
UpdateFacetResponse'
(Int -> UpdateFacetResponse)
-> Either String Int -> Either String UpdateFacetResponse
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 UpdateFacet
instance Prelude.NFData UpdateFacet
instance Core.ToHeaders UpdateFacet where
toHeaders :: UpdateFacet -> ResponseHeaders
toHeaders UpdateFacet' {Maybe [FacetAttributeUpdate]
Maybe ObjectType
Text
name :: Text
schemaArn :: Text
attributeUpdates :: Maybe [FacetAttributeUpdate]
objectType :: Maybe ObjectType
$sel:name:UpdateFacet' :: UpdateFacet -> Text
$sel:schemaArn:UpdateFacet' :: UpdateFacet -> Text
$sel:attributeUpdates:UpdateFacet' :: UpdateFacet -> Maybe [FacetAttributeUpdate]
$sel:objectType:UpdateFacet' :: UpdateFacet -> Maybe ObjectType
..} =
[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
schemaArn]
instance Core.ToJSON UpdateFacet where
toJSON :: UpdateFacet -> Value
toJSON UpdateFacet' {Maybe [FacetAttributeUpdate]
Maybe ObjectType
Text
name :: Text
schemaArn :: Text
attributeUpdates :: Maybe [FacetAttributeUpdate]
objectType :: Maybe ObjectType
$sel:name:UpdateFacet' :: UpdateFacet -> Text
$sel:schemaArn:UpdateFacet' :: UpdateFacet -> Text
$sel:attributeUpdates:UpdateFacet' :: UpdateFacet -> Maybe [FacetAttributeUpdate]
$sel:objectType:UpdateFacet' :: UpdateFacet -> Maybe ObjectType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ObjectType" Text -> ObjectType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ObjectType -> Pair) -> Maybe ObjectType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ObjectType
objectType,
(Text
"AttributeUpdates" Text -> [FacetAttributeUpdate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([FacetAttributeUpdate] -> Pair)
-> Maybe [FacetAttributeUpdate] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [FacetAttributeUpdate]
attributeUpdates,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)
instance Core.ToPath UpdateFacet where
toPath :: UpdateFacet -> ByteString
toPath =
ByteString -> UpdateFacet -> ByteString
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/facet"
instance Core.ToQuery UpdateFacet where
toQuery :: UpdateFacet -> QueryString
toQuery = QueryString -> UpdateFacet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateFacetResponse = UpdateFacetResponse'
{
UpdateFacetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateFacetResponse -> UpdateFacetResponse -> Bool
(UpdateFacetResponse -> UpdateFacetResponse -> Bool)
-> (UpdateFacetResponse -> UpdateFacetResponse -> Bool)
-> Eq UpdateFacetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFacetResponse -> UpdateFacetResponse -> Bool
$c/= :: UpdateFacetResponse -> UpdateFacetResponse -> Bool
== :: UpdateFacetResponse -> UpdateFacetResponse -> Bool
$c== :: UpdateFacetResponse -> UpdateFacetResponse -> Bool
Prelude.Eq, ReadPrec [UpdateFacetResponse]
ReadPrec UpdateFacetResponse
Int -> ReadS UpdateFacetResponse
ReadS [UpdateFacetResponse]
(Int -> ReadS UpdateFacetResponse)
-> ReadS [UpdateFacetResponse]
-> ReadPrec UpdateFacetResponse
-> ReadPrec [UpdateFacetResponse]
-> Read UpdateFacetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFacetResponse]
$creadListPrec :: ReadPrec [UpdateFacetResponse]
readPrec :: ReadPrec UpdateFacetResponse
$creadPrec :: ReadPrec UpdateFacetResponse
readList :: ReadS [UpdateFacetResponse]
$creadList :: ReadS [UpdateFacetResponse]
readsPrec :: Int -> ReadS UpdateFacetResponse
$creadsPrec :: Int -> ReadS UpdateFacetResponse
Prelude.Read, Int -> UpdateFacetResponse -> ShowS
[UpdateFacetResponse] -> ShowS
UpdateFacetResponse -> String
(Int -> UpdateFacetResponse -> ShowS)
-> (UpdateFacetResponse -> String)
-> ([UpdateFacetResponse] -> ShowS)
-> Show UpdateFacetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFacetResponse] -> ShowS
$cshowList :: [UpdateFacetResponse] -> ShowS
show :: UpdateFacetResponse -> String
$cshow :: UpdateFacetResponse -> String
showsPrec :: Int -> UpdateFacetResponse -> ShowS
$cshowsPrec :: Int -> UpdateFacetResponse -> ShowS
Prelude.Show, (forall x. UpdateFacetResponse -> Rep UpdateFacetResponse x)
-> (forall x. Rep UpdateFacetResponse x -> UpdateFacetResponse)
-> Generic UpdateFacetResponse
forall x. Rep UpdateFacetResponse x -> UpdateFacetResponse
forall x. UpdateFacetResponse -> Rep UpdateFacetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFacetResponse x -> UpdateFacetResponse
$cfrom :: forall x. UpdateFacetResponse -> Rep UpdateFacetResponse x
Prelude.Generic)
newUpdateFacetResponse ::
Prelude.Int ->
UpdateFacetResponse
newUpdateFacetResponse :: Int -> UpdateFacetResponse
newUpdateFacetResponse Int
pHttpStatus_ =
UpdateFacetResponse' :: Int -> UpdateFacetResponse
UpdateFacetResponse' {$sel:httpStatus:UpdateFacetResponse' :: Int
httpStatus = Int
pHttpStatus_}
updateFacetResponse_httpStatus :: Lens.Lens' UpdateFacetResponse Prelude.Int
updateFacetResponse_httpStatus :: (Int -> f Int) -> UpdateFacetResponse -> f UpdateFacetResponse
updateFacetResponse_httpStatus = (UpdateFacetResponse -> Int)
-> (UpdateFacetResponse -> Int -> UpdateFacetResponse)
-> Lens UpdateFacetResponse UpdateFacetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFacetResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateFacetResponse' :: UpdateFacetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateFacetResponse
s@UpdateFacetResponse' {} Int
a -> UpdateFacetResponse
s {$sel:httpStatus:UpdateFacetResponse' :: Int
httpStatus = Int
a} :: UpdateFacetResponse)
instance Prelude.NFData UpdateFacetResponse