{-# 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.UpdateDocument
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates one or more values for an SSM document.
module Amazonka.SSM.UpdateDocument
  ( -- * Creating a Request
    UpdateDocument (..),
    newUpdateDocument,

    -- * Request Lenses
    updateDocument_attachments,
    updateDocument_displayName,
    updateDocument_documentFormat,
    updateDocument_documentVersion,
    updateDocument_targetType,
    updateDocument_versionName,
    updateDocument_content,
    updateDocument_name,

    -- * Destructuring the Response
    UpdateDocumentResponse (..),
    newUpdateDocumentResponse,

    -- * Response Lenses
    updateDocumentResponse_documentDescription,
    updateDocumentResponse_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:/ 'newUpdateDocument' smart constructor.
data UpdateDocument = UpdateDocument'
  { -- | A list of key-value pairs that describe attachments to a version of a
    -- document.
    UpdateDocument -> Maybe [AttachmentsSource]
attachments :: Prelude.Maybe [AttachmentsSource],
    -- | The friendly name of the SSM document that you want to update. This
    -- value can differ for each version of the document. If you don\'t specify
    -- a value for this parameter in your request, the existing value is
    -- applied to the new document version.
    UpdateDocument -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
    -- | Specify the document format for the new document version. Systems
    -- Manager supports JSON and YAML documents. JSON is the default format.
    UpdateDocument -> Maybe DocumentFormat
documentFormat :: Prelude.Maybe DocumentFormat,
    -- | The version of the document that you want to update. Currently, Systems
    -- Manager supports updating only the latest version of the document. You
    -- can specify the version number of the latest version or use the
    -- @$LATEST@ variable.
    --
    -- If you change a document version for a State Manager association,
    -- Systems Manager immediately runs the association unless you previously
    -- specifed the @apply-only-at-cron-interval@ parameter.
    UpdateDocument -> Maybe Text
documentVersion :: Prelude.Maybe Prelude.Text,
    -- | Specify a new target type for the document.
    UpdateDocument -> Maybe Text
targetType :: Prelude.Maybe Prelude.Text,
    -- | An optional field specifying the version of the artifact you are
    -- updating with the document. For example, \"Release 12, Update 6\". This
    -- value is unique across all versions of a document, and can\'t be
    -- changed.
    UpdateDocument -> Maybe Text
versionName :: Prelude.Maybe Prelude.Text,
    -- | A valid JSON or YAML string.
    UpdateDocument -> Text
content :: Prelude.Text,
    -- | The name of the SSM document that you want to update.
    UpdateDocument -> Text
name :: Prelude.Text
  }
  deriving (UpdateDocument -> UpdateDocument -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDocument -> UpdateDocument -> Bool
$c/= :: UpdateDocument -> UpdateDocument -> Bool
== :: UpdateDocument -> UpdateDocument -> Bool
$c== :: UpdateDocument -> UpdateDocument -> Bool
Prelude.Eq, ReadPrec [UpdateDocument]
ReadPrec UpdateDocument
Int -> ReadS UpdateDocument
ReadS [UpdateDocument]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDocument]
$creadListPrec :: ReadPrec [UpdateDocument]
readPrec :: ReadPrec UpdateDocument
$creadPrec :: ReadPrec UpdateDocument
readList :: ReadS [UpdateDocument]
$creadList :: ReadS [UpdateDocument]
readsPrec :: Int -> ReadS UpdateDocument
$creadsPrec :: Int -> ReadS UpdateDocument
Prelude.Read, Int -> UpdateDocument -> ShowS
[UpdateDocument] -> ShowS
UpdateDocument -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDocument] -> ShowS
$cshowList :: [UpdateDocument] -> ShowS
show :: UpdateDocument -> String
$cshow :: UpdateDocument -> String
showsPrec :: Int -> UpdateDocument -> ShowS
$cshowsPrec :: Int -> UpdateDocument -> ShowS
Prelude.Show, forall x. Rep UpdateDocument x -> UpdateDocument
forall x. UpdateDocument -> Rep UpdateDocument x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDocument x -> UpdateDocument
$cfrom :: forall x. UpdateDocument -> Rep UpdateDocument x
Prelude.Generic)

-- |
-- Create a value of 'UpdateDocument' 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:
--
-- 'attachments', 'updateDocument_attachments' - A list of key-value pairs that describe attachments to a version of a
-- document.
--
-- 'displayName', 'updateDocument_displayName' - The friendly name of the SSM document that you want to update. This
-- value can differ for each version of the document. If you don\'t specify
-- a value for this parameter in your request, the existing value is
-- applied to the new document version.
--
-- 'documentFormat', 'updateDocument_documentFormat' - Specify the document format for the new document version. Systems
-- Manager supports JSON and YAML documents. JSON is the default format.
--
-- 'documentVersion', 'updateDocument_documentVersion' - The version of the document that you want to update. Currently, Systems
-- Manager supports updating only the latest version of the document. You
-- can specify the version number of the latest version or use the
-- @$LATEST@ variable.
--
-- If you change a document version for a State Manager association,
-- Systems Manager immediately runs the association unless you previously
-- specifed the @apply-only-at-cron-interval@ parameter.
--
-- 'targetType', 'updateDocument_targetType' - Specify a new target type for the document.
--
-- 'versionName', 'updateDocument_versionName' - An optional field specifying the version of the artifact you are
-- updating with the document. For example, \"Release 12, Update 6\". This
-- value is unique across all versions of a document, and can\'t be
-- changed.
--
-- 'content', 'updateDocument_content' - A valid JSON or YAML string.
--
-- 'name', 'updateDocument_name' - The name of the SSM document that you want to update.
newUpdateDocument ::
  -- | 'content'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  UpdateDocument
newUpdateDocument :: Text -> Text -> UpdateDocument
newUpdateDocument Text
pContent_ Text
pName_ =
  UpdateDocument'
    { $sel:attachments:UpdateDocument' :: Maybe [AttachmentsSource]
attachments = forall a. Maybe a
Prelude.Nothing,
      $sel:displayName:UpdateDocument' :: Maybe Text
displayName = forall a. Maybe a
Prelude.Nothing,
      $sel:documentFormat:UpdateDocument' :: Maybe DocumentFormat
documentFormat = forall a. Maybe a
Prelude.Nothing,
      $sel:documentVersion:UpdateDocument' :: Maybe Text
documentVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:targetType:UpdateDocument' :: Maybe Text
targetType = forall a. Maybe a
Prelude.Nothing,
      $sel:versionName:UpdateDocument' :: Maybe Text
versionName = forall a. Maybe a
Prelude.Nothing,
      $sel:content:UpdateDocument' :: Text
content = Text
pContent_,
      $sel:name:UpdateDocument' :: Text
name = Text
pName_
    }

-- | A list of key-value pairs that describe attachments to a version of a
-- document.
updateDocument_attachments :: Lens.Lens' UpdateDocument (Prelude.Maybe [AttachmentsSource])
updateDocument_attachments :: Lens' UpdateDocument (Maybe [AttachmentsSource])
updateDocument_attachments = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDocument' {Maybe [AttachmentsSource]
attachments :: Maybe [AttachmentsSource]
$sel:attachments:UpdateDocument' :: UpdateDocument -> Maybe [AttachmentsSource]
attachments} -> Maybe [AttachmentsSource]
attachments) (\s :: UpdateDocument
s@UpdateDocument' {} Maybe [AttachmentsSource]
a -> UpdateDocument
s {$sel:attachments:UpdateDocument' :: Maybe [AttachmentsSource]
attachments = Maybe [AttachmentsSource]
a} :: UpdateDocument) 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 friendly name of the SSM document that you want to update. This
-- value can differ for each version of the document. If you don\'t specify
-- a value for this parameter in your request, the existing value is
-- applied to the new document version.
updateDocument_displayName :: Lens.Lens' UpdateDocument (Prelude.Maybe Prelude.Text)
updateDocument_displayName :: Lens' UpdateDocument (Maybe Text)
updateDocument_displayName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDocument' {Maybe Text
displayName :: Maybe Text
$sel:displayName:UpdateDocument' :: UpdateDocument -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: UpdateDocument
s@UpdateDocument' {} Maybe Text
a -> UpdateDocument
s {$sel:displayName:UpdateDocument' :: Maybe Text
displayName = Maybe Text
a} :: UpdateDocument)

-- | Specify the document format for the new document version. Systems
-- Manager supports JSON and YAML documents. JSON is the default format.
updateDocument_documentFormat :: Lens.Lens' UpdateDocument (Prelude.Maybe DocumentFormat)
updateDocument_documentFormat :: Lens' UpdateDocument (Maybe DocumentFormat)
updateDocument_documentFormat = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDocument' {Maybe DocumentFormat
documentFormat :: Maybe DocumentFormat
$sel:documentFormat:UpdateDocument' :: UpdateDocument -> Maybe DocumentFormat
documentFormat} -> Maybe DocumentFormat
documentFormat) (\s :: UpdateDocument
s@UpdateDocument' {} Maybe DocumentFormat
a -> UpdateDocument
s {$sel:documentFormat:UpdateDocument' :: Maybe DocumentFormat
documentFormat = Maybe DocumentFormat
a} :: UpdateDocument)

-- | The version of the document that you want to update. Currently, Systems
-- Manager supports updating only the latest version of the document. You
-- can specify the version number of the latest version or use the
-- @$LATEST@ variable.
--
-- If you change a document version for a State Manager association,
-- Systems Manager immediately runs the association unless you previously
-- specifed the @apply-only-at-cron-interval@ parameter.
updateDocument_documentVersion :: Lens.Lens' UpdateDocument (Prelude.Maybe Prelude.Text)
updateDocument_documentVersion :: Lens' UpdateDocument (Maybe Text)
updateDocument_documentVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDocument' {Maybe Text
documentVersion :: Maybe Text
$sel:documentVersion:UpdateDocument' :: UpdateDocument -> Maybe Text
documentVersion} -> Maybe Text
documentVersion) (\s :: UpdateDocument
s@UpdateDocument' {} Maybe Text
a -> UpdateDocument
s {$sel:documentVersion:UpdateDocument' :: Maybe Text
documentVersion = Maybe Text
a} :: UpdateDocument)

-- | Specify a new target type for the document.
updateDocument_targetType :: Lens.Lens' UpdateDocument (Prelude.Maybe Prelude.Text)
updateDocument_targetType :: Lens' UpdateDocument (Maybe Text)
updateDocument_targetType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDocument' {Maybe Text
targetType :: Maybe Text
$sel:targetType:UpdateDocument' :: UpdateDocument -> Maybe Text
targetType} -> Maybe Text
targetType) (\s :: UpdateDocument
s@UpdateDocument' {} Maybe Text
a -> UpdateDocument
s {$sel:targetType:UpdateDocument' :: Maybe Text
targetType = Maybe Text
a} :: UpdateDocument)

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

-- | A valid JSON or YAML string.
updateDocument_content :: Lens.Lens' UpdateDocument Prelude.Text
updateDocument_content :: Lens' UpdateDocument Text
updateDocument_content = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDocument' {Text
content :: Text
$sel:content:UpdateDocument' :: UpdateDocument -> Text
content} -> Text
content) (\s :: UpdateDocument
s@UpdateDocument' {} Text
a -> UpdateDocument
s {$sel:content:UpdateDocument' :: Text
content = Text
a} :: UpdateDocument)

-- | The name of the SSM document that you want to update.
updateDocument_name :: Lens.Lens' UpdateDocument Prelude.Text
updateDocument_name :: Lens' UpdateDocument Text
updateDocument_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDocument' {Text
name :: Text
$sel:name:UpdateDocument' :: UpdateDocument -> Text
name} -> Text
name) (\s :: UpdateDocument
s@UpdateDocument' {} Text
a -> UpdateDocument
s {$sel:name:UpdateDocument' :: Text
name = Text
a} :: UpdateDocument)

instance Core.AWSRequest UpdateDocument where
  type
    AWSResponse UpdateDocument =
      UpdateDocumentResponse
  request :: (Service -> Service) -> UpdateDocument -> Request UpdateDocument
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 UpdateDocument
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateDocument)))
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 DocumentDescription -> Int -> UpdateDocumentResponse
UpdateDocumentResponse'
            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
"DocumentDescription")
            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 UpdateDocument where
  hashWithSalt :: Int -> UpdateDocument -> Int
hashWithSalt Int
_salt UpdateDocument' {Maybe [AttachmentsSource]
Maybe Text
Maybe DocumentFormat
Text
name :: Text
content :: Text
versionName :: Maybe Text
targetType :: Maybe Text
documentVersion :: Maybe Text
documentFormat :: Maybe DocumentFormat
displayName :: Maybe Text
attachments :: Maybe [AttachmentsSource]
$sel:name:UpdateDocument' :: UpdateDocument -> Text
$sel:content:UpdateDocument' :: UpdateDocument -> Text
$sel:versionName:UpdateDocument' :: UpdateDocument -> Maybe Text
$sel:targetType:UpdateDocument' :: UpdateDocument -> Maybe Text
$sel:documentVersion:UpdateDocument' :: UpdateDocument -> Maybe Text
$sel:documentFormat:UpdateDocument' :: UpdateDocument -> Maybe DocumentFormat
$sel:displayName:UpdateDocument' :: UpdateDocument -> Maybe Text
$sel:attachments:UpdateDocument' :: UpdateDocument -> Maybe [AttachmentsSource]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AttachmentsSource]
attachments
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
displayName
      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
targetType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
versionName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
content
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData UpdateDocument where
  rnf :: UpdateDocument -> ()
rnf UpdateDocument' {Maybe [AttachmentsSource]
Maybe Text
Maybe DocumentFormat
Text
name :: Text
content :: Text
versionName :: Maybe Text
targetType :: Maybe Text
documentVersion :: Maybe Text
documentFormat :: Maybe DocumentFormat
displayName :: Maybe Text
attachments :: Maybe [AttachmentsSource]
$sel:name:UpdateDocument' :: UpdateDocument -> Text
$sel:content:UpdateDocument' :: UpdateDocument -> Text
$sel:versionName:UpdateDocument' :: UpdateDocument -> Maybe Text
$sel:targetType:UpdateDocument' :: UpdateDocument -> Maybe Text
$sel:documentVersion:UpdateDocument' :: UpdateDocument -> Maybe Text
$sel:documentFormat:UpdateDocument' :: UpdateDocument -> Maybe DocumentFormat
$sel:displayName:UpdateDocument' :: UpdateDocument -> Maybe Text
$sel:attachments:UpdateDocument' :: UpdateDocument -> Maybe [AttachmentsSource]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AttachmentsSource]
attachments
      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 Text
documentVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
targetType
      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
content
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name

instance Data.ToHeaders UpdateDocument where
  toHeaders :: UpdateDocument -> 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.UpdateDocument" :: 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 UpdateDocument where
  toJSON :: UpdateDocument -> Value
toJSON UpdateDocument' {Maybe [AttachmentsSource]
Maybe Text
Maybe DocumentFormat
Text
name :: Text
content :: Text
versionName :: Maybe Text
targetType :: Maybe Text
documentVersion :: Maybe Text
documentFormat :: Maybe DocumentFormat
displayName :: Maybe Text
attachments :: Maybe [AttachmentsSource]
$sel:name:UpdateDocument' :: UpdateDocument -> Text
$sel:content:UpdateDocument' :: UpdateDocument -> Text
$sel:versionName:UpdateDocument' :: UpdateDocument -> Maybe Text
$sel:targetType:UpdateDocument' :: UpdateDocument -> Maybe Text
$sel:documentVersion:UpdateDocument' :: UpdateDocument -> Maybe Text
$sel:documentFormat:UpdateDocument' :: UpdateDocument -> Maybe DocumentFormat
$sel:displayName:UpdateDocument' :: UpdateDocument -> Maybe Text
$sel:attachments:UpdateDocument' :: UpdateDocument -> Maybe [AttachmentsSource]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Attachments" 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 [AttachmentsSource]
attachments,
            (Key
"DisplayName" 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
displayName,
            (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
"TargetType" 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
targetType,
            (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
"Content" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
content),
            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 UpdateDocument where
  toPath :: UpdateDocument -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newUpdateDocumentResponse' smart constructor.
data UpdateDocumentResponse = UpdateDocumentResponse'
  { -- | A description of the document that was updated.
    UpdateDocumentResponse -> Maybe DocumentDescription
documentDescription :: Prelude.Maybe DocumentDescription,
    -- | The response's http status code.
    UpdateDocumentResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateDocumentResponse -> UpdateDocumentResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDocumentResponse -> UpdateDocumentResponse -> Bool
$c/= :: UpdateDocumentResponse -> UpdateDocumentResponse -> Bool
== :: UpdateDocumentResponse -> UpdateDocumentResponse -> Bool
$c== :: UpdateDocumentResponse -> UpdateDocumentResponse -> Bool
Prelude.Eq, ReadPrec [UpdateDocumentResponse]
ReadPrec UpdateDocumentResponse
Int -> ReadS UpdateDocumentResponse
ReadS [UpdateDocumentResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDocumentResponse]
$creadListPrec :: ReadPrec [UpdateDocumentResponse]
readPrec :: ReadPrec UpdateDocumentResponse
$creadPrec :: ReadPrec UpdateDocumentResponse
readList :: ReadS [UpdateDocumentResponse]
$creadList :: ReadS [UpdateDocumentResponse]
readsPrec :: Int -> ReadS UpdateDocumentResponse
$creadsPrec :: Int -> ReadS UpdateDocumentResponse
Prelude.Read, Int -> UpdateDocumentResponse -> ShowS
[UpdateDocumentResponse] -> ShowS
UpdateDocumentResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDocumentResponse] -> ShowS
$cshowList :: [UpdateDocumentResponse] -> ShowS
show :: UpdateDocumentResponse -> String
$cshow :: UpdateDocumentResponse -> String
showsPrec :: Int -> UpdateDocumentResponse -> ShowS
$cshowsPrec :: Int -> UpdateDocumentResponse -> ShowS
Prelude.Show, forall x. Rep UpdateDocumentResponse x -> UpdateDocumentResponse
forall x. UpdateDocumentResponse -> Rep UpdateDocumentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDocumentResponse x -> UpdateDocumentResponse
$cfrom :: forall x. UpdateDocumentResponse -> Rep UpdateDocumentResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateDocumentResponse' 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:
--
-- 'documentDescription', 'updateDocumentResponse_documentDescription' - A description of the document that was updated.
--
-- 'httpStatus', 'updateDocumentResponse_httpStatus' - The response's http status code.
newUpdateDocumentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateDocumentResponse
newUpdateDocumentResponse :: Int -> UpdateDocumentResponse
newUpdateDocumentResponse Int
pHttpStatus_ =
  UpdateDocumentResponse'
    { $sel:documentDescription:UpdateDocumentResponse' :: Maybe DocumentDescription
documentDescription =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateDocumentResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A description of the document that was updated.
updateDocumentResponse_documentDescription :: Lens.Lens' UpdateDocumentResponse (Prelude.Maybe DocumentDescription)
updateDocumentResponse_documentDescription :: Lens' UpdateDocumentResponse (Maybe DocumentDescription)
updateDocumentResponse_documentDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDocumentResponse' {Maybe DocumentDescription
documentDescription :: Maybe DocumentDescription
$sel:documentDescription:UpdateDocumentResponse' :: UpdateDocumentResponse -> Maybe DocumentDescription
documentDescription} -> Maybe DocumentDescription
documentDescription) (\s :: UpdateDocumentResponse
s@UpdateDocumentResponse' {} Maybe DocumentDescription
a -> UpdateDocumentResponse
s {$sel:documentDescription:UpdateDocumentResponse' :: Maybe DocumentDescription
documentDescription = Maybe DocumentDescription
a} :: UpdateDocumentResponse)

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

instance Prelude.NFData UpdateDocumentResponse where
  rnf :: UpdateDocumentResponse -> ()
rnf UpdateDocumentResponse' {Int
Maybe DocumentDescription
httpStatus :: Int
documentDescription :: Maybe DocumentDescription
$sel:httpStatus:UpdateDocumentResponse' :: UpdateDocumentResponse -> Int
$sel:documentDescription:UpdateDocumentResponse' :: UpdateDocumentResponse -> Maybe DocumentDescription
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe DocumentDescription
documentDescription
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus