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

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

-- | Provides configuration information about a Lambda function
-- <https://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html alias>.
--
-- /See:/ 'newAliasConfiguration' smart constructor.
data AliasConfiguration = AliasConfiguration'
  { -- | The
    -- <https://docs.aws.amazon.com/lambda/latest/dg/lambda-traffic-shifting-using-aliases.html routing configuration>
    -- of the alias.
    AliasConfiguration -> Maybe AliasRoutingConfiguration
routingConfig :: Prelude.Maybe AliasRoutingConfiguration,
    -- | The name of the alias.
    AliasConfiguration -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The function version that the alias invokes.
    AliasConfiguration -> Maybe Text
functionVersion :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the alias.
    AliasConfiguration -> Maybe Text
aliasArn :: Prelude.Maybe Prelude.Text,
    -- | A description of the alias.
    AliasConfiguration -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier that changes when you update the alias.
    AliasConfiguration -> Maybe Text
revisionId :: Prelude.Maybe Prelude.Text
  }
  deriving (AliasConfiguration -> AliasConfiguration -> Bool
(AliasConfiguration -> AliasConfiguration -> Bool)
-> (AliasConfiguration -> AliasConfiguration -> Bool)
-> Eq AliasConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AliasConfiguration -> AliasConfiguration -> Bool
$c/= :: AliasConfiguration -> AliasConfiguration -> Bool
== :: AliasConfiguration -> AliasConfiguration -> Bool
$c== :: AliasConfiguration -> AliasConfiguration -> Bool
Prelude.Eq, ReadPrec [AliasConfiguration]
ReadPrec AliasConfiguration
Int -> ReadS AliasConfiguration
ReadS [AliasConfiguration]
(Int -> ReadS AliasConfiguration)
-> ReadS [AliasConfiguration]
-> ReadPrec AliasConfiguration
-> ReadPrec [AliasConfiguration]
-> Read AliasConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AliasConfiguration]
$creadListPrec :: ReadPrec [AliasConfiguration]
readPrec :: ReadPrec AliasConfiguration
$creadPrec :: ReadPrec AliasConfiguration
readList :: ReadS [AliasConfiguration]
$creadList :: ReadS [AliasConfiguration]
readsPrec :: Int -> ReadS AliasConfiguration
$creadsPrec :: Int -> ReadS AliasConfiguration
Prelude.Read, Int -> AliasConfiguration -> ShowS
[AliasConfiguration] -> ShowS
AliasConfiguration -> String
(Int -> AliasConfiguration -> ShowS)
-> (AliasConfiguration -> String)
-> ([AliasConfiguration] -> ShowS)
-> Show AliasConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AliasConfiguration] -> ShowS
$cshowList :: [AliasConfiguration] -> ShowS
show :: AliasConfiguration -> String
$cshow :: AliasConfiguration -> String
showsPrec :: Int -> AliasConfiguration -> ShowS
$cshowsPrec :: Int -> AliasConfiguration -> ShowS
Prelude.Show, (forall x. AliasConfiguration -> Rep AliasConfiguration x)
-> (forall x. Rep AliasConfiguration x -> AliasConfiguration)
-> Generic AliasConfiguration
forall x. Rep AliasConfiguration x -> AliasConfiguration
forall x. AliasConfiguration -> Rep AliasConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AliasConfiguration x -> AliasConfiguration
$cfrom :: forall x. AliasConfiguration -> Rep AliasConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'AliasConfiguration' 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:
--
-- 'routingConfig', 'aliasConfiguration_routingConfig' - The
-- <https://docs.aws.amazon.com/lambda/latest/dg/lambda-traffic-shifting-using-aliases.html routing configuration>
-- of the alias.
--
-- 'name', 'aliasConfiguration_name' - The name of the alias.
--
-- 'functionVersion', 'aliasConfiguration_functionVersion' - The function version that the alias invokes.
--
-- 'aliasArn', 'aliasConfiguration_aliasArn' - The Amazon Resource Name (ARN) of the alias.
--
-- 'description', 'aliasConfiguration_description' - A description of the alias.
--
-- 'revisionId', 'aliasConfiguration_revisionId' - A unique identifier that changes when you update the alias.
newAliasConfiguration ::
  AliasConfiguration
newAliasConfiguration :: AliasConfiguration
newAliasConfiguration =
  AliasConfiguration' :: Maybe AliasRoutingConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> AliasConfiguration
AliasConfiguration'
    { $sel:routingConfig:AliasConfiguration' :: Maybe AliasRoutingConfiguration
routingConfig =
        Maybe AliasRoutingConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:name:AliasConfiguration' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:functionVersion:AliasConfiguration' :: Maybe Text
functionVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:aliasArn:AliasConfiguration' :: Maybe Text
aliasArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:AliasConfiguration' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:revisionId:AliasConfiguration' :: Maybe Text
revisionId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The
-- <https://docs.aws.amazon.com/lambda/latest/dg/lambda-traffic-shifting-using-aliases.html routing configuration>
-- of the alias.
aliasConfiguration_routingConfig :: Lens.Lens' AliasConfiguration (Prelude.Maybe AliasRoutingConfiguration)
aliasConfiguration_routingConfig :: (Maybe AliasRoutingConfiguration
 -> f (Maybe AliasRoutingConfiguration))
-> AliasConfiguration -> f AliasConfiguration
aliasConfiguration_routingConfig = (AliasConfiguration -> Maybe AliasRoutingConfiguration)
-> (AliasConfiguration
    -> Maybe AliasRoutingConfiguration -> AliasConfiguration)
-> Lens
     AliasConfiguration
     AliasConfiguration
     (Maybe AliasRoutingConfiguration)
     (Maybe AliasRoutingConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AliasConfiguration' {Maybe AliasRoutingConfiguration
routingConfig :: Maybe AliasRoutingConfiguration
$sel:routingConfig:AliasConfiguration' :: AliasConfiguration -> Maybe AliasRoutingConfiguration
routingConfig} -> Maybe AliasRoutingConfiguration
routingConfig) (\s :: AliasConfiguration
s@AliasConfiguration' {} Maybe AliasRoutingConfiguration
a -> AliasConfiguration
s {$sel:routingConfig:AliasConfiguration' :: Maybe AliasRoutingConfiguration
routingConfig = Maybe AliasRoutingConfiguration
a} :: AliasConfiguration)

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

-- | The function version that the alias invokes.
aliasConfiguration_functionVersion :: Lens.Lens' AliasConfiguration (Prelude.Maybe Prelude.Text)
aliasConfiguration_functionVersion :: (Maybe Text -> f (Maybe Text))
-> AliasConfiguration -> f AliasConfiguration
aliasConfiguration_functionVersion = (AliasConfiguration -> Maybe Text)
-> (AliasConfiguration -> Maybe Text -> AliasConfiguration)
-> Lens
     AliasConfiguration AliasConfiguration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AliasConfiguration' {Maybe Text
functionVersion :: Maybe Text
$sel:functionVersion:AliasConfiguration' :: AliasConfiguration -> Maybe Text
functionVersion} -> Maybe Text
functionVersion) (\s :: AliasConfiguration
s@AliasConfiguration' {} Maybe Text
a -> AliasConfiguration
s {$sel:functionVersion:AliasConfiguration' :: Maybe Text
functionVersion = Maybe Text
a} :: AliasConfiguration)

-- | The Amazon Resource Name (ARN) of the alias.
aliasConfiguration_aliasArn :: Lens.Lens' AliasConfiguration (Prelude.Maybe Prelude.Text)
aliasConfiguration_aliasArn :: (Maybe Text -> f (Maybe Text))
-> AliasConfiguration -> f AliasConfiguration
aliasConfiguration_aliasArn = (AliasConfiguration -> Maybe Text)
-> (AliasConfiguration -> Maybe Text -> AliasConfiguration)
-> Lens
     AliasConfiguration AliasConfiguration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AliasConfiguration' {Maybe Text
aliasArn :: Maybe Text
$sel:aliasArn:AliasConfiguration' :: AliasConfiguration -> Maybe Text
aliasArn} -> Maybe Text
aliasArn) (\s :: AliasConfiguration
s@AliasConfiguration' {} Maybe Text
a -> AliasConfiguration
s {$sel:aliasArn:AliasConfiguration' :: Maybe Text
aliasArn = Maybe Text
a} :: AliasConfiguration)

-- | A description of the alias.
aliasConfiguration_description :: Lens.Lens' AliasConfiguration (Prelude.Maybe Prelude.Text)
aliasConfiguration_description :: (Maybe Text -> f (Maybe Text))
-> AliasConfiguration -> f AliasConfiguration
aliasConfiguration_description = (AliasConfiguration -> Maybe Text)
-> (AliasConfiguration -> Maybe Text -> AliasConfiguration)
-> Lens
     AliasConfiguration AliasConfiguration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AliasConfiguration' {Maybe Text
description :: Maybe Text
$sel:description:AliasConfiguration' :: AliasConfiguration -> Maybe Text
description} -> Maybe Text
description) (\s :: AliasConfiguration
s@AliasConfiguration' {} Maybe Text
a -> AliasConfiguration
s {$sel:description:AliasConfiguration' :: Maybe Text
description = Maybe Text
a} :: AliasConfiguration)

-- | A unique identifier that changes when you update the alias.
aliasConfiguration_revisionId :: Lens.Lens' AliasConfiguration (Prelude.Maybe Prelude.Text)
aliasConfiguration_revisionId :: (Maybe Text -> f (Maybe Text))
-> AliasConfiguration -> f AliasConfiguration
aliasConfiguration_revisionId = (AliasConfiguration -> Maybe Text)
-> (AliasConfiguration -> Maybe Text -> AliasConfiguration)
-> Lens
     AliasConfiguration AliasConfiguration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AliasConfiguration' {Maybe Text
revisionId :: Maybe Text
$sel:revisionId:AliasConfiguration' :: AliasConfiguration -> Maybe Text
revisionId} -> Maybe Text
revisionId) (\s :: AliasConfiguration
s@AliasConfiguration' {} Maybe Text
a -> AliasConfiguration
s {$sel:revisionId:AliasConfiguration' :: Maybe Text
revisionId = Maybe Text
a} :: AliasConfiguration)

instance Core.FromJSON AliasConfiguration where
  parseJSON :: Value -> Parser AliasConfiguration
parseJSON =
    String
-> (Object -> Parser AliasConfiguration)
-> Value
-> Parser AliasConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AliasConfiguration"
      ( \Object
x ->
          Maybe AliasRoutingConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> AliasConfiguration
AliasConfiguration'
            (Maybe AliasRoutingConfiguration
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> AliasConfiguration)
-> Parser (Maybe AliasRoutingConfiguration)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> AliasConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AliasRoutingConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RoutingConfig")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> AliasConfiguration)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> AliasConfiguration)
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
"Name")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> AliasConfiguration)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> AliasConfiguration)
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
"FunctionVersion")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> AliasConfiguration)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> AliasConfiguration)
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
"AliasArn")
            Parser (Maybe Text -> Maybe Text -> AliasConfiguration)
-> Parser (Maybe Text) -> Parser (Maybe Text -> AliasConfiguration)
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
"Description")
            Parser (Maybe Text -> AliasConfiguration)
-> Parser (Maybe Text) -> Parser AliasConfiguration
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
"RevisionId")
      )

instance Prelude.Hashable AliasConfiguration

instance Prelude.NFData AliasConfiguration