{-# 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.WorkDocs.CreateCustomMetadata
(
CreateCustomMetadata (..),
newCreateCustomMetadata,
createCustomMetadata_versionId,
createCustomMetadata_authenticationToken,
createCustomMetadata_resourceId,
createCustomMetadata_customMetadata,
CreateCustomMetadataResponse (..),
newCreateCustomMetadataResponse,
createCustomMetadataResponse_httpStatus,
)
where
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
import Amazonka.WorkDocs.Types
data CreateCustomMetadata = CreateCustomMetadata'
{
CreateCustomMetadata -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
CreateCustomMetadata -> Maybe (Sensitive Text)
authenticationToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
CreateCustomMetadata -> Text
resourceId :: Prelude.Text,
CreateCustomMetadata -> HashMap Text Text
customMetadata :: Prelude.HashMap Prelude.Text Prelude.Text
}
deriving (CreateCustomMetadata -> CreateCustomMetadata -> Bool
(CreateCustomMetadata -> CreateCustomMetadata -> Bool)
-> (CreateCustomMetadata -> CreateCustomMetadata -> Bool)
-> Eq CreateCustomMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCustomMetadata -> CreateCustomMetadata -> Bool
$c/= :: CreateCustomMetadata -> CreateCustomMetadata -> Bool
== :: CreateCustomMetadata -> CreateCustomMetadata -> Bool
$c== :: CreateCustomMetadata -> CreateCustomMetadata -> Bool
Prelude.Eq, Int -> CreateCustomMetadata -> ShowS
[CreateCustomMetadata] -> ShowS
CreateCustomMetadata -> String
(Int -> CreateCustomMetadata -> ShowS)
-> (CreateCustomMetadata -> String)
-> ([CreateCustomMetadata] -> ShowS)
-> Show CreateCustomMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCustomMetadata] -> ShowS
$cshowList :: [CreateCustomMetadata] -> ShowS
show :: CreateCustomMetadata -> String
$cshow :: CreateCustomMetadata -> String
showsPrec :: Int -> CreateCustomMetadata -> ShowS
$cshowsPrec :: Int -> CreateCustomMetadata -> ShowS
Prelude.Show, (forall x. CreateCustomMetadata -> Rep CreateCustomMetadata x)
-> (forall x. Rep CreateCustomMetadata x -> CreateCustomMetadata)
-> Generic CreateCustomMetadata
forall x. Rep CreateCustomMetadata x -> CreateCustomMetadata
forall x. CreateCustomMetadata -> Rep CreateCustomMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCustomMetadata x -> CreateCustomMetadata
$cfrom :: forall x. CreateCustomMetadata -> Rep CreateCustomMetadata x
Prelude.Generic)
newCreateCustomMetadata ::
Prelude.Text ->
CreateCustomMetadata
newCreateCustomMetadata :: Text -> CreateCustomMetadata
newCreateCustomMetadata Text
pResourceId_ =
CreateCustomMetadata' :: Maybe Text
-> Maybe (Sensitive Text)
-> Text
-> HashMap Text Text
-> CreateCustomMetadata
CreateCustomMetadata'
{ $sel:versionId:CreateCustomMetadata' :: Maybe Text
versionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:authenticationToken:CreateCustomMetadata' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:resourceId:CreateCustomMetadata' :: Text
resourceId = Text
pResourceId_,
$sel:customMetadata:CreateCustomMetadata' :: HashMap Text Text
customMetadata = HashMap Text Text
forall a. Monoid a => a
Prelude.mempty
}
createCustomMetadata_versionId :: Lens.Lens' CreateCustomMetadata (Prelude.Maybe Prelude.Text)
createCustomMetadata_versionId :: (Maybe Text -> f (Maybe Text))
-> CreateCustomMetadata -> f CreateCustomMetadata
createCustomMetadata_versionId = (CreateCustomMetadata -> Maybe Text)
-> (CreateCustomMetadata -> Maybe Text -> CreateCustomMetadata)
-> Lens
CreateCustomMetadata CreateCustomMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomMetadata' {Maybe Text
versionId :: Maybe Text
$sel:versionId:CreateCustomMetadata' :: CreateCustomMetadata -> Maybe Text
versionId} -> Maybe Text
versionId) (\s :: CreateCustomMetadata
s@CreateCustomMetadata' {} Maybe Text
a -> CreateCustomMetadata
s {$sel:versionId:CreateCustomMetadata' :: Maybe Text
versionId = Maybe Text
a} :: CreateCustomMetadata)
createCustomMetadata_authenticationToken :: Lens.Lens' CreateCustomMetadata (Prelude.Maybe Prelude.Text)
createCustomMetadata_authenticationToken :: (Maybe Text -> f (Maybe Text))
-> CreateCustomMetadata -> f CreateCustomMetadata
createCustomMetadata_authenticationToken = (CreateCustomMetadata -> Maybe (Sensitive Text))
-> (CreateCustomMetadata
-> Maybe (Sensitive Text) -> CreateCustomMetadata)
-> Lens
CreateCustomMetadata
CreateCustomMetadata
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomMetadata' {Maybe (Sensitive Text)
authenticationToken :: Maybe (Sensitive Text)
$sel:authenticationToken:CreateCustomMetadata' :: CreateCustomMetadata -> Maybe (Sensitive Text)
authenticationToken} -> Maybe (Sensitive Text)
authenticationToken) (\s :: CreateCustomMetadata
s@CreateCustomMetadata' {} Maybe (Sensitive Text)
a -> CreateCustomMetadata
s {$sel:authenticationToken:CreateCustomMetadata' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
a} :: CreateCustomMetadata) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> CreateCustomMetadata -> f CreateCustomMetadata)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateCustomMetadata
-> f CreateCustomMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
createCustomMetadata_resourceId :: Lens.Lens' CreateCustomMetadata Prelude.Text
createCustomMetadata_resourceId :: (Text -> f Text) -> CreateCustomMetadata -> f CreateCustomMetadata
createCustomMetadata_resourceId = (CreateCustomMetadata -> Text)
-> (CreateCustomMetadata -> Text -> CreateCustomMetadata)
-> Lens CreateCustomMetadata CreateCustomMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomMetadata' {Text
resourceId :: Text
$sel:resourceId:CreateCustomMetadata' :: CreateCustomMetadata -> Text
resourceId} -> Text
resourceId) (\s :: CreateCustomMetadata
s@CreateCustomMetadata' {} Text
a -> CreateCustomMetadata
s {$sel:resourceId:CreateCustomMetadata' :: Text
resourceId = Text
a} :: CreateCustomMetadata)
createCustomMetadata_customMetadata :: Lens.Lens' CreateCustomMetadata (Prelude.HashMap Prelude.Text Prelude.Text)
createCustomMetadata_customMetadata :: (HashMap Text Text -> f (HashMap Text Text))
-> CreateCustomMetadata -> f CreateCustomMetadata
createCustomMetadata_customMetadata = (CreateCustomMetadata -> HashMap Text Text)
-> (CreateCustomMetadata
-> HashMap Text Text -> CreateCustomMetadata)
-> Lens
CreateCustomMetadata
CreateCustomMetadata
(HashMap Text Text)
(HashMap Text Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomMetadata' {HashMap Text Text
customMetadata :: HashMap Text Text
$sel:customMetadata:CreateCustomMetadata' :: CreateCustomMetadata -> HashMap Text Text
customMetadata} -> HashMap Text Text
customMetadata) (\s :: CreateCustomMetadata
s@CreateCustomMetadata' {} HashMap Text Text
a -> CreateCustomMetadata
s {$sel:customMetadata:CreateCustomMetadata' :: HashMap Text Text
customMetadata = HashMap Text Text
a} :: CreateCustomMetadata) ((HashMap Text Text -> f (HashMap Text Text))
-> CreateCustomMetadata -> f CreateCustomMetadata)
-> ((HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> CreateCustomMetadata
-> f CreateCustomMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateCustomMetadata where
type
AWSResponse CreateCustomMetadata =
CreateCustomMetadataResponse
request :: CreateCustomMetadata -> Request CreateCustomMetadata
request = Service -> CreateCustomMetadata -> Request CreateCustomMetadata
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateCustomMetadata
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCustomMetadata)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse CreateCustomMetadata))
-> Logger
-> Service
-> Proxy CreateCustomMetadata
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCustomMetadata)))
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 -> CreateCustomMetadataResponse
CreateCustomMetadataResponse'
(Int -> CreateCustomMetadataResponse)
-> Either String Int -> Either String CreateCustomMetadataResponse
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 CreateCustomMetadata
instance Prelude.NFData CreateCustomMetadata
instance Core.ToHeaders CreateCustomMetadata where
toHeaders :: CreateCustomMetadata -> ResponseHeaders
toHeaders CreateCustomMetadata' {Maybe Text
Maybe (Sensitive Text)
Text
HashMap Text Text
customMetadata :: HashMap Text Text
resourceId :: Text
authenticationToken :: Maybe (Sensitive Text)
versionId :: Maybe Text
$sel:customMetadata:CreateCustomMetadata' :: CreateCustomMetadata -> HashMap Text Text
$sel:resourceId:CreateCustomMetadata' :: CreateCustomMetadata -> Text
$sel:authenticationToken:CreateCustomMetadata' :: CreateCustomMetadata -> Maybe (Sensitive Text)
$sel:versionId:CreateCustomMetadata' :: CreateCustomMetadata -> Maybe Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Authentication" HeaderName -> Maybe (Sensitive Text) -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe (Sensitive Text)
authenticationToken,
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 CreateCustomMetadata where
toJSON :: CreateCustomMetadata -> Value
toJSON CreateCustomMetadata' {Maybe Text
Maybe (Sensitive Text)
Text
HashMap Text Text
customMetadata :: HashMap Text Text
resourceId :: Text
authenticationToken :: Maybe (Sensitive Text)
versionId :: Maybe Text
$sel:customMetadata:CreateCustomMetadata' :: CreateCustomMetadata -> HashMap Text Text
$sel:resourceId:CreateCustomMetadata' :: CreateCustomMetadata -> Text
$sel:authenticationToken:CreateCustomMetadata' :: CreateCustomMetadata -> Maybe (Sensitive Text)
$sel:versionId:CreateCustomMetadata' :: CreateCustomMetadata -> Maybe 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
"CustomMetadata" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HashMap Text Text
customMetadata)
]
)
instance Core.ToPath CreateCustomMetadata where
toPath :: CreateCustomMetadata -> ByteString
toPath CreateCustomMetadata' {Maybe Text
Maybe (Sensitive Text)
Text
HashMap Text Text
customMetadata :: HashMap Text Text
resourceId :: Text
authenticationToken :: Maybe (Sensitive Text)
versionId :: Maybe Text
$sel:customMetadata:CreateCustomMetadata' :: CreateCustomMetadata -> HashMap Text Text
$sel:resourceId:CreateCustomMetadata' :: CreateCustomMetadata -> Text
$sel:authenticationToken:CreateCustomMetadata' :: CreateCustomMetadata -> Maybe (Sensitive Text)
$sel:versionId:CreateCustomMetadata' :: CreateCustomMetadata -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/api/v1/resources/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
resourceId,
ByteString
"/customMetadata"
]
instance Core.ToQuery CreateCustomMetadata where
toQuery :: CreateCustomMetadata -> QueryString
toQuery CreateCustomMetadata' {Maybe Text
Maybe (Sensitive Text)
Text
HashMap Text Text
customMetadata :: HashMap Text Text
resourceId :: Text
authenticationToken :: Maybe (Sensitive Text)
versionId :: Maybe Text
$sel:customMetadata:CreateCustomMetadata' :: CreateCustomMetadata -> HashMap Text Text
$sel:resourceId:CreateCustomMetadata' :: CreateCustomMetadata -> Text
$sel:authenticationToken:CreateCustomMetadata' :: CreateCustomMetadata -> Maybe (Sensitive Text)
$sel:versionId:CreateCustomMetadata' :: CreateCustomMetadata -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"versionid" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
versionId]
data CreateCustomMetadataResponse = CreateCustomMetadataResponse'
{
CreateCustomMetadataResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateCustomMetadataResponse
-> CreateCustomMetadataResponse -> Bool
(CreateCustomMetadataResponse
-> CreateCustomMetadataResponse -> Bool)
-> (CreateCustomMetadataResponse
-> CreateCustomMetadataResponse -> Bool)
-> Eq CreateCustomMetadataResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCustomMetadataResponse
-> CreateCustomMetadataResponse -> Bool
$c/= :: CreateCustomMetadataResponse
-> CreateCustomMetadataResponse -> Bool
== :: CreateCustomMetadataResponse
-> CreateCustomMetadataResponse -> Bool
$c== :: CreateCustomMetadataResponse
-> CreateCustomMetadataResponse -> Bool
Prelude.Eq, ReadPrec [CreateCustomMetadataResponse]
ReadPrec CreateCustomMetadataResponse
Int -> ReadS CreateCustomMetadataResponse
ReadS [CreateCustomMetadataResponse]
(Int -> ReadS CreateCustomMetadataResponse)
-> ReadS [CreateCustomMetadataResponse]
-> ReadPrec CreateCustomMetadataResponse
-> ReadPrec [CreateCustomMetadataResponse]
-> Read CreateCustomMetadataResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCustomMetadataResponse]
$creadListPrec :: ReadPrec [CreateCustomMetadataResponse]
readPrec :: ReadPrec CreateCustomMetadataResponse
$creadPrec :: ReadPrec CreateCustomMetadataResponse
readList :: ReadS [CreateCustomMetadataResponse]
$creadList :: ReadS [CreateCustomMetadataResponse]
readsPrec :: Int -> ReadS CreateCustomMetadataResponse
$creadsPrec :: Int -> ReadS CreateCustomMetadataResponse
Prelude.Read, Int -> CreateCustomMetadataResponse -> ShowS
[CreateCustomMetadataResponse] -> ShowS
CreateCustomMetadataResponse -> String
(Int -> CreateCustomMetadataResponse -> ShowS)
-> (CreateCustomMetadataResponse -> String)
-> ([CreateCustomMetadataResponse] -> ShowS)
-> Show CreateCustomMetadataResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCustomMetadataResponse] -> ShowS
$cshowList :: [CreateCustomMetadataResponse] -> ShowS
show :: CreateCustomMetadataResponse -> String
$cshow :: CreateCustomMetadataResponse -> String
showsPrec :: Int -> CreateCustomMetadataResponse -> ShowS
$cshowsPrec :: Int -> CreateCustomMetadataResponse -> ShowS
Prelude.Show, (forall x.
CreateCustomMetadataResponse -> Rep CreateCustomMetadataResponse x)
-> (forall x.
Rep CreateCustomMetadataResponse x -> CreateCustomMetadataResponse)
-> Generic CreateCustomMetadataResponse
forall x.
Rep CreateCustomMetadataResponse x -> CreateCustomMetadataResponse
forall x.
CreateCustomMetadataResponse -> Rep CreateCustomMetadataResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCustomMetadataResponse x -> CreateCustomMetadataResponse
$cfrom :: forall x.
CreateCustomMetadataResponse -> Rep CreateCustomMetadataResponse x
Prelude.Generic)
newCreateCustomMetadataResponse ::
Prelude.Int ->
CreateCustomMetadataResponse
newCreateCustomMetadataResponse :: Int -> CreateCustomMetadataResponse
newCreateCustomMetadataResponse Int
pHttpStatus_ =
CreateCustomMetadataResponse' :: Int -> CreateCustomMetadataResponse
CreateCustomMetadataResponse'
{ $sel:httpStatus:CreateCustomMetadataResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
createCustomMetadataResponse_httpStatus :: Lens.Lens' CreateCustomMetadataResponse Prelude.Int
createCustomMetadataResponse_httpStatus :: (Int -> f Int)
-> CreateCustomMetadataResponse -> f CreateCustomMetadataResponse
createCustomMetadataResponse_httpStatus = (CreateCustomMetadataResponse -> Int)
-> (CreateCustomMetadataResponse
-> Int -> CreateCustomMetadataResponse)
-> Lens
CreateCustomMetadataResponse CreateCustomMetadataResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomMetadataResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateCustomMetadataResponse' :: CreateCustomMetadataResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateCustomMetadataResponse
s@CreateCustomMetadataResponse' {} Int
a -> CreateCustomMetadataResponse
s {$sel:httpStatus:CreateCustomMetadataResponse' :: Int
httpStatus = Int
a} :: CreateCustomMetadataResponse)
instance Prelude.NFData CreateCustomMetadataResponse