{-# 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.Glacier.Types.S3Location
-- 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)
module Amazonka.Glacier.Types.S3Location where

import qualified Amazonka.Core as Core
import Amazonka.Glacier.Types.CannedACL
import Amazonka.Glacier.Types.Encryption
import Amazonka.Glacier.Types.Grant
import Amazonka.Glacier.Types.StorageClass
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the location in Amazon S3 where the select
-- job results are stored.
--
-- /See:/ 'newS3Location' smart constructor.
data S3Location = S3Location'
  { -- | The canned access control list (ACL) to apply to the job results.
    S3Location -> Maybe CannedACL
cannedACL :: Prelude.Maybe CannedACL,
    -- | The prefix that is prepended to the results for this request.
    S3Location -> Maybe Text
prefix :: Prelude.Maybe Prelude.Text,
    -- | The name of the Amazon S3 bucket where the job results are stored.
    S3Location -> Maybe Text
bucketName :: Prelude.Maybe Prelude.Text,
    -- | A list of grants that control access to the staged results.
    S3Location -> Maybe [Grant]
accessControlList :: Prelude.Maybe [Grant],
    -- | A map of metadata to store with the job results in Amazon S3.
    S3Location -> Maybe (HashMap Text Text)
userMetadata :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Contains information about the encryption used to store the job results
    -- in Amazon S3.
    S3Location -> Maybe Encryption
encryption :: Prelude.Maybe Encryption,
    -- | The storage class used to store the job results.
    S3Location -> Maybe StorageClass
storageClass :: Prelude.Maybe StorageClass,
    -- | The tag-set that is applied to the job results.
    S3Location -> Maybe (HashMap Text Text)
tagging :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (S3Location -> S3Location -> Bool
(S3Location -> S3Location -> Bool)
-> (S3Location -> S3Location -> Bool) -> Eq S3Location
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3Location -> S3Location -> Bool
$c/= :: S3Location -> S3Location -> Bool
== :: S3Location -> S3Location -> Bool
$c== :: S3Location -> S3Location -> Bool
Prelude.Eq, ReadPrec [S3Location]
ReadPrec S3Location
Int -> ReadS S3Location
ReadS [S3Location]
(Int -> ReadS S3Location)
-> ReadS [S3Location]
-> ReadPrec S3Location
-> ReadPrec [S3Location]
-> Read S3Location
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3Location]
$creadListPrec :: ReadPrec [S3Location]
readPrec :: ReadPrec S3Location
$creadPrec :: ReadPrec S3Location
readList :: ReadS [S3Location]
$creadList :: ReadS [S3Location]
readsPrec :: Int -> ReadS S3Location
$creadsPrec :: Int -> ReadS S3Location
Prelude.Read, Int -> S3Location -> ShowS
[S3Location] -> ShowS
S3Location -> String
(Int -> S3Location -> ShowS)
-> (S3Location -> String)
-> ([S3Location] -> ShowS)
-> Show S3Location
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3Location] -> ShowS
$cshowList :: [S3Location] -> ShowS
show :: S3Location -> String
$cshow :: S3Location -> String
showsPrec :: Int -> S3Location -> ShowS
$cshowsPrec :: Int -> S3Location -> ShowS
Prelude.Show, (forall x. S3Location -> Rep S3Location x)
-> (forall x. Rep S3Location x -> S3Location) -> Generic S3Location
forall x. Rep S3Location x -> S3Location
forall x. S3Location -> Rep S3Location x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3Location x -> S3Location
$cfrom :: forall x. S3Location -> Rep S3Location x
Prelude.Generic)

-- |
-- Create a value of 'S3Location' 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:
--
-- 'cannedACL', 's3Location_cannedACL' - The canned access control list (ACL) to apply to the job results.
--
-- 'prefix', 's3Location_prefix' - The prefix that is prepended to the results for this request.
--
-- 'bucketName', 's3Location_bucketName' - The name of the Amazon S3 bucket where the job results are stored.
--
-- 'accessControlList', 's3Location_accessControlList' - A list of grants that control access to the staged results.
--
-- 'userMetadata', 's3Location_userMetadata' - A map of metadata to store with the job results in Amazon S3.
--
-- 'encryption', 's3Location_encryption' - Contains information about the encryption used to store the job results
-- in Amazon S3.
--
-- 'storageClass', 's3Location_storageClass' - The storage class used to store the job results.
--
-- 'tagging', 's3Location_tagging' - The tag-set that is applied to the job results.
newS3Location ::
  S3Location
newS3Location :: S3Location
newS3Location =
  S3Location' :: Maybe CannedACL
-> Maybe Text
-> Maybe Text
-> Maybe [Grant]
-> Maybe (HashMap Text Text)
-> Maybe Encryption
-> Maybe StorageClass
-> Maybe (HashMap Text Text)
-> S3Location
S3Location'
    { $sel:cannedACL:S3Location' :: Maybe CannedACL
cannedACL = Maybe CannedACL
forall a. Maybe a
Prelude.Nothing,
      $sel:prefix:S3Location' :: Maybe Text
prefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bucketName:S3Location' :: Maybe Text
bucketName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:accessControlList:S3Location' :: Maybe [Grant]
accessControlList = Maybe [Grant]
forall a. Maybe a
Prelude.Nothing,
      $sel:userMetadata:S3Location' :: Maybe (HashMap Text Text)
userMetadata = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:encryption:S3Location' :: Maybe Encryption
encryption = Maybe Encryption
forall a. Maybe a
Prelude.Nothing,
      $sel:storageClass:S3Location' :: Maybe StorageClass
storageClass = Maybe StorageClass
forall a. Maybe a
Prelude.Nothing,
      $sel:tagging:S3Location' :: Maybe (HashMap Text Text)
tagging = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The canned access control list (ACL) to apply to the job results.
s3Location_cannedACL :: Lens.Lens' S3Location (Prelude.Maybe CannedACL)
s3Location_cannedACL :: (Maybe CannedACL -> f (Maybe CannedACL))
-> S3Location -> f S3Location
s3Location_cannedACL = (S3Location -> Maybe CannedACL)
-> (S3Location -> Maybe CannedACL -> S3Location)
-> Lens S3Location S3Location (Maybe CannedACL) (Maybe CannedACL)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Location' {Maybe CannedACL
cannedACL :: Maybe CannedACL
$sel:cannedACL:S3Location' :: S3Location -> Maybe CannedACL
cannedACL} -> Maybe CannedACL
cannedACL) (\s :: S3Location
s@S3Location' {} Maybe CannedACL
a -> S3Location
s {$sel:cannedACL:S3Location' :: Maybe CannedACL
cannedACL = Maybe CannedACL
a} :: S3Location)

-- | The prefix that is prepended to the results for this request.
s3Location_prefix :: Lens.Lens' S3Location (Prelude.Maybe Prelude.Text)
s3Location_prefix :: (Maybe Text -> f (Maybe Text)) -> S3Location -> f S3Location
s3Location_prefix = (S3Location -> Maybe Text)
-> (S3Location -> Maybe Text -> S3Location)
-> Lens S3Location S3Location (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Location' {Maybe Text
prefix :: Maybe Text
$sel:prefix:S3Location' :: S3Location -> Maybe Text
prefix} -> Maybe Text
prefix) (\s :: S3Location
s@S3Location' {} Maybe Text
a -> S3Location
s {$sel:prefix:S3Location' :: Maybe Text
prefix = Maybe Text
a} :: S3Location)

-- | The name of the Amazon S3 bucket where the job results are stored.
s3Location_bucketName :: Lens.Lens' S3Location (Prelude.Maybe Prelude.Text)
s3Location_bucketName :: (Maybe Text -> f (Maybe Text)) -> S3Location -> f S3Location
s3Location_bucketName = (S3Location -> Maybe Text)
-> (S3Location -> Maybe Text -> S3Location)
-> Lens S3Location S3Location (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Location' {Maybe Text
bucketName :: Maybe Text
$sel:bucketName:S3Location' :: S3Location -> Maybe Text
bucketName} -> Maybe Text
bucketName) (\s :: S3Location
s@S3Location' {} Maybe Text
a -> S3Location
s {$sel:bucketName:S3Location' :: Maybe Text
bucketName = Maybe Text
a} :: S3Location)

-- | A list of grants that control access to the staged results.
s3Location_accessControlList :: Lens.Lens' S3Location (Prelude.Maybe [Grant])
s3Location_accessControlList :: (Maybe [Grant] -> f (Maybe [Grant])) -> S3Location -> f S3Location
s3Location_accessControlList = (S3Location -> Maybe [Grant])
-> (S3Location -> Maybe [Grant] -> S3Location)
-> Lens S3Location S3Location (Maybe [Grant]) (Maybe [Grant])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Location' {Maybe [Grant]
accessControlList :: Maybe [Grant]
$sel:accessControlList:S3Location' :: S3Location -> Maybe [Grant]
accessControlList} -> Maybe [Grant]
accessControlList) (\s :: S3Location
s@S3Location' {} Maybe [Grant]
a -> S3Location
s {$sel:accessControlList:S3Location' :: Maybe [Grant]
accessControlList = Maybe [Grant]
a} :: S3Location) ((Maybe [Grant] -> f (Maybe [Grant]))
 -> S3Location -> f S3Location)
-> ((Maybe [Grant] -> f (Maybe [Grant]))
    -> Maybe [Grant] -> f (Maybe [Grant]))
-> (Maybe [Grant] -> f (Maybe [Grant]))
-> S3Location
-> f S3Location
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Grant] [Grant] [Grant] [Grant]
-> Iso
     (Maybe [Grant]) (Maybe [Grant]) (Maybe [Grant]) (Maybe [Grant])
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 [Grant] [Grant] [Grant] [Grant]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A map of metadata to store with the job results in Amazon S3.
s3Location_userMetadata :: Lens.Lens' S3Location (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
s3Location_userMetadata :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> S3Location -> f S3Location
s3Location_userMetadata = (S3Location -> Maybe (HashMap Text Text))
-> (S3Location -> Maybe (HashMap Text Text) -> S3Location)
-> Lens
     S3Location
     S3Location
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Location' {Maybe (HashMap Text Text)
userMetadata :: Maybe (HashMap Text Text)
$sel:userMetadata:S3Location' :: S3Location -> Maybe (HashMap Text Text)
userMetadata} -> Maybe (HashMap Text Text)
userMetadata) (\s :: S3Location
s@S3Location' {} Maybe (HashMap Text Text)
a -> S3Location
s {$sel:userMetadata:S3Location' :: Maybe (HashMap Text Text)
userMetadata = Maybe (HashMap Text Text)
a} :: S3Location) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> S3Location -> f S3Location)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> S3Location
-> f S3Location
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text 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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Contains information about the encryption used to store the job results
-- in Amazon S3.
s3Location_encryption :: Lens.Lens' S3Location (Prelude.Maybe Encryption)
s3Location_encryption :: (Maybe Encryption -> f (Maybe Encryption))
-> S3Location -> f S3Location
s3Location_encryption = (S3Location -> Maybe Encryption)
-> (S3Location -> Maybe Encryption -> S3Location)
-> Lens S3Location S3Location (Maybe Encryption) (Maybe Encryption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Location' {Maybe Encryption
encryption :: Maybe Encryption
$sel:encryption:S3Location' :: S3Location -> Maybe Encryption
encryption} -> Maybe Encryption
encryption) (\s :: S3Location
s@S3Location' {} Maybe Encryption
a -> S3Location
s {$sel:encryption:S3Location' :: Maybe Encryption
encryption = Maybe Encryption
a} :: S3Location)

-- | The storage class used to store the job results.
s3Location_storageClass :: Lens.Lens' S3Location (Prelude.Maybe StorageClass)
s3Location_storageClass :: (Maybe StorageClass -> f (Maybe StorageClass))
-> S3Location -> f S3Location
s3Location_storageClass = (S3Location -> Maybe StorageClass)
-> (S3Location -> Maybe StorageClass -> S3Location)
-> Lens
     S3Location S3Location (Maybe StorageClass) (Maybe StorageClass)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Location' {Maybe StorageClass
storageClass :: Maybe StorageClass
$sel:storageClass:S3Location' :: S3Location -> Maybe StorageClass
storageClass} -> Maybe StorageClass
storageClass) (\s :: S3Location
s@S3Location' {} Maybe StorageClass
a -> S3Location
s {$sel:storageClass:S3Location' :: Maybe StorageClass
storageClass = Maybe StorageClass
a} :: S3Location)

-- | The tag-set that is applied to the job results.
s3Location_tagging :: Lens.Lens' S3Location (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
s3Location_tagging :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> S3Location -> f S3Location
s3Location_tagging = (S3Location -> Maybe (HashMap Text Text))
-> (S3Location -> Maybe (HashMap Text Text) -> S3Location)
-> Lens
     S3Location
     S3Location
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Location' {Maybe (HashMap Text Text)
tagging :: Maybe (HashMap Text Text)
$sel:tagging:S3Location' :: S3Location -> Maybe (HashMap Text Text)
tagging} -> Maybe (HashMap Text Text)
tagging) (\s :: S3Location
s@S3Location' {} Maybe (HashMap Text Text)
a -> S3Location
s {$sel:tagging:S3Location' :: Maybe (HashMap Text Text)
tagging = Maybe (HashMap Text Text)
a} :: S3Location) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> S3Location -> f S3Location)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> S3Location
-> f S3Location
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text 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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON S3Location where
  parseJSON :: Value -> Parser S3Location
parseJSON =
    String
-> (Object -> Parser S3Location) -> Value -> Parser S3Location
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"S3Location"
      ( \Object
x ->
          Maybe CannedACL
-> Maybe Text
-> Maybe Text
-> Maybe [Grant]
-> Maybe (HashMap Text Text)
-> Maybe Encryption
-> Maybe StorageClass
-> Maybe (HashMap Text Text)
-> S3Location
S3Location'
            (Maybe CannedACL
 -> Maybe Text
 -> Maybe Text
 -> Maybe [Grant]
 -> Maybe (HashMap Text Text)
 -> Maybe Encryption
 -> Maybe StorageClass
 -> Maybe (HashMap Text Text)
 -> S3Location)
-> Parser (Maybe CannedACL)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe [Grant]
      -> Maybe (HashMap Text Text)
      -> Maybe Encryption
      -> Maybe StorageClass
      -> Maybe (HashMap Text Text)
      -> S3Location)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CannedACL)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CannedACL")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe [Grant]
   -> Maybe (HashMap Text Text)
   -> Maybe Encryption
   -> Maybe StorageClass
   -> Maybe (HashMap Text Text)
   -> S3Location)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [Grant]
      -> Maybe (HashMap Text Text)
      -> Maybe Encryption
      -> Maybe StorageClass
      -> Maybe (HashMap Text Text)
      -> S3Location)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Prefix")
            Parser
  (Maybe Text
   -> Maybe [Grant]
   -> Maybe (HashMap Text Text)
   -> Maybe Encryption
   -> Maybe StorageClass
   -> Maybe (HashMap Text Text)
   -> S3Location)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Grant]
      -> Maybe (HashMap Text Text)
      -> Maybe Encryption
      -> Maybe StorageClass
      -> Maybe (HashMap Text Text)
      -> S3Location)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BucketName")
            Parser
  (Maybe [Grant]
   -> Maybe (HashMap Text Text)
   -> Maybe Encryption
   -> Maybe StorageClass
   -> Maybe (HashMap Text Text)
   -> S3Location)
-> Parser (Maybe [Grant])
-> Parser
     (Maybe (HashMap Text Text)
      -> Maybe Encryption
      -> Maybe StorageClass
      -> Maybe (HashMap Text Text)
      -> S3Location)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Grant]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AccessControlList"
                            Parser (Maybe (Maybe [Grant]))
-> Maybe [Grant] -> Parser (Maybe [Grant])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Grant]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe (HashMap Text Text)
   -> Maybe Encryption
   -> Maybe StorageClass
   -> Maybe (HashMap Text Text)
   -> S3Location)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Maybe Encryption
      -> Maybe StorageClass -> Maybe (HashMap Text Text) -> S3Location)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UserMetadata" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Encryption
   -> Maybe StorageClass -> Maybe (HashMap Text Text) -> S3Location)
-> Parser (Maybe Encryption)
-> Parser
     (Maybe StorageClass -> Maybe (HashMap Text Text) -> S3Location)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Encryption)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Encryption")
            Parser
  (Maybe StorageClass -> Maybe (HashMap Text Text) -> S3Location)
-> Parser (Maybe StorageClass)
-> Parser (Maybe (HashMap Text Text) -> S3Location)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe StorageClass)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StorageClass")
            Parser (Maybe (HashMap Text Text) -> S3Location)
-> Parser (Maybe (HashMap Text Text)) -> Parser S3Location
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Tagging" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable S3Location

instance Prelude.NFData S3Location

instance Core.ToJSON S3Location where
  toJSON :: S3Location -> Value
toJSON S3Location' {Maybe [Grant]
Maybe Text
Maybe (HashMap Text Text)
Maybe CannedACL
Maybe Encryption
Maybe StorageClass
tagging :: Maybe (HashMap Text Text)
storageClass :: Maybe StorageClass
encryption :: Maybe Encryption
userMetadata :: Maybe (HashMap Text Text)
accessControlList :: Maybe [Grant]
bucketName :: Maybe Text
prefix :: Maybe Text
cannedACL :: Maybe CannedACL
$sel:tagging:S3Location' :: S3Location -> Maybe (HashMap Text Text)
$sel:storageClass:S3Location' :: S3Location -> Maybe StorageClass
$sel:encryption:S3Location' :: S3Location -> Maybe Encryption
$sel:userMetadata:S3Location' :: S3Location -> Maybe (HashMap Text Text)
$sel:accessControlList:S3Location' :: S3Location -> Maybe [Grant]
$sel:bucketName:S3Location' :: S3Location -> Maybe Text
$sel:prefix:S3Location' :: S3Location -> Maybe Text
$sel:cannedACL:S3Location' :: S3Location -> Maybe CannedACL
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"CannedACL" Text -> CannedACL -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CannedACL -> Pair) -> Maybe CannedACL -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CannedACL
cannedACL,
            (Text
"Prefix" 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
prefix,
            (Text
"BucketName" 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
bucketName,
            (Text
"AccessControlList" Text -> [Grant] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Grant] -> Pair) -> Maybe [Grant] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Grant]
accessControlList,
            (Text
"UserMetadata" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
userMetadata,
            (Text
"Encryption" Text -> Encryption -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Encryption -> Pair) -> Maybe Encryption -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Encryption
encryption,
            (Text
"StorageClass" Text -> StorageClass -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (StorageClass -> Pair) -> Maybe StorageClass -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StorageClass
storageClass,
            (Text
"Tagging" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tagging
          ]
      )