{-# 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.ServiceCatalog.Types.ProvisioningArtifactPreferences
-- 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.ServiceCatalog.Types.ProvisioningArtifactPreferences where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The user-defined preferences that will be applied during product
-- provisioning, unless overridden by @ProvisioningPreferences@ or
-- @UpdateProvisioningPreferences@.
--
-- For more information on maximum concurrent accounts and failure
-- tolerance, see
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-concepts.html#stackset-ops-options Stack set operation options>
-- in the /AWS CloudFormation User Guide/.
--
-- /See:/ 'newProvisioningArtifactPreferences' smart constructor.
data ProvisioningArtifactPreferences = ProvisioningArtifactPreferences'
  { -- | One or more AWS Regions where stack instances are deployed from the
    -- stack set. These regions can be scoped in
    -- @ProvisioningPreferences$StackSetRegions@ and
    -- @UpdateProvisioningPreferences$StackSetRegions@.
    --
    -- Applicable only to a @CFN_STACKSET@ provisioned product type.
    ProvisioningArtifactPreferences -> Maybe [Text]
stackSetRegions :: Prelude.Maybe [Prelude.Text],
    -- | One or more AWS accounts where stack instances are deployed from the
    -- stack set. These accounts can be scoped in
    -- @ProvisioningPreferences$StackSetAccounts@ and
    -- @UpdateProvisioningPreferences$StackSetAccounts@.
    --
    -- Applicable only to a @CFN_STACKSET@ provisioned product type.
    ProvisioningArtifactPreferences -> Maybe [Text]
stackSetAccounts :: Prelude.Maybe [Prelude.Text]
  }
  deriving (ProvisioningArtifactPreferences
-> ProvisioningArtifactPreferences -> Bool
(ProvisioningArtifactPreferences
 -> ProvisioningArtifactPreferences -> Bool)
-> (ProvisioningArtifactPreferences
    -> ProvisioningArtifactPreferences -> Bool)
-> Eq ProvisioningArtifactPreferences
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProvisioningArtifactPreferences
-> ProvisioningArtifactPreferences -> Bool
$c/= :: ProvisioningArtifactPreferences
-> ProvisioningArtifactPreferences -> Bool
== :: ProvisioningArtifactPreferences
-> ProvisioningArtifactPreferences -> Bool
$c== :: ProvisioningArtifactPreferences
-> ProvisioningArtifactPreferences -> Bool
Prelude.Eq, ReadPrec [ProvisioningArtifactPreferences]
ReadPrec ProvisioningArtifactPreferences
Int -> ReadS ProvisioningArtifactPreferences
ReadS [ProvisioningArtifactPreferences]
(Int -> ReadS ProvisioningArtifactPreferences)
-> ReadS [ProvisioningArtifactPreferences]
-> ReadPrec ProvisioningArtifactPreferences
-> ReadPrec [ProvisioningArtifactPreferences]
-> Read ProvisioningArtifactPreferences
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProvisioningArtifactPreferences]
$creadListPrec :: ReadPrec [ProvisioningArtifactPreferences]
readPrec :: ReadPrec ProvisioningArtifactPreferences
$creadPrec :: ReadPrec ProvisioningArtifactPreferences
readList :: ReadS [ProvisioningArtifactPreferences]
$creadList :: ReadS [ProvisioningArtifactPreferences]
readsPrec :: Int -> ReadS ProvisioningArtifactPreferences
$creadsPrec :: Int -> ReadS ProvisioningArtifactPreferences
Prelude.Read, Int -> ProvisioningArtifactPreferences -> ShowS
[ProvisioningArtifactPreferences] -> ShowS
ProvisioningArtifactPreferences -> String
(Int -> ProvisioningArtifactPreferences -> ShowS)
-> (ProvisioningArtifactPreferences -> String)
-> ([ProvisioningArtifactPreferences] -> ShowS)
-> Show ProvisioningArtifactPreferences
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProvisioningArtifactPreferences] -> ShowS
$cshowList :: [ProvisioningArtifactPreferences] -> ShowS
show :: ProvisioningArtifactPreferences -> String
$cshow :: ProvisioningArtifactPreferences -> String
showsPrec :: Int -> ProvisioningArtifactPreferences -> ShowS
$cshowsPrec :: Int -> ProvisioningArtifactPreferences -> ShowS
Prelude.Show, (forall x.
 ProvisioningArtifactPreferences
 -> Rep ProvisioningArtifactPreferences x)
-> (forall x.
    Rep ProvisioningArtifactPreferences x
    -> ProvisioningArtifactPreferences)
-> Generic ProvisioningArtifactPreferences
forall x.
Rep ProvisioningArtifactPreferences x
-> ProvisioningArtifactPreferences
forall x.
ProvisioningArtifactPreferences
-> Rep ProvisioningArtifactPreferences x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ProvisioningArtifactPreferences x
-> ProvisioningArtifactPreferences
$cfrom :: forall x.
ProvisioningArtifactPreferences
-> Rep ProvisioningArtifactPreferences x
Prelude.Generic)

-- |
-- Create a value of 'ProvisioningArtifactPreferences' 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:
--
-- 'stackSetRegions', 'provisioningArtifactPreferences_stackSetRegions' - One or more AWS Regions where stack instances are deployed from the
-- stack set. These regions can be scoped in
-- @ProvisioningPreferences$StackSetRegions@ and
-- @UpdateProvisioningPreferences$StackSetRegions@.
--
-- Applicable only to a @CFN_STACKSET@ provisioned product type.
--
-- 'stackSetAccounts', 'provisioningArtifactPreferences_stackSetAccounts' - One or more AWS accounts where stack instances are deployed from the
-- stack set. These accounts can be scoped in
-- @ProvisioningPreferences$StackSetAccounts@ and
-- @UpdateProvisioningPreferences$StackSetAccounts@.
--
-- Applicable only to a @CFN_STACKSET@ provisioned product type.
newProvisioningArtifactPreferences ::
  ProvisioningArtifactPreferences
newProvisioningArtifactPreferences :: ProvisioningArtifactPreferences
newProvisioningArtifactPreferences =
  ProvisioningArtifactPreferences' :: Maybe [Text] -> Maybe [Text] -> ProvisioningArtifactPreferences
ProvisioningArtifactPreferences'
    { $sel:stackSetRegions:ProvisioningArtifactPreferences' :: Maybe [Text]
stackSetRegions =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:stackSetAccounts:ProvisioningArtifactPreferences' :: Maybe [Text]
stackSetAccounts = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | One or more AWS Regions where stack instances are deployed from the
-- stack set. These regions can be scoped in
-- @ProvisioningPreferences$StackSetRegions@ and
-- @UpdateProvisioningPreferences$StackSetRegions@.
--
-- Applicable only to a @CFN_STACKSET@ provisioned product type.
provisioningArtifactPreferences_stackSetRegions :: Lens.Lens' ProvisioningArtifactPreferences (Prelude.Maybe [Prelude.Text])
provisioningArtifactPreferences_stackSetRegions :: (Maybe [Text] -> f (Maybe [Text]))
-> ProvisioningArtifactPreferences
-> f ProvisioningArtifactPreferences
provisioningArtifactPreferences_stackSetRegions = (ProvisioningArtifactPreferences -> Maybe [Text])
-> (ProvisioningArtifactPreferences
    -> Maybe [Text] -> ProvisioningArtifactPreferences)
-> Lens
     ProvisioningArtifactPreferences
     ProvisioningArtifactPreferences
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisioningArtifactPreferences' {Maybe [Text]
stackSetRegions :: Maybe [Text]
$sel:stackSetRegions:ProvisioningArtifactPreferences' :: ProvisioningArtifactPreferences -> Maybe [Text]
stackSetRegions} -> Maybe [Text]
stackSetRegions) (\s :: ProvisioningArtifactPreferences
s@ProvisioningArtifactPreferences' {} Maybe [Text]
a -> ProvisioningArtifactPreferences
s {$sel:stackSetRegions:ProvisioningArtifactPreferences' :: Maybe [Text]
stackSetRegions = Maybe [Text]
a} :: ProvisioningArtifactPreferences) ((Maybe [Text] -> f (Maybe [Text]))
 -> ProvisioningArtifactPreferences
 -> f ProvisioningArtifactPreferences)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ProvisioningArtifactPreferences
-> f ProvisioningArtifactPreferences
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | One or more AWS accounts where stack instances are deployed from the
-- stack set. These accounts can be scoped in
-- @ProvisioningPreferences$StackSetAccounts@ and
-- @UpdateProvisioningPreferences$StackSetAccounts@.
--
-- Applicable only to a @CFN_STACKSET@ provisioned product type.
provisioningArtifactPreferences_stackSetAccounts :: Lens.Lens' ProvisioningArtifactPreferences (Prelude.Maybe [Prelude.Text])
provisioningArtifactPreferences_stackSetAccounts :: (Maybe [Text] -> f (Maybe [Text]))
-> ProvisioningArtifactPreferences
-> f ProvisioningArtifactPreferences
provisioningArtifactPreferences_stackSetAccounts = (ProvisioningArtifactPreferences -> Maybe [Text])
-> (ProvisioningArtifactPreferences
    -> Maybe [Text] -> ProvisioningArtifactPreferences)
-> Lens
     ProvisioningArtifactPreferences
     ProvisioningArtifactPreferences
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProvisioningArtifactPreferences' {Maybe [Text]
stackSetAccounts :: Maybe [Text]
$sel:stackSetAccounts:ProvisioningArtifactPreferences' :: ProvisioningArtifactPreferences -> Maybe [Text]
stackSetAccounts} -> Maybe [Text]
stackSetAccounts) (\s :: ProvisioningArtifactPreferences
s@ProvisioningArtifactPreferences' {} Maybe [Text]
a -> ProvisioningArtifactPreferences
s {$sel:stackSetAccounts:ProvisioningArtifactPreferences' :: Maybe [Text]
stackSetAccounts = Maybe [Text]
a} :: ProvisioningArtifactPreferences) ((Maybe [Text] -> f (Maybe [Text]))
 -> ProvisioningArtifactPreferences
 -> f ProvisioningArtifactPreferences)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ProvisioningArtifactPreferences
-> f ProvisioningArtifactPreferences
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.FromJSON
    ProvisioningArtifactPreferences
  where
  parseJSON :: Value -> Parser ProvisioningArtifactPreferences
parseJSON =
    String
-> (Object -> Parser ProvisioningArtifactPreferences)
-> Value
-> Parser ProvisioningArtifactPreferences
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProvisioningArtifactPreferences"
      ( \Object
x ->
          Maybe [Text] -> Maybe [Text] -> ProvisioningArtifactPreferences
ProvisioningArtifactPreferences'
            (Maybe [Text] -> Maybe [Text] -> ProvisioningArtifactPreferences)
-> Parser (Maybe [Text])
-> Parser (Maybe [Text] -> ProvisioningArtifactPreferences)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StackSetRegions"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe [Text] -> ProvisioningArtifactPreferences)
-> Parser (Maybe [Text]) -> Parser ProvisioningArtifactPreferences
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StackSetAccounts"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance
  Prelude.Hashable
    ProvisioningArtifactPreferences

instance
  Prelude.NFData
    ProvisioningArtifactPreferences