{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SSM.GetDocument
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets the contents of the specified Amazon Web Services Systems Manager
-- document (SSM document).
module Amazonka.SSM.GetDocument
  ( -- * Creating a Request
    GetDocument (..),
    newGetDocument,

    -- * Request Lenses
    getDocument_documentFormat,
    getDocument_documentVersion,
    getDocument_versionName,
    getDocument_name,

    -- * Destructuring the Response
    GetDocumentResponse (..),
    newGetDocumentResponse,

    -- * Response Lenses
    getDocumentResponse_attachmentsContent,
    getDocumentResponse_content,
    getDocumentResponse_createdDate,
    getDocumentResponse_displayName,
    getDocumentResponse_documentFormat,
    getDocumentResponse_documentType,
    getDocumentResponse_documentVersion,
    getDocumentResponse_name,
    getDocumentResponse_requires,
    getDocumentResponse_reviewStatus,
    getDocumentResponse_status,
    getDocumentResponse_statusInformation,
    getDocumentResponse_versionName,
    getDocumentResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SSM.Types

-- | /See:/ 'newGetDocument' smart constructor.
data GetDocument = GetDocument'
  { -- | Returns the document in the specified format. The document format can be
    -- either JSON or YAML. JSON is the default format.
    GetDocument -> Maybe DocumentFormat
documentFormat :: Prelude.Maybe DocumentFormat,
    -- | The document version for which you want information.
    GetDocument -> Maybe Text
documentVersion :: Prelude.Maybe Prelude.Text,
    -- | An optional field specifying the version of the artifact associated with
    -- the document. For example, \"Release 12, Update 6\". This value is
    -- unique across all versions of a document and can\'t be changed.
    GetDocument -> Maybe Text
versionName :: Prelude.Maybe Prelude.Text,
    -- | The name of the SSM document.
    GetDocument -> Text
name :: Prelude.Text
  }
  deriving (GetDocument -> GetDocument -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDocument -> GetDocument -> Bool
$c/= :: GetDocument -> GetDocument -> Bool
== :: GetDocument -> GetDocument -> Bool
$c== :: GetDocument -> GetDocument -> Bool
Prelude.Eq, ReadPrec [GetDocument]
ReadPrec GetDocument
Int -> ReadS GetDocument
ReadS [GetDocument]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDocument]
$creadListPrec :: ReadPrec [GetDocument]
readPrec :: ReadPrec GetDocument
$creadPrec :: ReadPrec GetDocument
readList :: ReadS [GetDocument]
$creadList :: ReadS [GetDocument]
readsPrec :: Int -> ReadS GetDocument
$creadsPrec :: Int -> ReadS GetDocument
Prelude.Read, Int -> GetDocument -> ShowS
[GetDocument] -> ShowS
GetDocument -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDocument] -> ShowS
$cshowList :: [GetDocument] -> ShowS
show :: GetDocument -> String
$cshow :: GetDocument -> String
showsPrec :: Int -> GetDocument -> ShowS
$cshowsPrec :: Int -> GetDocument -> ShowS
Prelude.Show, forall x. Rep GetDocument x -> GetDocument
forall x. GetDocument -> Rep GetDocument x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDocument x -> GetDocument
$cfrom :: forall x. GetDocument -> Rep GetDocument x
Prelude.Generic)

-- |
-- Create a value of 'GetDocument' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'documentFormat', 'getDocument_documentFormat' - Returns the document in the specified format. The document format can be
-- either JSON or YAML. JSON is the default format.
--
-- 'documentVersion', 'getDocument_documentVersion' - The document version for which you want information.
--
-- 'versionName', 'getDocument_versionName' - An optional field specifying the version of the artifact associated with
-- the document. For example, \"Release 12, Update 6\". This value is
-- unique across all versions of a document and can\'t be changed.
--
-- 'name', 'getDocument_name' - The name of the SSM document.
newGetDocument ::
  -- | 'name'
  Prelude.Text ->
  GetDocument
newGetDocument :: Text -> GetDocument
newGetDocument Text
pName_ =
  GetDocument'
    { $sel:documentFormat:GetDocument' :: Maybe DocumentFormat
documentFormat = forall a. Maybe a
Prelude.Nothing,
      $sel:documentVersion:GetDocument' :: Maybe Text
documentVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:versionName:GetDocument' :: Maybe Text
versionName = forall a. Maybe a
Prelude.Nothing,
      $sel:name:GetDocument' :: Text
name = Text
pName_
    }

-- | Returns the document in the specified format. The document format can be
-- either JSON or YAML. JSON is the default format.
getDocument_documentFormat :: Lens.Lens' GetDocument (Prelude.Maybe DocumentFormat)
getDocument_documentFormat :: Lens' GetDocument (Maybe DocumentFormat)
getDocument_documentFormat = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocument' {Maybe DocumentFormat
documentFormat :: Maybe DocumentFormat
$sel:documentFormat:GetDocument' :: GetDocument -> Maybe DocumentFormat
documentFormat} -> Maybe DocumentFormat
documentFormat) (\s :: GetDocument
s@GetDocument' {} Maybe DocumentFormat
a -> GetDocument
s {$sel:documentFormat:GetDocument' :: Maybe DocumentFormat
documentFormat = Maybe DocumentFormat
a} :: GetDocument)

-- | The document version for which you want information.
getDocument_documentVersion :: Lens.Lens' GetDocument (Prelude.Maybe Prelude.Text)
getDocument_documentVersion :: Lens' GetDocument (Maybe Text)
getDocument_documentVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocument' {Maybe Text
documentVersion :: Maybe Text
$sel:documentVersion:GetDocument' :: GetDocument -> Maybe Text
documentVersion} -> Maybe Text
documentVersion) (\s :: GetDocument
s@GetDocument' {} Maybe Text
a -> GetDocument
s {$sel:documentVersion:GetDocument' :: Maybe Text
documentVersion = Maybe Text
a} :: GetDocument)

-- | An optional field specifying the version of the artifact associated with
-- the document. For example, \"Release 12, Update 6\". This value is
-- unique across all versions of a document and can\'t be changed.
getDocument_versionName :: Lens.Lens' GetDocument (Prelude.Maybe Prelude.Text)
getDocument_versionName :: Lens' GetDocument (Maybe Text)
getDocument_versionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocument' {Maybe Text
versionName :: Maybe Text
$sel:versionName:GetDocument' :: GetDocument -> Maybe Text
versionName} -> Maybe Text
versionName) (\s :: GetDocument
s@GetDocument' {} Maybe Text
a -> GetDocument
s {$sel:versionName:GetDocument' :: Maybe Text
versionName = Maybe Text
a} :: GetDocument)

-- | The name of the SSM document.
getDocument_name :: Lens.Lens' GetDocument Prelude.Text
getDocument_name :: Lens' GetDocument Text
getDocument_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocument' {Text
name :: Text
$sel:name:GetDocument' :: GetDocument -> Text
name} -> Text
name) (\s :: GetDocument
s@GetDocument' {} Text
a -> GetDocument
s {$sel:name:GetDocument' :: Text
name = Text
a} :: GetDocument)

instance Core.AWSRequest GetDocument where
  type AWSResponse GetDocument = GetDocumentResponse
  request :: (Service -> Service) -> GetDocument -> Request GetDocument
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetDocument
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDocument)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [AttachmentContent]
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe DocumentFormat
-> Maybe DocumentType
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty DocumentRequires)
-> Maybe ReviewStatus
-> Maybe DocumentStatus
-> Maybe Text
-> Maybe Text
-> Int
-> GetDocumentResponse
GetDocumentResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"AttachmentsContent"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Content")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"CreatedDate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"DisplayName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"DocumentFormat")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"DocumentType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"DocumentVersion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Requires")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ReviewStatus")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"StatusInformation")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"VersionName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetDocument where
  hashWithSalt :: Int -> GetDocument -> Int
hashWithSalt Int
_salt GetDocument' {Maybe Text
Maybe DocumentFormat
Text
name :: Text
versionName :: Maybe Text
documentVersion :: Maybe Text
documentFormat :: Maybe DocumentFormat
$sel:name:GetDocument' :: GetDocument -> Text
$sel:versionName:GetDocument' :: GetDocument -> Maybe Text
$sel:documentVersion:GetDocument' :: GetDocument -> Maybe Text
$sel:documentFormat:GetDocument' :: GetDocument -> Maybe DocumentFormat
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DocumentFormat
documentFormat
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
documentVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
versionName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData GetDocument where
  rnf :: GetDocument -> ()
rnf GetDocument' {Maybe Text
Maybe DocumentFormat
Text
name :: Text
versionName :: Maybe Text
documentVersion :: Maybe Text
documentFormat :: Maybe DocumentFormat
$sel:name:GetDocument' :: GetDocument -> Text
$sel:versionName:GetDocument' :: GetDocument -> Maybe Text
$sel:documentVersion:GetDocument' :: GetDocument -> Maybe Text
$sel:documentFormat:GetDocument' :: GetDocument -> Maybe DocumentFormat
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe DocumentFormat
documentFormat
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
documentVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name

instance Data.ToHeaders GetDocument where
  toHeaders :: GetDocument -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"AmazonSSM.GetDocument" :: Prelude.ByteString),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON GetDocument where
  toJSON :: GetDocument -> Value
toJSON GetDocument' {Maybe Text
Maybe DocumentFormat
Text
name :: Text
versionName :: Maybe Text
documentVersion :: Maybe Text
documentFormat :: Maybe DocumentFormat
$sel:name:GetDocument' :: GetDocument -> Text
$sel:versionName:GetDocument' :: GetDocument -> Maybe Text
$sel:documentVersion:GetDocument' :: GetDocument -> Maybe Text
$sel:documentFormat:GetDocument' :: GetDocument -> Maybe DocumentFormat
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DocumentFormat" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DocumentFormat
documentFormat,
            (Key
"DocumentVersion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
documentVersion,
            (Key
"VersionName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
versionName,
            forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
          ]
      )

instance Data.ToPath GetDocument where
  toPath :: GetDocument -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery GetDocument where
  toQuery :: GetDocument -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetDocumentResponse' smart constructor.
data GetDocumentResponse = GetDocumentResponse'
  { -- | A description of the document attachments, including names, locations,
    -- sizes, and so on.
    GetDocumentResponse -> Maybe [AttachmentContent]
attachmentsContent :: Prelude.Maybe [AttachmentContent],
    -- | The contents of the SSM document.
    GetDocumentResponse -> Maybe Text
content :: Prelude.Maybe Prelude.Text,
    -- | The date the SSM document was created.
    GetDocumentResponse -> Maybe POSIX
createdDate :: Prelude.Maybe Data.POSIX,
    -- | The friendly name of the SSM document. This value can differ for each
    -- version of the document. If you want to update this value, see
    -- UpdateDocument.
    GetDocumentResponse -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
    -- | The document format, either JSON or YAML.
    GetDocumentResponse -> Maybe DocumentFormat
documentFormat :: Prelude.Maybe DocumentFormat,
    -- | The document type.
    GetDocumentResponse -> Maybe DocumentType
documentType :: Prelude.Maybe DocumentType,
    -- | The document version.
    GetDocumentResponse -> Maybe Text
documentVersion :: Prelude.Maybe Prelude.Text,
    -- | The name of the SSM document.
    GetDocumentResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | A list of SSM documents required by a document. For example, an
    -- @ApplicationConfiguration@ document requires an
    -- @ApplicationConfigurationSchema@ document.
    GetDocumentResponse -> Maybe (NonEmpty DocumentRequires)
requires :: Prelude.Maybe (Prelude.NonEmpty DocumentRequires),
    -- | The current review status of a new custom Systems Manager document (SSM
    -- document) created by a member of your organization, or of the latest
    -- version of an existing SSM document.
    --
    -- Only one version of an SSM document can be in the APPROVED state at a
    -- time. When a new version is approved, the status of the previous version
    -- changes to REJECTED.
    --
    -- Only one version of an SSM document can be in review, or PENDING, at a
    -- time.
    GetDocumentResponse -> Maybe ReviewStatus
reviewStatus :: Prelude.Maybe ReviewStatus,
    -- | The status of the SSM document, such as @Creating@, @Active@,
    -- @Updating@, @Failed@, and @Deleting@.
    GetDocumentResponse -> Maybe DocumentStatus
status :: Prelude.Maybe DocumentStatus,
    -- | A message returned by Amazon Web Services Systems Manager that explains
    -- the @Status@ value. For example, a @Failed@ status might be explained by
    -- the @StatusInformation@ message, \"The specified S3 bucket doesn\'t
    -- exist. Verify that the URL of the S3 bucket is correct.\"
    GetDocumentResponse -> Maybe Text
statusInformation :: Prelude.Maybe Prelude.Text,
    -- | The version of the artifact associated with the document. For example,
    -- \"Release 12, Update 6\". This value is unique across all versions of a
    -- document, and can\'t be changed.
    GetDocumentResponse -> Maybe Text
versionName :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetDocumentResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetDocumentResponse -> GetDocumentResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDocumentResponse -> GetDocumentResponse -> Bool
$c/= :: GetDocumentResponse -> GetDocumentResponse -> Bool
== :: GetDocumentResponse -> GetDocumentResponse -> Bool
$c== :: GetDocumentResponse -> GetDocumentResponse -> Bool
Prelude.Eq, ReadPrec [GetDocumentResponse]
ReadPrec GetDocumentResponse
Int -> ReadS GetDocumentResponse
ReadS [GetDocumentResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDocumentResponse]
$creadListPrec :: ReadPrec [GetDocumentResponse]
readPrec :: ReadPrec GetDocumentResponse
$creadPrec :: ReadPrec GetDocumentResponse
readList :: ReadS [GetDocumentResponse]
$creadList :: ReadS [GetDocumentResponse]
readsPrec :: Int -> ReadS GetDocumentResponse
$creadsPrec :: Int -> ReadS GetDocumentResponse
Prelude.Read, Int -> GetDocumentResponse -> ShowS
[GetDocumentResponse] -> ShowS
GetDocumentResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDocumentResponse] -> ShowS
$cshowList :: [GetDocumentResponse] -> ShowS
show :: GetDocumentResponse -> String
$cshow :: GetDocumentResponse -> String
showsPrec :: Int -> GetDocumentResponse -> ShowS
$cshowsPrec :: Int -> GetDocumentResponse -> ShowS
Prelude.Show, forall x. Rep GetDocumentResponse x -> GetDocumentResponse
forall x. GetDocumentResponse -> Rep GetDocumentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDocumentResponse x -> GetDocumentResponse
$cfrom :: forall x. GetDocumentResponse -> Rep GetDocumentResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetDocumentResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'attachmentsContent', 'getDocumentResponse_attachmentsContent' - A description of the document attachments, including names, locations,
-- sizes, and so on.
--
-- 'content', 'getDocumentResponse_content' - The contents of the SSM document.
--
-- 'createdDate', 'getDocumentResponse_createdDate' - The date the SSM document was created.
--
-- 'displayName', 'getDocumentResponse_displayName' - The friendly name of the SSM document. This value can differ for each
-- version of the document. If you want to update this value, see
-- UpdateDocument.
--
-- 'documentFormat', 'getDocumentResponse_documentFormat' - The document format, either JSON or YAML.
--
-- 'documentType', 'getDocumentResponse_documentType' - The document type.
--
-- 'documentVersion', 'getDocumentResponse_documentVersion' - The document version.
--
-- 'name', 'getDocumentResponse_name' - The name of the SSM document.
--
-- 'requires', 'getDocumentResponse_requires' - A list of SSM documents required by a document. For example, an
-- @ApplicationConfiguration@ document requires an
-- @ApplicationConfigurationSchema@ document.
--
-- 'reviewStatus', 'getDocumentResponse_reviewStatus' - The current review status of a new custom Systems Manager document (SSM
-- document) created by a member of your organization, or of the latest
-- version of an existing SSM document.
--
-- Only one version of an SSM document can be in the APPROVED state at a
-- time. When a new version is approved, the status of the previous version
-- changes to REJECTED.
--
-- Only one version of an SSM document can be in review, or PENDING, at a
-- time.
--
-- 'status', 'getDocumentResponse_status' - The status of the SSM document, such as @Creating@, @Active@,
-- @Updating@, @Failed@, and @Deleting@.
--
-- 'statusInformation', 'getDocumentResponse_statusInformation' - A message returned by Amazon Web Services Systems Manager that explains
-- the @Status@ value. For example, a @Failed@ status might be explained by
-- the @StatusInformation@ message, \"The specified S3 bucket doesn\'t
-- exist. Verify that the URL of the S3 bucket is correct.\"
--
-- 'versionName', 'getDocumentResponse_versionName' - The version of the artifact associated with the document. For example,
-- \"Release 12, Update 6\". This value is unique across all versions of a
-- document, and can\'t be changed.
--
-- 'httpStatus', 'getDocumentResponse_httpStatus' - The response's http status code.
newGetDocumentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetDocumentResponse
newGetDocumentResponse :: Int -> GetDocumentResponse
newGetDocumentResponse Int
pHttpStatus_ =
  GetDocumentResponse'
    { $sel:attachmentsContent:GetDocumentResponse' :: Maybe [AttachmentContent]
attachmentsContent =
        forall a. Maybe a
Prelude.Nothing,
      $sel:content:GetDocumentResponse' :: Maybe Text
content = forall a. Maybe a
Prelude.Nothing,
      $sel:createdDate:GetDocumentResponse' :: Maybe POSIX
createdDate = forall a. Maybe a
Prelude.Nothing,
      $sel:displayName:GetDocumentResponse' :: Maybe Text
displayName = forall a. Maybe a
Prelude.Nothing,
      $sel:documentFormat:GetDocumentResponse' :: Maybe DocumentFormat
documentFormat = forall a. Maybe a
Prelude.Nothing,
      $sel:documentType:GetDocumentResponse' :: Maybe DocumentType
documentType = forall a. Maybe a
Prelude.Nothing,
      $sel:documentVersion:GetDocumentResponse' :: Maybe Text
documentVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:name:GetDocumentResponse' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:requires:GetDocumentResponse' :: Maybe (NonEmpty DocumentRequires)
requires = forall a. Maybe a
Prelude.Nothing,
      $sel:reviewStatus:GetDocumentResponse' :: Maybe ReviewStatus
reviewStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:status:GetDocumentResponse' :: Maybe DocumentStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:statusInformation:GetDocumentResponse' :: Maybe Text
statusInformation = forall a. Maybe a
Prelude.Nothing,
      $sel:versionName:GetDocumentResponse' :: Maybe Text
versionName = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetDocumentResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A description of the document attachments, including names, locations,
-- sizes, and so on.
getDocumentResponse_attachmentsContent :: Lens.Lens' GetDocumentResponse (Prelude.Maybe [AttachmentContent])
getDocumentResponse_attachmentsContent :: Lens' GetDocumentResponse (Maybe [AttachmentContent])
getDocumentResponse_attachmentsContent = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentResponse' {Maybe [AttachmentContent]
attachmentsContent :: Maybe [AttachmentContent]
$sel:attachmentsContent:GetDocumentResponse' :: GetDocumentResponse -> Maybe [AttachmentContent]
attachmentsContent} -> Maybe [AttachmentContent]
attachmentsContent) (\s :: GetDocumentResponse
s@GetDocumentResponse' {} Maybe [AttachmentContent]
a -> GetDocumentResponse
s {$sel:attachmentsContent:GetDocumentResponse' :: Maybe [AttachmentContent]
attachmentsContent = Maybe [AttachmentContent]
a} :: GetDocumentResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The contents of the SSM document.
getDocumentResponse_content :: Lens.Lens' GetDocumentResponse (Prelude.Maybe Prelude.Text)
getDocumentResponse_content :: Lens' GetDocumentResponse (Maybe Text)
getDocumentResponse_content = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentResponse' {Maybe Text
content :: Maybe Text
$sel:content:GetDocumentResponse' :: GetDocumentResponse -> Maybe Text
content} -> Maybe Text
content) (\s :: GetDocumentResponse
s@GetDocumentResponse' {} Maybe Text
a -> GetDocumentResponse
s {$sel:content:GetDocumentResponse' :: Maybe Text
content = Maybe Text
a} :: GetDocumentResponse)

-- | The date the SSM document was created.
getDocumentResponse_createdDate :: Lens.Lens' GetDocumentResponse (Prelude.Maybe Prelude.UTCTime)
getDocumentResponse_createdDate :: Lens' GetDocumentResponse (Maybe UTCTime)
getDocumentResponse_createdDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentResponse' {Maybe POSIX
createdDate :: Maybe POSIX
$sel:createdDate:GetDocumentResponse' :: GetDocumentResponse -> Maybe POSIX
createdDate} -> Maybe POSIX
createdDate) (\s :: GetDocumentResponse
s@GetDocumentResponse' {} Maybe POSIX
a -> GetDocumentResponse
s {$sel:createdDate:GetDocumentResponse' :: Maybe POSIX
createdDate = Maybe POSIX
a} :: GetDocumentResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The friendly name of the SSM document. This value can differ for each
-- version of the document. If you want to update this value, see
-- UpdateDocument.
getDocumentResponse_displayName :: Lens.Lens' GetDocumentResponse (Prelude.Maybe Prelude.Text)
getDocumentResponse_displayName :: Lens' GetDocumentResponse (Maybe Text)
getDocumentResponse_displayName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentResponse' {Maybe Text
displayName :: Maybe Text
$sel:displayName:GetDocumentResponse' :: GetDocumentResponse -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: GetDocumentResponse
s@GetDocumentResponse' {} Maybe Text
a -> GetDocumentResponse
s {$sel:displayName:GetDocumentResponse' :: Maybe Text
displayName = Maybe Text
a} :: GetDocumentResponse)

-- | The document format, either JSON or YAML.
getDocumentResponse_documentFormat :: Lens.Lens' GetDocumentResponse (Prelude.Maybe DocumentFormat)
getDocumentResponse_documentFormat :: Lens' GetDocumentResponse (Maybe DocumentFormat)
getDocumentResponse_documentFormat = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentResponse' {Maybe DocumentFormat
documentFormat :: Maybe DocumentFormat
$sel:documentFormat:GetDocumentResponse' :: GetDocumentResponse -> Maybe DocumentFormat
documentFormat} -> Maybe DocumentFormat
documentFormat) (\s :: GetDocumentResponse
s@GetDocumentResponse' {} Maybe DocumentFormat
a -> GetDocumentResponse
s {$sel:documentFormat:GetDocumentResponse' :: Maybe DocumentFormat
documentFormat = Maybe DocumentFormat
a} :: GetDocumentResponse)

-- | The document type.
getDocumentResponse_documentType :: Lens.Lens' GetDocumentResponse (Prelude.Maybe DocumentType)
getDocumentResponse_documentType :: Lens' GetDocumentResponse (Maybe DocumentType)
getDocumentResponse_documentType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentResponse' {Maybe DocumentType
documentType :: Maybe DocumentType
$sel:documentType:GetDocumentResponse' :: GetDocumentResponse -> Maybe DocumentType
documentType} -> Maybe DocumentType
documentType) (\s :: GetDocumentResponse
s@GetDocumentResponse' {} Maybe DocumentType
a -> GetDocumentResponse
s {$sel:documentType:GetDocumentResponse' :: Maybe DocumentType
documentType = Maybe DocumentType
a} :: GetDocumentResponse)

-- | The document version.
getDocumentResponse_documentVersion :: Lens.Lens' GetDocumentResponse (Prelude.Maybe Prelude.Text)
getDocumentResponse_documentVersion :: Lens' GetDocumentResponse (Maybe Text)
getDocumentResponse_documentVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentResponse' {Maybe Text
documentVersion :: Maybe Text
$sel:documentVersion:GetDocumentResponse' :: GetDocumentResponse -> Maybe Text
documentVersion} -> Maybe Text
documentVersion) (\s :: GetDocumentResponse
s@GetDocumentResponse' {} Maybe Text
a -> GetDocumentResponse
s {$sel:documentVersion:GetDocumentResponse' :: Maybe Text
documentVersion = Maybe Text
a} :: GetDocumentResponse)

-- | The name of the SSM document.
getDocumentResponse_name :: Lens.Lens' GetDocumentResponse (Prelude.Maybe Prelude.Text)
getDocumentResponse_name :: Lens' GetDocumentResponse (Maybe Text)
getDocumentResponse_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentResponse' {Maybe Text
name :: Maybe Text
$sel:name:GetDocumentResponse' :: GetDocumentResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: GetDocumentResponse
s@GetDocumentResponse' {} Maybe Text
a -> GetDocumentResponse
s {$sel:name:GetDocumentResponse' :: Maybe Text
name = Maybe Text
a} :: GetDocumentResponse)

-- | A list of SSM documents required by a document. For example, an
-- @ApplicationConfiguration@ document requires an
-- @ApplicationConfigurationSchema@ document.
getDocumentResponse_requires :: Lens.Lens' GetDocumentResponse (Prelude.Maybe (Prelude.NonEmpty DocumentRequires))
getDocumentResponse_requires :: Lens' GetDocumentResponse (Maybe (NonEmpty DocumentRequires))
getDocumentResponse_requires = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentResponse' {Maybe (NonEmpty DocumentRequires)
requires :: Maybe (NonEmpty DocumentRequires)
$sel:requires:GetDocumentResponse' :: GetDocumentResponse -> Maybe (NonEmpty DocumentRequires)
requires} -> Maybe (NonEmpty DocumentRequires)
requires) (\s :: GetDocumentResponse
s@GetDocumentResponse' {} Maybe (NonEmpty DocumentRequires)
a -> GetDocumentResponse
s {$sel:requires:GetDocumentResponse' :: Maybe (NonEmpty DocumentRequires)
requires = Maybe (NonEmpty DocumentRequires)
a} :: GetDocumentResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The current review status of a new custom Systems Manager document (SSM
-- document) created by a member of your organization, or of the latest
-- version of an existing SSM document.
--
-- Only one version of an SSM document can be in the APPROVED state at a
-- time. When a new version is approved, the status of the previous version
-- changes to REJECTED.
--
-- Only one version of an SSM document can be in review, or PENDING, at a
-- time.
getDocumentResponse_reviewStatus :: Lens.Lens' GetDocumentResponse (Prelude.Maybe ReviewStatus)
getDocumentResponse_reviewStatus :: Lens' GetDocumentResponse (Maybe ReviewStatus)
getDocumentResponse_reviewStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentResponse' {Maybe ReviewStatus
reviewStatus :: Maybe ReviewStatus
$sel:reviewStatus:GetDocumentResponse' :: GetDocumentResponse -> Maybe ReviewStatus
reviewStatus} -> Maybe ReviewStatus
reviewStatus) (\s :: GetDocumentResponse
s@GetDocumentResponse' {} Maybe ReviewStatus
a -> GetDocumentResponse
s {$sel:reviewStatus:GetDocumentResponse' :: Maybe ReviewStatus
reviewStatus = Maybe ReviewStatus
a} :: GetDocumentResponse)

-- | The status of the SSM document, such as @Creating@, @Active@,
-- @Updating@, @Failed@, and @Deleting@.
getDocumentResponse_status :: Lens.Lens' GetDocumentResponse (Prelude.Maybe DocumentStatus)
getDocumentResponse_status :: Lens' GetDocumentResponse (Maybe DocumentStatus)
getDocumentResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentResponse' {Maybe DocumentStatus
status :: Maybe DocumentStatus
$sel:status:GetDocumentResponse' :: GetDocumentResponse -> Maybe DocumentStatus
status} -> Maybe DocumentStatus
status) (\s :: GetDocumentResponse
s@GetDocumentResponse' {} Maybe DocumentStatus
a -> GetDocumentResponse
s {$sel:status:GetDocumentResponse' :: Maybe DocumentStatus
status = Maybe DocumentStatus
a} :: GetDocumentResponse)

-- | A message returned by Amazon Web Services Systems Manager that explains
-- the @Status@ value. For example, a @Failed@ status might be explained by
-- the @StatusInformation@ message, \"The specified S3 bucket doesn\'t
-- exist. Verify that the URL of the S3 bucket is correct.\"
getDocumentResponse_statusInformation :: Lens.Lens' GetDocumentResponse (Prelude.Maybe Prelude.Text)
getDocumentResponse_statusInformation :: Lens' GetDocumentResponse (Maybe Text)
getDocumentResponse_statusInformation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentResponse' {Maybe Text
statusInformation :: Maybe Text
$sel:statusInformation:GetDocumentResponse' :: GetDocumentResponse -> Maybe Text
statusInformation} -> Maybe Text
statusInformation) (\s :: GetDocumentResponse
s@GetDocumentResponse' {} Maybe Text
a -> GetDocumentResponse
s {$sel:statusInformation:GetDocumentResponse' :: Maybe Text
statusInformation = Maybe Text
a} :: GetDocumentResponse)

-- | The version of the artifact associated with the document. For example,
-- \"Release 12, Update 6\". This value is unique across all versions of a
-- document, and can\'t be changed.
getDocumentResponse_versionName :: Lens.Lens' GetDocumentResponse (Prelude.Maybe Prelude.Text)
getDocumentResponse_versionName :: Lens' GetDocumentResponse (Maybe Text)
getDocumentResponse_versionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentResponse' {Maybe Text
versionName :: Maybe Text
$sel:versionName:GetDocumentResponse' :: GetDocumentResponse -> Maybe Text
versionName} -> Maybe Text
versionName) (\s :: GetDocumentResponse
s@GetDocumentResponse' {} Maybe Text
a -> GetDocumentResponse
s {$sel:versionName:GetDocumentResponse' :: Maybe Text
versionName = Maybe Text
a} :: GetDocumentResponse)

-- | The response's http status code.
getDocumentResponse_httpStatus :: Lens.Lens' GetDocumentResponse Prelude.Int
getDocumentResponse_httpStatus :: Lens' GetDocumentResponse Int
getDocumentResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDocumentResponse' :: GetDocumentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDocumentResponse
s@GetDocumentResponse' {} Int
a -> GetDocumentResponse
s {$sel:httpStatus:GetDocumentResponse' :: Int
httpStatus = Int
a} :: GetDocumentResponse)

instance Prelude.NFData GetDocumentResponse where
  rnf :: GetDocumentResponse -> ()
rnf GetDocumentResponse' {Int
Maybe [AttachmentContent]
Maybe (NonEmpty DocumentRequires)
Maybe Text
Maybe POSIX
Maybe DocumentFormat
Maybe DocumentStatus
Maybe DocumentType
Maybe ReviewStatus
httpStatus :: Int
versionName :: Maybe Text
statusInformation :: Maybe Text
status :: Maybe DocumentStatus
reviewStatus :: Maybe ReviewStatus
requires :: Maybe (NonEmpty DocumentRequires)
name :: Maybe Text
documentVersion :: Maybe Text
documentType :: Maybe DocumentType
documentFormat :: Maybe DocumentFormat
displayName :: Maybe Text
createdDate :: Maybe POSIX
content :: Maybe Text
attachmentsContent :: Maybe [AttachmentContent]
$sel:httpStatus:GetDocumentResponse' :: GetDocumentResponse -> Int
$sel:versionName:GetDocumentResponse' :: GetDocumentResponse -> Maybe Text
$sel:statusInformation:GetDocumentResponse' :: GetDocumentResponse -> Maybe Text
$sel:status:GetDocumentResponse' :: GetDocumentResponse -> Maybe DocumentStatus
$sel:reviewStatus:GetDocumentResponse' :: GetDocumentResponse -> Maybe ReviewStatus
$sel:requires:GetDocumentResponse' :: GetDocumentResponse -> Maybe (NonEmpty DocumentRequires)
$sel:name:GetDocumentResponse' :: GetDocumentResponse -> Maybe Text
$sel:documentVersion:GetDocumentResponse' :: GetDocumentResponse -> Maybe Text
$sel:documentType:GetDocumentResponse' :: GetDocumentResponse -> Maybe DocumentType
$sel:documentFormat:GetDocumentResponse' :: GetDocumentResponse -> Maybe DocumentFormat
$sel:displayName:GetDocumentResponse' :: GetDocumentResponse -> Maybe Text
$sel:createdDate:GetDocumentResponse' :: GetDocumentResponse -> Maybe POSIX
$sel:content:GetDocumentResponse' :: GetDocumentResponse -> Maybe Text
$sel:attachmentsContent:GetDocumentResponse' :: GetDocumentResponse -> Maybe [AttachmentContent]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AttachmentContent]
attachmentsContent
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
content
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
displayName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DocumentFormat
documentFormat
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DocumentType
documentType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
documentVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty DocumentRequires)
requires
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ReviewStatus
reviewStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DocumentStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
statusInformation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus