{-# 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.KafkaConnect.Types.S3LocationDescription
-- 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.KafkaConnect.Types.S3LocationDescription where

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

-- | The description of the location of an object in Amazon S3.
--
-- /See:/ 'newS3LocationDescription' smart constructor.
data S3LocationDescription = S3LocationDescription'
  { -- | The version of an object in an S3 bucket.
    S3LocationDescription -> Maybe Text
objectVersion :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of an S3 bucket.
    S3LocationDescription -> Maybe Text
bucketArn :: Prelude.Maybe Prelude.Text,
    -- | The file key for an object in an S3 bucket.
    S3LocationDescription -> Maybe Text
fileKey :: Prelude.Maybe Prelude.Text
  }
  deriving (S3LocationDescription -> S3LocationDescription -> Bool
(S3LocationDescription -> S3LocationDescription -> Bool)
-> (S3LocationDescription -> S3LocationDescription -> Bool)
-> Eq S3LocationDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3LocationDescription -> S3LocationDescription -> Bool
$c/= :: S3LocationDescription -> S3LocationDescription -> Bool
== :: S3LocationDescription -> S3LocationDescription -> Bool
$c== :: S3LocationDescription -> S3LocationDescription -> Bool
Prelude.Eq, ReadPrec [S3LocationDescription]
ReadPrec S3LocationDescription
Int -> ReadS S3LocationDescription
ReadS [S3LocationDescription]
(Int -> ReadS S3LocationDescription)
-> ReadS [S3LocationDescription]
-> ReadPrec S3LocationDescription
-> ReadPrec [S3LocationDescription]
-> Read S3LocationDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3LocationDescription]
$creadListPrec :: ReadPrec [S3LocationDescription]
readPrec :: ReadPrec S3LocationDescription
$creadPrec :: ReadPrec S3LocationDescription
readList :: ReadS [S3LocationDescription]
$creadList :: ReadS [S3LocationDescription]
readsPrec :: Int -> ReadS S3LocationDescription
$creadsPrec :: Int -> ReadS S3LocationDescription
Prelude.Read, Int -> S3LocationDescription -> ShowS
[S3LocationDescription] -> ShowS
S3LocationDescription -> String
(Int -> S3LocationDescription -> ShowS)
-> (S3LocationDescription -> String)
-> ([S3LocationDescription] -> ShowS)
-> Show S3LocationDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3LocationDescription] -> ShowS
$cshowList :: [S3LocationDescription] -> ShowS
show :: S3LocationDescription -> String
$cshow :: S3LocationDescription -> String
showsPrec :: Int -> S3LocationDescription -> ShowS
$cshowsPrec :: Int -> S3LocationDescription -> ShowS
Prelude.Show, (forall x. S3LocationDescription -> Rep S3LocationDescription x)
-> (forall x. Rep S3LocationDescription x -> S3LocationDescription)
-> Generic S3LocationDescription
forall x. Rep S3LocationDescription x -> S3LocationDescription
forall x. S3LocationDescription -> Rep S3LocationDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3LocationDescription x -> S3LocationDescription
$cfrom :: forall x. S3LocationDescription -> Rep S3LocationDescription x
Prelude.Generic)

-- |
-- Create a value of 'S3LocationDescription' 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:
--
-- 'objectVersion', 's3LocationDescription_objectVersion' - The version of an object in an S3 bucket.
--
-- 'bucketArn', 's3LocationDescription_bucketArn' - The Amazon Resource Name (ARN) of an S3 bucket.
--
-- 'fileKey', 's3LocationDescription_fileKey' - The file key for an object in an S3 bucket.
newS3LocationDescription ::
  S3LocationDescription
newS3LocationDescription :: S3LocationDescription
newS3LocationDescription =
  S3LocationDescription' :: Maybe Text -> Maybe Text -> Maybe Text -> S3LocationDescription
S3LocationDescription'
    { $sel:objectVersion:S3LocationDescription' :: Maybe Text
objectVersion =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bucketArn:S3LocationDescription' :: Maybe Text
bucketArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fileKey:S3LocationDescription' :: Maybe Text
fileKey = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The version of an object in an S3 bucket.
s3LocationDescription_objectVersion :: Lens.Lens' S3LocationDescription (Prelude.Maybe Prelude.Text)
s3LocationDescription_objectVersion :: (Maybe Text -> f (Maybe Text))
-> S3LocationDescription -> f S3LocationDescription
s3LocationDescription_objectVersion = (S3LocationDescription -> Maybe Text)
-> (S3LocationDescription -> Maybe Text -> S3LocationDescription)
-> Lens
     S3LocationDescription
     S3LocationDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3LocationDescription' {Maybe Text
objectVersion :: Maybe Text
$sel:objectVersion:S3LocationDescription' :: S3LocationDescription -> Maybe Text
objectVersion} -> Maybe Text
objectVersion) (\s :: S3LocationDescription
s@S3LocationDescription' {} Maybe Text
a -> S3LocationDescription
s {$sel:objectVersion:S3LocationDescription' :: Maybe Text
objectVersion = Maybe Text
a} :: S3LocationDescription)

-- | The Amazon Resource Name (ARN) of an S3 bucket.
s3LocationDescription_bucketArn :: Lens.Lens' S3LocationDescription (Prelude.Maybe Prelude.Text)
s3LocationDescription_bucketArn :: (Maybe Text -> f (Maybe Text))
-> S3LocationDescription -> f S3LocationDescription
s3LocationDescription_bucketArn = (S3LocationDescription -> Maybe Text)
-> (S3LocationDescription -> Maybe Text -> S3LocationDescription)
-> Lens
     S3LocationDescription
     S3LocationDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3LocationDescription' {Maybe Text
bucketArn :: Maybe Text
$sel:bucketArn:S3LocationDescription' :: S3LocationDescription -> Maybe Text
bucketArn} -> Maybe Text
bucketArn) (\s :: S3LocationDescription
s@S3LocationDescription' {} Maybe Text
a -> S3LocationDescription
s {$sel:bucketArn:S3LocationDescription' :: Maybe Text
bucketArn = Maybe Text
a} :: S3LocationDescription)

-- | The file key for an object in an S3 bucket.
s3LocationDescription_fileKey :: Lens.Lens' S3LocationDescription (Prelude.Maybe Prelude.Text)
s3LocationDescription_fileKey :: (Maybe Text -> f (Maybe Text))
-> S3LocationDescription -> f S3LocationDescription
s3LocationDescription_fileKey = (S3LocationDescription -> Maybe Text)
-> (S3LocationDescription -> Maybe Text -> S3LocationDescription)
-> Lens
     S3LocationDescription
     S3LocationDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3LocationDescription' {Maybe Text
fileKey :: Maybe Text
$sel:fileKey:S3LocationDescription' :: S3LocationDescription -> Maybe Text
fileKey} -> Maybe Text
fileKey) (\s :: S3LocationDescription
s@S3LocationDescription' {} Maybe Text
a -> S3LocationDescription
s {$sel:fileKey:S3LocationDescription' :: Maybe Text
fileKey = Maybe Text
a} :: S3LocationDescription)

instance Core.FromJSON S3LocationDescription where
  parseJSON :: Value -> Parser S3LocationDescription
parseJSON =
    String
-> (Object -> Parser S3LocationDescription)
-> Value
-> Parser S3LocationDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"S3LocationDescription"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> S3LocationDescription
S3LocationDescription'
            (Maybe Text -> Maybe Text -> Maybe Text -> S3LocationDescription)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> S3LocationDescription)
forall (f :: * -> *) a b. Functor 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
"objectVersion")
            Parser (Maybe Text -> Maybe Text -> S3LocationDescription)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> S3LocationDescription)
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
"bucketArn")
            Parser (Maybe Text -> S3LocationDescription)
-> Parser (Maybe Text) -> Parser S3LocationDescription
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
"fileKey")
      )

instance Prelude.Hashable S3LocationDescription

instance Prelude.NFData S3LocationDescription