{-# 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.Layer
-- 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.Layer 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

-- | An
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html Lambda layer>.
--
-- /See:/ 'newLayer' smart constructor.
data Layer = Layer'
  { -- | The Amazon Resource Name (ARN) of the function layer.
    Layer -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The size of the layer archive in bytes.
    Layer -> Maybe Integer
codeSize :: Prelude.Maybe Prelude.Integer,
    -- | The Amazon Resource Name (ARN) of a signing job.
    Layer -> Maybe Text
signingJobArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) for a signing profile version.
    Layer -> Maybe Text
signingProfileVersionArn :: Prelude.Maybe Prelude.Text
  }
  deriving (Layer -> Layer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Layer -> Layer -> Bool
$c/= :: Layer -> Layer -> Bool
== :: Layer -> Layer -> Bool
$c== :: Layer -> Layer -> Bool
Prelude.Eq, ReadPrec [Layer]
ReadPrec Layer
Int -> ReadS Layer
ReadS [Layer]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Layer]
$creadListPrec :: ReadPrec [Layer]
readPrec :: ReadPrec Layer
$creadPrec :: ReadPrec Layer
readList :: ReadS [Layer]
$creadList :: ReadS [Layer]
readsPrec :: Int -> ReadS Layer
$creadsPrec :: Int -> ReadS Layer
Prelude.Read, Int -> Layer -> ShowS
[Layer] -> ShowS
Layer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Layer] -> ShowS
$cshowList :: [Layer] -> ShowS
show :: Layer -> String
$cshow :: Layer -> String
showsPrec :: Int -> Layer -> ShowS
$cshowsPrec :: Int -> Layer -> ShowS
Prelude.Show, forall x. Rep Layer x -> Layer
forall x. Layer -> Rep Layer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Layer x -> Layer
$cfrom :: forall x. Layer -> Rep Layer x
Prelude.Generic)

-- |
-- Create a value of 'Layer' 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:
--
-- 'arn', 'layer_arn' - The Amazon Resource Name (ARN) of the function layer.
--
-- 'codeSize', 'layer_codeSize' - The size of the layer archive in bytes.
--
-- 'signingJobArn', 'layer_signingJobArn' - The Amazon Resource Name (ARN) of a signing job.
--
-- 'signingProfileVersionArn', 'layer_signingProfileVersionArn' - The Amazon Resource Name (ARN) for a signing profile version.
newLayer ::
  Layer
newLayer :: Layer
newLayer =
  Layer'
    { $sel:arn:Layer' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:codeSize:Layer' :: Maybe Integer
codeSize = forall a. Maybe a
Prelude.Nothing,
      $sel:signingJobArn:Layer' :: Maybe Text
signingJobArn = forall a. Maybe a
Prelude.Nothing,
      $sel:signingProfileVersionArn:Layer' :: Maybe Text
signingProfileVersionArn = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the function layer.
layer_arn :: Lens.Lens' Layer (Prelude.Maybe Prelude.Text)
layer_arn :: Lens' Layer (Maybe Text)
layer_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Layer' {Maybe Text
arn :: Maybe Text
$sel:arn:Layer' :: Layer -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Layer
s@Layer' {} Maybe Text
a -> Layer
s {$sel:arn:Layer' :: Maybe Text
arn = Maybe Text
a} :: Layer)

-- | The size of the layer archive in bytes.
layer_codeSize :: Lens.Lens' Layer (Prelude.Maybe Prelude.Integer)
layer_codeSize :: Lens' Layer (Maybe Integer)
layer_codeSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Layer' {Maybe Integer
codeSize :: Maybe Integer
$sel:codeSize:Layer' :: Layer -> Maybe Integer
codeSize} -> Maybe Integer
codeSize) (\s :: Layer
s@Layer' {} Maybe Integer
a -> Layer
s {$sel:codeSize:Layer' :: Maybe Integer
codeSize = Maybe Integer
a} :: Layer)

-- | The Amazon Resource Name (ARN) of a signing job.
layer_signingJobArn :: Lens.Lens' Layer (Prelude.Maybe Prelude.Text)
layer_signingJobArn :: Lens' Layer (Maybe Text)
layer_signingJobArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Layer' {Maybe Text
signingJobArn :: Maybe Text
$sel:signingJobArn:Layer' :: Layer -> Maybe Text
signingJobArn} -> Maybe Text
signingJobArn) (\s :: Layer
s@Layer' {} Maybe Text
a -> Layer
s {$sel:signingJobArn:Layer' :: Maybe Text
signingJobArn = Maybe Text
a} :: Layer)

-- | The Amazon Resource Name (ARN) for a signing profile version.
layer_signingProfileVersionArn :: Lens.Lens' Layer (Prelude.Maybe Prelude.Text)
layer_signingProfileVersionArn :: Lens' Layer (Maybe Text)
layer_signingProfileVersionArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Layer' {Maybe Text
signingProfileVersionArn :: Maybe Text
$sel:signingProfileVersionArn:Layer' :: Layer -> Maybe Text
signingProfileVersionArn} -> Maybe Text
signingProfileVersionArn) (\s :: Layer
s@Layer' {} Maybe Text
a -> Layer
s {$sel:signingProfileVersionArn:Layer' :: Maybe Text
signingProfileVersionArn = Maybe Text
a} :: Layer)

instance Data.FromJSON Layer where
  parseJSON :: Value -> Parser Layer
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Layer"
      ( \Object
x ->
          Maybe Text -> Maybe Integer -> Maybe Text -> Maybe Text -> Layer
Layer'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CodeSize")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SigningJobArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SigningProfileVersionArn")
      )

instance Prelude.Hashable Layer where
  hashWithSalt :: Int -> Layer -> Int
hashWithSalt Int
_salt Layer' {Maybe Integer
Maybe Text
signingProfileVersionArn :: Maybe Text
signingJobArn :: Maybe Text
codeSize :: Maybe Integer
arn :: Maybe Text
$sel:signingProfileVersionArn:Layer' :: Layer -> Maybe Text
$sel:signingJobArn:Layer' :: Layer -> Maybe Text
$sel:codeSize:Layer' :: Layer -> Maybe Integer
$sel:arn:Layer' :: Layer -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
codeSize
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
signingJobArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
signingProfileVersionArn

instance Prelude.NFData Layer where
  rnf :: Layer -> ()
rnf Layer' {Maybe Integer
Maybe Text
signingProfileVersionArn :: Maybe Text
signingJobArn :: Maybe Text
codeSize :: Maybe Integer
arn :: Maybe Text
$sel:signingProfileVersionArn:Layer' :: Layer -> Maybe Text
$sel:signingJobArn:Layer' :: Layer -> Maybe Text
$sel:codeSize:Layer' :: Layer -> Maybe Integer
$sel:arn:Layer' :: Layer -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
codeSize
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
signingJobArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
signingProfileVersionArn