{-# 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.LookoutEquipment.Types.S3Object
-- 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.LookoutEquipment.Types.S3Object where

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

-- | Contains information about an S3 bucket.
--
-- /See:/ 'newS3Object' smart constructor.
data S3Object = S3Object'
  { -- | The name of the specific S3 bucket.
    S3Object -> Text
bucket :: Prelude.Text,
    -- | The AWS Key Management Service (AWS KMS) key being used to encrypt the
    -- S3 object. Without this key, data in the bucket is not accessible.
    S3Object -> Text
key :: Prelude.Text
  }
  deriving (S3Object -> S3Object -> Bool
(S3Object -> S3Object -> Bool)
-> (S3Object -> S3Object -> Bool) -> Eq S3Object
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3Object -> S3Object -> Bool
$c/= :: S3Object -> S3Object -> Bool
== :: S3Object -> S3Object -> Bool
$c== :: S3Object -> S3Object -> Bool
Prelude.Eq, ReadPrec [S3Object]
ReadPrec S3Object
Int -> ReadS S3Object
ReadS [S3Object]
(Int -> ReadS S3Object)
-> ReadS [S3Object]
-> ReadPrec S3Object
-> ReadPrec [S3Object]
-> Read S3Object
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3Object]
$creadListPrec :: ReadPrec [S3Object]
readPrec :: ReadPrec S3Object
$creadPrec :: ReadPrec S3Object
readList :: ReadS [S3Object]
$creadList :: ReadS [S3Object]
readsPrec :: Int -> ReadS S3Object
$creadsPrec :: Int -> ReadS S3Object
Prelude.Read, Int -> S3Object -> ShowS
[S3Object] -> ShowS
S3Object -> String
(Int -> S3Object -> ShowS)
-> (S3Object -> String) -> ([S3Object] -> ShowS) -> Show S3Object
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3Object] -> ShowS
$cshowList :: [S3Object] -> ShowS
show :: S3Object -> String
$cshow :: S3Object -> String
showsPrec :: Int -> S3Object -> ShowS
$cshowsPrec :: Int -> S3Object -> ShowS
Prelude.Show, (forall x. S3Object -> Rep S3Object x)
-> (forall x. Rep S3Object x -> S3Object) -> Generic S3Object
forall x. Rep S3Object x -> S3Object
forall x. S3Object -> Rep S3Object x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3Object x -> S3Object
$cfrom :: forall x. S3Object -> Rep S3Object x
Prelude.Generic)

-- |
-- Create a value of 'S3Object' 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', 's3Object_bucket' - The name of the specific S3 bucket.
--
-- 'key', 's3Object_key' - The AWS Key Management Service (AWS KMS) key being used to encrypt the
-- S3 object. Without this key, data in the bucket is not accessible.
newS3Object ::
  -- | 'bucket'
  Prelude.Text ->
  -- | 'key'
  Prelude.Text ->
  S3Object
newS3Object :: Text -> Text -> S3Object
newS3Object Text
pBucket_ Text
pKey_ =
  S3Object' :: Text -> Text -> S3Object
S3Object' {$sel:bucket:S3Object' :: Text
bucket = Text
pBucket_, $sel:key:S3Object' :: Text
key = Text
pKey_}

-- | The name of the specific S3 bucket.
s3Object_bucket :: Lens.Lens' S3Object Prelude.Text
s3Object_bucket :: (Text -> f Text) -> S3Object -> f S3Object
s3Object_bucket = (S3Object -> Text)
-> (S3Object -> Text -> S3Object)
-> Lens S3Object S3Object Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Object' {Text
bucket :: Text
$sel:bucket:S3Object' :: S3Object -> Text
bucket} -> Text
bucket) (\s :: S3Object
s@S3Object' {} Text
a -> S3Object
s {$sel:bucket:S3Object' :: Text
bucket = Text
a} :: S3Object)

-- | The AWS Key Management Service (AWS KMS) key being used to encrypt the
-- S3 object. Without this key, data in the bucket is not accessible.
s3Object_key :: Lens.Lens' S3Object Prelude.Text
s3Object_key :: (Text -> f Text) -> S3Object -> f S3Object
s3Object_key = (S3Object -> Text)
-> (S3Object -> Text -> S3Object)
-> Lens S3Object S3Object Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Object' {Text
key :: Text
$sel:key:S3Object' :: S3Object -> Text
key} -> Text
key) (\s :: S3Object
s@S3Object' {} Text
a -> S3Object
s {$sel:key:S3Object' :: Text
key = Text
a} :: S3Object)

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

instance Prelude.Hashable S3Object

instance Prelude.NFData S3Object