{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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_versionName,
    updateDocument_targetType,
    updateDocument_documentFormat,
    updateDocument_documentVersion,
    updateDocument_displayName,
    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.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

-- | /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],
    -- | 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,
    -- | Specify a new target type for the document.
    UpdateDocument -> Maybe Text
targetType :: 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.
    UpdateDocument -> Maybe Text
documentVersion :: Prelude.Maybe Prelude.Text,
    -- | 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,
    -- | 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
(UpdateDocument -> UpdateDocument -> Bool)
-> (UpdateDocument -> UpdateDocument -> Bool) -> Eq UpdateDocument
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]
(Int -> ReadS UpdateDocument)
-> ReadS [UpdateDocument]
-> ReadPrec UpdateDocument
-> ReadPrec [UpdateDocument]
-> Read 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
(Int -> UpdateDocument -> ShowS)
-> (UpdateDocument -> String)
-> ([UpdateDocument] -> ShowS)
-> Show UpdateDocument
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. UpdateDocument -> Rep UpdateDocument x)
-> (forall x. Rep UpdateDocument x -> UpdateDocument)
-> Generic UpdateDocument
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.
--
-- '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.
--
-- 'targetType', 'updateDocument_targetType' - Specify a new target type for the document.
--
-- '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.
--
-- '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.
--
-- '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' :: Maybe [AttachmentsSource]
-> Maybe Text
-> Maybe Text
-> Maybe DocumentFormat
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> UpdateDocument
UpdateDocument'
    { $sel:attachments:UpdateDocument' :: Maybe [AttachmentsSource]
attachments = Maybe [AttachmentsSource]
forall a. Maybe a
Prelude.Nothing,
      $sel:versionName:UpdateDocument' :: Maybe Text
versionName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:targetType:UpdateDocument' :: Maybe Text
targetType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:documentFormat:UpdateDocument' :: Maybe DocumentFormat
documentFormat = Maybe DocumentFormat
forall a. Maybe a
Prelude.Nothing,
      $sel:documentVersion:UpdateDocument' :: Maybe Text
documentVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:displayName:UpdateDocument' :: Maybe Text
displayName = Maybe Text
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 :: (Maybe [AttachmentsSource] -> f (Maybe [AttachmentsSource]))
-> UpdateDocument -> f UpdateDocument
updateDocument_attachments = (UpdateDocument -> Maybe [AttachmentsSource])
-> (UpdateDocument -> Maybe [AttachmentsSource] -> UpdateDocument)
-> Lens
     UpdateDocument
     UpdateDocument
     (Maybe [AttachmentsSource])
     (Maybe [AttachmentsSource])
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) ((Maybe [AttachmentsSource] -> f (Maybe [AttachmentsSource]))
 -> UpdateDocument -> f UpdateDocument)
-> ((Maybe [AttachmentsSource] -> f (Maybe [AttachmentsSource]))
    -> Maybe [AttachmentsSource] -> f (Maybe [AttachmentsSource]))
-> (Maybe [AttachmentsSource] -> f (Maybe [AttachmentsSource]))
-> UpdateDocument
-> f UpdateDocument
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AttachmentsSource]
  [AttachmentsSource]
  [AttachmentsSource]
  [AttachmentsSource]
-> Iso
     (Maybe [AttachmentsSource])
     (Maybe [AttachmentsSource])
     (Maybe [AttachmentsSource])
     (Maybe [AttachmentsSource])
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
  [AttachmentsSource]
  [AttachmentsSource]
  [AttachmentsSource]
  [AttachmentsSource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> UpdateDocument -> f UpdateDocument
updateDocument_versionName = (UpdateDocument -> Maybe Text)
-> (UpdateDocument -> Maybe Text -> UpdateDocument)
-> Lens UpdateDocument UpdateDocument (Maybe Text) (Maybe Text)
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)

-- | Specify a new target type for the document.
updateDocument_targetType :: Lens.Lens' UpdateDocument (Prelude.Maybe Prelude.Text)
updateDocument_targetType :: (Maybe Text -> f (Maybe Text))
-> UpdateDocument -> f UpdateDocument
updateDocument_targetType = (UpdateDocument -> Maybe Text)
-> (UpdateDocument -> Maybe Text -> UpdateDocument)
-> Lens UpdateDocument UpdateDocument (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe DocumentFormat -> f (Maybe DocumentFormat))
-> UpdateDocument -> f UpdateDocument
updateDocument_documentFormat = (UpdateDocument -> Maybe DocumentFormat)
-> (UpdateDocument -> Maybe DocumentFormat -> UpdateDocument)
-> Lens
     UpdateDocument
     UpdateDocument
     (Maybe DocumentFormat)
     (Maybe 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.
updateDocument_documentVersion :: Lens.Lens' UpdateDocument (Prelude.Maybe Prelude.Text)
updateDocument_documentVersion :: (Maybe Text -> f (Maybe Text))
-> UpdateDocument -> f UpdateDocument
updateDocument_documentVersion = (UpdateDocument -> Maybe Text)
-> (UpdateDocument -> Maybe Text -> UpdateDocument)
-> Lens UpdateDocument UpdateDocument (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> UpdateDocument -> f UpdateDocument
updateDocument_displayName = (UpdateDocument -> Maybe Text)
-> (UpdateDocument -> Maybe Text -> UpdateDocument)
-> Lens UpdateDocument UpdateDocument (Maybe Text) (Maybe Text)
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)

-- | A valid JSON or YAML string.
updateDocument_content :: Lens.Lens' UpdateDocument Prelude.Text
updateDocument_content :: (Text -> f Text) -> UpdateDocument -> f UpdateDocument
updateDocument_content = (UpdateDocument -> Text)
-> (UpdateDocument -> Text -> UpdateDocument)
-> Lens UpdateDocument UpdateDocument Text Text
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 :: (Text -> f Text) -> UpdateDocument -> f UpdateDocument
updateDocument_name = (UpdateDocument -> Text)
-> (UpdateDocument -> Text -> UpdateDocument)
-> Lens UpdateDocument UpdateDocument Text Text
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 :: UpdateDocument -> Request UpdateDocument
request = Service -> UpdateDocument -> Request UpdateDocument
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateDocument
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateDocument)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateDocument))
-> Logger
-> Service
-> Proxy UpdateDocument
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateDocument)))
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 -> UpdateDocumentResponse
UpdateDocumentResponse'
            (Maybe DocumentDescription -> Int -> UpdateDocumentResponse)
-> Either String (Maybe DocumentDescription)
-> Either String (Int -> UpdateDocumentResponse)
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
"DocumentDescription")
            Either String (Int -> UpdateDocumentResponse)
-> Either String Int -> Either String UpdateDocumentResponse
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 UpdateDocument

instance Prelude.NFData UpdateDocument

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

instance Core.ToQuery UpdateDocument where
  toQuery :: UpdateDocument -> QueryString
toQuery = QueryString -> UpdateDocument -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(UpdateDocumentResponse -> UpdateDocumentResponse -> Bool)
-> (UpdateDocumentResponse -> UpdateDocumentResponse -> Bool)
-> Eq UpdateDocumentResponse
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]
(Int -> ReadS UpdateDocumentResponse)
-> ReadS [UpdateDocumentResponse]
-> ReadPrec UpdateDocumentResponse
-> ReadPrec [UpdateDocumentResponse]
-> Read 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
(Int -> UpdateDocumentResponse -> ShowS)
-> (UpdateDocumentResponse -> String)
-> ([UpdateDocumentResponse] -> ShowS)
-> Show UpdateDocumentResponse
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. UpdateDocumentResponse -> Rep UpdateDocumentResponse x)
-> (forall x.
    Rep UpdateDocumentResponse x -> UpdateDocumentResponse)
-> Generic UpdateDocumentResponse
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' :: Maybe DocumentDescription -> Int -> UpdateDocumentResponse
UpdateDocumentResponse'
    { $sel:documentDescription:UpdateDocumentResponse' :: Maybe DocumentDescription
documentDescription =
        Maybe 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 :: (Maybe DocumentDescription -> f (Maybe DocumentDescription))
-> UpdateDocumentResponse -> f UpdateDocumentResponse
updateDocumentResponse_documentDescription = (UpdateDocumentResponse -> Maybe DocumentDescription)
-> (UpdateDocumentResponse
    -> Maybe DocumentDescription -> UpdateDocumentResponse)
-> Lens
     UpdateDocumentResponse
     UpdateDocumentResponse
     (Maybe DocumentDescription)
     (Maybe 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 :: (Int -> f Int)
-> UpdateDocumentResponse -> f UpdateDocumentResponse
updateDocumentResponse_httpStatus = (UpdateDocumentResponse -> Int)
-> (UpdateDocumentResponse -> Int -> UpdateDocumentResponse)
-> Lens UpdateDocumentResponse UpdateDocumentResponse Int Int
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