{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.ConnectParticipant.Types.UploadMetadata
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ConnectParticipant.Types.UploadMetadata 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

-- | Fields to be used while uploading the attachment.
--
-- /See:/ 'newUploadMetadata' smart constructor.
data UploadMetadata = UploadMetadata'
  { -- | The headers to be provided while uploading the file to the URL.
    UploadMetadata -> Maybe (HashMap Text Text)
headersToInclude :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | This is the pre-signed URL that can be used for uploading the file to
    -- Amazon S3 when used in response to
    -- <https://docs.aws.amazon.com/connect-participant/latest/APIReference/API_StartAttachmentUpload.html StartAttachmentUpload>.
    UploadMetadata -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
    -- | The expiration time of the URL in ISO timestamp. It\'s specified in ISO
    -- 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example,
    -- 2019-11-08T02:41:28.172Z.
    UploadMetadata -> Maybe Text
urlExpiry :: Prelude.Maybe Prelude.Text
  }
  deriving (UploadMetadata -> UploadMetadata -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UploadMetadata -> UploadMetadata -> Bool
$c/= :: UploadMetadata -> UploadMetadata -> Bool
== :: UploadMetadata -> UploadMetadata -> Bool
$c== :: UploadMetadata -> UploadMetadata -> Bool
Prelude.Eq, ReadPrec [UploadMetadata]
ReadPrec UploadMetadata
Int -> ReadS UploadMetadata
ReadS [UploadMetadata]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UploadMetadata]
$creadListPrec :: ReadPrec [UploadMetadata]
readPrec :: ReadPrec UploadMetadata
$creadPrec :: ReadPrec UploadMetadata
readList :: ReadS [UploadMetadata]
$creadList :: ReadS [UploadMetadata]
readsPrec :: Int -> ReadS UploadMetadata
$creadsPrec :: Int -> ReadS UploadMetadata
Prelude.Read, Int -> UploadMetadata -> ShowS
[UploadMetadata] -> ShowS
UploadMetadata -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UploadMetadata] -> ShowS
$cshowList :: [UploadMetadata] -> ShowS
show :: UploadMetadata -> String
$cshow :: UploadMetadata -> String
showsPrec :: Int -> UploadMetadata -> ShowS
$cshowsPrec :: Int -> UploadMetadata -> ShowS
Prelude.Show, forall x. Rep UploadMetadata x -> UploadMetadata
forall x. UploadMetadata -> Rep UploadMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UploadMetadata x -> UploadMetadata
$cfrom :: forall x. UploadMetadata -> Rep UploadMetadata x
Prelude.Generic)

-- |
-- Create a value of 'UploadMetadata' 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:
--
-- 'headersToInclude', 'uploadMetadata_headersToInclude' - The headers to be provided while uploading the file to the URL.
--
-- 'url', 'uploadMetadata_url' - This is the pre-signed URL that can be used for uploading the file to
-- Amazon S3 when used in response to
-- <https://docs.aws.amazon.com/connect-participant/latest/APIReference/API_StartAttachmentUpload.html StartAttachmentUpload>.
--
-- 'urlExpiry', 'uploadMetadata_urlExpiry' - The expiration time of the URL in ISO timestamp. It\'s specified in ISO
-- 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example,
-- 2019-11-08T02:41:28.172Z.
newUploadMetadata ::
  UploadMetadata
newUploadMetadata :: UploadMetadata
newUploadMetadata =
  UploadMetadata'
    { $sel:headersToInclude:UploadMetadata' :: Maybe (HashMap Text Text)
headersToInclude = forall a. Maybe a
Prelude.Nothing,
      $sel:url:UploadMetadata' :: Maybe Text
url = forall a. Maybe a
Prelude.Nothing,
      $sel:urlExpiry:UploadMetadata' :: Maybe Text
urlExpiry = forall a. Maybe a
Prelude.Nothing
    }

-- | The headers to be provided while uploading the file to the URL.
uploadMetadata_headersToInclude :: Lens.Lens' UploadMetadata (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
uploadMetadata_headersToInclude :: Lens' UploadMetadata (Maybe (HashMap Text Text))
uploadMetadata_headersToInclude = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadMetadata' {Maybe (HashMap Text Text)
headersToInclude :: Maybe (HashMap Text Text)
$sel:headersToInclude:UploadMetadata' :: UploadMetadata -> Maybe (HashMap Text Text)
headersToInclude} -> Maybe (HashMap Text Text)
headersToInclude) (\s :: UploadMetadata
s@UploadMetadata' {} Maybe (HashMap Text Text)
a -> UploadMetadata
s {$sel:headersToInclude:UploadMetadata' :: Maybe (HashMap Text Text)
headersToInclude = Maybe (HashMap Text Text)
a} :: UploadMetadata) 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

-- | This is the pre-signed URL that can be used for uploading the file to
-- Amazon S3 when used in response to
-- <https://docs.aws.amazon.com/connect-participant/latest/APIReference/API_StartAttachmentUpload.html StartAttachmentUpload>.
uploadMetadata_url :: Lens.Lens' UploadMetadata (Prelude.Maybe Prelude.Text)
uploadMetadata_url :: Lens' UploadMetadata (Maybe Text)
uploadMetadata_url = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadMetadata' {Maybe Text
url :: Maybe Text
$sel:url:UploadMetadata' :: UploadMetadata -> Maybe Text
url} -> Maybe Text
url) (\s :: UploadMetadata
s@UploadMetadata' {} Maybe Text
a -> UploadMetadata
s {$sel:url:UploadMetadata' :: Maybe Text
url = Maybe Text
a} :: UploadMetadata)

-- | The expiration time of the URL in ISO timestamp. It\'s specified in ISO
-- 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example,
-- 2019-11-08T02:41:28.172Z.
uploadMetadata_urlExpiry :: Lens.Lens' UploadMetadata (Prelude.Maybe Prelude.Text)
uploadMetadata_urlExpiry :: Lens' UploadMetadata (Maybe Text)
uploadMetadata_urlExpiry = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadMetadata' {Maybe Text
urlExpiry :: Maybe Text
$sel:urlExpiry:UploadMetadata' :: UploadMetadata -> Maybe Text
urlExpiry} -> Maybe Text
urlExpiry) (\s :: UploadMetadata
s@UploadMetadata' {} Maybe Text
a -> UploadMetadata
s {$sel:urlExpiry:UploadMetadata' :: Maybe Text
urlExpiry = Maybe Text
a} :: UploadMetadata)

instance Data.FromJSON UploadMetadata where
  parseJSON :: Value -> Parser UploadMetadata
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UploadMetadata"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> Maybe Text -> Maybe Text -> UploadMetadata
UploadMetadata'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"HeadersToInclude"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Url")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"UrlExpiry")
      )

instance Prelude.Hashable UploadMetadata where
  hashWithSalt :: Int -> UploadMetadata -> Int
hashWithSalt Int
_salt UploadMetadata' {Maybe Text
Maybe (HashMap Text Text)
urlExpiry :: Maybe Text
url :: Maybe Text
headersToInclude :: Maybe (HashMap Text Text)
$sel:urlExpiry:UploadMetadata' :: UploadMetadata -> Maybe Text
$sel:url:UploadMetadata' :: UploadMetadata -> Maybe Text
$sel:headersToInclude:UploadMetadata' :: UploadMetadata -> Maybe (HashMap Text Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
headersToInclude
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
url
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
urlExpiry

instance Prelude.NFData UploadMetadata where
  rnf :: UploadMetadata -> ()
rnf UploadMetadata' {Maybe Text
Maybe (HashMap Text Text)
urlExpiry :: Maybe Text
url :: Maybe Text
headersToInclude :: Maybe (HashMap Text Text)
$sel:urlExpiry:UploadMetadata' :: UploadMetadata -> Maybe Text
$sel:url:UploadMetadata' :: UploadMetadata -> Maybe Text
$sel:headersToInclude:UploadMetadata' :: UploadMetadata -> Maybe (HashMap Text Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
headersToInclude
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
url
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
urlExpiry