{-# 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.KinesisAnalyticsV2.Types.EnvironmentProperties
-- 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.KinesisAnalyticsV2.Types.EnvironmentProperties where

import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.Types.PropertyGroup
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes execution properties for a Flink-based Kinesis Data Analytics
-- application.
--
-- /See:/ 'newEnvironmentProperties' smart constructor.
data EnvironmentProperties = EnvironmentProperties'
  { -- | Describes the execution property groups.
    EnvironmentProperties -> [PropertyGroup]
propertyGroups :: [PropertyGroup]
  }
  deriving (EnvironmentProperties -> EnvironmentProperties -> Bool
(EnvironmentProperties -> EnvironmentProperties -> Bool)
-> (EnvironmentProperties -> EnvironmentProperties -> Bool)
-> Eq EnvironmentProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnvironmentProperties -> EnvironmentProperties -> Bool
$c/= :: EnvironmentProperties -> EnvironmentProperties -> Bool
== :: EnvironmentProperties -> EnvironmentProperties -> Bool
$c== :: EnvironmentProperties -> EnvironmentProperties -> Bool
Prelude.Eq, ReadPrec [EnvironmentProperties]
ReadPrec EnvironmentProperties
Int -> ReadS EnvironmentProperties
ReadS [EnvironmentProperties]
(Int -> ReadS EnvironmentProperties)
-> ReadS [EnvironmentProperties]
-> ReadPrec EnvironmentProperties
-> ReadPrec [EnvironmentProperties]
-> Read EnvironmentProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnvironmentProperties]
$creadListPrec :: ReadPrec [EnvironmentProperties]
readPrec :: ReadPrec EnvironmentProperties
$creadPrec :: ReadPrec EnvironmentProperties
readList :: ReadS [EnvironmentProperties]
$creadList :: ReadS [EnvironmentProperties]
readsPrec :: Int -> ReadS EnvironmentProperties
$creadsPrec :: Int -> ReadS EnvironmentProperties
Prelude.Read, Int -> EnvironmentProperties -> ShowS
[EnvironmentProperties] -> ShowS
EnvironmentProperties -> String
(Int -> EnvironmentProperties -> ShowS)
-> (EnvironmentProperties -> String)
-> ([EnvironmentProperties] -> ShowS)
-> Show EnvironmentProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnvironmentProperties] -> ShowS
$cshowList :: [EnvironmentProperties] -> ShowS
show :: EnvironmentProperties -> String
$cshow :: EnvironmentProperties -> String
showsPrec :: Int -> EnvironmentProperties -> ShowS
$cshowsPrec :: Int -> EnvironmentProperties -> ShowS
Prelude.Show, (forall x. EnvironmentProperties -> Rep EnvironmentProperties x)
-> (forall x. Rep EnvironmentProperties x -> EnvironmentProperties)
-> Generic EnvironmentProperties
forall x. Rep EnvironmentProperties x -> EnvironmentProperties
forall x. EnvironmentProperties -> Rep EnvironmentProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnvironmentProperties x -> EnvironmentProperties
$cfrom :: forall x. EnvironmentProperties -> Rep EnvironmentProperties x
Prelude.Generic)

-- |
-- Create a value of 'EnvironmentProperties' 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:
--
-- 'propertyGroups', 'environmentProperties_propertyGroups' - Describes the execution property groups.
newEnvironmentProperties ::
  EnvironmentProperties
newEnvironmentProperties :: EnvironmentProperties
newEnvironmentProperties =
  EnvironmentProperties' :: [PropertyGroup] -> EnvironmentProperties
EnvironmentProperties'
    { $sel:propertyGroups:EnvironmentProperties' :: [PropertyGroup]
propertyGroups =
        [PropertyGroup]
forall a. Monoid a => a
Prelude.mempty
    }

-- | Describes the execution property groups.
environmentProperties_propertyGroups :: Lens.Lens' EnvironmentProperties [PropertyGroup]
environmentProperties_propertyGroups :: ([PropertyGroup] -> f [PropertyGroup])
-> EnvironmentProperties -> f EnvironmentProperties
environmentProperties_propertyGroups = (EnvironmentProperties -> [PropertyGroup])
-> (EnvironmentProperties
    -> [PropertyGroup] -> EnvironmentProperties)
-> Lens
     EnvironmentProperties
     EnvironmentProperties
     [PropertyGroup]
     [PropertyGroup]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentProperties' {[PropertyGroup]
propertyGroups :: [PropertyGroup]
$sel:propertyGroups:EnvironmentProperties' :: EnvironmentProperties -> [PropertyGroup]
propertyGroups} -> [PropertyGroup]
propertyGroups) (\s :: EnvironmentProperties
s@EnvironmentProperties' {} [PropertyGroup]
a -> EnvironmentProperties
s {$sel:propertyGroups:EnvironmentProperties' :: [PropertyGroup]
propertyGroups = [PropertyGroup]
a} :: EnvironmentProperties) (([PropertyGroup] -> f [PropertyGroup])
 -> EnvironmentProperties -> f EnvironmentProperties)
-> (([PropertyGroup] -> f [PropertyGroup])
    -> [PropertyGroup] -> f [PropertyGroup])
-> ([PropertyGroup] -> f [PropertyGroup])
-> EnvironmentProperties
-> f EnvironmentProperties
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([PropertyGroup] -> f [PropertyGroup])
-> [PropertyGroup] -> f [PropertyGroup]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable EnvironmentProperties

instance Prelude.NFData EnvironmentProperties

instance Core.ToJSON EnvironmentProperties where
  toJSON :: EnvironmentProperties -> Value
toJSON EnvironmentProperties' {[PropertyGroup]
propertyGroups :: [PropertyGroup]
$sel:propertyGroups:EnvironmentProperties' :: EnvironmentProperties -> [PropertyGroup]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"PropertyGroups" Text -> [PropertyGroup] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [PropertyGroup]
propertyGroups)
          ]
      )