{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.LookoutVision.Types.InputS3Object 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

-- | 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
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]
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
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. 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'
    { $sel:versionId:InputS3Object' :: Maybe Text
versionId = 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 :: Lens' InputS3Object (Maybe Text)
inputS3Object_versionId = 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 :: Lens' InputS3Object Text
inputS3Object_bucket = 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 :: Lens' InputS3Object Text
inputS3Object_key = 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 where
  hashWithSalt :: Int -> InputS3Object -> Int
hashWithSalt Int
_salt 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
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
versionId
      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 InputS3Object where
  rnf :: InputS3Object -> ()
rnf 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
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"VersionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
versionId,
            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)
          ]
      )