{-# 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.Rekognition.Types.S3Destination
-- 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.Rekognition.Types.S3Destination 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

-- | The Amazon S3 bucket location to which Amazon Rekognition publishes the
-- detailed inference results of a video analysis operation. These results
-- include the name of the stream processor resource, the session ID of the
-- stream processing session, and labeled timestamps and bounding boxes for
-- detected labels.
--
-- /See:/ 'newS3Destination' smart constructor.
data S3Destination = S3Destination'
  { -- | The name of the Amazon S3 bucket you want to associate with the
    -- streaming video project. You must be the owner of the Amazon S3 bucket.
    S3Destination -> Maybe Text
bucket :: Prelude.Maybe Prelude.Text,
    -- | The prefix value of the location within the bucket that you want the
    -- information to be published to. For more information, see
    -- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-prefixes.html Using prefixes>.
    S3Destination -> Maybe Text
keyPrefix :: Prelude.Maybe Prelude.Text
  }
  deriving (S3Destination -> S3Destination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3Destination -> S3Destination -> Bool
$c/= :: S3Destination -> S3Destination -> Bool
== :: S3Destination -> S3Destination -> Bool
$c== :: S3Destination -> S3Destination -> Bool
Prelude.Eq, ReadPrec [S3Destination]
ReadPrec S3Destination
Int -> ReadS S3Destination
ReadS [S3Destination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3Destination]
$creadListPrec :: ReadPrec [S3Destination]
readPrec :: ReadPrec S3Destination
$creadPrec :: ReadPrec S3Destination
readList :: ReadS [S3Destination]
$creadList :: ReadS [S3Destination]
readsPrec :: Int -> ReadS S3Destination
$creadsPrec :: Int -> ReadS S3Destination
Prelude.Read, Int -> S3Destination -> ShowS
[S3Destination] -> ShowS
S3Destination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3Destination] -> ShowS
$cshowList :: [S3Destination] -> ShowS
show :: S3Destination -> String
$cshow :: S3Destination -> String
showsPrec :: Int -> S3Destination -> ShowS
$cshowsPrec :: Int -> S3Destination -> ShowS
Prelude.Show, forall x. Rep S3Destination x -> S3Destination
forall x. S3Destination -> Rep S3Destination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3Destination x -> S3Destination
$cfrom :: forall x. S3Destination -> Rep S3Destination x
Prelude.Generic)

-- |
-- Create a value of 'S3Destination' 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', 's3Destination_bucket' - The name of the Amazon S3 bucket you want to associate with the
-- streaming video project. You must be the owner of the Amazon S3 bucket.
--
-- 'keyPrefix', 's3Destination_keyPrefix' - The prefix value of the location within the bucket that you want the
-- information to be published to. For more information, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-prefixes.html Using prefixes>.
newS3Destination ::
  S3Destination
newS3Destination :: S3Destination
newS3Destination =
  S3Destination'
    { $sel:bucket:S3Destination' :: Maybe Text
bucket = forall a. Maybe a
Prelude.Nothing,
      $sel:keyPrefix:S3Destination' :: Maybe Text
keyPrefix = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the Amazon S3 bucket you want to associate with the
-- streaming video project. You must be the owner of the Amazon S3 bucket.
s3Destination_bucket :: Lens.Lens' S3Destination (Prelude.Maybe Prelude.Text)
s3Destination_bucket :: Lens' S3Destination (Maybe Text)
s3Destination_bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Destination' {Maybe Text
bucket :: Maybe Text
$sel:bucket:S3Destination' :: S3Destination -> Maybe Text
bucket} -> Maybe Text
bucket) (\s :: S3Destination
s@S3Destination' {} Maybe Text
a -> S3Destination
s {$sel:bucket:S3Destination' :: Maybe Text
bucket = Maybe Text
a} :: S3Destination)

-- | The prefix value of the location within the bucket that you want the
-- information to be published to. For more information, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-prefixes.html Using prefixes>.
s3Destination_keyPrefix :: Lens.Lens' S3Destination (Prelude.Maybe Prelude.Text)
s3Destination_keyPrefix :: Lens' S3Destination (Maybe Text)
s3Destination_keyPrefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Destination' {Maybe Text
keyPrefix :: Maybe Text
$sel:keyPrefix:S3Destination' :: S3Destination -> Maybe Text
keyPrefix} -> Maybe Text
keyPrefix) (\s :: S3Destination
s@S3Destination' {} Maybe Text
a -> S3Destination
s {$sel:keyPrefix:S3Destination' :: Maybe Text
keyPrefix = Maybe Text
a} :: S3Destination)

instance Data.FromJSON S3Destination where
  parseJSON :: Value -> Parser S3Destination
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"S3Destination"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> S3Destination
S3Destination'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Bucket")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"KeyPrefix")
      )

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

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

instance Data.ToJSON S3Destination where
  toJSON :: S3Destination -> Value
toJSON S3Destination' {Maybe Text
keyPrefix :: Maybe Text
bucket :: Maybe Text
$sel:keyPrefix:S3Destination' :: S3Destination -> Maybe Text
$sel:bucket:S3Destination' :: S3Destination -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Bucket" 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
bucket,
            (Key
"KeyPrefix" 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
keyPrefix
          ]
      )