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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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,
    -- | 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,
    -- | A list of the major versions of the extension type that the macro
    -- supports.
    RequiredActivatedType -> Maybe [Natural]
supportedMajorVersions :: Prelude.Maybe [Prelude.Natural],
    -- | The publisher ID of the extension publisher.
    RequiredActivatedType -> Maybe Text
publisherId :: Prelude.Maybe Prelude.Text
  }
  deriving (RequiredActivatedType -> RequiredActivatedType -> Bool
(RequiredActivatedType -> RequiredActivatedType -> Bool)
-> (RequiredActivatedType -> RequiredActivatedType -> Bool)
-> Eq RequiredActivatedType
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]
(Int -> ReadS RequiredActivatedType)
-> ReadS [RequiredActivatedType]
-> ReadPrec RequiredActivatedType
-> ReadPrec [RequiredActivatedType]
-> Read 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
(Int -> RequiredActivatedType -> ShowS)
-> (RequiredActivatedType -> String)
-> ([RequiredActivatedType] -> ShowS)
-> Show RequiredActivatedType
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. RequiredActivatedType -> Rep RequiredActivatedType x)
-> (forall x. Rep RequiredActivatedType x -> RequiredActivatedType)
-> Generic RequiredActivatedType
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/.
--
-- '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.
--
-- 'supportedMajorVersions', 'requiredActivatedType_supportedMajorVersions' - A list of the major versions of the extension type that the macro
-- supports.
--
-- 'publisherId', 'requiredActivatedType_publisherId' - The publisher ID of the extension publisher.
newRequiredActivatedType ::
  RequiredActivatedType
newRequiredActivatedType :: RequiredActivatedType
newRequiredActivatedType =
  RequiredActivatedType' :: Maybe Text
-> Maybe Text
-> Maybe [Natural]
-> Maybe Text
-> RequiredActivatedType
RequiredActivatedType'
    { $sel:originalTypeName:RequiredActivatedType' :: Maybe Text
originalTypeName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:typeNameAlias:RequiredActivatedType' :: Maybe Text
typeNameAlias = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:supportedMajorVersions:RequiredActivatedType' :: Maybe [Natural]
supportedMajorVersions = Maybe [Natural]
forall a. Maybe a
Prelude.Nothing,
      $sel:publisherId:RequiredActivatedType' :: Maybe Text
publisherId = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> RequiredActivatedType -> f RequiredActivatedType
requiredActivatedType_originalTypeName = (RequiredActivatedType -> Maybe Text)
-> (RequiredActivatedType -> Maybe Text -> RequiredActivatedType)
-> Lens
     RequiredActivatedType
     RequiredActivatedType
     (Maybe Text)
     (Maybe Text)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> RequiredActivatedType -> f RequiredActivatedType
requiredActivatedType_typeNameAlias = (RequiredActivatedType -> Maybe Text)
-> (RequiredActivatedType -> Maybe Text -> RequiredActivatedType)
-> Lens
     RequiredActivatedType
     RequiredActivatedType
     (Maybe Text)
     (Maybe Text)
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)

-- | 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 :: (Maybe [Natural] -> f (Maybe [Natural]))
-> RequiredActivatedType -> f RequiredActivatedType
requiredActivatedType_supportedMajorVersions = (RequiredActivatedType -> Maybe [Natural])
-> (RequiredActivatedType
    -> Maybe [Natural] -> RequiredActivatedType)
-> Lens
     RequiredActivatedType
     RequiredActivatedType
     (Maybe [Natural])
     (Maybe [Natural])
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) ((Maybe [Natural] -> f (Maybe [Natural]))
 -> RequiredActivatedType -> f RequiredActivatedType)
-> ((Maybe [Natural] -> f (Maybe [Natural]))
    -> Maybe [Natural] -> f (Maybe [Natural]))
-> (Maybe [Natural] -> f (Maybe [Natural]))
-> RequiredActivatedType
-> f RequiredActivatedType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Natural] [Natural] [Natural] [Natural]
-> Iso
     (Maybe [Natural])
     (Maybe [Natural])
     (Maybe [Natural])
     (Maybe [Natural])
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 AnIso [Natural] [Natural] [Natural] [Natural]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The publisher ID of the extension publisher.
requiredActivatedType_publisherId :: Lens.Lens' RequiredActivatedType (Prelude.Maybe Prelude.Text)
requiredActivatedType_publisherId :: (Maybe Text -> f (Maybe Text))
-> RequiredActivatedType -> f RequiredActivatedType
requiredActivatedType_publisherId = (RequiredActivatedType -> Maybe Text)
-> (RequiredActivatedType -> Maybe Text -> RequiredActivatedType)
-> Lens
     RequiredActivatedType
     RequiredActivatedType
     (Maybe Text)
     (Maybe Text)
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)

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

instance Prelude.Hashable RequiredActivatedType

instance Prelude.NFData RequiredActivatedType