{-# 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.LayersListItem
-- 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.LayersListItem where

import qualified Amazonka.Core as Core
import Amazonka.Lambda.Types.LayerVersionsListItem
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Details about an
-- <https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html Lambda layer>.
--
-- /See:/ 'newLayersListItem' smart constructor.
data LayersListItem = LayersListItem'
  { -- | The name of the layer.
    LayersListItem -> Maybe Text
layerName :: Prelude.Maybe Prelude.Text,
    -- | The newest version of the layer.
    LayersListItem -> Maybe LayerVersionsListItem
latestMatchingVersion :: Prelude.Maybe LayerVersionsListItem,
    -- | The Amazon Resource Name (ARN) of the function layer.
    LayersListItem -> Maybe Text
layerArn :: Prelude.Maybe Prelude.Text
  }
  deriving (LayersListItem -> LayersListItem -> Bool
(LayersListItem -> LayersListItem -> Bool)
-> (LayersListItem -> LayersListItem -> Bool) -> Eq LayersListItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LayersListItem -> LayersListItem -> Bool
$c/= :: LayersListItem -> LayersListItem -> Bool
== :: LayersListItem -> LayersListItem -> Bool
$c== :: LayersListItem -> LayersListItem -> Bool
Prelude.Eq, ReadPrec [LayersListItem]
ReadPrec LayersListItem
Int -> ReadS LayersListItem
ReadS [LayersListItem]
(Int -> ReadS LayersListItem)
-> ReadS [LayersListItem]
-> ReadPrec LayersListItem
-> ReadPrec [LayersListItem]
-> Read LayersListItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LayersListItem]
$creadListPrec :: ReadPrec [LayersListItem]
readPrec :: ReadPrec LayersListItem
$creadPrec :: ReadPrec LayersListItem
readList :: ReadS [LayersListItem]
$creadList :: ReadS [LayersListItem]
readsPrec :: Int -> ReadS LayersListItem
$creadsPrec :: Int -> ReadS LayersListItem
Prelude.Read, Int -> LayersListItem -> ShowS
[LayersListItem] -> ShowS
LayersListItem -> String
(Int -> LayersListItem -> ShowS)
-> (LayersListItem -> String)
-> ([LayersListItem] -> ShowS)
-> Show LayersListItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LayersListItem] -> ShowS
$cshowList :: [LayersListItem] -> ShowS
show :: LayersListItem -> String
$cshow :: LayersListItem -> String
showsPrec :: Int -> LayersListItem -> ShowS
$cshowsPrec :: Int -> LayersListItem -> ShowS
Prelude.Show, (forall x. LayersListItem -> Rep LayersListItem x)
-> (forall x. Rep LayersListItem x -> LayersListItem)
-> Generic LayersListItem
forall x. Rep LayersListItem x -> LayersListItem
forall x. LayersListItem -> Rep LayersListItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LayersListItem x -> LayersListItem
$cfrom :: forall x. LayersListItem -> Rep LayersListItem x
Prelude.Generic)

-- |
-- Create a value of 'LayersListItem' 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:
--
-- 'layerName', 'layersListItem_layerName' - The name of the layer.
--
-- 'latestMatchingVersion', 'layersListItem_latestMatchingVersion' - The newest version of the layer.
--
-- 'layerArn', 'layersListItem_layerArn' - The Amazon Resource Name (ARN) of the function layer.
newLayersListItem ::
  LayersListItem
newLayersListItem :: LayersListItem
newLayersListItem =
  LayersListItem' :: Maybe Text
-> Maybe LayerVersionsListItem -> Maybe Text -> LayersListItem
LayersListItem'
    { $sel:layerName:LayersListItem' :: Maybe Text
layerName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:latestMatchingVersion:LayersListItem' :: Maybe LayerVersionsListItem
latestMatchingVersion = Maybe LayerVersionsListItem
forall a. Maybe a
Prelude.Nothing,
      $sel:layerArn:LayersListItem' :: Maybe Text
layerArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the layer.
layersListItem_layerName :: Lens.Lens' LayersListItem (Prelude.Maybe Prelude.Text)
layersListItem_layerName :: (Maybe Text -> f (Maybe Text))
-> LayersListItem -> f LayersListItem
layersListItem_layerName = (LayersListItem -> Maybe Text)
-> (LayersListItem -> Maybe Text -> LayersListItem)
-> Lens LayersListItem LayersListItem (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LayersListItem' {Maybe Text
layerName :: Maybe Text
$sel:layerName:LayersListItem' :: LayersListItem -> Maybe Text
layerName} -> Maybe Text
layerName) (\s :: LayersListItem
s@LayersListItem' {} Maybe Text
a -> LayersListItem
s {$sel:layerName:LayersListItem' :: Maybe Text
layerName = Maybe Text
a} :: LayersListItem)

-- | The newest version of the layer.
layersListItem_latestMatchingVersion :: Lens.Lens' LayersListItem (Prelude.Maybe LayerVersionsListItem)
layersListItem_latestMatchingVersion :: (Maybe LayerVersionsListItem -> f (Maybe LayerVersionsListItem))
-> LayersListItem -> f LayersListItem
layersListItem_latestMatchingVersion = (LayersListItem -> Maybe LayerVersionsListItem)
-> (LayersListItem
    -> Maybe LayerVersionsListItem -> LayersListItem)
-> Lens
     LayersListItem
     LayersListItem
     (Maybe LayerVersionsListItem)
     (Maybe LayerVersionsListItem)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LayersListItem' {Maybe LayerVersionsListItem
latestMatchingVersion :: Maybe LayerVersionsListItem
$sel:latestMatchingVersion:LayersListItem' :: LayersListItem -> Maybe LayerVersionsListItem
latestMatchingVersion} -> Maybe LayerVersionsListItem
latestMatchingVersion) (\s :: LayersListItem
s@LayersListItem' {} Maybe LayerVersionsListItem
a -> LayersListItem
s {$sel:latestMatchingVersion:LayersListItem' :: Maybe LayerVersionsListItem
latestMatchingVersion = Maybe LayerVersionsListItem
a} :: LayersListItem)

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

instance Core.FromJSON LayersListItem where
  parseJSON :: Value -> Parser LayersListItem
parseJSON =
    String
-> (Object -> Parser LayersListItem)
-> Value
-> Parser LayersListItem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LayersListItem"
      ( \Object
x ->
          Maybe Text
-> Maybe LayerVersionsListItem -> Maybe Text -> LayersListItem
LayersListItem'
            (Maybe Text
 -> Maybe LayerVersionsListItem -> Maybe Text -> LayersListItem)
-> Parser (Maybe Text)
-> Parser
     (Maybe LayerVersionsListItem -> Maybe Text -> LayersListItem)
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
"LayerName")
            Parser
  (Maybe LayerVersionsListItem -> Maybe Text -> LayersListItem)
-> Parser (Maybe LayerVersionsListItem)
-> Parser (Maybe Text -> LayersListItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LayerVersionsListItem)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LatestMatchingVersion")
            Parser (Maybe Text -> LayersListItem)
-> Parser (Maybe Text) -> Parser LayersListItem
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
"LayerArn")
      )

instance Prelude.Hashable LayersListItem

instance Prelude.NFData LayersListItem