{-# 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.KinesisAnalyticsV2.Types.S3ContentBaseLocation
-- 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.KinesisAnalyticsV2.Types.S3ContentBaseLocation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The S3 bucket that holds the application information.
--
-- /See:/ 'newS3ContentBaseLocation' smart constructor.
data S3ContentBaseLocation = S3ContentBaseLocation'
  { -- | The base path for the S3 bucket.
    S3ContentBaseLocation -> Maybe Text
basePath :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the S3 bucket.
    S3ContentBaseLocation -> Text
bucketARN :: Prelude.Text
  }
  deriving (S3ContentBaseLocation -> S3ContentBaseLocation -> Bool
(S3ContentBaseLocation -> S3ContentBaseLocation -> Bool)
-> (S3ContentBaseLocation -> S3ContentBaseLocation -> Bool)
-> Eq S3ContentBaseLocation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3ContentBaseLocation -> S3ContentBaseLocation -> Bool
$c/= :: S3ContentBaseLocation -> S3ContentBaseLocation -> Bool
== :: S3ContentBaseLocation -> S3ContentBaseLocation -> Bool
$c== :: S3ContentBaseLocation -> S3ContentBaseLocation -> Bool
Prelude.Eq, ReadPrec [S3ContentBaseLocation]
ReadPrec S3ContentBaseLocation
Int -> ReadS S3ContentBaseLocation
ReadS [S3ContentBaseLocation]
(Int -> ReadS S3ContentBaseLocation)
-> ReadS [S3ContentBaseLocation]
-> ReadPrec S3ContentBaseLocation
-> ReadPrec [S3ContentBaseLocation]
-> Read S3ContentBaseLocation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3ContentBaseLocation]
$creadListPrec :: ReadPrec [S3ContentBaseLocation]
readPrec :: ReadPrec S3ContentBaseLocation
$creadPrec :: ReadPrec S3ContentBaseLocation
readList :: ReadS [S3ContentBaseLocation]
$creadList :: ReadS [S3ContentBaseLocation]
readsPrec :: Int -> ReadS S3ContentBaseLocation
$creadsPrec :: Int -> ReadS S3ContentBaseLocation
Prelude.Read, Int -> S3ContentBaseLocation -> ShowS
[S3ContentBaseLocation] -> ShowS
S3ContentBaseLocation -> String
(Int -> S3ContentBaseLocation -> ShowS)
-> (S3ContentBaseLocation -> String)
-> ([S3ContentBaseLocation] -> ShowS)
-> Show S3ContentBaseLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3ContentBaseLocation] -> ShowS
$cshowList :: [S3ContentBaseLocation] -> ShowS
show :: S3ContentBaseLocation -> String
$cshow :: S3ContentBaseLocation -> String
showsPrec :: Int -> S3ContentBaseLocation -> ShowS
$cshowsPrec :: Int -> S3ContentBaseLocation -> ShowS
Prelude.Show, (forall x. S3ContentBaseLocation -> Rep S3ContentBaseLocation x)
-> (forall x. Rep S3ContentBaseLocation x -> S3ContentBaseLocation)
-> Generic S3ContentBaseLocation
forall x. Rep S3ContentBaseLocation x -> S3ContentBaseLocation
forall x. S3ContentBaseLocation -> Rep S3ContentBaseLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3ContentBaseLocation x -> S3ContentBaseLocation
$cfrom :: forall x. S3ContentBaseLocation -> Rep S3ContentBaseLocation x
Prelude.Generic)

-- |
-- Create a value of 'S3ContentBaseLocation' 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:
--
-- 'basePath', 's3ContentBaseLocation_basePath' - The base path for the S3 bucket.
--
-- 'bucketARN', 's3ContentBaseLocation_bucketARN' - The Amazon Resource Name (ARN) of the S3 bucket.
newS3ContentBaseLocation ::
  -- | 'bucketARN'
  Prelude.Text ->
  S3ContentBaseLocation
newS3ContentBaseLocation :: Text -> S3ContentBaseLocation
newS3ContentBaseLocation Text
pBucketARN_ =
  S3ContentBaseLocation' :: Maybe Text -> Text -> S3ContentBaseLocation
S3ContentBaseLocation'
    { $sel:basePath:S3ContentBaseLocation' :: Maybe Text
basePath = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bucketARN:S3ContentBaseLocation' :: Text
bucketARN = Text
pBucketARN_
    }

-- | The base path for the S3 bucket.
s3ContentBaseLocation_basePath :: Lens.Lens' S3ContentBaseLocation (Prelude.Maybe Prelude.Text)
s3ContentBaseLocation_basePath :: (Maybe Text -> f (Maybe Text))
-> S3ContentBaseLocation -> f S3ContentBaseLocation
s3ContentBaseLocation_basePath = (S3ContentBaseLocation -> Maybe Text)
-> (S3ContentBaseLocation -> Maybe Text -> S3ContentBaseLocation)
-> Lens
     S3ContentBaseLocation
     S3ContentBaseLocation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3ContentBaseLocation' {Maybe Text
basePath :: Maybe Text
$sel:basePath:S3ContentBaseLocation' :: S3ContentBaseLocation -> Maybe Text
basePath} -> Maybe Text
basePath) (\s :: S3ContentBaseLocation
s@S3ContentBaseLocation' {} Maybe Text
a -> S3ContentBaseLocation
s {$sel:basePath:S3ContentBaseLocation' :: Maybe Text
basePath = Maybe Text
a} :: S3ContentBaseLocation)

-- | The Amazon Resource Name (ARN) of the S3 bucket.
s3ContentBaseLocation_bucketARN :: Lens.Lens' S3ContentBaseLocation Prelude.Text
s3ContentBaseLocation_bucketARN :: (Text -> f Text)
-> S3ContentBaseLocation -> f S3ContentBaseLocation
s3ContentBaseLocation_bucketARN = (S3ContentBaseLocation -> Text)
-> (S3ContentBaseLocation -> Text -> S3ContentBaseLocation)
-> Lens S3ContentBaseLocation S3ContentBaseLocation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3ContentBaseLocation' {Text
bucketARN :: Text
$sel:bucketARN:S3ContentBaseLocation' :: S3ContentBaseLocation -> Text
bucketARN} -> Text
bucketARN) (\s :: S3ContentBaseLocation
s@S3ContentBaseLocation' {} Text
a -> S3ContentBaseLocation
s {$sel:bucketARN:S3ContentBaseLocation' :: Text
bucketARN = Text
a} :: S3ContentBaseLocation)

instance Prelude.Hashable S3ContentBaseLocation

instance Prelude.NFData S3ContentBaseLocation

instance Core.ToJSON S3ContentBaseLocation where
  toJSON :: S3ContentBaseLocation -> Value
toJSON S3ContentBaseLocation' {Maybe Text
Text
bucketARN :: Text
basePath :: Maybe Text
$sel:bucketARN:S3ContentBaseLocation' :: S3ContentBaseLocation -> Text
$sel:basePath:S3ContentBaseLocation' :: S3ContentBaseLocation -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"BasePath" 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
basePath,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"BucketARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bucketARN)
          ]
      )