{-# 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.WorkDocs.InitiateDocumentVersionUpload
-- 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)
--
-- Creates a new document object and version object.
--
-- The client specifies the parent folder ID and name of the document to
-- upload. The ID is optionally specified when creating a new version of an
-- existing document. This is the first step to upload a document. Next,
-- upload the document to the URL returned from the call, and then call
-- UpdateDocumentVersion.
--
-- To cancel the document upload, call AbortDocumentVersionUpload.
module Amazonka.WorkDocs.InitiateDocumentVersionUpload
  ( -- * Creating a Request
    InitiateDocumentVersionUpload (..),
    newInitiateDocumentVersionUpload,

    -- * Request Lenses
    initiateDocumentVersionUpload_documentSizeInBytes,
    initiateDocumentVersionUpload_contentCreatedTimestamp,
    initiateDocumentVersionUpload_authenticationToken,
    initiateDocumentVersionUpload_name,
    initiateDocumentVersionUpload_id,
    initiateDocumentVersionUpload_contentModifiedTimestamp,
    initiateDocumentVersionUpload_contentType,
    initiateDocumentVersionUpload_parentFolderId,

    -- * Destructuring the Response
    InitiateDocumentVersionUploadResponse (..),
    newInitiateDocumentVersionUploadResponse,

    -- * Response Lenses
    initiateDocumentVersionUploadResponse_metadata,
    initiateDocumentVersionUploadResponse_uploadMetadata,
    initiateDocumentVersionUploadResponse_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.WorkDocs.Types

-- | /See:/ 'newInitiateDocumentVersionUpload' smart constructor.
data InitiateDocumentVersionUpload = InitiateDocumentVersionUpload'
  { -- | The size of the document, in bytes.
    InitiateDocumentVersionUpload -> Maybe Integer
documentSizeInBytes :: Prelude.Maybe Prelude.Integer,
    -- | The timestamp when the content of the document was originally created.
    InitiateDocumentVersionUpload -> Maybe POSIX
contentCreatedTimestamp :: Prelude.Maybe Core.POSIX,
    -- | Amazon WorkDocs authentication token. Not required when using AWS
    -- administrator credentials to access the API.
    InitiateDocumentVersionUpload -> Maybe (Sensitive Text)
authenticationToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The name of the document.
    InitiateDocumentVersionUpload -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ID of the document.
    InitiateDocumentVersionUpload -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The timestamp when the content of the document was modified.
    InitiateDocumentVersionUpload -> Maybe POSIX
contentModifiedTimestamp :: Prelude.Maybe Core.POSIX,
    -- | The content type of the document.
    InitiateDocumentVersionUpload -> Maybe Text
contentType :: Prelude.Maybe Prelude.Text,
    -- | The ID of the parent folder.
    InitiateDocumentVersionUpload -> Text
parentFolderId :: Prelude.Text
  }
  deriving (InitiateDocumentVersionUpload
-> InitiateDocumentVersionUpload -> Bool
(InitiateDocumentVersionUpload
 -> InitiateDocumentVersionUpload -> Bool)
-> (InitiateDocumentVersionUpload
    -> InitiateDocumentVersionUpload -> Bool)
-> Eq InitiateDocumentVersionUpload
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InitiateDocumentVersionUpload
-> InitiateDocumentVersionUpload -> Bool
$c/= :: InitiateDocumentVersionUpload
-> InitiateDocumentVersionUpload -> Bool
== :: InitiateDocumentVersionUpload
-> InitiateDocumentVersionUpload -> Bool
$c== :: InitiateDocumentVersionUpload
-> InitiateDocumentVersionUpload -> Bool
Prelude.Eq, Int -> InitiateDocumentVersionUpload -> ShowS
[InitiateDocumentVersionUpload] -> ShowS
InitiateDocumentVersionUpload -> String
(Int -> InitiateDocumentVersionUpload -> ShowS)
-> (InitiateDocumentVersionUpload -> String)
-> ([InitiateDocumentVersionUpload] -> ShowS)
-> Show InitiateDocumentVersionUpload
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InitiateDocumentVersionUpload] -> ShowS
$cshowList :: [InitiateDocumentVersionUpload] -> ShowS
show :: InitiateDocumentVersionUpload -> String
$cshow :: InitiateDocumentVersionUpload -> String
showsPrec :: Int -> InitiateDocumentVersionUpload -> ShowS
$cshowsPrec :: Int -> InitiateDocumentVersionUpload -> ShowS
Prelude.Show, (forall x.
 InitiateDocumentVersionUpload
 -> Rep InitiateDocumentVersionUpload x)
-> (forall x.
    Rep InitiateDocumentVersionUpload x
    -> InitiateDocumentVersionUpload)
-> Generic InitiateDocumentVersionUpload
forall x.
Rep InitiateDocumentVersionUpload x
-> InitiateDocumentVersionUpload
forall x.
InitiateDocumentVersionUpload
-> Rep InitiateDocumentVersionUpload x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InitiateDocumentVersionUpload x
-> InitiateDocumentVersionUpload
$cfrom :: forall x.
InitiateDocumentVersionUpload
-> Rep InitiateDocumentVersionUpload x
Prelude.Generic)

-- |
-- Create a value of 'InitiateDocumentVersionUpload' 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:
--
-- 'documentSizeInBytes', 'initiateDocumentVersionUpload_documentSizeInBytes' - The size of the document, in bytes.
--
-- 'contentCreatedTimestamp', 'initiateDocumentVersionUpload_contentCreatedTimestamp' - The timestamp when the content of the document was originally created.
--
-- 'authenticationToken', 'initiateDocumentVersionUpload_authenticationToken' - Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
--
-- 'name', 'initiateDocumentVersionUpload_name' - The name of the document.
--
-- 'id', 'initiateDocumentVersionUpload_id' - The ID of the document.
--
-- 'contentModifiedTimestamp', 'initiateDocumentVersionUpload_contentModifiedTimestamp' - The timestamp when the content of the document was modified.
--
-- 'contentType', 'initiateDocumentVersionUpload_contentType' - The content type of the document.
--
-- 'parentFolderId', 'initiateDocumentVersionUpload_parentFolderId' - The ID of the parent folder.
newInitiateDocumentVersionUpload ::
  -- | 'parentFolderId'
  Prelude.Text ->
  InitiateDocumentVersionUpload
newInitiateDocumentVersionUpload :: Text -> InitiateDocumentVersionUpload
newInitiateDocumentVersionUpload Text
pParentFolderId_ =
  InitiateDocumentVersionUpload' :: Maybe Integer
-> Maybe POSIX
-> Maybe (Sensitive Text)
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Text
-> InitiateDocumentVersionUpload
InitiateDocumentVersionUpload'
    { $sel:documentSizeInBytes:InitiateDocumentVersionUpload' :: Maybe Integer
documentSizeInBytes =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:contentCreatedTimestamp:InitiateDocumentVersionUpload' :: Maybe POSIX
contentCreatedTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:authenticationToken:InitiateDocumentVersionUpload' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:name:InitiateDocumentVersionUpload' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:InitiateDocumentVersionUpload' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:contentModifiedTimestamp:InitiateDocumentVersionUpload' :: Maybe POSIX
contentModifiedTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:contentType:InitiateDocumentVersionUpload' :: Maybe Text
contentType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:parentFolderId:InitiateDocumentVersionUpload' :: Text
parentFolderId = Text
pParentFolderId_
    }

-- | The size of the document, in bytes.
initiateDocumentVersionUpload_documentSizeInBytes :: Lens.Lens' InitiateDocumentVersionUpload (Prelude.Maybe Prelude.Integer)
initiateDocumentVersionUpload_documentSizeInBytes :: (Maybe Integer -> f (Maybe Integer))
-> InitiateDocumentVersionUpload -> f InitiateDocumentVersionUpload
initiateDocumentVersionUpload_documentSizeInBytes = (InitiateDocumentVersionUpload -> Maybe Integer)
-> (InitiateDocumentVersionUpload
    -> Maybe Integer -> InitiateDocumentVersionUpload)
-> Lens
     InitiateDocumentVersionUpload
     InitiateDocumentVersionUpload
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InitiateDocumentVersionUpload' {Maybe Integer
documentSizeInBytes :: Maybe Integer
$sel:documentSizeInBytes:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe Integer
documentSizeInBytes} -> Maybe Integer
documentSizeInBytes) (\s :: InitiateDocumentVersionUpload
s@InitiateDocumentVersionUpload' {} Maybe Integer
a -> InitiateDocumentVersionUpload
s {$sel:documentSizeInBytes:InitiateDocumentVersionUpload' :: Maybe Integer
documentSizeInBytes = Maybe Integer
a} :: InitiateDocumentVersionUpload)

-- | The timestamp when the content of the document was originally created.
initiateDocumentVersionUpload_contentCreatedTimestamp :: Lens.Lens' InitiateDocumentVersionUpload (Prelude.Maybe Prelude.UTCTime)
initiateDocumentVersionUpload_contentCreatedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> InitiateDocumentVersionUpload -> f InitiateDocumentVersionUpload
initiateDocumentVersionUpload_contentCreatedTimestamp = (InitiateDocumentVersionUpload -> Maybe POSIX)
-> (InitiateDocumentVersionUpload
    -> Maybe POSIX -> InitiateDocumentVersionUpload)
-> Lens
     InitiateDocumentVersionUpload
     InitiateDocumentVersionUpload
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InitiateDocumentVersionUpload' {Maybe POSIX
contentCreatedTimestamp :: Maybe POSIX
$sel:contentCreatedTimestamp:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe POSIX
contentCreatedTimestamp} -> Maybe POSIX
contentCreatedTimestamp) (\s :: InitiateDocumentVersionUpload
s@InitiateDocumentVersionUpload' {} Maybe POSIX
a -> InitiateDocumentVersionUpload
s {$sel:contentCreatedTimestamp:InitiateDocumentVersionUpload' :: Maybe POSIX
contentCreatedTimestamp = Maybe POSIX
a} :: InitiateDocumentVersionUpload) ((Maybe POSIX -> f (Maybe POSIX))
 -> InitiateDocumentVersionUpload
 -> f InitiateDocumentVersionUpload)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> InitiateDocumentVersionUpload
-> f InitiateDocumentVersionUpload
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
initiateDocumentVersionUpload_authenticationToken :: Lens.Lens' InitiateDocumentVersionUpload (Prelude.Maybe Prelude.Text)
initiateDocumentVersionUpload_authenticationToken :: (Maybe Text -> f (Maybe Text))
-> InitiateDocumentVersionUpload -> f InitiateDocumentVersionUpload
initiateDocumentVersionUpload_authenticationToken = (InitiateDocumentVersionUpload -> Maybe (Sensitive Text))
-> (InitiateDocumentVersionUpload
    -> Maybe (Sensitive Text) -> InitiateDocumentVersionUpload)
-> Lens
     InitiateDocumentVersionUpload
     InitiateDocumentVersionUpload
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InitiateDocumentVersionUpload' {Maybe (Sensitive Text)
authenticationToken :: Maybe (Sensitive Text)
$sel:authenticationToken:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe (Sensitive Text)
authenticationToken} -> Maybe (Sensitive Text)
authenticationToken) (\s :: InitiateDocumentVersionUpload
s@InitiateDocumentVersionUpload' {} Maybe (Sensitive Text)
a -> InitiateDocumentVersionUpload
s {$sel:authenticationToken:InitiateDocumentVersionUpload' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
a} :: InitiateDocumentVersionUpload) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> InitiateDocumentVersionUpload
 -> f InitiateDocumentVersionUpload)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> InitiateDocumentVersionUpload
-> f InitiateDocumentVersionUpload
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

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

-- | The ID of the document.
initiateDocumentVersionUpload_id :: Lens.Lens' InitiateDocumentVersionUpload (Prelude.Maybe Prelude.Text)
initiateDocumentVersionUpload_id :: (Maybe Text -> f (Maybe Text))
-> InitiateDocumentVersionUpload -> f InitiateDocumentVersionUpload
initiateDocumentVersionUpload_id = (InitiateDocumentVersionUpload -> Maybe Text)
-> (InitiateDocumentVersionUpload
    -> Maybe Text -> InitiateDocumentVersionUpload)
-> Lens
     InitiateDocumentVersionUpload
     InitiateDocumentVersionUpload
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InitiateDocumentVersionUpload' {Maybe Text
id :: Maybe Text
$sel:id:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe Text
id} -> Maybe Text
id) (\s :: InitiateDocumentVersionUpload
s@InitiateDocumentVersionUpload' {} Maybe Text
a -> InitiateDocumentVersionUpload
s {$sel:id:InitiateDocumentVersionUpload' :: Maybe Text
id = Maybe Text
a} :: InitiateDocumentVersionUpload)

-- | The timestamp when the content of the document was modified.
initiateDocumentVersionUpload_contentModifiedTimestamp :: Lens.Lens' InitiateDocumentVersionUpload (Prelude.Maybe Prelude.UTCTime)
initiateDocumentVersionUpload_contentModifiedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> InitiateDocumentVersionUpload -> f InitiateDocumentVersionUpload
initiateDocumentVersionUpload_contentModifiedTimestamp = (InitiateDocumentVersionUpload -> Maybe POSIX)
-> (InitiateDocumentVersionUpload
    -> Maybe POSIX -> InitiateDocumentVersionUpload)
-> Lens
     InitiateDocumentVersionUpload
     InitiateDocumentVersionUpload
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InitiateDocumentVersionUpload' {Maybe POSIX
contentModifiedTimestamp :: Maybe POSIX
$sel:contentModifiedTimestamp:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe POSIX
contentModifiedTimestamp} -> Maybe POSIX
contentModifiedTimestamp) (\s :: InitiateDocumentVersionUpload
s@InitiateDocumentVersionUpload' {} Maybe POSIX
a -> InitiateDocumentVersionUpload
s {$sel:contentModifiedTimestamp:InitiateDocumentVersionUpload' :: Maybe POSIX
contentModifiedTimestamp = Maybe POSIX
a} :: InitiateDocumentVersionUpload) ((Maybe POSIX -> f (Maybe POSIX))
 -> InitiateDocumentVersionUpload
 -> f InitiateDocumentVersionUpload)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> InitiateDocumentVersionUpload
-> f InitiateDocumentVersionUpload
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The content type of the document.
initiateDocumentVersionUpload_contentType :: Lens.Lens' InitiateDocumentVersionUpload (Prelude.Maybe Prelude.Text)
initiateDocumentVersionUpload_contentType :: (Maybe Text -> f (Maybe Text))
-> InitiateDocumentVersionUpload -> f InitiateDocumentVersionUpload
initiateDocumentVersionUpload_contentType = (InitiateDocumentVersionUpload -> Maybe Text)
-> (InitiateDocumentVersionUpload
    -> Maybe Text -> InitiateDocumentVersionUpload)
-> Lens
     InitiateDocumentVersionUpload
     InitiateDocumentVersionUpload
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InitiateDocumentVersionUpload' {Maybe Text
contentType :: Maybe Text
$sel:contentType:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe Text
contentType} -> Maybe Text
contentType) (\s :: InitiateDocumentVersionUpload
s@InitiateDocumentVersionUpload' {} Maybe Text
a -> InitiateDocumentVersionUpload
s {$sel:contentType:InitiateDocumentVersionUpload' :: Maybe Text
contentType = Maybe Text
a} :: InitiateDocumentVersionUpload)

-- | The ID of the parent folder.
initiateDocumentVersionUpload_parentFolderId :: Lens.Lens' InitiateDocumentVersionUpload Prelude.Text
initiateDocumentVersionUpload_parentFolderId :: (Text -> f Text)
-> InitiateDocumentVersionUpload -> f InitiateDocumentVersionUpload
initiateDocumentVersionUpload_parentFolderId = (InitiateDocumentVersionUpload -> Text)
-> (InitiateDocumentVersionUpload
    -> Text -> InitiateDocumentVersionUpload)
-> Lens
     InitiateDocumentVersionUpload
     InitiateDocumentVersionUpload
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InitiateDocumentVersionUpload' {Text
parentFolderId :: Text
$sel:parentFolderId:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Text
parentFolderId} -> Text
parentFolderId) (\s :: InitiateDocumentVersionUpload
s@InitiateDocumentVersionUpload' {} Text
a -> InitiateDocumentVersionUpload
s {$sel:parentFolderId:InitiateDocumentVersionUpload' :: Text
parentFolderId = Text
a} :: InitiateDocumentVersionUpload)

instance
  Core.AWSRequest
    InitiateDocumentVersionUpload
  where
  type
    AWSResponse InitiateDocumentVersionUpload =
      InitiateDocumentVersionUploadResponse
  request :: InitiateDocumentVersionUpload
-> Request InitiateDocumentVersionUpload
request = Service
-> InitiateDocumentVersionUpload
-> Request InitiateDocumentVersionUpload
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy InitiateDocumentVersionUpload
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse InitiateDocumentVersionUpload)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse InitiateDocumentVersionUpload))
-> Logger
-> Service
-> Proxy InitiateDocumentVersionUpload
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse InitiateDocumentVersionUpload)))
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 DocumentMetadata
-> Maybe UploadMetadata
-> Int
-> InitiateDocumentVersionUploadResponse
InitiateDocumentVersionUploadResponse'
            (Maybe DocumentMetadata
 -> Maybe UploadMetadata
 -> Int
 -> InitiateDocumentVersionUploadResponse)
-> Either String (Maybe DocumentMetadata)
-> Either
     String
     (Maybe UploadMetadata
      -> Int -> InitiateDocumentVersionUploadResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DocumentMetadata)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Metadata")
            Either
  String
  (Maybe UploadMetadata
   -> Int -> InitiateDocumentVersionUploadResponse)
-> Either String (Maybe UploadMetadata)
-> Either String (Int -> InitiateDocumentVersionUploadResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe UploadMetadata)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"UploadMetadata")
            Either String (Int -> InitiateDocumentVersionUploadResponse)
-> Either String Int
-> Either String InitiateDocumentVersionUploadResponse
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
    InitiateDocumentVersionUpload

instance Prelude.NFData InitiateDocumentVersionUpload

instance Core.ToHeaders InitiateDocumentVersionUpload where
  toHeaders :: InitiateDocumentVersionUpload -> ResponseHeaders
toHeaders InitiateDocumentVersionUpload' {Maybe Integer
Maybe Text
Maybe (Sensitive Text)
Maybe POSIX
Text
parentFolderId :: Text
contentType :: Maybe Text
contentModifiedTimestamp :: Maybe POSIX
id :: Maybe Text
name :: Maybe Text
authenticationToken :: Maybe (Sensitive Text)
contentCreatedTimestamp :: Maybe POSIX
documentSizeInBytes :: Maybe Integer
$sel:parentFolderId:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Text
$sel:contentType:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe Text
$sel:contentModifiedTimestamp:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe POSIX
$sel:id:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe Text
$sel:name:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe Text
$sel:authenticationToken:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe (Sensitive Text)
$sel:contentCreatedTimestamp:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe POSIX
$sel:documentSizeInBytes:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe Integer
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"Authentication" HeaderName -> Maybe (Sensitive Text) -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe (Sensitive Text)
authenticationToken,
        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 InitiateDocumentVersionUpload where
  toJSON :: InitiateDocumentVersionUpload -> Value
toJSON InitiateDocumentVersionUpload' {Maybe Integer
Maybe Text
Maybe (Sensitive Text)
Maybe POSIX
Text
parentFolderId :: Text
contentType :: Maybe Text
contentModifiedTimestamp :: Maybe POSIX
id :: Maybe Text
name :: Maybe Text
authenticationToken :: Maybe (Sensitive Text)
contentCreatedTimestamp :: Maybe POSIX
documentSizeInBytes :: Maybe Integer
$sel:parentFolderId:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Text
$sel:contentType:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe Text
$sel:contentModifiedTimestamp:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe POSIX
$sel:id:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe Text
$sel:name:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe Text
$sel:authenticationToken:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe (Sensitive Text)
$sel:contentCreatedTimestamp:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe POSIX
$sel:documentSizeInBytes:InitiateDocumentVersionUpload' :: InitiateDocumentVersionUpload -> Maybe Integer
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DocumentSizeInBytes" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
documentSizeInBytes,
            (Text
"ContentCreatedTimestamp" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
contentCreatedTimestamp,
            (Text
"Name" 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
name,
            (Text
"Id" 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
id,
            (Text
"ContentModifiedTimestamp" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
contentModifiedTimestamp,
            (Text
"ContentType" 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
contentType,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ParentFolderId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
parentFolderId)
          ]
      )

instance Core.ToPath InitiateDocumentVersionUpload where
  toPath :: InitiateDocumentVersionUpload -> ByteString
toPath = ByteString -> InitiateDocumentVersionUpload -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/api/v1/documents"

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

-- | /See:/ 'newInitiateDocumentVersionUploadResponse' smart constructor.
data InitiateDocumentVersionUploadResponse = InitiateDocumentVersionUploadResponse'
  { -- | The document metadata.
    InitiateDocumentVersionUploadResponse -> Maybe DocumentMetadata
metadata :: Prelude.Maybe DocumentMetadata,
    -- | The upload metadata.
    InitiateDocumentVersionUploadResponse -> Maybe UploadMetadata
uploadMetadata :: Prelude.Maybe UploadMetadata,
    -- | The response's http status code.
    InitiateDocumentVersionUploadResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (InitiateDocumentVersionUploadResponse
-> InitiateDocumentVersionUploadResponse -> Bool
(InitiateDocumentVersionUploadResponse
 -> InitiateDocumentVersionUploadResponse -> Bool)
-> (InitiateDocumentVersionUploadResponse
    -> InitiateDocumentVersionUploadResponse -> Bool)
-> Eq InitiateDocumentVersionUploadResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InitiateDocumentVersionUploadResponse
-> InitiateDocumentVersionUploadResponse -> Bool
$c/= :: InitiateDocumentVersionUploadResponse
-> InitiateDocumentVersionUploadResponse -> Bool
== :: InitiateDocumentVersionUploadResponse
-> InitiateDocumentVersionUploadResponse -> Bool
$c== :: InitiateDocumentVersionUploadResponse
-> InitiateDocumentVersionUploadResponse -> Bool
Prelude.Eq, Int -> InitiateDocumentVersionUploadResponse -> ShowS
[InitiateDocumentVersionUploadResponse] -> ShowS
InitiateDocumentVersionUploadResponse -> String
(Int -> InitiateDocumentVersionUploadResponse -> ShowS)
-> (InitiateDocumentVersionUploadResponse -> String)
-> ([InitiateDocumentVersionUploadResponse] -> ShowS)
-> Show InitiateDocumentVersionUploadResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InitiateDocumentVersionUploadResponse] -> ShowS
$cshowList :: [InitiateDocumentVersionUploadResponse] -> ShowS
show :: InitiateDocumentVersionUploadResponse -> String
$cshow :: InitiateDocumentVersionUploadResponse -> String
showsPrec :: Int -> InitiateDocumentVersionUploadResponse -> ShowS
$cshowsPrec :: Int -> InitiateDocumentVersionUploadResponse -> ShowS
Prelude.Show, (forall x.
 InitiateDocumentVersionUploadResponse
 -> Rep InitiateDocumentVersionUploadResponse x)
-> (forall x.
    Rep InitiateDocumentVersionUploadResponse x
    -> InitiateDocumentVersionUploadResponse)
-> Generic InitiateDocumentVersionUploadResponse
forall x.
Rep InitiateDocumentVersionUploadResponse x
-> InitiateDocumentVersionUploadResponse
forall x.
InitiateDocumentVersionUploadResponse
-> Rep InitiateDocumentVersionUploadResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InitiateDocumentVersionUploadResponse x
-> InitiateDocumentVersionUploadResponse
$cfrom :: forall x.
InitiateDocumentVersionUploadResponse
-> Rep InitiateDocumentVersionUploadResponse x
Prelude.Generic)

-- |
-- Create a value of 'InitiateDocumentVersionUploadResponse' 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:
--
-- 'metadata', 'initiateDocumentVersionUploadResponse_metadata' - The document metadata.
--
-- 'uploadMetadata', 'initiateDocumentVersionUploadResponse_uploadMetadata' - The upload metadata.
--
-- 'httpStatus', 'initiateDocumentVersionUploadResponse_httpStatus' - The response's http status code.
newInitiateDocumentVersionUploadResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  InitiateDocumentVersionUploadResponse
newInitiateDocumentVersionUploadResponse :: Int -> InitiateDocumentVersionUploadResponse
newInitiateDocumentVersionUploadResponse Int
pHttpStatus_ =
  InitiateDocumentVersionUploadResponse' :: Maybe DocumentMetadata
-> Maybe UploadMetadata
-> Int
-> InitiateDocumentVersionUploadResponse
InitiateDocumentVersionUploadResponse'
    { $sel:metadata:InitiateDocumentVersionUploadResponse' :: Maybe DocumentMetadata
metadata =
        Maybe DocumentMetadata
forall a. Maybe a
Prelude.Nothing,
      $sel:uploadMetadata:InitiateDocumentVersionUploadResponse' :: Maybe UploadMetadata
uploadMetadata = Maybe UploadMetadata
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:InitiateDocumentVersionUploadResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The document metadata.
initiateDocumentVersionUploadResponse_metadata :: Lens.Lens' InitiateDocumentVersionUploadResponse (Prelude.Maybe DocumentMetadata)
initiateDocumentVersionUploadResponse_metadata :: (Maybe DocumentMetadata -> f (Maybe DocumentMetadata))
-> InitiateDocumentVersionUploadResponse
-> f InitiateDocumentVersionUploadResponse
initiateDocumentVersionUploadResponse_metadata = (InitiateDocumentVersionUploadResponse -> Maybe DocumentMetadata)
-> (InitiateDocumentVersionUploadResponse
    -> Maybe DocumentMetadata -> InitiateDocumentVersionUploadResponse)
-> Lens
     InitiateDocumentVersionUploadResponse
     InitiateDocumentVersionUploadResponse
     (Maybe DocumentMetadata)
     (Maybe DocumentMetadata)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InitiateDocumentVersionUploadResponse' {Maybe DocumentMetadata
metadata :: Maybe DocumentMetadata
$sel:metadata:InitiateDocumentVersionUploadResponse' :: InitiateDocumentVersionUploadResponse -> Maybe DocumentMetadata
metadata} -> Maybe DocumentMetadata
metadata) (\s :: InitiateDocumentVersionUploadResponse
s@InitiateDocumentVersionUploadResponse' {} Maybe DocumentMetadata
a -> InitiateDocumentVersionUploadResponse
s {$sel:metadata:InitiateDocumentVersionUploadResponse' :: Maybe DocumentMetadata
metadata = Maybe DocumentMetadata
a} :: InitiateDocumentVersionUploadResponse)

-- | The upload metadata.
initiateDocumentVersionUploadResponse_uploadMetadata :: Lens.Lens' InitiateDocumentVersionUploadResponse (Prelude.Maybe UploadMetadata)
initiateDocumentVersionUploadResponse_uploadMetadata :: (Maybe UploadMetadata -> f (Maybe UploadMetadata))
-> InitiateDocumentVersionUploadResponse
-> f InitiateDocumentVersionUploadResponse
initiateDocumentVersionUploadResponse_uploadMetadata = (InitiateDocumentVersionUploadResponse -> Maybe UploadMetadata)
-> (InitiateDocumentVersionUploadResponse
    -> Maybe UploadMetadata -> InitiateDocumentVersionUploadResponse)
-> Lens
     InitiateDocumentVersionUploadResponse
     InitiateDocumentVersionUploadResponse
     (Maybe UploadMetadata)
     (Maybe UploadMetadata)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InitiateDocumentVersionUploadResponse' {Maybe UploadMetadata
uploadMetadata :: Maybe UploadMetadata
$sel:uploadMetadata:InitiateDocumentVersionUploadResponse' :: InitiateDocumentVersionUploadResponse -> Maybe UploadMetadata
uploadMetadata} -> Maybe UploadMetadata
uploadMetadata) (\s :: InitiateDocumentVersionUploadResponse
s@InitiateDocumentVersionUploadResponse' {} Maybe UploadMetadata
a -> InitiateDocumentVersionUploadResponse
s {$sel:uploadMetadata:InitiateDocumentVersionUploadResponse' :: Maybe UploadMetadata
uploadMetadata = Maybe UploadMetadata
a} :: InitiateDocumentVersionUploadResponse)

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

instance
  Prelude.NFData
    InitiateDocumentVersionUploadResponse