{-# 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.AbortDocumentVersionUpload
-- 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)
--
-- Aborts the upload of the specified document version that was previously
-- initiated by InitiateDocumentVersionUpload. The client should make this
-- call only when it no longer intends to upload the document version, or
-- fails to do so.
module Amazonka.WorkDocs.AbortDocumentVersionUpload
  ( -- * Creating a Request
    AbortDocumentVersionUpload (..),
    newAbortDocumentVersionUpload,

    -- * Request Lenses
    abortDocumentVersionUpload_authenticationToken,
    abortDocumentVersionUpload_documentId,
    abortDocumentVersionUpload_versionId,

    -- * Destructuring the Response
    AbortDocumentVersionUploadResponse (..),
    newAbortDocumentVersionUploadResponse,
  )
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:/ 'newAbortDocumentVersionUpload' smart constructor.
data AbortDocumentVersionUpload = AbortDocumentVersionUpload'
  { -- | Amazon WorkDocs authentication token. Not required when using AWS
    -- administrator credentials to access the API.
    AbortDocumentVersionUpload -> Maybe (Sensitive Text)
authenticationToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The ID of the document.
    AbortDocumentVersionUpload -> Text
documentId :: Prelude.Text,
    -- | The ID of the version.
    AbortDocumentVersionUpload -> Text
versionId :: Prelude.Text
  }
  deriving (AbortDocumentVersionUpload -> AbortDocumentVersionUpload -> Bool
(AbortDocumentVersionUpload -> AbortDocumentVersionUpload -> Bool)
-> (AbortDocumentVersionUpload
    -> AbortDocumentVersionUpload -> Bool)
-> Eq AbortDocumentVersionUpload
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AbortDocumentVersionUpload -> AbortDocumentVersionUpload -> Bool
$c/= :: AbortDocumentVersionUpload -> AbortDocumentVersionUpload -> Bool
== :: AbortDocumentVersionUpload -> AbortDocumentVersionUpload -> Bool
$c== :: AbortDocumentVersionUpload -> AbortDocumentVersionUpload -> Bool
Prelude.Eq, Int -> AbortDocumentVersionUpload -> ShowS
[AbortDocumentVersionUpload] -> ShowS
AbortDocumentVersionUpload -> String
(Int -> AbortDocumentVersionUpload -> ShowS)
-> (AbortDocumentVersionUpload -> String)
-> ([AbortDocumentVersionUpload] -> ShowS)
-> Show AbortDocumentVersionUpload
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AbortDocumentVersionUpload] -> ShowS
$cshowList :: [AbortDocumentVersionUpload] -> ShowS
show :: AbortDocumentVersionUpload -> String
$cshow :: AbortDocumentVersionUpload -> String
showsPrec :: Int -> AbortDocumentVersionUpload -> ShowS
$cshowsPrec :: Int -> AbortDocumentVersionUpload -> ShowS
Prelude.Show, (forall x.
 AbortDocumentVersionUpload -> Rep AbortDocumentVersionUpload x)
-> (forall x.
    Rep AbortDocumentVersionUpload x -> AbortDocumentVersionUpload)
-> Generic AbortDocumentVersionUpload
forall x.
Rep AbortDocumentVersionUpload x -> AbortDocumentVersionUpload
forall x.
AbortDocumentVersionUpload -> Rep AbortDocumentVersionUpload x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AbortDocumentVersionUpload x -> AbortDocumentVersionUpload
$cfrom :: forall x.
AbortDocumentVersionUpload -> Rep AbortDocumentVersionUpload x
Prelude.Generic)

-- |
-- Create a value of 'AbortDocumentVersionUpload' 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:
--
-- 'authenticationToken', 'abortDocumentVersionUpload_authenticationToken' - Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
--
-- 'documentId', 'abortDocumentVersionUpload_documentId' - The ID of the document.
--
-- 'versionId', 'abortDocumentVersionUpload_versionId' - The ID of the version.
newAbortDocumentVersionUpload ::
  -- | 'documentId'
  Prelude.Text ->
  -- | 'versionId'
  Prelude.Text ->
  AbortDocumentVersionUpload
newAbortDocumentVersionUpload :: Text -> Text -> AbortDocumentVersionUpload
newAbortDocumentVersionUpload
  Text
pDocumentId_
  Text
pVersionId_ =
    AbortDocumentVersionUpload' :: Maybe (Sensitive Text)
-> Text -> Text -> AbortDocumentVersionUpload
AbortDocumentVersionUpload'
      { $sel:authenticationToken:AbortDocumentVersionUpload' :: Maybe (Sensitive Text)
authenticationToken =
          Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:documentId:AbortDocumentVersionUpload' :: Text
documentId = Text
pDocumentId_,
        $sel:versionId:AbortDocumentVersionUpload' :: Text
versionId = Text
pVersionId_
      }

-- | Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
abortDocumentVersionUpload_authenticationToken :: Lens.Lens' AbortDocumentVersionUpload (Prelude.Maybe Prelude.Text)
abortDocumentVersionUpload_authenticationToken :: (Maybe Text -> f (Maybe Text))
-> AbortDocumentVersionUpload -> f AbortDocumentVersionUpload
abortDocumentVersionUpload_authenticationToken = (AbortDocumentVersionUpload -> Maybe (Sensitive Text))
-> (AbortDocumentVersionUpload
    -> Maybe (Sensitive Text) -> AbortDocumentVersionUpload)
-> Lens
     AbortDocumentVersionUpload
     AbortDocumentVersionUpload
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AbortDocumentVersionUpload' {Maybe (Sensitive Text)
authenticationToken :: Maybe (Sensitive Text)
$sel:authenticationToken:AbortDocumentVersionUpload' :: AbortDocumentVersionUpload -> Maybe (Sensitive Text)
authenticationToken} -> Maybe (Sensitive Text)
authenticationToken) (\s :: AbortDocumentVersionUpload
s@AbortDocumentVersionUpload' {} Maybe (Sensitive Text)
a -> AbortDocumentVersionUpload
s {$sel:authenticationToken:AbortDocumentVersionUpload' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
a} :: AbortDocumentVersionUpload) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> AbortDocumentVersionUpload -> f AbortDocumentVersionUpload)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> AbortDocumentVersionUpload
-> f AbortDocumentVersionUpload
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 ID of the document.
abortDocumentVersionUpload_documentId :: Lens.Lens' AbortDocumentVersionUpload Prelude.Text
abortDocumentVersionUpload_documentId :: (Text -> f Text)
-> AbortDocumentVersionUpload -> f AbortDocumentVersionUpload
abortDocumentVersionUpload_documentId = (AbortDocumentVersionUpload -> Text)
-> (AbortDocumentVersionUpload
    -> Text -> AbortDocumentVersionUpload)
-> Lens
     AbortDocumentVersionUpload AbortDocumentVersionUpload Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AbortDocumentVersionUpload' {Text
documentId :: Text
$sel:documentId:AbortDocumentVersionUpload' :: AbortDocumentVersionUpload -> Text
documentId} -> Text
documentId) (\s :: AbortDocumentVersionUpload
s@AbortDocumentVersionUpload' {} Text
a -> AbortDocumentVersionUpload
s {$sel:documentId:AbortDocumentVersionUpload' :: Text
documentId = Text
a} :: AbortDocumentVersionUpload)

-- | The ID of the version.
abortDocumentVersionUpload_versionId :: Lens.Lens' AbortDocumentVersionUpload Prelude.Text
abortDocumentVersionUpload_versionId :: (Text -> f Text)
-> AbortDocumentVersionUpload -> f AbortDocumentVersionUpload
abortDocumentVersionUpload_versionId = (AbortDocumentVersionUpload -> Text)
-> (AbortDocumentVersionUpload
    -> Text -> AbortDocumentVersionUpload)
-> Lens
     AbortDocumentVersionUpload AbortDocumentVersionUpload Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AbortDocumentVersionUpload' {Text
versionId :: Text
$sel:versionId:AbortDocumentVersionUpload' :: AbortDocumentVersionUpload -> Text
versionId} -> Text
versionId) (\s :: AbortDocumentVersionUpload
s@AbortDocumentVersionUpload' {} Text
a -> AbortDocumentVersionUpload
s {$sel:versionId:AbortDocumentVersionUpload' :: Text
versionId = Text
a} :: AbortDocumentVersionUpload)

instance Core.AWSRequest AbortDocumentVersionUpload where
  type
    AWSResponse AbortDocumentVersionUpload =
      AbortDocumentVersionUploadResponse
  request :: AbortDocumentVersionUpload -> Request AbortDocumentVersionUpload
request = Service
-> AbortDocumentVersionUpload -> Request AbortDocumentVersionUpload
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy AbortDocumentVersionUpload
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AbortDocumentVersionUpload)))
response =
    AWSResponse AbortDocumentVersionUpload
-> Logger
-> Service
-> Proxy AbortDocumentVersionUpload
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AbortDocumentVersionUpload)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse AbortDocumentVersionUpload
AbortDocumentVersionUploadResponse
AbortDocumentVersionUploadResponse'

instance Prelude.Hashable AbortDocumentVersionUpload

instance Prelude.NFData AbortDocumentVersionUpload

instance Core.ToHeaders AbortDocumentVersionUpload where
  toHeaders :: AbortDocumentVersionUpload -> [Header]
toHeaders AbortDocumentVersionUpload' {Maybe (Sensitive Text)
Text
versionId :: Text
documentId :: Text
authenticationToken :: Maybe (Sensitive Text)
$sel:versionId:AbortDocumentVersionUpload' :: AbortDocumentVersionUpload -> Text
$sel:documentId:AbortDocumentVersionUpload' :: AbortDocumentVersionUpload -> Text
$sel:authenticationToken:AbortDocumentVersionUpload' :: AbortDocumentVersionUpload -> Maybe (Sensitive Text)
..} =
    [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"Authentication" HeaderName -> Maybe (Sensitive Text) -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# Maybe (Sensitive Text)
authenticationToken,
        HeaderName
"Content-Type"
          HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# (ByteString
"application/x-amz-json-1.1" :: Prelude.ByteString)
      ]

instance Core.ToPath AbortDocumentVersionUpload where
  toPath :: AbortDocumentVersionUpload -> ByteString
toPath AbortDocumentVersionUpload' {Maybe (Sensitive Text)
Text
versionId :: Text
documentId :: Text
authenticationToken :: Maybe (Sensitive Text)
$sel:versionId:AbortDocumentVersionUpload' :: AbortDocumentVersionUpload -> Text
$sel:documentId:AbortDocumentVersionUpload' :: AbortDocumentVersionUpload -> Text
$sel:authenticationToken:AbortDocumentVersionUpload' :: AbortDocumentVersionUpload -> Maybe (Sensitive Text)
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/api/v1/documents/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
documentId,
        ByteString
"/versions/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
versionId
      ]

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

-- | /See:/ 'newAbortDocumentVersionUploadResponse' smart constructor.
data AbortDocumentVersionUploadResponse = AbortDocumentVersionUploadResponse'
  {
  }
  deriving (AbortDocumentVersionUploadResponse
-> AbortDocumentVersionUploadResponse -> Bool
(AbortDocumentVersionUploadResponse
 -> AbortDocumentVersionUploadResponse -> Bool)
-> (AbortDocumentVersionUploadResponse
    -> AbortDocumentVersionUploadResponse -> Bool)
-> Eq AbortDocumentVersionUploadResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AbortDocumentVersionUploadResponse
-> AbortDocumentVersionUploadResponse -> Bool
$c/= :: AbortDocumentVersionUploadResponse
-> AbortDocumentVersionUploadResponse -> Bool
== :: AbortDocumentVersionUploadResponse
-> AbortDocumentVersionUploadResponse -> Bool
$c== :: AbortDocumentVersionUploadResponse
-> AbortDocumentVersionUploadResponse -> Bool
Prelude.Eq, ReadPrec [AbortDocumentVersionUploadResponse]
ReadPrec AbortDocumentVersionUploadResponse
Int -> ReadS AbortDocumentVersionUploadResponse
ReadS [AbortDocumentVersionUploadResponse]
(Int -> ReadS AbortDocumentVersionUploadResponse)
-> ReadS [AbortDocumentVersionUploadResponse]
-> ReadPrec AbortDocumentVersionUploadResponse
-> ReadPrec [AbortDocumentVersionUploadResponse]
-> Read AbortDocumentVersionUploadResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AbortDocumentVersionUploadResponse]
$creadListPrec :: ReadPrec [AbortDocumentVersionUploadResponse]
readPrec :: ReadPrec AbortDocumentVersionUploadResponse
$creadPrec :: ReadPrec AbortDocumentVersionUploadResponse
readList :: ReadS [AbortDocumentVersionUploadResponse]
$creadList :: ReadS [AbortDocumentVersionUploadResponse]
readsPrec :: Int -> ReadS AbortDocumentVersionUploadResponse
$creadsPrec :: Int -> ReadS AbortDocumentVersionUploadResponse
Prelude.Read, Int -> AbortDocumentVersionUploadResponse -> ShowS
[AbortDocumentVersionUploadResponse] -> ShowS
AbortDocumentVersionUploadResponse -> String
(Int -> AbortDocumentVersionUploadResponse -> ShowS)
-> (AbortDocumentVersionUploadResponse -> String)
-> ([AbortDocumentVersionUploadResponse] -> ShowS)
-> Show AbortDocumentVersionUploadResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AbortDocumentVersionUploadResponse] -> ShowS
$cshowList :: [AbortDocumentVersionUploadResponse] -> ShowS
show :: AbortDocumentVersionUploadResponse -> String
$cshow :: AbortDocumentVersionUploadResponse -> String
showsPrec :: Int -> AbortDocumentVersionUploadResponse -> ShowS
$cshowsPrec :: Int -> AbortDocumentVersionUploadResponse -> ShowS
Prelude.Show, (forall x.
 AbortDocumentVersionUploadResponse
 -> Rep AbortDocumentVersionUploadResponse x)
-> (forall x.
    Rep AbortDocumentVersionUploadResponse x
    -> AbortDocumentVersionUploadResponse)
-> Generic AbortDocumentVersionUploadResponse
forall x.
Rep AbortDocumentVersionUploadResponse x
-> AbortDocumentVersionUploadResponse
forall x.
AbortDocumentVersionUploadResponse
-> Rep AbortDocumentVersionUploadResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AbortDocumentVersionUploadResponse x
-> AbortDocumentVersionUploadResponse
$cfrom :: forall x.
AbortDocumentVersionUploadResponse
-> Rep AbortDocumentVersionUploadResponse x
Prelude.Generic)

-- |
-- Create a value of 'AbortDocumentVersionUploadResponse' 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.
newAbortDocumentVersionUploadResponse ::
  AbortDocumentVersionUploadResponse
newAbortDocumentVersionUploadResponse :: AbortDocumentVersionUploadResponse
newAbortDocumentVersionUploadResponse =
  AbortDocumentVersionUploadResponse
AbortDocumentVersionUploadResponse'

instance
  Prelude.NFData
    AbortDocumentVersionUploadResponse