{-# 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.Lambda.Types.LayerVersionContentInput
-- 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.Lambda.Types.LayerVersionContentInput 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

-- | A ZIP archive that contains the contents of an
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html Lambda layer>.
-- You can specify either an Amazon S3 location, or upload a layer archive
-- directly.
--
-- /See:/ 'newLayerVersionContentInput' smart constructor.
data LayerVersionContentInput = LayerVersionContentInput'
  { -- | The Amazon S3 bucket of the layer archive.
    LayerVersionContentInput -> Maybe Text
s3Bucket :: Prelude.Maybe Prelude.Text,
    -- | The Amazon S3 key of the layer archive.
    LayerVersionContentInput -> Maybe Text
s3Key :: Prelude.Maybe Prelude.Text,
    -- | For versioned objects, the version of the layer archive object to use.
    LayerVersionContentInput -> Maybe Text
s3ObjectVersion :: Prelude.Maybe Prelude.Text,
    -- | The base64-encoded contents of the layer archive. Amazon Web Services
    -- SDK and Amazon Web Services CLI clients handle the encoding for you.
    LayerVersionContentInput -> Maybe (Sensitive Base64)
zipFile :: Prelude.Maybe (Data.Sensitive Data.Base64)
  }
  deriving (LayerVersionContentInput -> LayerVersionContentInput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LayerVersionContentInput -> LayerVersionContentInput -> Bool
$c/= :: LayerVersionContentInput -> LayerVersionContentInput -> Bool
== :: LayerVersionContentInput -> LayerVersionContentInput -> Bool
$c== :: LayerVersionContentInput -> LayerVersionContentInput -> Bool
Prelude.Eq, Int -> LayerVersionContentInput -> ShowS
[LayerVersionContentInput] -> ShowS
LayerVersionContentInput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LayerVersionContentInput] -> ShowS
$cshowList :: [LayerVersionContentInput] -> ShowS
show :: LayerVersionContentInput -> String
$cshow :: LayerVersionContentInput -> String
showsPrec :: Int -> LayerVersionContentInput -> ShowS
$cshowsPrec :: Int -> LayerVersionContentInput -> ShowS
Prelude.Show, forall x.
Rep LayerVersionContentInput x -> LayerVersionContentInput
forall x.
LayerVersionContentInput -> Rep LayerVersionContentInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LayerVersionContentInput x -> LayerVersionContentInput
$cfrom :: forall x.
LayerVersionContentInput -> Rep LayerVersionContentInput x
Prelude.Generic)

-- |
-- Create a value of 'LayerVersionContentInput' 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:
--
-- 's3Bucket', 'layerVersionContentInput_s3Bucket' - The Amazon S3 bucket of the layer archive.
--
-- 's3Key', 'layerVersionContentInput_s3Key' - The Amazon S3 key of the layer archive.
--
-- 's3ObjectVersion', 'layerVersionContentInput_s3ObjectVersion' - For versioned objects, the version of the layer archive object to use.
--
-- 'zipFile', 'layerVersionContentInput_zipFile' - The base64-encoded contents of the layer archive. Amazon Web Services
-- SDK and Amazon Web Services CLI clients handle the encoding for you.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
newLayerVersionContentInput ::
  LayerVersionContentInput
newLayerVersionContentInput :: LayerVersionContentInput
newLayerVersionContentInput =
  LayerVersionContentInput'
    { $sel:s3Bucket:LayerVersionContentInput' :: Maybe Text
s3Bucket =
        forall a. Maybe a
Prelude.Nothing,
      $sel:s3Key:LayerVersionContentInput' :: Maybe Text
s3Key = forall a. Maybe a
Prelude.Nothing,
      $sel:s3ObjectVersion:LayerVersionContentInput' :: Maybe Text
s3ObjectVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:zipFile:LayerVersionContentInput' :: Maybe (Sensitive Base64)
zipFile = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon S3 bucket of the layer archive.
layerVersionContentInput_s3Bucket :: Lens.Lens' LayerVersionContentInput (Prelude.Maybe Prelude.Text)
layerVersionContentInput_s3Bucket :: Lens' LayerVersionContentInput (Maybe Text)
layerVersionContentInput_s3Bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LayerVersionContentInput' {Maybe Text
s3Bucket :: Maybe Text
$sel:s3Bucket:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe Text
s3Bucket} -> Maybe Text
s3Bucket) (\s :: LayerVersionContentInput
s@LayerVersionContentInput' {} Maybe Text
a -> LayerVersionContentInput
s {$sel:s3Bucket:LayerVersionContentInput' :: Maybe Text
s3Bucket = Maybe Text
a} :: LayerVersionContentInput)

-- | The Amazon S3 key of the layer archive.
layerVersionContentInput_s3Key :: Lens.Lens' LayerVersionContentInput (Prelude.Maybe Prelude.Text)
layerVersionContentInput_s3Key :: Lens' LayerVersionContentInput (Maybe Text)
layerVersionContentInput_s3Key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LayerVersionContentInput' {Maybe Text
s3Key :: Maybe Text
$sel:s3Key:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe Text
s3Key} -> Maybe Text
s3Key) (\s :: LayerVersionContentInput
s@LayerVersionContentInput' {} Maybe Text
a -> LayerVersionContentInput
s {$sel:s3Key:LayerVersionContentInput' :: Maybe Text
s3Key = Maybe Text
a} :: LayerVersionContentInput)

-- | For versioned objects, the version of the layer archive object to use.
layerVersionContentInput_s3ObjectVersion :: Lens.Lens' LayerVersionContentInput (Prelude.Maybe Prelude.Text)
layerVersionContentInput_s3ObjectVersion :: Lens' LayerVersionContentInput (Maybe Text)
layerVersionContentInput_s3ObjectVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LayerVersionContentInput' {Maybe Text
s3ObjectVersion :: Maybe Text
$sel:s3ObjectVersion:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe Text
s3ObjectVersion} -> Maybe Text
s3ObjectVersion) (\s :: LayerVersionContentInput
s@LayerVersionContentInput' {} Maybe Text
a -> LayerVersionContentInput
s {$sel:s3ObjectVersion:LayerVersionContentInput' :: Maybe Text
s3ObjectVersion = Maybe Text
a} :: LayerVersionContentInput)

-- | The base64-encoded contents of the layer archive. Amazon Web Services
-- SDK and Amazon Web Services CLI clients handle the encoding for you.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
layerVersionContentInput_zipFile :: Lens.Lens' LayerVersionContentInput (Prelude.Maybe Prelude.ByteString)
layerVersionContentInput_zipFile :: Lens' LayerVersionContentInput (Maybe ByteString)
layerVersionContentInput_zipFile = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LayerVersionContentInput' {Maybe (Sensitive Base64)
zipFile :: Maybe (Sensitive Base64)
$sel:zipFile:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe (Sensitive Base64)
zipFile} -> Maybe (Sensitive Base64)
zipFile) (\s :: LayerVersionContentInput
s@LayerVersionContentInput' {} Maybe (Sensitive Base64)
a -> LayerVersionContentInput
s {$sel:zipFile:LayerVersionContentInput' :: Maybe (Sensitive Base64)
zipFile = Maybe (Sensitive Base64)
a} :: LayerVersionContentInput) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping (forall a. Iso' (Sensitive a) a
Data._Sensitive forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Iso' Base64 ByteString
Data._Base64)

instance Prelude.Hashable LayerVersionContentInput where
  hashWithSalt :: Int -> LayerVersionContentInput -> Int
hashWithSalt Int
_salt LayerVersionContentInput' {Maybe Text
Maybe (Sensitive Base64)
zipFile :: Maybe (Sensitive Base64)
s3ObjectVersion :: Maybe Text
s3Key :: Maybe Text
s3Bucket :: Maybe Text
$sel:zipFile:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe (Sensitive Base64)
$sel:s3ObjectVersion:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe Text
$sel:s3Key:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe Text
$sel:s3Bucket:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3Bucket
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3Key
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3ObjectVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Base64)
zipFile

instance Prelude.NFData LayerVersionContentInput where
  rnf :: LayerVersionContentInput -> ()
rnf LayerVersionContentInput' {Maybe Text
Maybe (Sensitive Base64)
zipFile :: Maybe (Sensitive Base64)
s3ObjectVersion :: Maybe Text
s3Key :: Maybe Text
s3Bucket :: Maybe Text
$sel:zipFile:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe (Sensitive Base64)
$sel:s3ObjectVersion:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe Text
$sel:s3Key:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe Text
$sel:s3Bucket:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3Bucket
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3Key
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3ObjectVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Base64)
zipFile

instance Data.ToJSON LayerVersionContentInput where
  toJSON :: LayerVersionContentInput -> Value
toJSON LayerVersionContentInput' {Maybe Text
Maybe (Sensitive Base64)
zipFile :: Maybe (Sensitive Base64)
s3ObjectVersion :: Maybe Text
s3Key :: Maybe Text
s3Bucket :: Maybe Text
$sel:zipFile:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe (Sensitive Base64)
$sel:s3ObjectVersion:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe Text
$sel:s3Key:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe Text
$sel:s3Bucket:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"S3Bucket" 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
s3Bucket,
            (Key
"S3Key" 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
s3Key,
            (Key
"S3ObjectVersion" 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
s3ObjectVersion,
            (Key
"ZipFile" 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 (Sensitive Base64)
zipFile
          ]
      )