{-# 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.Evidently.Types.LaunchGroupConfig
-- 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.Evidently.Types.LaunchGroupConfig 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

-- | A structure that defines one launch group in a launch. A launch group is
-- a variation of the feature that you are including in the launch.
--
-- /See:/ 'newLaunchGroupConfig' smart constructor.
data LaunchGroupConfig = LaunchGroupConfig'
  { -- | A description of the launch group.
    LaunchGroupConfig -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The feature that this launch is using.
    LaunchGroupConfig -> Text
feature :: Prelude.Text,
    -- | A name for this launch group.
    LaunchGroupConfig -> Text
name :: Prelude.Text,
    -- | The feature variation to use for this launch group.
    LaunchGroupConfig -> Text
variation :: Prelude.Text
  }
  deriving (LaunchGroupConfig -> LaunchGroupConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LaunchGroupConfig -> LaunchGroupConfig -> Bool
$c/= :: LaunchGroupConfig -> LaunchGroupConfig -> Bool
== :: LaunchGroupConfig -> LaunchGroupConfig -> Bool
$c== :: LaunchGroupConfig -> LaunchGroupConfig -> Bool
Prelude.Eq, ReadPrec [LaunchGroupConfig]
ReadPrec LaunchGroupConfig
Int -> ReadS LaunchGroupConfig
ReadS [LaunchGroupConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LaunchGroupConfig]
$creadListPrec :: ReadPrec [LaunchGroupConfig]
readPrec :: ReadPrec LaunchGroupConfig
$creadPrec :: ReadPrec LaunchGroupConfig
readList :: ReadS [LaunchGroupConfig]
$creadList :: ReadS [LaunchGroupConfig]
readsPrec :: Int -> ReadS LaunchGroupConfig
$creadsPrec :: Int -> ReadS LaunchGroupConfig
Prelude.Read, Int -> LaunchGroupConfig -> ShowS
[LaunchGroupConfig] -> ShowS
LaunchGroupConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LaunchGroupConfig] -> ShowS
$cshowList :: [LaunchGroupConfig] -> ShowS
show :: LaunchGroupConfig -> String
$cshow :: LaunchGroupConfig -> String
showsPrec :: Int -> LaunchGroupConfig -> ShowS
$cshowsPrec :: Int -> LaunchGroupConfig -> ShowS
Prelude.Show, forall x. Rep LaunchGroupConfig x -> LaunchGroupConfig
forall x. LaunchGroupConfig -> Rep LaunchGroupConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LaunchGroupConfig x -> LaunchGroupConfig
$cfrom :: forall x. LaunchGroupConfig -> Rep LaunchGroupConfig x
Prelude.Generic)

-- |
-- Create a value of 'LaunchGroupConfig' 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:
--
-- 'description', 'launchGroupConfig_description' - A description of the launch group.
--
-- 'feature', 'launchGroupConfig_feature' - The feature that this launch is using.
--
-- 'name', 'launchGroupConfig_name' - A name for this launch group.
--
-- 'variation', 'launchGroupConfig_variation' - The feature variation to use for this launch group.
newLaunchGroupConfig ::
  -- | 'feature'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'variation'
  Prelude.Text ->
  LaunchGroupConfig
newLaunchGroupConfig :: Text -> Text -> Text -> LaunchGroupConfig
newLaunchGroupConfig Text
pFeature_ Text
pName_ Text
pVariation_ =
  LaunchGroupConfig'
    { $sel:description:LaunchGroupConfig' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:feature:LaunchGroupConfig' :: Text
feature = Text
pFeature_,
      $sel:name:LaunchGroupConfig' :: Text
name = Text
pName_,
      $sel:variation:LaunchGroupConfig' :: Text
variation = Text
pVariation_
    }

-- | A description of the launch group.
launchGroupConfig_description :: Lens.Lens' LaunchGroupConfig (Prelude.Maybe Prelude.Text)
launchGroupConfig_description :: Lens' LaunchGroupConfig (Maybe Text)
launchGroupConfig_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchGroupConfig' {Maybe Text
description :: Maybe Text
$sel:description:LaunchGroupConfig' :: LaunchGroupConfig -> Maybe Text
description} -> Maybe Text
description) (\s :: LaunchGroupConfig
s@LaunchGroupConfig' {} Maybe Text
a -> LaunchGroupConfig
s {$sel:description:LaunchGroupConfig' :: Maybe Text
description = Maybe Text
a} :: LaunchGroupConfig)

-- | The feature that this launch is using.
launchGroupConfig_feature :: Lens.Lens' LaunchGroupConfig Prelude.Text
launchGroupConfig_feature :: Lens' LaunchGroupConfig Text
launchGroupConfig_feature = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchGroupConfig' {Text
feature :: Text
$sel:feature:LaunchGroupConfig' :: LaunchGroupConfig -> Text
feature} -> Text
feature) (\s :: LaunchGroupConfig
s@LaunchGroupConfig' {} Text
a -> LaunchGroupConfig
s {$sel:feature:LaunchGroupConfig' :: Text
feature = Text
a} :: LaunchGroupConfig)

-- | A name for this launch group.
launchGroupConfig_name :: Lens.Lens' LaunchGroupConfig Prelude.Text
launchGroupConfig_name :: Lens' LaunchGroupConfig Text
launchGroupConfig_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchGroupConfig' {Text
name :: Text
$sel:name:LaunchGroupConfig' :: LaunchGroupConfig -> Text
name} -> Text
name) (\s :: LaunchGroupConfig
s@LaunchGroupConfig' {} Text
a -> LaunchGroupConfig
s {$sel:name:LaunchGroupConfig' :: Text
name = Text
a} :: LaunchGroupConfig)

-- | The feature variation to use for this launch group.
launchGroupConfig_variation :: Lens.Lens' LaunchGroupConfig Prelude.Text
launchGroupConfig_variation :: Lens' LaunchGroupConfig Text
launchGroupConfig_variation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LaunchGroupConfig' {Text
variation :: Text
$sel:variation:LaunchGroupConfig' :: LaunchGroupConfig -> Text
variation} -> Text
variation) (\s :: LaunchGroupConfig
s@LaunchGroupConfig' {} Text
a -> LaunchGroupConfig
s {$sel:variation:LaunchGroupConfig' :: Text
variation = Text
a} :: LaunchGroupConfig)

instance Prelude.Hashable LaunchGroupConfig where
  hashWithSalt :: Int -> LaunchGroupConfig -> Int
hashWithSalt Int
_salt LaunchGroupConfig' {Maybe Text
Text
variation :: Text
name :: Text
feature :: Text
description :: Maybe Text
$sel:variation:LaunchGroupConfig' :: LaunchGroupConfig -> Text
$sel:name:LaunchGroupConfig' :: LaunchGroupConfig -> Text
$sel:feature:LaunchGroupConfig' :: LaunchGroupConfig -> Text
$sel:description:LaunchGroupConfig' :: LaunchGroupConfig -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
feature
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
variation

instance Prelude.NFData LaunchGroupConfig where
  rnf :: LaunchGroupConfig -> ()
rnf LaunchGroupConfig' {Maybe Text
Text
variation :: Text
name :: Text
feature :: Text
description :: Maybe Text
$sel:variation:LaunchGroupConfig' :: LaunchGroupConfig -> Text
$sel:name:LaunchGroupConfig' :: LaunchGroupConfig -> Text
$sel:feature:LaunchGroupConfig' :: LaunchGroupConfig -> Text
$sel:description:LaunchGroupConfig' :: LaunchGroupConfig -> Maybe Text
..} =
    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 Text
feature
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
variation

instance Data.ToJSON LaunchGroupConfig where
  toJSON :: LaunchGroupConfig -> Value
toJSON LaunchGroupConfig' {Maybe Text
Text
variation :: Text
name :: Text
feature :: Text
description :: Maybe Text
$sel:variation:LaunchGroupConfig' :: LaunchGroupConfig -> Text
$sel:name:LaunchGroupConfig' :: LaunchGroupConfig -> Text
$sel:feature:LaunchGroupConfig' :: LaunchGroupConfig -> Text
$sel:description:LaunchGroupConfig' :: LaunchGroupConfig -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            forall a. a -> Maybe a
Prelude.Just (Key
"feature" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
feature),
            forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"variation" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
variation)
          ]
      )