{-# 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.SSM.CreateOpsMetadata
(
CreateOpsMetadata (..),
newCreateOpsMetadata,
createOpsMetadata_metadata,
createOpsMetadata_tags,
createOpsMetadata_resourceId,
CreateOpsMetadataResponse (..),
newCreateOpsMetadataResponse,
createOpsMetadataResponse_opsMetadataArn,
createOpsMetadataResponse_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.SSM.Types
data CreateOpsMetadata = CreateOpsMetadata'
{
CreateOpsMetadata -> Maybe (HashMap Text MetadataValue)
metadata :: Prelude.Maybe (Prelude.HashMap Prelude.Text MetadataValue),
CreateOpsMetadata -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateOpsMetadata -> Text
resourceId :: Prelude.Text
}
deriving (CreateOpsMetadata -> CreateOpsMetadata -> Bool
(CreateOpsMetadata -> CreateOpsMetadata -> Bool)
-> (CreateOpsMetadata -> CreateOpsMetadata -> Bool)
-> Eq CreateOpsMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateOpsMetadata -> CreateOpsMetadata -> Bool
$c/= :: CreateOpsMetadata -> CreateOpsMetadata -> Bool
== :: CreateOpsMetadata -> CreateOpsMetadata -> Bool
$c== :: CreateOpsMetadata -> CreateOpsMetadata -> Bool
Prelude.Eq, ReadPrec [CreateOpsMetadata]
ReadPrec CreateOpsMetadata
Int -> ReadS CreateOpsMetadata
ReadS [CreateOpsMetadata]
(Int -> ReadS CreateOpsMetadata)
-> ReadS [CreateOpsMetadata]
-> ReadPrec CreateOpsMetadata
-> ReadPrec [CreateOpsMetadata]
-> Read CreateOpsMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateOpsMetadata]
$creadListPrec :: ReadPrec [CreateOpsMetadata]
readPrec :: ReadPrec CreateOpsMetadata
$creadPrec :: ReadPrec CreateOpsMetadata
readList :: ReadS [CreateOpsMetadata]
$creadList :: ReadS [CreateOpsMetadata]
readsPrec :: Int -> ReadS CreateOpsMetadata
$creadsPrec :: Int -> ReadS CreateOpsMetadata
Prelude.Read, Int -> CreateOpsMetadata -> ShowS
[CreateOpsMetadata] -> ShowS
CreateOpsMetadata -> String
(Int -> CreateOpsMetadata -> ShowS)
-> (CreateOpsMetadata -> String)
-> ([CreateOpsMetadata] -> ShowS)
-> Show CreateOpsMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateOpsMetadata] -> ShowS
$cshowList :: [CreateOpsMetadata] -> ShowS
show :: CreateOpsMetadata -> String
$cshow :: CreateOpsMetadata -> String
showsPrec :: Int -> CreateOpsMetadata -> ShowS
$cshowsPrec :: Int -> CreateOpsMetadata -> ShowS
Prelude.Show, (forall x. CreateOpsMetadata -> Rep CreateOpsMetadata x)
-> (forall x. Rep CreateOpsMetadata x -> CreateOpsMetadata)
-> Generic CreateOpsMetadata
forall x. Rep CreateOpsMetadata x -> CreateOpsMetadata
forall x. CreateOpsMetadata -> Rep CreateOpsMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateOpsMetadata x -> CreateOpsMetadata
$cfrom :: forall x. CreateOpsMetadata -> Rep CreateOpsMetadata x
Prelude.Generic)
newCreateOpsMetadata ::
Prelude.Text ->
CreateOpsMetadata
newCreateOpsMetadata :: Text -> CreateOpsMetadata
newCreateOpsMetadata Text
pResourceId_ =
CreateOpsMetadata' :: Maybe (HashMap Text MetadataValue)
-> Maybe [Tag] -> Text -> CreateOpsMetadata
CreateOpsMetadata'
{ $sel:metadata:CreateOpsMetadata' :: Maybe (HashMap Text MetadataValue)
metadata = Maybe (HashMap Text MetadataValue)
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateOpsMetadata' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:resourceId:CreateOpsMetadata' :: Text
resourceId = Text
pResourceId_
}
createOpsMetadata_metadata :: Lens.Lens' CreateOpsMetadata (Prelude.Maybe (Prelude.HashMap Prelude.Text MetadataValue))
createOpsMetadata_metadata :: (Maybe (HashMap Text MetadataValue)
-> f (Maybe (HashMap Text MetadataValue)))
-> CreateOpsMetadata -> f CreateOpsMetadata
createOpsMetadata_metadata = (CreateOpsMetadata -> Maybe (HashMap Text MetadataValue))
-> (CreateOpsMetadata
-> Maybe (HashMap Text MetadataValue) -> CreateOpsMetadata)
-> Lens
CreateOpsMetadata
CreateOpsMetadata
(Maybe (HashMap Text MetadataValue))
(Maybe (HashMap Text MetadataValue))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsMetadata' {Maybe (HashMap Text MetadataValue)
metadata :: Maybe (HashMap Text MetadataValue)
$sel:metadata:CreateOpsMetadata' :: CreateOpsMetadata -> Maybe (HashMap Text MetadataValue)
metadata} -> Maybe (HashMap Text MetadataValue)
metadata) (\s :: CreateOpsMetadata
s@CreateOpsMetadata' {} Maybe (HashMap Text MetadataValue)
a -> CreateOpsMetadata
s {$sel:metadata:CreateOpsMetadata' :: Maybe (HashMap Text MetadataValue)
metadata = Maybe (HashMap Text MetadataValue)
a} :: CreateOpsMetadata) ((Maybe (HashMap Text MetadataValue)
-> f (Maybe (HashMap Text MetadataValue)))
-> CreateOpsMetadata -> f CreateOpsMetadata)
-> ((Maybe (HashMap Text MetadataValue)
-> f (Maybe (HashMap Text MetadataValue)))
-> Maybe (HashMap Text MetadataValue)
-> f (Maybe (HashMap Text MetadataValue)))
-> (Maybe (HashMap Text MetadataValue)
-> f (Maybe (HashMap Text MetadataValue)))
-> CreateOpsMetadata
-> f CreateOpsMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text MetadataValue)
(HashMap Text MetadataValue)
(HashMap Text MetadataValue)
(HashMap Text MetadataValue)
-> Iso
(Maybe (HashMap Text MetadataValue))
(Maybe (HashMap Text MetadataValue))
(Maybe (HashMap Text MetadataValue))
(Maybe (HashMap Text MetadataValue))
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
(HashMap Text MetadataValue)
(HashMap Text MetadataValue)
(HashMap Text MetadataValue)
(HashMap Text MetadataValue)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createOpsMetadata_tags :: Lens.Lens' CreateOpsMetadata (Prelude.Maybe [Tag])
createOpsMetadata_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateOpsMetadata -> f CreateOpsMetadata
createOpsMetadata_tags = (CreateOpsMetadata -> Maybe [Tag])
-> (CreateOpsMetadata -> Maybe [Tag] -> CreateOpsMetadata)
-> Lens
CreateOpsMetadata CreateOpsMetadata (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsMetadata' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateOpsMetadata' :: CreateOpsMetadata -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateOpsMetadata
s@CreateOpsMetadata' {} Maybe [Tag]
a -> CreateOpsMetadata
s {$sel:tags:CreateOpsMetadata' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateOpsMetadata) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateOpsMetadata -> f CreateOpsMetadata)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateOpsMetadata
-> f CreateOpsMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createOpsMetadata_resourceId :: Lens.Lens' CreateOpsMetadata Prelude.Text
createOpsMetadata_resourceId :: (Text -> f Text) -> CreateOpsMetadata -> f CreateOpsMetadata
createOpsMetadata_resourceId = (CreateOpsMetadata -> Text)
-> (CreateOpsMetadata -> Text -> CreateOpsMetadata)
-> Lens CreateOpsMetadata CreateOpsMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsMetadata' {Text
resourceId :: Text
$sel:resourceId:CreateOpsMetadata' :: CreateOpsMetadata -> Text
resourceId} -> Text
resourceId) (\s :: CreateOpsMetadata
s@CreateOpsMetadata' {} Text
a -> CreateOpsMetadata
s {$sel:resourceId:CreateOpsMetadata' :: Text
resourceId = Text
a} :: CreateOpsMetadata)
instance Core.AWSRequest CreateOpsMetadata where
type
AWSResponse CreateOpsMetadata =
CreateOpsMetadataResponse
request :: CreateOpsMetadata -> Request CreateOpsMetadata
request = Service -> CreateOpsMetadata -> Request CreateOpsMetadata
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateOpsMetadata
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateOpsMetadata)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateOpsMetadata))
-> Logger
-> Service
-> Proxy CreateOpsMetadata
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateOpsMetadata)))
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 -> CreateOpsMetadataResponse
CreateOpsMetadataResponse'
(Maybe Text -> Int -> CreateOpsMetadataResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateOpsMetadataResponse)
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
"OpsMetadataArn")
Either String (Int -> CreateOpsMetadataResponse)
-> Either String Int -> Either String CreateOpsMetadataResponse
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 CreateOpsMetadata
instance Prelude.NFData CreateOpsMetadata
instance Core.ToHeaders CreateOpsMetadata where
toHeaders :: CreateOpsMetadata -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateOpsMetadata -> 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
"AmazonSSM.CreateOpsMetadata" ::
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 CreateOpsMetadata where
toJSON :: CreateOpsMetadata -> Value
toJSON CreateOpsMetadata' {Maybe [Tag]
Maybe (HashMap Text MetadataValue)
Text
resourceId :: Text
tags :: Maybe [Tag]
metadata :: Maybe (HashMap Text MetadataValue)
$sel:resourceId:CreateOpsMetadata' :: CreateOpsMetadata -> Text
$sel:tags:CreateOpsMetadata' :: CreateOpsMetadata -> Maybe [Tag]
$sel:metadata:CreateOpsMetadata' :: CreateOpsMetadata -> Maybe (HashMap Text MetadataValue)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Metadata" Text -> HashMap Text MetadataValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text MetadataValue -> Pair)
-> Maybe (HashMap Text MetadataValue) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text MetadataValue)
metadata,
(Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceId)
]
)
instance Core.ToPath CreateOpsMetadata where
toPath :: CreateOpsMetadata -> ByteString
toPath = ByteString -> CreateOpsMetadata -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateOpsMetadata where
toQuery :: CreateOpsMetadata -> QueryString
toQuery = QueryString -> CreateOpsMetadata -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateOpsMetadataResponse = CreateOpsMetadataResponse'
{
CreateOpsMetadataResponse -> Maybe Text
opsMetadataArn :: Prelude.Maybe Prelude.Text,
CreateOpsMetadataResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateOpsMetadataResponse -> CreateOpsMetadataResponse -> Bool
(CreateOpsMetadataResponse -> CreateOpsMetadataResponse -> Bool)
-> (CreateOpsMetadataResponse -> CreateOpsMetadataResponse -> Bool)
-> Eq CreateOpsMetadataResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateOpsMetadataResponse -> CreateOpsMetadataResponse -> Bool
$c/= :: CreateOpsMetadataResponse -> CreateOpsMetadataResponse -> Bool
== :: CreateOpsMetadataResponse -> CreateOpsMetadataResponse -> Bool
$c== :: CreateOpsMetadataResponse -> CreateOpsMetadataResponse -> Bool
Prelude.Eq, ReadPrec [CreateOpsMetadataResponse]
ReadPrec CreateOpsMetadataResponse
Int -> ReadS CreateOpsMetadataResponse
ReadS [CreateOpsMetadataResponse]
(Int -> ReadS CreateOpsMetadataResponse)
-> ReadS [CreateOpsMetadataResponse]
-> ReadPrec CreateOpsMetadataResponse
-> ReadPrec [CreateOpsMetadataResponse]
-> Read CreateOpsMetadataResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateOpsMetadataResponse]
$creadListPrec :: ReadPrec [CreateOpsMetadataResponse]
readPrec :: ReadPrec CreateOpsMetadataResponse
$creadPrec :: ReadPrec CreateOpsMetadataResponse
readList :: ReadS [CreateOpsMetadataResponse]
$creadList :: ReadS [CreateOpsMetadataResponse]
readsPrec :: Int -> ReadS CreateOpsMetadataResponse
$creadsPrec :: Int -> ReadS CreateOpsMetadataResponse
Prelude.Read, Int -> CreateOpsMetadataResponse -> ShowS
[CreateOpsMetadataResponse] -> ShowS
CreateOpsMetadataResponse -> String
(Int -> CreateOpsMetadataResponse -> ShowS)
-> (CreateOpsMetadataResponse -> String)
-> ([CreateOpsMetadataResponse] -> ShowS)
-> Show CreateOpsMetadataResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateOpsMetadataResponse] -> ShowS
$cshowList :: [CreateOpsMetadataResponse] -> ShowS
show :: CreateOpsMetadataResponse -> String
$cshow :: CreateOpsMetadataResponse -> String
showsPrec :: Int -> CreateOpsMetadataResponse -> ShowS
$cshowsPrec :: Int -> CreateOpsMetadataResponse -> ShowS
Prelude.Show, (forall x.
CreateOpsMetadataResponse -> Rep CreateOpsMetadataResponse x)
-> (forall x.
Rep CreateOpsMetadataResponse x -> CreateOpsMetadataResponse)
-> Generic CreateOpsMetadataResponse
forall x.
Rep CreateOpsMetadataResponse x -> CreateOpsMetadataResponse
forall x.
CreateOpsMetadataResponse -> Rep CreateOpsMetadataResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateOpsMetadataResponse x -> CreateOpsMetadataResponse
$cfrom :: forall x.
CreateOpsMetadataResponse -> Rep CreateOpsMetadataResponse x
Prelude.Generic)
newCreateOpsMetadataResponse ::
Prelude.Int ->
CreateOpsMetadataResponse
newCreateOpsMetadataResponse :: Int -> CreateOpsMetadataResponse
newCreateOpsMetadataResponse Int
pHttpStatus_ =
CreateOpsMetadataResponse' :: Maybe Text -> Int -> CreateOpsMetadataResponse
CreateOpsMetadataResponse'
{ $sel:opsMetadataArn:CreateOpsMetadataResponse' :: Maybe Text
opsMetadataArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateOpsMetadataResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createOpsMetadataResponse_opsMetadataArn :: Lens.Lens' CreateOpsMetadataResponse (Prelude.Maybe Prelude.Text)
createOpsMetadataResponse_opsMetadataArn :: (Maybe Text -> f (Maybe Text))
-> CreateOpsMetadataResponse -> f CreateOpsMetadataResponse
createOpsMetadataResponse_opsMetadataArn = (CreateOpsMetadataResponse -> Maybe Text)
-> (CreateOpsMetadataResponse
-> Maybe Text -> CreateOpsMetadataResponse)
-> Lens
CreateOpsMetadataResponse
CreateOpsMetadataResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsMetadataResponse' {Maybe Text
opsMetadataArn :: Maybe Text
$sel:opsMetadataArn:CreateOpsMetadataResponse' :: CreateOpsMetadataResponse -> Maybe Text
opsMetadataArn} -> Maybe Text
opsMetadataArn) (\s :: CreateOpsMetadataResponse
s@CreateOpsMetadataResponse' {} Maybe Text
a -> CreateOpsMetadataResponse
s {$sel:opsMetadataArn:CreateOpsMetadataResponse' :: Maybe Text
opsMetadataArn = Maybe Text
a} :: CreateOpsMetadataResponse)
createOpsMetadataResponse_httpStatus :: Lens.Lens' CreateOpsMetadataResponse Prelude.Int
createOpsMetadataResponse_httpStatus :: (Int -> f Int)
-> CreateOpsMetadataResponse -> f CreateOpsMetadataResponse
createOpsMetadataResponse_httpStatus = (CreateOpsMetadataResponse -> Int)
-> (CreateOpsMetadataResponse -> Int -> CreateOpsMetadataResponse)
-> Lens CreateOpsMetadataResponse CreateOpsMetadataResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOpsMetadataResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateOpsMetadataResponse' :: CreateOpsMetadataResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateOpsMetadataResponse
s@CreateOpsMetadataResponse' {} Int
a -> CreateOpsMetadataResponse
s {$sel:httpStatus:CreateOpsMetadataResponse' :: Int
httpStatus = Int
a} :: CreateOpsMetadataResponse)
instance Prelude.NFData CreateOpsMetadataResponse