{-# 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.LookoutVision.Types.InputS3Object
-- 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.LookoutVision.Types.InputS3Object where

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

-- | Amazon S3 Location information for an input manifest file.
--
-- /See:/ 'newInputS3Object' smart constructor.
data InputS3Object = InputS3Object'
  { -- | The version ID of the bucket.
    InputS3Object -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon S3 bucket that contains the manifest.
    InputS3Object -> Text
bucket :: Prelude.Text,
    -- | The name and location of the manifest file withiin the bucket.
    InputS3Object -> Text
key :: Prelude.Text
  }
  deriving (InputS3Object -> InputS3Object -> Bool
(InputS3Object -> InputS3Object -> Bool)
-> (InputS3Object -> InputS3Object -> Bool) -> Eq InputS3Object
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputS3Object -> InputS3Object -> Bool
$c/= :: InputS3Object -> InputS3Object -> Bool
== :: InputS3Object -> InputS3Object -> Bool
$c== :: InputS3Object -> InputS3Object -> Bool
Prelude.Eq, ReadPrec [InputS3Object]
ReadPrec InputS3Object
Int -> ReadS InputS3Object
ReadS [InputS3Object]
(Int -> ReadS InputS3Object)
-> ReadS [InputS3Object]
-> ReadPrec InputS3Object
-> ReadPrec [InputS3Object]
-> Read InputS3Object
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputS3Object]
$creadListPrec :: ReadPrec [InputS3Object]
readPrec :: ReadPrec InputS3Object
$creadPrec :: ReadPrec InputS3Object
readList :: ReadS [InputS3Object]
$creadList :: ReadS [InputS3Object]
readsPrec :: Int -> ReadS InputS3Object
$creadsPrec :: Int -> ReadS InputS3Object
Prelude.Read, Int -> InputS3Object -> ShowS
[InputS3Object] -> ShowS
InputS3Object -> String
(Int -> InputS3Object -> ShowS)
-> (InputS3Object -> String)
-> ([InputS3Object] -> ShowS)
-> Show InputS3Object
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputS3Object] -> ShowS
$cshowList :: [InputS3Object] -> ShowS
show :: InputS3Object -> String
$cshow :: InputS3Object -> String
showsPrec :: Int -> InputS3Object -> ShowS
$cshowsPrec :: Int -> InputS3Object -> ShowS
Prelude.Show, (forall x. InputS3Object -> Rep InputS3Object x)
-> (forall x. Rep InputS3Object x -> InputS3Object)
-> Generic InputS3Object
forall x. Rep InputS3Object x -> InputS3Object
forall x. InputS3Object -> Rep InputS3Object x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputS3Object x -> InputS3Object
$cfrom :: forall x. InputS3Object -> Rep InputS3Object x
Prelude.Generic)

-- |
-- Create a value of 'InputS3Object' 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:
--
-- 'versionId', 'inputS3Object_versionId' - The version ID of the bucket.
--
-- 'bucket', 'inputS3Object_bucket' - The Amazon S3 bucket that contains the manifest.
--
-- 'key', 'inputS3Object_key' - The name and location of the manifest file withiin the bucket.
newInputS3Object ::
  -- | 'bucket'
  Prelude.Text ->
  -- | 'key'
  Prelude.Text ->
  InputS3Object
newInputS3Object :: Text -> Text -> InputS3Object
newInputS3Object Text
pBucket_ Text
pKey_ =
  InputS3Object' :: Maybe Text -> Text -> Text -> InputS3Object
InputS3Object'
    { $sel:versionId:InputS3Object' :: Maybe Text
versionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bucket:InputS3Object' :: Text
bucket = Text
pBucket_,
      $sel:key:InputS3Object' :: Text
key = Text
pKey_
    }

-- | The version ID of the bucket.
inputS3Object_versionId :: Lens.Lens' InputS3Object (Prelude.Maybe Prelude.Text)
inputS3Object_versionId :: (Maybe Text -> f (Maybe Text)) -> InputS3Object -> f InputS3Object
inputS3Object_versionId = (InputS3Object -> Maybe Text)
-> (InputS3Object -> Maybe Text -> InputS3Object)
-> Lens InputS3Object InputS3Object (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputS3Object' {Maybe Text
versionId :: Maybe Text
$sel:versionId:InputS3Object' :: InputS3Object -> Maybe Text
versionId} -> Maybe Text
versionId) (\s :: InputS3Object
s@InputS3Object' {} Maybe Text
a -> InputS3Object
s {$sel:versionId:InputS3Object' :: Maybe Text
versionId = Maybe Text
a} :: InputS3Object)

-- | The Amazon S3 bucket that contains the manifest.
inputS3Object_bucket :: Lens.Lens' InputS3Object Prelude.Text
inputS3Object_bucket :: (Text -> f Text) -> InputS3Object -> f InputS3Object
inputS3Object_bucket = (InputS3Object -> Text)
-> (InputS3Object -> Text -> InputS3Object)
-> Lens InputS3Object InputS3Object Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputS3Object' {Text
bucket :: Text
$sel:bucket:InputS3Object' :: InputS3Object -> Text
bucket} -> Text
bucket) (\s :: InputS3Object
s@InputS3Object' {} Text
a -> InputS3Object
s {$sel:bucket:InputS3Object' :: Text
bucket = Text
a} :: InputS3Object)

-- | The name and location of the manifest file withiin the bucket.
inputS3Object_key :: Lens.Lens' InputS3Object Prelude.Text
inputS3Object_key :: (Text -> f Text) -> InputS3Object -> f InputS3Object
inputS3Object_key = (InputS3Object -> Text)
-> (InputS3Object -> Text -> InputS3Object)
-> Lens InputS3Object InputS3Object Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputS3Object' {Text
key :: Text
$sel:key:InputS3Object' :: InputS3Object -> Text
key} -> Text
key) (\s :: InputS3Object
s@InputS3Object' {} Text
a -> InputS3Object
s {$sel:key:InputS3Object' :: Text
key = Text
a} :: InputS3Object)

instance Prelude.Hashable InputS3Object

instance Prelude.NFData InputS3Object

instance Core.ToJSON InputS3Object where
  toJSON :: InputS3Object -> Value
toJSON InputS3Object' {Maybe Text
Text
key :: Text
bucket :: Text
versionId :: Maybe Text
$sel:key:InputS3Object' :: InputS3Object -> Text
$sel:bucket:InputS3Object' :: InputS3Object -> Text
$sel:versionId:InputS3Object' :: InputS3Object -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"VersionId" 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
versionId,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Bucket" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bucket),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Key" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
key)
          ]
      )