{-# 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.RobOMaker.Types.S3KeyOutput
-- 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.RobOMaker.Types.S3KeyOutput where

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

-- | Information about S3 keys.
--
-- /See:/ 'newS3KeyOutput' smart constructor.
data S3KeyOutput = S3KeyOutput'
  { -- | The etag for the object.
    S3KeyOutput -> Maybe Text
etag :: Prelude.Maybe Prelude.Text,
    -- | The S3 key.
    S3KeyOutput -> Maybe Text
s3Key :: Prelude.Maybe Prelude.Text
  }
  deriving (S3KeyOutput -> S3KeyOutput -> Bool
(S3KeyOutput -> S3KeyOutput -> Bool)
-> (S3KeyOutput -> S3KeyOutput -> Bool) -> Eq S3KeyOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3KeyOutput -> S3KeyOutput -> Bool
$c/= :: S3KeyOutput -> S3KeyOutput -> Bool
== :: S3KeyOutput -> S3KeyOutput -> Bool
$c== :: S3KeyOutput -> S3KeyOutput -> Bool
Prelude.Eq, ReadPrec [S3KeyOutput]
ReadPrec S3KeyOutput
Int -> ReadS S3KeyOutput
ReadS [S3KeyOutput]
(Int -> ReadS S3KeyOutput)
-> ReadS [S3KeyOutput]
-> ReadPrec S3KeyOutput
-> ReadPrec [S3KeyOutput]
-> Read S3KeyOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3KeyOutput]
$creadListPrec :: ReadPrec [S3KeyOutput]
readPrec :: ReadPrec S3KeyOutput
$creadPrec :: ReadPrec S3KeyOutput
readList :: ReadS [S3KeyOutput]
$creadList :: ReadS [S3KeyOutput]
readsPrec :: Int -> ReadS S3KeyOutput
$creadsPrec :: Int -> ReadS S3KeyOutput
Prelude.Read, Int -> S3KeyOutput -> ShowS
[S3KeyOutput] -> ShowS
S3KeyOutput -> String
(Int -> S3KeyOutput -> ShowS)
-> (S3KeyOutput -> String)
-> ([S3KeyOutput] -> ShowS)
-> Show S3KeyOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3KeyOutput] -> ShowS
$cshowList :: [S3KeyOutput] -> ShowS
show :: S3KeyOutput -> String
$cshow :: S3KeyOutput -> String
showsPrec :: Int -> S3KeyOutput -> ShowS
$cshowsPrec :: Int -> S3KeyOutput -> ShowS
Prelude.Show, (forall x. S3KeyOutput -> Rep S3KeyOutput x)
-> (forall x. Rep S3KeyOutput x -> S3KeyOutput)
-> Generic S3KeyOutput
forall x. Rep S3KeyOutput x -> S3KeyOutput
forall x. S3KeyOutput -> Rep S3KeyOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3KeyOutput x -> S3KeyOutput
$cfrom :: forall x. S3KeyOutput -> Rep S3KeyOutput x
Prelude.Generic)

-- |
-- Create a value of 'S3KeyOutput' 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:
--
-- 'etag', 's3KeyOutput_etag' - The etag for the object.
--
-- 's3Key', 's3KeyOutput_s3Key' - The S3 key.
newS3KeyOutput ::
  S3KeyOutput
newS3KeyOutput :: S3KeyOutput
newS3KeyOutput =
  S3KeyOutput' :: Maybe Text -> Maybe Text -> S3KeyOutput
S3KeyOutput'
    { $sel:etag:S3KeyOutput' :: Maybe Text
etag = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3Key:S3KeyOutput' :: Maybe Text
s3Key = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The etag for the object.
s3KeyOutput_etag :: Lens.Lens' S3KeyOutput (Prelude.Maybe Prelude.Text)
s3KeyOutput_etag :: (Maybe Text -> f (Maybe Text)) -> S3KeyOutput -> f S3KeyOutput
s3KeyOutput_etag = (S3KeyOutput -> Maybe Text)
-> (S3KeyOutput -> Maybe Text -> S3KeyOutput)
-> Lens S3KeyOutput S3KeyOutput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3KeyOutput' {Maybe Text
etag :: Maybe Text
$sel:etag:S3KeyOutput' :: S3KeyOutput -> Maybe Text
etag} -> Maybe Text
etag) (\s :: S3KeyOutput
s@S3KeyOutput' {} Maybe Text
a -> S3KeyOutput
s {$sel:etag:S3KeyOutput' :: Maybe Text
etag = Maybe Text
a} :: S3KeyOutput)

-- | The S3 key.
s3KeyOutput_s3Key :: Lens.Lens' S3KeyOutput (Prelude.Maybe Prelude.Text)
s3KeyOutput_s3Key :: (Maybe Text -> f (Maybe Text)) -> S3KeyOutput -> f S3KeyOutput
s3KeyOutput_s3Key = (S3KeyOutput -> Maybe Text)
-> (S3KeyOutput -> Maybe Text -> S3KeyOutput)
-> Lens S3KeyOutput S3KeyOutput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3KeyOutput' {Maybe Text
s3Key :: Maybe Text
$sel:s3Key:S3KeyOutput' :: S3KeyOutput -> Maybe Text
s3Key} -> Maybe Text
s3Key) (\s :: S3KeyOutput
s@S3KeyOutput' {} Maybe Text
a -> S3KeyOutput
s {$sel:s3Key:S3KeyOutput' :: Maybe Text
s3Key = Maybe Text
a} :: S3KeyOutput)

instance Core.FromJSON S3KeyOutput where
  parseJSON :: Value -> Parser S3KeyOutput
parseJSON =
    String
-> (Object -> Parser S3KeyOutput) -> Value -> Parser S3KeyOutput
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"S3KeyOutput"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> S3KeyOutput
S3KeyOutput'
            (Maybe Text -> Maybe Text -> S3KeyOutput)
-> Parser (Maybe Text) -> Parser (Maybe Text -> S3KeyOutput)
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
"etag") Parser (Maybe Text -> S3KeyOutput)
-> Parser (Maybe Text) -> Parser S3KeyOutput
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
"s3Key")
      )

instance Prelude.Hashable S3KeyOutput

instance Prelude.NFData S3KeyOutput