{-# 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.Proton.Types.S3ObjectSource
-- 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.Proton.Types.S3ObjectSource 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

-- | Template bundle S3 bucket data.
--
-- /See:/ 'newS3ObjectSource' smart constructor.
data S3ObjectSource = S3ObjectSource'
  { -- | The name of the S3 bucket that contains a template bundle.
    S3ObjectSource -> Text
bucket :: Prelude.Text,
    -- | The path to the S3 bucket that contains a template bundle.
    S3ObjectSource -> Text
key :: Prelude.Text
  }
  deriving (S3ObjectSource -> S3ObjectSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3ObjectSource -> S3ObjectSource -> Bool
$c/= :: S3ObjectSource -> S3ObjectSource -> Bool
== :: S3ObjectSource -> S3ObjectSource -> Bool
$c== :: S3ObjectSource -> S3ObjectSource -> Bool
Prelude.Eq, ReadPrec [S3ObjectSource]
ReadPrec S3ObjectSource
Int -> ReadS S3ObjectSource
ReadS [S3ObjectSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3ObjectSource]
$creadListPrec :: ReadPrec [S3ObjectSource]
readPrec :: ReadPrec S3ObjectSource
$creadPrec :: ReadPrec S3ObjectSource
readList :: ReadS [S3ObjectSource]
$creadList :: ReadS [S3ObjectSource]
readsPrec :: Int -> ReadS S3ObjectSource
$creadsPrec :: Int -> ReadS S3ObjectSource
Prelude.Read, Int -> S3ObjectSource -> ShowS
[S3ObjectSource] -> ShowS
S3ObjectSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3ObjectSource] -> ShowS
$cshowList :: [S3ObjectSource] -> ShowS
show :: S3ObjectSource -> String
$cshow :: S3ObjectSource -> String
showsPrec :: Int -> S3ObjectSource -> ShowS
$cshowsPrec :: Int -> S3ObjectSource -> ShowS
Prelude.Show, forall x. Rep S3ObjectSource x -> S3ObjectSource
forall x. S3ObjectSource -> Rep S3ObjectSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3ObjectSource x -> S3ObjectSource
$cfrom :: forall x. S3ObjectSource -> Rep S3ObjectSource x
Prelude.Generic)

-- |
-- Create a value of 'S3ObjectSource' 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:
--
-- 'bucket', 's3ObjectSource_bucket' - The name of the S3 bucket that contains a template bundle.
--
-- 'key', 's3ObjectSource_key' - The path to the S3 bucket that contains a template bundle.
newS3ObjectSource ::
  -- | 'bucket'
  Prelude.Text ->
  -- | 'key'
  Prelude.Text ->
  S3ObjectSource
newS3ObjectSource :: Text -> Text -> S3ObjectSource
newS3ObjectSource Text
pBucket_ Text
pKey_ =
  S3ObjectSource' {$sel:bucket:S3ObjectSource' :: Text
bucket = Text
pBucket_, $sel:key:S3ObjectSource' :: Text
key = Text
pKey_}

-- | The name of the S3 bucket that contains a template bundle.
s3ObjectSource_bucket :: Lens.Lens' S3ObjectSource Prelude.Text
s3ObjectSource_bucket :: Lens' S3ObjectSource Text
s3ObjectSource_bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3ObjectSource' {Text
bucket :: Text
$sel:bucket:S3ObjectSource' :: S3ObjectSource -> Text
bucket} -> Text
bucket) (\s :: S3ObjectSource
s@S3ObjectSource' {} Text
a -> S3ObjectSource
s {$sel:bucket:S3ObjectSource' :: Text
bucket = Text
a} :: S3ObjectSource)

-- | The path to the S3 bucket that contains a template bundle.
s3ObjectSource_key :: Lens.Lens' S3ObjectSource Prelude.Text
s3ObjectSource_key :: Lens' S3ObjectSource Text
s3ObjectSource_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3ObjectSource' {Text
key :: Text
$sel:key:S3ObjectSource' :: S3ObjectSource -> Text
key} -> Text
key) (\s :: S3ObjectSource
s@S3ObjectSource' {} Text
a -> S3ObjectSource
s {$sel:key:S3ObjectSource' :: Text
key = Text
a} :: S3ObjectSource)

instance Prelude.Hashable S3ObjectSource where
  hashWithSalt :: Int -> S3ObjectSource -> Int
hashWithSalt Int
_salt S3ObjectSource' {Text
key :: Text
bucket :: Text
$sel:key:S3ObjectSource' :: S3ObjectSource -> Text
$sel:bucket:S3ObjectSource' :: S3ObjectSource -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
bucket
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
key

instance Prelude.NFData S3ObjectSource where
  rnf :: S3ObjectSource -> ()
rnf S3ObjectSource' {Text
key :: Text
bucket :: Text
$sel:key:S3ObjectSource' :: S3ObjectSource -> Text
$sel:bucket:S3ObjectSource' :: S3ObjectSource -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
bucket seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
key

instance Data.ToJSON S3ObjectSource where
  toJSON :: S3ObjectSource -> Value
toJSON S3ObjectSource' {Text
key :: Text
bucket :: Text
$sel:key:S3ObjectSource' :: S3ObjectSource -> Text
$sel:bucket:S3ObjectSource' :: S3ObjectSource -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"bucket" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
bucket),
            forall a. a -> Maybe a
Prelude.Just (Key
"key" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
key)
          ]
      )