{-# 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.CloudFormation.Types.RequiredActivatedType
-- 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.CloudFormation.Types.RequiredActivatedType 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

-- | For extensions that are modules, a public third-party extension that
-- must be activated in your account in order for the module itself to be
-- activated.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/modules.html#module-enabling Activating public modules for use in your account>
-- in the /CloudFormation User Guide/.
--
-- /See:/ 'newRequiredActivatedType' smart constructor.
data RequiredActivatedType = RequiredActivatedType'
  { -- | The type name of the public extension.
    --
    -- If you specified a @TypeNameAlias@ when enabling the extension in this
    -- account and region, CloudFormation treats that alias as the extension\'s
    -- type name within the account and region, not the type name of the public
    -- extension. For more information, see
    -- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/registry-public.html#registry-public-enable-alias Specifying aliases to refer to extensions>
    -- in the /CloudFormation User Guide/.
    RequiredActivatedType -> Maybe Text
originalTypeName :: Prelude.Maybe Prelude.Text,
    -- | The publisher ID of the extension publisher.
    RequiredActivatedType -> Maybe Text
publisherId :: Prelude.Maybe Prelude.Text,
    -- | A list of the major versions of the extension type that the macro
    -- supports.
    RequiredActivatedType -> Maybe [Natural]
supportedMajorVersions :: Prelude.Maybe [Prelude.Natural],
    -- | An alias assigned to the public extension, in this account and region.
    -- If you specify an alias for the extension, CloudFormation treats the
    -- alias as the extension type name within this account and region. You
    -- must use the alias to refer to the extension in your templates, API
    -- calls, and CloudFormation console.
    RequiredActivatedType -> Maybe Text
typeNameAlias :: Prelude.Maybe Prelude.Text
  }
  deriving (RequiredActivatedType -> RequiredActivatedType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RequiredActivatedType -> RequiredActivatedType -> Bool
$c/= :: RequiredActivatedType -> RequiredActivatedType -> Bool
== :: RequiredActivatedType -> RequiredActivatedType -> Bool
$c== :: RequiredActivatedType -> RequiredActivatedType -> Bool
Prelude.Eq, ReadPrec [RequiredActivatedType]
ReadPrec RequiredActivatedType
Int -> ReadS RequiredActivatedType
ReadS [RequiredActivatedType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RequiredActivatedType]
$creadListPrec :: ReadPrec [RequiredActivatedType]
readPrec :: ReadPrec RequiredActivatedType
$creadPrec :: ReadPrec RequiredActivatedType
readList :: ReadS [RequiredActivatedType]
$creadList :: ReadS [RequiredActivatedType]
readsPrec :: Int -> ReadS RequiredActivatedType
$creadsPrec :: Int -> ReadS RequiredActivatedType
Prelude.Read, Int -> RequiredActivatedType -> ShowS
[RequiredActivatedType] -> ShowS
RequiredActivatedType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RequiredActivatedType] -> ShowS
$cshowList :: [RequiredActivatedType] -> ShowS
show :: RequiredActivatedType -> String
$cshow :: RequiredActivatedType -> String
showsPrec :: Int -> RequiredActivatedType -> ShowS
$cshowsPrec :: Int -> RequiredActivatedType -> ShowS
Prelude.Show, forall x. Rep RequiredActivatedType x -> RequiredActivatedType
forall x. RequiredActivatedType -> Rep RequiredActivatedType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RequiredActivatedType x -> RequiredActivatedType
$cfrom :: forall x. RequiredActivatedType -> Rep RequiredActivatedType x
Prelude.Generic)

-- |
-- Create a value of 'RequiredActivatedType' 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:
--
-- 'originalTypeName', 'requiredActivatedType_originalTypeName' - The type name of the public extension.
--
-- If you specified a @TypeNameAlias@ when enabling the extension in this
-- account and region, CloudFormation treats that alias as the extension\'s
-- type name within the account and region, not the type name of the public
-- extension. For more information, see
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/registry-public.html#registry-public-enable-alias Specifying aliases to refer to extensions>
-- in the /CloudFormation User Guide/.
--
-- 'publisherId', 'requiredActivatedType_publisherId' - The publisher ID of the extension publisher.
--
-- 'supportedMajorVersions', 'requiredActivatedType_supportedMajorVersions' - A list of the major versions of the extension type that the macro
-- supports.
--
-- 'typeNameAlias', 'requiredActivatedType_typeNameAlias' - An alias assigned to the public extension, in this account and region.
-- If you specify an alias for the extension, CloudFormation treats the
-- alias as the extension type name within this account and region. You
-- must use the alias to refer to the extension in your templates, API
-- calls, and CloudFormation console.
newRequiredActivatedType ::
  RequiredActivatedType
newRequiredActivatedType :: RequiredActivatedType
newRequiredActivatedType =
  RequiredActivatedType'
    { $sel:originalTypeName:RequiredActivatedType' :: Maybe Text
originalTypeName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:publisherId:RequiredActivatedType' :: Maybe Text
publisherId = forall a. Maybe a
Prelude.Nothing,
      $sel:supportedMajorVersions:RequiredActivatedType' :: Maybe [Natural]
supportedMajorVersions = forall a. Maybe a
Prelude.Nothing,
      $sel:typeNameAlias:RequiredActivatedType' :: Maybe Text
typeNameAlias = forall a. Maybe a
Prelude.Nothing
    }

-- | The type name of the public extension.
--
-- If you specified a @TypeNameAlias@ when enabling the extension in this
-- account and region, CloudFormation treats that alias as the extension\'s
-- type name within the account and region, not the type name of the public
-- extension. For more information, see
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/registry-public.html#registry-public-enable-alias Specifying aliases to refer to extensions>
-- in the /CloudFormation User Guide/.
requiredActivatedType_originalTypeName :: Lens.Lens' RequiredActivatedType (Prelude.Maybe Prelude.Text)
requiredActivatedType_originalTypeName :: Lens' RequiredActivatedType (Maybe Text)
requiredActivatedType_originalTypeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequiredActivatedType' {Maybe Text
originalTypeName :: Maybe Text
$sel:originalTypeName:RequiredActivatedType' :: RequiredActivatedType -> Maybe Text
originalTypeName} -> Maybe Text
originalTypeName) (\s :: RequiredActivatedType
s@RequiredActivatedType' {} Maybe Text
a -> RequiredActivatedType
s {$sel:originalTypeName:RequiredActivatedType' :: Maybe Text
originalTypeName = Maybe Text
a} :: RequiredActivatedType)

-- | The publisher ID of the extension publisher.
requiredActivatedType_publisherId :: Lens.Lens' RequiredActivatedType (Prelude.Maybe Prelude.Text)
requiredActivatedType_publisherId :: Lens' RequiredActivatedType (Maybe Text)
requiredActivatedType_publisherId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequiredActivatedType' {Maybe Text
publisherId :: Maybe Text
$sel:publisherId:RequiredActivatedType' :: RequiredActivatedType -> Maybe Text
publisherId} -> Maybe Text
publisherId) (\s :: RequiredActivatedType
s@RequiredActivatedType' {} Maybe Text
a -> RequiredActivatedType
s {$sel:publisherId:RequiredActivatedType' :: Maybe Text
publisherId = Maybe Text
a} :: RequiredActivatedType)

-- | A list of the major versions of the extension type that the macro
-- supports.
requiredActivatedType_supportedMajorVersions :: Lens.Lens' RequiredActivatedType (Prelude.Maybe [Prelude.Natural])
requiredActivatedType_supportedMajorVersions :: Lens' RequiredActivatedType (Maybe [Natural])
requiredActivatedType_supportedMajorVersions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequiredActivatedType' {Maybe [Natural]
supportedMajorVersions :: Maybe [Natural]
$sel:supportedMajorVersions:RequiredActivatedType' :: RequiredActivatedType -> Maybe [Natural]
supportedMajorVersions} -> Maybe [Natural]
supportedMajorVersions) (\s :: RequiredActivatedType
s@RequiredActivatedType' {} Maybe [Natural]
a -> RequiredActivatedType
s {$sel:supportedMajorVersions:RequiredActivatedType' :: Maybe [Natural]
supportedMajorVersions = Maybe [Natural]
a} :: RequiredActivatedType) 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

-- | An alias assigned to the public extension, in this account and region.
-- If you specify an alias for the extension, CloudFormation treats the
-- alias as the extension type name within this account and region. You
-- must use the alias to refer to the extension in your templates, API
-- calls, and CloudFormation console.
requiredActivatedType_typeNameAlias :: Lens.Lens' RequiredActivatedType (Prelude.Maybe Prelude.Text)
requiredActivatedType_typeNameAlias :: Lens' RequiredActivatedType (Maybe Text)
requiredActivatedType_typeNameAlias = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequiredActivatedType' {Maybe Text
typeNameAlias :: Maybe Text
$sel:typeNameAlias:RequiredActivatedType' :: RequiredActivatedType -> Maybe Text
typeNameAlias} -> Maybe Text
typeNameAlias) (\s :: RequiredActivatedType
s@RequiredActivatedType' {} Maybe Text
a -> RequiredActivatedType
s {$sel:typeNameAlias:RequiredActivatedType' :: Maybe Text
typeNameAlias = Maybe Text
a} :: RequiredActivatedType)

instance Data.FromXML RequiredActivatedType where
  parseXML :: [Node] -> Either String RequiredActivatedType
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe [Natural]
-> Maybe Text
-> RequiredActivatedType
RequiredActivatedType'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"OriginalTypeName")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"PublisherId")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
                      forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"SupportedMajorVersions"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                  )
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"TypeNameAlias")

instance Prelude.Hashable RequiredActivatedType where
  hashWithSalt :: Int -> RequiredActivatedType -> Int
hashWithSalt Int
_salt RequiredActivatedType' {Maybe [Natural]
Maybe Text
typeNameAlias :: Maybe Text
supportedMajorVersions :: Maybe [Natural]
publisherId :: Maybe Text
originalTypeName :: Maybe Text
$sel:typeNameAlias:RequiredActivatedType' :: RequiredActivatedType -> Maybe Text
$sel:supportedMajorVersions:RequiredActivatedType' :: RequiredActivatedType -> Maybe [Natural]
$sel:publisherId:RequiredActivatedType' :: RequiredActivatedType -> Maybe Text
$sel:originalTypeName:RequiredActivatedType' :: RequiredActivatedType -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
originalTypeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
publisherId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Natural]
supportedMajorVersions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
typeNameAlias

instance Prelude.NFData RequiredActivatedType where
  rnf :: RequiredActivatedType -> ()
rnf RequiredActivatedType' {Maybe [Natural]
Maybe Text
typeNameAlias :: Maybe Text
supportedMajorVersions :: Maybe [Natural]
publisherId :: Maybe Text
originalTypeName :: Maybe Text
$sel:typeNameAlias:RequiredActivatedType' :: RequiredActivatedType -> Maybe Text
$sel:supportedMajorVersions:RequiredActivatedType' :: RequiredActivatedType -> Maybe [Natural]
$sel:publisherId:RequiredActivatedType' :: RequiredActivatedType -> Maybe Text
$sel:originalTypeName:RequiredActivatedType' :: RequiredActivatedType -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
originalTypeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
publisherId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Natural]
supportedMajorVersions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
typeNameAlias