{-# 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.Signer.Types.S3SignedObject
-- 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.Signer.Types.S3SignedObject where

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

-- | The S3 bucket name and key where code signing saved your signed code
-- image.
--
-- /See:/ 'newS3SignedObject' smart constructor.
data S3SignedObject = S3SignedObject'
  { -- | Name of the S3 bucket.
    S3SignedObject -> Maybe Text
bucketName :: Prelude.Maybe Prelude.Text,
    -- | Key name that uniquely identifies a signed code image in your bucket.
    S3SignedObject -> Maybe Text
key :: Prelude.Maybe Prelude.Text
  }
  deriving (S3SignedObject -> S3SignedObject -> Bool
(S3SignedObject -> S3SignedObject -> Bool)
-> (S3SignedObject -> S3SignedObject -> Bool) -> Eq S3SignedObject
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3SignedObject -> S3SignedObject -> Bool
$c/= :: S3SignedObject -> S3SignedObject -> Bool
== :: S3SignedObject -> S3SignedObject -> Bool
$c== :: S3SignedObject -> S3SignedObject -> Bool
Prelude.Eq, ReadPrec [S3SignedObject]
ReadPrec S3SignedObject
Int -> ReadS S3SignedObject
ReadS [S3SignedObject]
(Int -> ReadS S3SignedObject)
-> ReadS [S3SignedObject]
-> ReadPrec S3SignedObject
-> ReadPrec [S3SignedObject]
-> Read S3SignedObject
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3SignedObject]
$creadListPrec :: ReadPrec [S3SignedObject]
readPrec :: ReadPrec S3SignedObject
$creadPrec :: ReadPrec S3SignedObject
readList :: ReadS [S3SignedObject]
$creadList :: ReadS [S3SignedObject]
readsPrec :: Int -> ReadS S3SignedObject
$creadsPrec :: Int -> ReadS S3SignedObject
Prelude.Read, Int -> S3SignedObject -> ShowS
[S3SignedObject] -> ShowS
S3SignedObject -> String
(Int -> S3SignedObject -> ShowS)
-> (S3SignedObject -> String)
-> ([S3SignedObject] -> ShowS)
-> Show S3SignedObject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3SignedObject] -> ShowS
$cshowList :: [S3SignedObject] -> ShowS
show :: S3SignedObject -> String
$cshow :: S3SignedObject -> String
showsPrec :: Int -> S3SignedObject -> ShowS
$cshowsPrec :: Int -> S3SignedObject -> ShowS
Prelude.Show, (forall x. S3SignedObject -> Rep S3SignedObject x)
-> (forall x. Rep S3SignedObject x -> S3SignedObject)
-> Generic S3SignedObject
forall x. Rep S3SignedObject x -> S3SignedObject
forall x. S3SignedObject -> Rep S3SignedObject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3SignedObject x -> S3SignedObject
$cfrom :: forall x. S3SignedObject -> Rep S3SignedObject x
Prelude.Generic)

-- |
-- Create a value of 'S3SignedObject' 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:
--
-- 'bucketName', 's3SignedObject_bucketName' - Name of the S3 bucket.
--
-- 'key', 's3SignedObject_key' - Key name that uniquely identifies a signed code image in your bucket.
newS3SignedObject ::
  S3SignedObject
newS3SignedObject :: S3SignedObject
newS3SignedObject =
  S3SignedObject' :: Maybe Text -> Maybe Text -> S3SignedObject
S3SignedObject'
    { $sel:bucketName:S3SignedObject' :: Maybe Text
bucketName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:key:S3SignedObject' :: Maybe Text
key = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Name of the S3 bucket.
s3SignedObject_bucketName :: Lens.Lens' S3SignedObject (Prelude.Maybe Prelude.Text)
s3SignedObject_bucketName :: (Maybe Text -> f (Maybe Text))
-> S3SignedObject -> f S3SignedObject
s3SignedObject_bucketName = (S3SignedObject -> Maybe Text)
-> (S3SignedObject -> Maybe Text -> S3SignedObject)
-> Lens S3SignedObject S3SignedObject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3SignedObject' {Maybe Text
bucketName :: Maybe Text
$sel:bucketName:S3SignedObject' :: S3SignedObject -> Maybe Text
bucketName} -> Maybe Text
bucketName) (\s :: S3SignedObject
s@S3SignedObject' {} Maybe Text
a -> S3SignedObject
s {$sel:bucketName:S3SignedObject' :: Maybe Text
bucketName = Maybe Text
a} :: S3SignedObject)

-- | Key name that uniquely identifies a signed code image in your bucket.
s3SignedObject_key :: Lens.Lens' S3SignedObject (Prelude.Maybe Prelude.Text)
s3SignedObject_key :: (Maybe Text -> f (Maybe Text))
-> S3SignedObject -> f S3SignedObject
s3SignedObject_key = (S3SignedObject -> Maybe Text)
-> (S3SignedObject -> Maybe Text -> S3SignedObject)
-> Lens S3SignedObject S3SignedObject (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3SignedObject' {Maybe Text
key :: Maybe Text
$sel:key:S3SignedObject' :: S3SignedObject -> Maybe Text
key} -> Maybe Text
key) (\s :: S3SignedObject
s@S3SignedObject' {} Maybe Text
a -> S3SignedObject
s {$sel:key:S3SignedObject' :: Maybe Text
key = Maybe Text
a} :: S3SignedObject)

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

instance Prelude.Hashable S3SignedObject

instance Prelude.NFData S3SignedObject