{-# 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.AppConfig.Types.Extension
-- 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.AppConfig.Types.Extension where

import Amazonka.AppConfig.Types.Action
import Amazonka.AppConfig.Types.ActionPoint
import Amazonka.AppConfig.Types.Parameter
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

-- | /See:/ 'newExtension' smart constructor.
data Extension = Extension'
  { -- | The actions defined in the extension.
    Extension -> Maybe (HashMap ActionPoint (NonEmpty Action))
actions :: Prelude.Maybe (Prelude.HashMap ActionPoint (Prelude.NonEmpty Action)),
    -- | The system-generated Amazon Resource Name (ARN) for the extension.
    Extension -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | Information about the extension.
    Extension -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The system-generated ID of the extension.
    Extension -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The extension name.
    Extension -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The parameters accepted by the extension. You specify parameter values
    -- when you associate the extension to an AppConfig resource by using the
    -- @CreateExtensionAssociation@ API action. For Lambda extension actions,
    -- these parameters are included in the Lambda request object.
    Extension -> Maybe (HashMap Text Parameter)
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Parameter),
    -- | The extension version number.
    Extension -> Maybe Int
versionNumber :: Prelude.Maybe Prelude.Int
  }
  deriving (Extension -> Extension -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Extension -> Extension -> Bool
$c/= :: Extension -> Extension -> Bool
== :: Extension -> Extension -> Bool
$c== :: Extension -> Extension -> Bool
Prelude.Eq, ReadPrec [Extension]
ReadPrec Extension
Int -> ReadS Extension
ReadS [Extension]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Extension]
$creadListPrec :: ReadPrec [Extension]
readPrec :: ReadPrec Extension
$creadPrec :: ReadPrec Extension
readList :: ReadS [Extension]
$creadList :: ReadS [Extension]
readsPrec :: Int -> ReadS Extension
$creadsPrec :: Int -> ReadS Extension
Prelude.Read, Int -> Extension -> ShowS
[Extension] -> ShowS
Extension -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Extension] -> ShowS
$cshowList :: [Extension] -> ShowS
show :: Extension -> String
$cshow :: Extension -> String
showsPrec :: Int -> Extension -> ShowS
$cshowsPrec :: Int -> Extension -> ShowS
Prelude.Show, forall x. Rep Extension x -> Extension
forall x. Extension -> Rep Extension x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Extension x -> Extension
$cfrom :: forall x. Extension -> Rep Extension x
Prelude.Generic)

-- |
-- Create a value of 'Extension' 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:
--
-- 'actions', 'extension_actions' - The actions defined in the extension.
--
-- 'arn', 'extension_arn' - The system-generated Amazon Resource Name (ARN) for the extension.
--
-- 'description', 'extension_description' - Information about the extension.
--
-- 'id', 'extension_id' - The system-generated ID of the extension.
--
-- 'name', 'extension_name' - The extension name.
--
-- 'parameters', 'extension_parameters' - The parameters accepted by the extension. You specify parameter values
-- when you associate the extension to an AppConfig resource by using the
-- @CreateExtensionAssociation@ API action. For Lambda extension actions,
-- these parameters are included in the Lambda request object.
--
-- 'versionNumber', 'extension_versionNumber' - The extension version number.
newExtension ::
  Extension
newExtension :: Extension
newExtension =
  Extension'
    { $sel:actions:Extension' :: Maybe (HashMap ActionPoint (NonEmpty Action))
actions = forall a. Maybe a
Prelude.Nothing,
      $sel:arn:Extension' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:description:Extension' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:id:Extension' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Extension' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:parameters:Extension' :: Maybe (HashMap Text Parameter)
parameters = forall a. Maybe a
Prelude.Nothing,
      $sel:versionNumber:Extension' :: Maybe Int
versionNumber = forall a. Maybe a
Prelude.Nothing
    }

-- | The actions defined in the extension.
extension_actions :: Lens.Lens' Extension (Prelude.Maybe (Prelude.HashMap ActionPoint (Prelude.NonEmpty Action)))
extension_actions :: Lens' Extension (Maybe (HashMap ActionPoint (NonEmpty Action)))
extension_actions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Extension' {Maybe (HashMap ActionPoint (NonEmpty Action))
actions :: Maybe (HashMap ActionPoint (NonEmpty Action))
$sel:actions:Extension' :: Extension -> Maybe (HashMap ActionPoint (NonEmpty Action))
actions} -> Maybe (HashMap ActionPoint (NonEmpty Action))
actions) (\s :: Extension
s@Extension' {} Maybe (HashMap ActionPoint (NonEmpty Action))
a -> Extension
s {$sel:actions:Extension' :: Maybe (HashMap ActionPoint (NonEmpty Action))
actions = Maybe (HashMap ActionPoint (NonEmpty Action))
a} :: Extension) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The system-generated Amazon Resource Name (ARN) for the extension.
extension_arn :: Lens.Lens' Extension (Prelude.Maybe Prelude.Text)
extension_arn :: Lens' Extension (Maybe Text)
extension_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Extension' {Maybe Text
arn :: Maybe Text
$sel:arn:Extension' :: Extension -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Extension
s@Extension' {} Maybe Text
a -> Extension
s {$sel:arn:Extension' :: Maybe Text
arn = Maybe Text
a} :: Extension)

-- | Information about the extension.
extension_description :: Lens.Lens' Extension (Prelude.Maybe Prelude.Text)
extension_description :: Lens' Extension (Maybe Text)
extension_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Extension' {Maybe Text
description :: Maybe Text
$sel:description:Extension' :: Extension -> Maybe Text
description} -> Maybe Text
description) (\s :: Extension
s@Extension' {} Maybe Text
a -> Extension
s {$sel:description:Extension' :: Maybe Text
description = Maybe Text
a} :: Extension)

-- | The system-generated ID of the extension.
extension_id :: Lens.Lens' Extension (Prelude.Maybe Prelude.Text)
extension_id :: Lens' Extension (Maybe Text)
extension_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Extension' {Maybe Text
id :: Maybe Text
$sel:id:Extension' :: Extension -> Maybe Text
id} -> Maybe Text
id) (\s :: Extension
s@Extension' {} Maybe Text
a -> Extension
s {$sel:id:Extension' :: Maybe Text
id = Maybe Text
a} :: Extension)

-- | The extension name.
extension_name :: Lens.Lens' Extension (Prelude.Maybe Prelude.Text)
extension_name :: Lens' Extension (Maybe Text)
extension_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Extension' {Maybe Text
name :: Maybe Text
$sel:name:Extension' :: Extension -> Maybe Text
name} -> Maybe Text
name) (\s :: Extension
s@Extension' {} Maybe Text
a -> Extension
s {$sel:name:Extension' :: Maybe Text
name = Maybe Text
a} :: Extension)

-- | The parameters accepted by the extension. You specify parameter values
-- when you associate the extension to an AppConfig resource by using the
-- @CreateExtensionAssociation@ API action. For Lambda extension actions,
-- these parameters are included in the Lambda request object.
extension_parameters :: Lens.Lens' Extension (Prelude.Maybe (Prelude.HashMap Prelude.Text Parameter))
extension_parameters :: Lens' Extension (Maybe (HashMap Text Parameter))
extension_parameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Extension' {Maybe (HashMap Text Parameter)
parameters :: Maybe (HashMap Text Parameter)
$sel:parameters:Extension' :: Extension -> Maybe (HashMap Text Parameter)
parameters} -> Maybe (HashMap Text Parameter)
parameters) (\s :: Extension
s@Extension' {} Maybe (HashMap Text Parameter)
a -> Extension
s {$sel:parameters:Extension' :: Maybe (HashMap Text Parameter)
parameters = Maybe (HashMap Text Parameter)
a} :: Extension) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The extension version number.
extension_versionNumber :: Lens.Lens' Extension (Prelude.Maybe Prelude.Int)
extension_versionNumber :: Lens' Extension (Maybe Int)
extension_versionNumber = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Extension' {Maybe Int
versionNumber :: Maybe Int
$sel:versionNumber:Extension' :: Extension -> Maybe Int
versionNumber} -> Maybe Int
versionNumber) (\s :: Extension
s@Extension' {} Maybe Int
a -> Extension
s {$sel:versionNumber:Extension' :: Maybe Int
versionNumber = Maybe Int
a} :: Extension)

instance Data.FromJSON Extension where
  parseJSON :: Value -> Parser Extension
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Extension"
      ( \Object
x ->
          Maybe (HashMap ActionPoint (NonEmpty Action))
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Parameter)
-> Maybe Int
-> Extension
Extension'
            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
"Actions" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"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
"Description")
            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
"Id")
            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
"Name")
            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
"Parameters" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"VersionNumber")
      )

instance Prelude.Hashable Extension where
  hashWithSalt :: Int -> Extension -> Int
hashWithSalt Int
_salt Extension' {Maybe Int
Maybe Text
Maybe (HashMap Text Parameter)
Maybe (HashMap ActionPoint (NonEmpty Action))
versionNumber :: Maybe Int
parameters :: Maybe (HashMap Text Parameter)
name :: Maybe Text
id :: Maybe Text
description :: Maybe Text
arn :: Maybe Text
actions :: Maybe (HashMap ActionPoint (NonEmpty Action))
$sel:versionNumber:Extension' :: Extension -> Maybe Int
$sel:parameters:Extension' :: Extension -> Maybe (HashMap Text Parameter)
$sel:name:Extension' :: Extension -> Maybe Text
$sel:id:Extension' :: Extension -> Maybe Text
$sel:description:Extension' :: Extension -> Maybe Text
$sel:arn:Extension' :: Extension -> Maybe Text
$sel:actions:Extension' :: Extension -> Maybe (HashMap ActionPoint (NonEmpty Action))
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap ActionPoint (NonEmpty Action))
actions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Parameter)
parameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
versionNumber

instance Prelude.NFData Extension where
  rnf :: Extension -> ()
rnf Extension' {Maybe Int
Maybe Text
Maybe (HashMap Text Parameter)
Maybe (HashMap ActionPoint (NonEmpty Action))
versionNumber :: Maybe Int
parameters :: Maybe (HashMap Text Parameter)
name :: Maybe Text
id :: Maybe Text
description :: Maybe Text
arn :: Maybe Text
actions :: Maybe (HashMap ActionPoint (NonEmpty Action))
$sel:versionNumber:Extension' :: Extension -> Maybe Int
$sel:parameters:Extension' :: Extension -> Maybe (HashMap Text Parameter)
$sel:name:Extension' :: Extension -> Maybe Text
$sel:id:Extension' :: Extension -> Maybe Text
$sel:description:Extension' :: Extension -> Maybe Text
$sel:arn:Extension' :: Extension -> Maybe Text
$sel:actions:Extension' :: Extension -> Maybe (HashMap ActionPoint (NonEmpty Action))
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap ActionPoint (NonEmpty Action))
actions
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Parameter)
parameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
versionNumber