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

import Amazonka.CloudFormation.Types.RegionConcurrencyType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The user-specified preferences for how CloudFormation performs a stack
-- set operation.
--
-- 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>.
--
-- /See:/ 'newStackSetOperationPreferences' smart constructor.
data StackSetOperationPreferences = StackSetOperationPreferences'
  { -- | The order of the Regions in where you want to perform the stack
    -- operation.
    StackSetOperationPreferences -> Maybe [Text]
regionOrder :: Prelude.Maybe [Prelude.Text],
    -- | The maximum number of accounts in which to perform this operation at one
    -- time. This is dependent on the value of @FailureToleranceCount@.
    -- @MaxConcurrentCount@ is at most one more than the
    -- @FailureToleranceCount@.
    --
    -- Note that this setting lets you specify the /maximum/ for operations.
    -- For large deployments, under certain circumstances the actual number of
    -- accounts acted upon concurrently may be lower due to service throttling.
    --
    -- Conditional: You must specify either @MaxConcurrentCount@ or
    -- @MaxConcurrentPercentage@, but not both.
    --
    -- By default, @1@ is specified.
    StackSetOperationPreferences -> Maybe Natural
maxConcurrentCount :: Prelude.Maybe Prelude.Natural,
    -- | The maximum percentage of accounts in which to perform this operation at
    -- one time.
    --
    -- When calculating the number of accounts based on the specified
    -- percentage, CloudFormation rounds down to the next whole number. This is
    -- true except in cases where rounding down would result is zero. In this
    -- case, CloudFormation sets the number as one instead.
    --
    -- Note that this setting lets you specify the /maximum/ for operations.
    -- For large deployments, under certain circumstances the actual number of
    -- accounts acted upon concurrently may be lower due to service throttling.
    --
    -- Conditional: You must specify either @MaxConcurrentCount@ or
    -- @MaxConcurrentPercentage@, but not both.
    --
    -- By default, @1@ is specified.
    StackSetOperationPreferences -> Maybe Natural
maxConcurrentPercentage :: Prelude.Maybe Prelude.Natural,
    -- | The number of accounts, per Region, for which this operation can fail
    -- before CloudFormation stops the operation in that Region. If the
    -- operation is stopped in a Region, CloudFormation doesn\'t attempt the
    -- operation in any subsequent Regions.
    --
    -- Conditional: You must specify either @FailureToleranceCount@ or
    -- @FailureTolerancePercentage@ (but not both).
    --
    -- By default, @0@ is specified.
    StackSetOperationPreferences -> Maybe Natural
failureToleranceCount :: Prelude.Maybe Prelude.Natural,
    -- | The concurrency type of deploying StackSets operations in Regions, could
    -- be in parallel or one Region at a time.
    StackSetOperationPreferences -> Maybe RegionConcurrencyType
regionConcurrencyType :: Prelude.Maybe RegionConcurrencyType,
    -- | The percentage of accounts, per Region, for which this stack operation
    -- can fail before CloudFormation stops the operation in that Region. If
    -- the operation is stopped in a Region, CloudFormation doesn\'t attempt
    -- the operation in any subsequent Regions.
    --
    -- When calculating the number of accounts based on the specified
    -- percentage, CloudFormation rounds /down/ to the next whole number.
    --
    -- Conditional: You must specify either @FailureToleranceCount@ or
    -- @FailureTolerancePercentage@, but not both.
    --
    -- By default, @0@ is specified.
    StackSetOperationPreferences -> Maybe Natural
failureTolerancePercentage :: Prelude.Maybe Prelude.Natural
  }
  deriving (StackSetOperationPreferences
-> StackSetOperationPreferences -> Bool
(StackSetOperationPreferences
 -> StackSetOperationPreferences -> Bool)
-> (StackSetOperationPreferences
    -> StackSetOperationPreferences -> Bool)
-> Eq StackSetOperationPreferences
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StackSetOperationPreferences
-> StackSetOperationPreferences -> Bool
$c/= :: StackSetOperationPreferences
-> StackSetOperationPreferences -> Bool
== :: StackSetOperationPreferences
-> StackSetOperationPreferences -> Bool
$c== :: StackSetOperationPreferences
-> StackSetOperationPreferences -> Bool
Prelude.Eq, ReadPrec [StackSetOperationPreferences]
ReadPrec StackSetOperationPreferences
Int -> ReadS StackSetOperationPreferences
ReadS [StackSetOperationPreferences]
(Int -> ReadS StackSetOperationPreferences)
-> ReadS [StackSetOperationPreferences]
-> ReadPrec StackSetOperationPreferences
-> ReadPrec [StackSetOperationPreferences]
-> Read StackSetOperationPreferences
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StackSetOperationPreferences]
$creadListPrec :: ReadPrec [StackSetOperationPreferences]
readPrec :: ReadPrec StackSetOperationPreferences
$creadPrec :: ReadPrec StackSetOperationPreferences
readList :: ReadS [StackSetOperationPreferences]
$creadList :: ReadS [StackSetOperationPreferences]
readsPrec :: Int -> ReadS StackSetOperationPreferences
$creadsPrec :: Int -> ReadS StackSetOperationPreferences
Prelude.Read, Int -> StackSetOperationPreferences -> ShowS
[StackSetOperationPreferences] -> ShowS
StackSetOperationPreferences -> String
(Int -> StackSetOperationPreferences -> ShowS)
-> (StackSetOperationPreferences -> String)
-> ([StackSetOperationPreferences] -> ShowS)
-> Show StackSetOperationPreferences
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StackSetOperationPreferences] -> ShowS
$cshowList :: [StackSetOperationPreferences] -> ShowS
show :: StackSetOperationPreferences -> String
$cshow :: StackSetOperationPreferences -> String
showsPrec :: Int -> StackSetOperationPreferences -> ShowS
$cshowsPrec :: Int -> StackSetOperationPreferences -> ShowS
Prelude.Show, (forall x.
 StackSetOperationPreferences -> Rep StackSetOperationPreferences x)
-> (forall x.
    Rep StackSetOperationPreferences x -> StackSetOperationPreferences)
-> Generic StackSetOperationPreferences
forall x.
Rep StackSetOperationPreferences x -> StackSetOperationPreferences
forall x.
StackSetOperationPreferences -> Rep StackSetOperationPreferences x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StackSetOperationPreferences x -> StackSetOperationPreferences
$cfrom :: forall x.
StackSetOperationPreferences -> Rep StackSetOperationPreferences x
Prelude.Generic)

-- |
-- Create a value of 'StackSetOperationPreferences' 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:
--
-- 'regionOrder', 'stackSetOperationPreferences_regionOrder' - The order of the Regions in where you want to perform the stack
-- operation.
--
-- 'maxConcurrentCount', 'stackSetOperationPreferences_maxConcurrentCount' - The maximum number of accounts in which to perform this operation at one
-- time. This is dependent on the value of @FailureToleranceCount@.
-- @MaxConcurrentCount@ is at most one more than the
-- @FailureToleranceCount@.
--
-- Note that this setting lets you specify the /maximum/ for operations.
-- For large deployments, under certain circumstances the actual number of
-- accounts acted upon concurrently may be lower due to service throttling.
--
-- Conditional: You must specify either @MaxConcurrentCount@ or
-- @MaxConcurrentPercentage@, but not both.
--
-- By default, @1@ is specified.
--
-- 'maxConcurrentPercentage', 'stackSetOperationPreferences_maxConcurrentPercentage' - The maximum percentage of accounts in which to perform this operation at
-- one time.
--
-- When calculating the number of accounts based on the specified
-- percentage, CloudFormation rounds down to the next whole number. This is
-- true except in cases where rounding down would result is zero. In this
-- case, CloudFormation sets the number as one instead.
--
-- Note that this setting lets you specify the /maximum/ for operations.
-- For large deployments, under certain circumstances the actual number of
-- accounts acted upon concurrently may be lower due to service throttling.
--
-- Conditional: You must specify either @MaxConcurrentCount@ or
-- @MaxConcurrentPercentage@, but not both.
--
-- By default, @1@ is specified.
--
-- 'failureToleranceCount', 'stackSetOperationPreferences_failureToleranceCount' - The number of accounts, per Region, for which this operation can fail
-- before CloudFormation stops the operation in that Region. If the
-- operation is stopped in a Region, CloudFormation doesn\'t attempt the
-- operation in any subsequent Regions.
--
-- Conditional: You must specify either @FailureToleranceCount@ or
-- @FailureTolerancePercentage@ (but not both).
--
-- By default, @0@ is specified.
--
-- 'regionConcurrencyType', 'stackSetOperationPreferences_regionConcurrencyType' - The concurrency type of deploying StackSets operations in Regions, could
-- be in parallel or one Region at a time.
--
-- 'failureTolerancePercentage', 'stackSetOperationPreferences_failureTolerancePercentage' - The percentage of accounts, per Region, for which this stack operation
-- can fail before CloudFormation stops the operation in that Region. If
-- the operation is stopped in a Region, CloudFormation doesn\'t attempt
-- the operation in any subsequent Regions.
--
-- When calculating the number of accounts based on the specified
-- percentage, CloudFormation rounds /down/ to the next whole number.
--
-- Conditional: You must specify either @FailureToleranceCount@ or
-- @FailureTolerancePercentage@, but not both.
--
-- By default, @0@ is specified.
newStackSetOperationPreferences ::
  StackSetOperationPreferences
newStackSetOperationPreferences :: StackSetOperationPreferences
newStackSetOperationPreferences =
  StackSetOperationPreferences' :: Maybe [Text]
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe RegionConcurrencyType
-> Maybe Natural
-> StackSetOperationPreferences
StackSetOperationPreferences'
    { $sel:regionOrder:StackSetOperationPreferences' :: Maybe [Text]
regionOrder =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:maxConcurrentCount:StackSetOperationPreferences' :: Maybe Natural
maxConcurrentCount = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:maxConcurrentPercentage:StackSetOperationPreferences' :: Maybe Natural
maxConcurrentPercentage = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:failureToleranceCount:StackSetOperationPreferences' :: Maybe Natural
failureToleranceCount = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:regionConcurrencyType:StackSetOperationPreferences' :: Maybe RegionConcurrencyType
regionConcurrencyType = Maybe RegionConcurrencyType
forall a. Maybe a
Prelude.Nothing,
      $sel:failureTolerancePercentage:StackSetOperationPreferences' :: Maybe Natural
failureTolerancePercentage = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The order of the Regions in where you want to perform the stack
-- operation.
stackSetOperationPreferences_regionOrder :: Lens.Lens' StackSetOperationPreferences (Prelude.Maybe [Prelude.Text])
stackSetOperationPreferences_regionOrder :: (Maybe [Text] -> f (Maybe [Text]))
-> StackSetOperationPreferences -> f StackSetOperationPreferences
stackSetOperationPreferences_regionOrder = (StackSetOperationPreferences -> Maybe [Text])
-> (StackSetOperationPreferences
    -> Maybe [Text] -> StackSetOperationPreferences)
-> Lens
     StackSetOperationPreferences
     StackSetOperationPreferences
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSetOperationPreferences' {Maybe [Text]
regionOrder :: Maybe [Text]
$sel:regionOrder:StackSetOperationPreferences' :: StackSetOperationPreferences -> Maybe [Text]
regionOrder} -> Maybe [Text]
regionOrder) (\s :: StackSetOperationPreferences
s@StackSetOperationPreferences' {} Maybe [Text]
a -> StackSetOperationPreferences
s {$sel:regionOrder:StackSetOperationPreferences' :: Maybe [Text]
regionOrder = Maybe [Text]
a} :: StackSetOperationPreferences) ((Maybe [Text] -> f (Maybe [Text]))
 -> StackSetOperationPreferences -> f StackSetOperationPreferences)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> StackSetOperationPreferences
-> f StackSetOperationPreferences
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

-- | The maximum number of accounts in which to perform this operation at one
-- time. This is dependent on the value of @FailureToleranceCount@.
-- @MaxConcurrentCount@ is at most one more than the
-- @FailureToleranceCount@.
--
-- Note that this setting lets you specify the /maximum/ for operations.
-- For large deployments, under certain circumstances the actual number of
-- accounts acted upon concurrently may be lower due to service throttling.
--
-- Conditional: You must specify either @MaxConcurrentCount@ or
-- @MaxConcurrentPercentage@, but not both.
--
-- By default, @1@ is specified.
stackSetOperationPreferences_maxConcurrentCount :: Lens.Lens' StackSetOperationPreferences (Prelude.Maybe Prelude.Natural)
stackSetOperationPreferences_maxConcurrentCount :: (Maybe Natural -> f (Maybe Natural))
-> StackSetOperationPreferences -> f StackSetOperationPreferences
stackSetOperationPreferences_maxConcurrentCount = (StackSetOperationPreferences -> Maybe Natural)
-> (StackSetOperationPreferences
    -> Maybe Natural -> StackSetOperationPreferences)
-> Lens
     StackSetOperationPreferences
     StackSetOperationPreferences
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSetOperationPreferences' {Maybe Natural
maxConcurrentCount :: Maybe Natural
$sel:maxConcurrentCount:StackSetOperationPreferences' :: StackSetOperationPreferences -> Maybe Natural
maxConcurrentCount} -> Maybe Natural
maxConcurrentCount) (\s :: StackSetOperationPreferences
s@StackSetOperationPreferences' {} Maybe Natural
a -> StackSetOperationPreferences
s {$sel:maxConcurrentCount:StackSetOperationPreferences' :: Maybe Natural
maxConcurrentCount = Maybe Natural
a} :: StackSetOperationPreferences)

-- | The maximum percentage of accounts in which to perform this operation at
-- one time.
--
-- When calculating the number of accounts based on the specified
-- percentage, CloudFormation rounds down to the next whole number. This is
-- true except in cases where rounding down would result is zero. In this
-- case, CloudFormation sets the number as one instead.
--
-- Note that this setting lets you specify the /maximum/ for operations.
-- For large deployments, under certain circumstances the actual number of
-- accounts acted upon concurrently may be lower due to service throttling.
--
-- Conditional: You must specify either @MaxConcurrentCount@ or
-- @MaxConcurrentPercentage@, but not both.
--
-- By default, @1@ is specified.
stackSetOperationPreferences_maxConcurrentPercentage :: Lens.Lens' StackSetOperationPreferences (Prelude.Maybe Prelude.Natural)
stackSetOperationPreferences_maxConcurrentPercentage :: (Maybe Natural -> f (Maybe Natural))
-> StackSetOperationPreferences -> f StackSetOperationPreferences
stackSetOperationPreferences_maxConcurrentPercentage = (StackSetOperationPreferences -> Maybe Natural)
-> (StackSetOperationPreferences
    -> Maybe Natural -> StackSetOperationPreferences)
-> Lens
     StackSetOperationPreferences
     StackSetOperationPreferences
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSetOperationPreferences' {Maybe Natural
maxConcurrentPercentage :: Maybe Natural
$sel:maxConcurrentPercentage:StackSetOperationPreferences' :: StackSetOperationPreferences -> Maybe Natural
maxConcurrentPercentage} -> Maybe Natural
maxConcurrentPercentage) (\s :: StackSetOperationPreferences
s@StackSetOperationPreferences' {} Maybe Natural
a -> StackSetOperationPreferences
s {$sel:maxConcurrentPercentage:StackSetOperationPreferences' :: Maybe Natural
maxConcurrentPercentage = Maybe Natural
a} :: StackSetOperationPreferences)

-- | The number of accounts, per Region, for which this operation can fail
-- before CloudFormation stops the operation in that Region. If the
-- operation is stopped in a Region, CloudFormation doesn\'t attempt the
-- operation in any subsequent Regions.
--
-- Conditional: You must specify either @FailureToleranceCount@ or
-- @FailureTolerancePercentage@ (but not both).
--
-- By default, @0@ is specified.
stackSetOperationPreferences_failureToleranceCount :: Lens.Lens' StackSetOperationPreferences (Prelude.Maybe Prelude.Natural)
stackSetOperationPreferences_failureToleranceCount :: (Maybe Natural -> f (Maybe Natural))
-> StackSetOperationPreferences -> f StackSetOperationPreferences
stackSetOperationPreferences_failureToleranceCount = (StackSetOperationPreferences -> Maybe Natural)
-> (StackSetOperationPreferences
    -> Maybe Natural -> StackSetOperationPreferences)
-> Lens
     StackSetOperationPreferences
     StackSetOperationPreferences
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSetOperationPreferences' {Maybe Natural
failureToleranceCount :: Maybe Natural
$sel:failureToleranceCount:StackSetOperationPreferences' :: StackSetOperationPreferences -> Maybe Natural
failureToleranceCount} -> Maybe Natural
failureToleranceCount) (\s :: StackSetOperationPreferences
s@StackSetOperationPreferences' {} Maybe Natural
a -> StackSetOperationPreferences
s {$sel:failureToleranceCount:StackSetOperationPreferences' :: Maybe Natural
failureToleranceCount = Maybe Natural
a} :: StackSetOperationPreferences)

-- | The concurrency type of deploying StackSets operations in Regions, could
-- be in parallel or one Region at a time.
stackSetOperationPreferences_regionConcurrencyType :: Lens.Lens' StackSetOperationPreferences (Prelude.Maybe RegionConcurrencyType)
stackSetOperationPreferences_regionConcurrencyType :: (Maybe RegionConcurrencyType -> f (Maybe RegionConcurrencyType))
-> StackSetOperationPreferences -> f StackSetOperationPreferences
stackSetOperationPreferences_regionConcurrencyType = (StackSetOperationPreferences -> Maybe RegionConcurrencyType)
-> (StackSetOperationPreferences
    -> Maybe RegionConcurrencyType -> StackSetOperationPreferences)
-> Lens
     StackSetOperationPreferences
     StackSetOperationPreferences
     (Maybe RegionConcurrencyType)
     (Maybe RegionConcurrencyType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSetOperationPreferences' {Maybe RegionConcurrencyType
regionConcurrencyType :: Maybe RegionConcurrencyType
$sel:regionConcurrencyType:StackSetOperationPreferences' :: StackSetOperationPreferences -> Maybe RegionConcurrencyType
regionConcurrencyType} -> Maybe RegionConcurrencyType
regionConcurrencyType) (\s :: StackSetOperationPreferences
s@StackSetOperationPreferences' {} Maybe RegionConcurrencyType
a -> StackSetOperationPreferences
s {$sel:regionConcurrencyType:StackSetOperationPreferences' :: Maybe RegionConcurrencyType
regionConcurrencyType = Maybe RegionConcurrencyType
a} :: StackSetOperationPreferences)

-- | The percentage of accounts, per Region, for which this stack operation
-- can fail before CloudFormation stops the operation in that Region. If
-- the operation is stopped in a Region, CloudFormation doesn\'t attempt
-- the operation in any subsequent Regions.
--
-- When calculating the number of accounts based on the specified
-- percentage, CloudFormation rounds /down/ to the next whole number.
--
-- Conditional: You must specify either @FailureToleranceCount@ or
-- @FailureTolerancePercentage@, but not both.
--
-- By default, @0@ is specified.
stackSetOperationPreferences_failureTolerancePercentage :: Lens.Lens' StackSetOperationPreferences (Prelude.Maybe Prelude.Natural)
stackSetOperationPreferences_failureTolerancePercentage :: (Maybe Natural -> f (Maybe Natural))
-> StackSetOperationPreferences -> f StackSetOperationPreferences
stackSetOperationPreferences_failureTolerancePercentage = (StackSetOperationPreferences -> Maybe Natural)
-> (StackSetOperationPreferences
    -> Maybe Natural -> StackSetOperationPreferences)
-> Lens
     StackSetOperationPreferences
     StackSetOperationPreferences
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackSetOperationPreferences' {Maybe Natural
failureTolerancePercentage :: Maybe Natural
$sel:failureTolerancePercentage:StackSetOperationPreferences' :: StackSetOperationPreferences -> Maybe Natural
failureTolerancePercentage} -> Maybe Natural
failureTolerancePercentage) (\s :: StackSetOperationPreferences
s@StackSetOperationPreferences' {} Maybe Natural
a -> StackSetOperationPreferences
s {$sel:failureTolerancePercentage:StackSetOperationPreferences' :: Maybe Natural
failureTolerancePercentage = Maybe Natural
a} :: StackSetOperationPreferences)

instance Core.FromXML StackSetOperationPreferences where
  parseXML :: [Node] -> Either String StackSetOperationPreferences
parseXML [Node]
x =
    Maybe [Text]
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe RegionConcurrencyType
-> Maybe Natural
-> StackSetOperationPreferences
StackSetOperationPreferences'
      (Maybe [Text]
 -> Maybe Natural
 -> Maybe Natural
 -> Maybe Natural
 -> Maybe RegionConcurrencyType
 -> Maybe Natural
 -> StackSetOperationPreferences)
-> Either String (Maybe [Text])
-> Either
     String
     (Maybe Natural
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe RegionConcurrencyType
      -> Maybe Natural
      -> StackSetOperationPreferences)
forall (f :: * -> *) a b. Functor 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
"RegionOrder" 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 [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )
      Either
  String
  (Maybe Natural
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe RegionConcurrencyType
   -> Maybe Natural
   -> StackSetOperationPreferences)
-> Either String (Maybe Natural)
-> Either
     String
     (Maybe Natural
      -> Maybe Natural
      -> Maybe RegionConcurrencyType
      -> Maybe Natural
      -> StackSetOperationPreferences)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Natural)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"MaxConcurrentCount")
      Either
  String
  (Maybe Natural
   -> Maybe Natural
   -> Maybe RegionConcurrencyType
   -> Maybe Natural
   -> StackSetOperationPreferences)
-> Either String (Maybe Natural)
-> Either
     String
     (Maybe Natural
      -> Maybe RegionConcurrencyType
      -> Maybe Natural
      -> StackSetOperationPreferences)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Natural)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"MaxConcurrentPercentage")
      Either
  String
  (Maybe Natural
   -> Maybe RegionConcurrencyType
   -> Maybe Natural
   -> StackSetOperationPreferences)
-> Either String (Maybe Natural)
-> Either
     String
     (Maybe RegionConcurrencyType
      -> Maybe Natural -> StackSetOperationPreferences)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Natural)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"FailureToleranceCount")
      Either
  String
  (Maybe RegionConcurrencyType
   -> Maybe Natural -> StackSetOperationPreferences)
-> Either String (Maybe RegionConcurrencyType)
-> Either String (Maybe Natural -> StackSetOperationPreferences)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe RegionConcurrencyType)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"RegionConcurrencyType")
      Either String (Maybe Natural -> StackSetOperationPreferences)
-> Either String (Maybe Natural)
-> Either String StackSetOperationPreferences
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Natural)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"FailureTolerancePercentage")

instance
  Prelude.Hashable
    StackSetOperationPreferences

instance Prelude.NFData StackSetOperationPreferences

instance Core.ToQuery StackSetOperationPreferences where
  toQuery :: StackSetOperationPreferences -> QueryString
toQuery StackSetOperationPreferences' {Maybe Natural
Maybe [Text]
Maybe RegionConcurrencyType
failureTolerancePercentage :: Maybe Natural
regionConcurrencyType :: Maybe RegionConcurrencyType
failureToleranceCount :: Maybe Natural
maxConcurrentPercentage :: Maybe Natural
maxConcurrentCount :: Maybe Natural
regionOrder :: Maybe [Text]
$sel:failureTolerancePercentage:StackSetOperationPreferences' :: StackSetOperationPreferences -> Maybe Natural
$sel:regionConcurrencyType:StackSetOperationPreferences' :: StackSetOperationPreferences -> Maybe RegionConcurrencyType
$sel:failureToleranceCount:StackSetOperationPreferences' :: StackSetOperationPreferences -> Maybe Natural
$sel:maxConcurrentPercentage:StackSetOperationPreferences' :: StackSetOperationPreferences -> Maybe Natural
$sel:maxConcurrentCount:StackSetOperationPreferences' :: StackSetOperationPreferences -> Maybe Natural
$sel:regionOrder:StackSetOperationPreferences' :: StackSetOperationPreferences -> Maybe [Text]
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"RegionOrder"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
regionOrder),
        ByteString
"MaxConcurrentCount" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxConcurrentCount,
        ByteString
"MaxConcurrentPercentage"
          ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxConcurrentPercentage,
        ByteString
"FailureToleranceCount"
          ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
failureToleranceCount,
        ByteString
"RegionConcurrencyType"
          ByteString -> Maybe RegionConcurrencyType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe RegionConcurrencyType
regionConcurrencyType,
        ByteString
"FailureTolerancePercentage"
          ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
failureTolerancePercentage
      ]