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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | For versioned objects, the version of the layer archive object to use.
    LayerVersionContentInput -> Maybe Text
s3ObjectVersion :: Prelude.Maybe Prelude.Text,
    -- | The Amazon S3 key of the layer archive.
    LayerVersionContentInput -> Maybe Text
s3Key :: 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 (Core.Sensitive Core.Base64),
    -- | The Amazon S3 bucket of the layer archive.
    LayerVersionContentInput -> Maybe Text
s3Bucket :: Prelude.Maybe Prelude.Text
  }
  deriving (LayerVersionContentInput -> LayerVersionContentInput -> Bool
(LayerVersionContentInput -> LayerVersionContentInput -> Bool)
-> (LayerVersionContentInput -> LayerVersionContentInput -> Bool)
-> Eq LayerVersionContentInput
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
(Int -> LayerVersionContentInput -> ShowS)
-> (LayerVersionContentInput -> String)
-> ([LayerVersionContentInput] -> ShowS)
-> Show LayerVersionContentInput
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.
 LayerVersionContentInput -> Rep LayerVersionContentInput x)
-> (forall x.
    Rep LayerVersionContentInput x -> LayerVersionContentInput)
-> Generic LayerVersionContentInput
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:
--
-- 's3ObjectVersion', 'layerVersionContentInput_s3ObjectVersion' - For versioned objects, the version of the layer archive object to use.
--
-- 's3Key', 'layerVersionContentInput_s3Key' - The Amazon S3 key of the layer archive.
--
-- '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.
--
-- 's3Bucket', 'layerVersionContentInput_s3Bucket' - The Amazon S3 bucket of the layer archive.
newLayerVersionContentInput ::
  LayerVersionContentInput
newLayerVersionContentInput :: LayerVersionContentInput
newLayerVersionContentInput =
  LayerVersionContentInput' :: Maybe Text
-> Maybe Text
-> Maybe (Sensitive Base64)
-> Maybe Text
-> LayerVersionContentInput
LayerVersionContentInput'
    { $sel:s3ObjectVersion:LayerVersionContentInput' :: Maybe Text
s3ObjectVersion =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3Key:LayerVersionContentInput' :: Maybe Text
s3Key = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:zipFile:LayerVersionContentInput' :: Maybe (Sensitive Base64)
zipFile = Maybe (Sensitive Base64)
forall a. Maybe a
Prelude.Nothing,
      $sel:s3Bucket:LayerVersionContentInput' :: Maybe Text
s3Bucket = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | For versioned objects, the version of the layer archive object to use.
layerVersionContentInput_s3ObjectVersion :: Lens.Lens' LayerVersionContentInput (Prelude.Maybe Prelude.Text)
layerVersionContentInput_s3ObjectVersion :: (Maybe Text -> f (Maybe Text))
-> LayerVersionContentInput -> f LayerVersionContentInput
layerVersionContentInput_s3ObjectVersion = (LayerVersionContentInput -> Maybe Text)
-> (LayerVersionContentInput
    -> Maybe Text -> LayerVersionContentInput)
-> Lens
     LayerVersionContentInput
     LayerVersionContentInput
     (Maybe Text)
     (Maybe Text)
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 Amazon S3 key of the layer archive.
layerVersionContentInput_s3Key :: Lens.Lens' LayerVersionContentInput (Prelude.Maybe Prelude.Text)
layerVersionContentInput_s3Key :: (Maybe Text -> f (Maybe Text))
-> LayerVersionContentInput -> f LayerVersionContentInput
layerVersionContentInput_s3Key = (LayerVersionContentInput -> Maybe Text)
-> (LayerVersionContentInput
    -> Maybe Text -> LayerVersionContentInput)
-> Lens
     LayerVersionContentInput
     LayerVersionContentInput
     (Maybe Text)
     (Maybe Text)
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)

-- | 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 :: (Maybe ByteString -> f (Maybe ByteString))
-> LayerVersionContentInput -> f LayerVersionContentInput
layerVersionContentInput_zipFile = (LayerVersionContentInput -> Maybe (Sensitive Base64))
-> (LayerVersionContentInput
    -> Maybe (Sensitive Base64) -> LayerVersionContentInput)
-> Lens
     LayerVersionContentInput
     LayerVersionContentInput
     (Maybe (Sensitive Base64))
     (Maybe (Sensitive Base64))
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) ((Maybe (Sensitive Base64) -> f (Maybe (Sensitive Base64)))
 -> LayerVersionContentInput -> f LayerVersionContentInput)
-> ((Maybe ByteString -> f (Maybe ByteString))
    -> Maybe (Sensitive Base64) -> f (Maybe (Sensitive Base64)))
-> (Maybe ByteString -> f (Maybe ByteString))
-> LayerVersionContentInput
-> f LayerVersionContentInput
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Base64) (Sensitive Base64) ByteString ByteString
-> Iso
     (Maybe (Sensitive Base64))
     (Maybe (Sensitive Base64))
     (Maybe ByteString)
     (Maybe ByteString)
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 (Exchange ByteString ByteString Base64 (Identity Base64)
-> Exchange
     ByteString
     ByteString
     (Sensitive Base64)
     (Identity (Sensitive Base64))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Exchange ByteString ByteString Base64 (Identity Base64)
 -> Exchange
      ByteString
      ByteString
      (Sensitive Base64)
      (Identity (Sensitive Base64)))
-> (Exchange ByteString ByteString ByteString (Identity ByteString)
    -> Exchange ByteString ByteString Base64 (Identity Base64))
-> AnIso
     (Sensitive Base64) (Sensitive Base64) ByteString ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Exchange ByteString ByteString ByteString (Identity ByteString)
-> Exchange ByteString ByteString Base64 (Identity Base64)
Iso' Base64 ByteString
Core._Base64)

-- | The Amazon S3 bucket of the layer archive.
layerVersionContentInput_s3Bucket :: Lens.Lens' LayerVersionContentInput (Prelude.Maybe Prelude.Text)
layerVersionContentInput_s3Bucket :: (Maybe Text -> f (Maybe Text))
-> LayerVersionContentInput -> f LayerVersionContentInput
layerVersionContentInput_s3Bucket = (LayerVersionContentInput -> Maybe Text)
-> (LayerVersionContentInput
    -> Maybe Text -> LayerVersionContentInput)
-> Lens
     LayerVersionContentInput
     LayerVersionContentInput
     (Maybe Text)
     (Maybe Text)
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)

instance Prelude.Hashable LayerVersionContentInput

instance Prelude.NFData LayerVersionContentInput

instance Core.ToJSON LayerVersionContentInput where
  toJSON :: LayerVersionContentInput -> Value
toJSON LayerVersionContentInput' {Maybe Text
Maybe (Sensitive Base64)
s3Bucket :: Maybe Text
zipFile :: Maybe (Sensitive Base64)
s3Key :: Maybe Text
s3ObjectVersion :: Maybe Text
$sel:s3Bucket:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe Text
$sel:zipFile:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe (Sensitive Base64)
$sel:s3Key:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe Text
$sel:s3ObjectVersion:LayerVersionContentInput' :: LayerVersionContentInput -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"S3ObjectVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
s3ObjectVersion,
            (Text
"S3Key" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
s3Key,
            (Text
"ZipFile" Text -> Sensitive Base64 -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Base64 -> Pair)
-> Maybe (Sensitive Base64) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Base64)
zipFile,
            (Text
"S3Bucket" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
s3Bucket
          ]
      )