{-# 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.DescribeDocument
(
DescribeDocument (..),
newDescribeDocument,
describeDocument_versionName,
describeDocument_documentVersion,
describeDocument_name,
DescribeDocumentResponse (..),
newDescribeDocumentResponse,
describeDocumentResponse_document,
describeDocumentResponse_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 DescribeDocument = DescribeDocument'
{
DescribeDocument -> Maybe Text
versionName :: Prelude.Maybe Prelude.Text,
DescribeDocument -> Maybe Text
documentVersion :: Prelude.Maybe Prelude.Text,
DescribeDocument -> Text
name :: Prelude.Text
}
deriving (DescribeDocument -> DescribeDocument -> Bool
(DescribeDocument -> DescribeDocument -> Bool)
-> (DescribeDocument -> DescribeDocument -> Bool)
-> Eq DescribeDocument
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDocument -> DescribeDocument -> Bool
$c/= :: DescribeDocument -> DescribeDocument -> Bool
== :: DescribeDocument -> DescribeDocument -> Bool
$c== :: DescribeDocument -> DescribeDocument -> Bool
Prelude.Eq, ReadPrec [DescribeDocument]
ReadPrec DescribeDocument
Int -> ReadS DescribeDocument
ReadS [DescribeDocument]
(Int -> ReadS DescribeDocument)
-> ReadS [DescribeDocument]
-> ReadPrec DescribeDocument
-> ReadPrec [DescribeDocument]
-> Read DescribeDocument
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDocument]
$creadListPrec :: ReadPrec [DescribeDocument]
readPrec :: ReadPrec DescribeDocument
$creadPrec :: ReadPrec DescribeDocument
readList :: ReadS [DescribeDocument]
$creadList :: ReadS [DescribeDocument]
readsPrec :: Int -> ReadS DescribeDocument
$creadsPrec :: Int -> ReadS DescribeDocument
Prelude.Read, Int -> DescribeDocument -> ShowS
[DescribeDocument] -> ShowS
DescribeDocument -> String
(Int -> DescribeDocument -> ShowS)
-> (DescribeDocument -> String)
-> ([DescribeDocument] -> ShowS)
-> Show DescribeDocument
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDocument] -> ShowS
$cshowList :: [DescribeDocument] -> ShowS
show :: DescribeDocument -> String
$cshow :: DescribeDocument -> String
showsPrec :: Int -> DescribeDocument -> ShowS
$cshowsPrec :: Int -> DescribeDocument -> ShowS
Prelude.Show, (forall x. DescribeDocument -> Rep DescribeDocument x)
-> (forall x. Rep DescribeDocument x -> DescribeDocument)
-> Generic DescribeDocument
forall x. Rep DescribeDocument x -> DescribeDocument
forall x. DescribeDocument -> Rep DescribeDocument x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeDocument x -> DescribeDocument
$cfrom :: forall x. DescribeDocument -> Rep DescribeDocument x
Prelude.Generic)
newDescribeDocument ::
Prelude.Text ->
DescribeDocument
newDescribeDocument :: Text -> DescribeDocument
newDescribeDocument Text
pName_ =
DescribeDocument' :: Maybe Text -> Maybe Text -> Text -> DescribeDocument
DescribeDocument'
{ $sel:versionName:DescribeDocument' :: Maybe Text
versionName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:documentVersion:DescribeDocument' :: Maybe Text
documentVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:DescribeDocument' :: Text
name = Text
pName_
}
describeDocument_versionName :: Lens.Lens' DescribeDocument (Prelude.Maybe Prelude.Text)
describeDocument_versionName :: (Maybe Text -> f (Maybe Text))
-> DescribeDocument -> f DescribeDocument
describeDocument_versionName = (DescribeDocument -> Maybe Text)
-> (DescribeDocument -> Maybe Text -> DescribeDocument)
-> Lens DescribeDocument DescribeDocument (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDocument' {Maybe Text
versionName :: Maybe Text
$sel:versionName:DescribeDocument' :: DescribeDocument -> Maybe Text
versionName} -> Maybe Text
versionName) (\s :: DescribeDocument
s@DescribeDocument' {} Maybe Text
a -> DescribeDocument
s {$sel:versionName:DescribeDocument' :: Maybe Text
versionName = Maybe Text
a} :: DescribeDocument)
describeDocument_documentVersion :: Lens.Lens' DescribeDocument (Prelude.Maybe Prelude.Text)
describeDocument_documentVersion :: (Maybe Text -> f (Maybe Text))
-> DescribeDocument -> f DescribeDocument
describeDocument_documentVersion = (DescribeDocument -> Maybe Text)
-> (DescribeDocument -> Maybe Text -> DescribeDocument)
-> Lens DescribeDocument DescribeDocument (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDocument' {Maybe Text
documentVersion :: Maybe Text
$sel:documentVersion:DescribeDocument' :: DescribeDocument -> Maybe Text
documentVersion} -> Maybe Text
documentVersion) (\s :: DescribeDocument
s@DescribeDocument' {} Maybe Text
a -> DescribeDocument
s {$sel:documentVersion:DescribeDocument' :: Maybe Text
documentVersion = Maybe Text
a} :: DescribeDocument)
describeDocument_name :: Lens.Lens' DescribeDocument Prelude.Text
describeDocument_name :: (Text -> f Text) -> DescribeDocument -> f DescribeDocument
describeDocument_name = (DescribeDocument -> Text)
-> (DescribeDocument -> Text -> DescribeDocument)
-> Lens DescribeDocument DescribeDocument Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDocument' {Text
name :: Text
$sel:name:DescribeDocument' :: DescribeDocument -> Text
name} -> Text
name) (\s :: DescribeDocument
s@DescribeDocument' {} Text
a -> DescribeDocument
s {$sel:name:DescribeDocument' :: Text
name = Text
a} :: DescribeDocument)
instance Core.AWSRequest DescribeDocument where
type
AWSResponse DescribeDocument =
DescribeDocumentResponse
request :: DescribeDocument -> Request DescribeDocument
request = Service -> DescribeDocument -> Request DescribeDocument
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeDocument
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeDocument)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeDocument))
-> Logger
-> Service
-> Proxy DescribeDocument
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeDocument)))
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 DocumentDescription -> Int -> DescribeDocumentResponse
DescribeDocumentResponse'
(Maybe DocumentDescription -> Int -> DescribeDocumentResponse)
-> Either String (Maybe DocumentDescription)
-> Either String (Int -> DescribeDocumentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DocumentDescription)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Document")
Either String (Int -> DescribeDocumentResponse)
-> Either String Int -> Either String DescribeDocumentResponse
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 DescribeDocument
instance Prelude.NFData DescribeDocument
instance Core.ToHeaders DescribeDocument where
toHeaders :: DescribeDocument -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeDocument -> 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.DescribeDocument" :: 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 DescribeDocument where
toJSON :: DescribeDocument -> Value
toJSON DescribeDocument' {Maybe Text
Text
name :: Text
documentVersion :: Maybe Text
versionName :: Maybe Text
$sel:name:DescribeDocument' :: DescribeDocument -> Text
$sel:documentVersion:DescribeDocument' :: DescribeDocument -> Maybe Text
$sel:versionName:DescribeDocument' :: DescribeDocument -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"VersionName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
versionName,
(Text
"DocumentVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
documentVersion,
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 DescribeDocument where
toPath :: DescribeDocument -> ByteString
toPath = ByteString -> DescribeDocument -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeDocument where
toQuery :: DescribeDocument -> QueryString
toQuery = QueryString -> DescribeDocument -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeDocumentResponse = DescribeDocumentResponse'
{
DescribeDocumentResponse -> Maybe DocumentDescription
document :: Prelude.Maybe DocumentDescription,
DescribeDocumentResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeDocumentResponse -> DescribeDocumentResponse -> Bool
(DescribeDocumentResponse -> DescribeDocumentResponse -> Bool)
-> (DescribeDocumentResponse -> DescribeDocumentResponse -> Bool)
-> Eq DescribeDocumentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDocumentResponse -> DescribeDocumentResponse -> Bool
$c/= :: DescribeDocumentResponse -> DescribeDocumentResponse -> Bool
== :: DescribeDocumentResponse -> DescribeDocumentResponse -> Bool
$c== :: DescribeDocumentResponse -> DescribeDocumentResponse -> Bool
Prelude.Eq, ReadPrec [DescribeDocumentResponse]
ReadPrec DescribeDocumentResponse
Int -> ReadS DescribeDocumentResponse
ReadS [DescribeDocumentResponse]
(Int -> ReadS DescribeDocumentResponse)
-> ReadS [DescribeDocumentResponse]
-> ReadPrec DescribeDocumentResponse
-> ReadPrec [DescribeDocumentResponse]
-> Read DescribeDocumentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDocumentResponse]
$creadListPrec :: ReadPrec [DescribeDocumentResponse]
readPrec :: ReadPrec DescribeDocumentResponse
$creadPrec :: ReadPrec DescribeDocumentResponse
readList :: ReadS [DescribeDocumentResponse]
$creadList :: ReadS [DescribeDocumentResponse]
readsPrec :: Int -> ReadS DescribeDocumentResponse
$creadsPrec :: Int -> ReadS DescribeDocumentResponse
Prelude.Read, Int -> DescribeDocumentResponse -> ShowS
[DescribeDocumentResponse] -> ShowS
DescribeDocumentResponse -> String
(Int -> DescribeDocumentResponse -> ShowS)
-> (DescribeDocumentResponse -> String)
-> ([DescribeDocumentResponse] -> ShowS)
-> Show DescribeDocumentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDocumentResponse] -> ShowS
$cshowList :: [DescribeDocumentResponse] -> ShowS
show :: DescribeDocumentResponse -> String
$cshow :: DescribeDocumentResponse -> String
showsPrec :: Int -> DescribeDocumentResponse -> ShowS
$cshowsPrec :: Int -> DescribeDocumentResponse -> ShowS
Prelude.Show, (forall x.
DescribeDocumentResponse -> Rep DescribeDocumentResponse x)
-> (forall x.
Rep DescribeDocumentResponse x -> DescribeDocumentResponse)
-> Generic DescribeDocumentResponse
forall x.
Rep DescribeDocumentResponse x -> DescribeDocumentResponse
forall x.
DescribeDocumentResponse -> Rep DescribeDocumentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDocumentResponse x -> DescribeDocumentResponse
$cfrom :: forall x.
DescribeDocumentResponse -> Rep DescribeDocumentResponse x
Prelude.Generic)
newDescribeDocumentResponse ::
Prelude.Int ->
DescribeDocumentResponse
newDescribeDocumentResponse :: Int -> DescribeDocumentResponse
newDescribeDocumentResponse Int
pHttpStatus_ =
DescribeDocumentResponse' :: Maybe DocumentDescription -> Int -> DescribeDocumentResponse
DescribeDocumentResponse'
{ $sel:document:DescribeDocumentResponse' :: Maybe DocumentDescription
document =
Maybe DocumentDescription
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeDocumentResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeDocumentResponse_document :: Lens.Lens' DescribeDocumentResponse (Prelude.Maybe DocumentDescription)
describeDocumentResponse_document :: (Maybe DocumentDescription -> f (Maybe DocumentDescription))
-> DescribeDocumentResponse -> f DescribeDocumentResponse
describeDocumentResponse_document = (DescribeDocumentResponse -> Maybe DocumentDescription)
-> (DescribeDocumentResponse
-> Maybe DocumentDescription -> DescribeDocumentResponse)
-> Lens
DescribeDocumentResponse
DescribeDocumentResponse
(Maybe DocumentDescription)
(Maybe DocumentDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDocumentResponse' {Maybe DocumentDescription
document :: Maybe DocumentDescription
$sel:document:DescribeDocumentResponse' :: DescribeDocumentResponse -> Maybe DocumentDescription
document} -> Maybe DocumentDescription
document) (\s :: DescribeDocumentResponse
s@DescribeDocumentResponse' {} Maybe DocumentDescription
a -> DescribeDocumentResponse
s {$sel:document:DescribeDocumentResponse' :: Maybe DocumentDescription
document = Maybe DocumentDescription
a} :: DescribeDocumentResponse)
describeDocumentResponse_httpStatus :: Lens.Lens' DescribeDocumentResponse Prelude.Int
describeDocumentResponse_httpStatus :: (Int -> f Int)
-> DescribeDocumentResponse -> f DescribeDocumentResponse
describeDocumentResponse_httpStatus = (DescribeDocumentResponse -> Int)
-> (DescribeDocumentResponse -> Int -> DescribeDocumentResponse)
-> Lens DescribeDocumentResponse DescribeDocumentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDocumentResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeDocumentResponse' :: DescribeDocumentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeDocumentResponse
s@DescribeDocumentResponse' {} Int
a -> DescribeDocumentResponse
s {$sel:httpStatus:DescribeDocumentResponse' :: Int
httpStatus = Int
a} :: DescribeDocumentResponse)
instance Prelude.NFData DescribeDocumentResponse