{-# 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.AuditManager.Types.UpdateAssessmentFrameworkControlSet
-- 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.AuditManager.Types.UpdateAssessmentFrameworkControlSet where

import Amazonka.AuditManager.Types.CreateAssessmentFrameworkControl
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A @controlSet@ entity that represents a collection of controls in Audit
-- Manager. This does not contain the control set ID.
--
-- /See:/ 'newUpdateAssessmentFrameworkControlSet' smart constructor.
data UpdateAssessmentFrameworkControlSet = UpdateAssessmentFrameworkControlSet'
  { -- | The list of controls contained within the control set.
    UpdateAssessmentFrameworkControlSet
-> Maybe (NonEmpty CreateAssessmentFrameworkControl)
controls :: Prelude.Maybe (Prelude.NonEmpty CreateAssessmentFrameworkControl),
    -- | The unique identifier for the control set.
    UpdateAssessmentFrameworkControlSet -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The name of the control set.
    UpdateAssessmentFrameworkControlSet -> Text
name :: Prelude.Text
  }
  deriving (UpdateAssessmentFrameworkControlSet
-> UpdateAssessmentFrameworkControlSet -> Bool
(UpdateAssessmentFrameworkControlSet
 -> UpdateAssessmentFrameworkControlSet -> Bool)
-> (UpdateAssessmentFrameworkControlSet
    -> UpdateAssessmentFrameworkControlSet -> Bool)
-> Eq UpdateAssessmentFrameworkControlSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAssessmentFrameworkControlSet
-> UpdateAssessmentFrameworkControlSet -> Bool
$c/= :: UpdateAssessmentFrameworkControlSet
-> UpdateAssessmentFrameworkControlSet -> Bool
== :: UpdateAssessmentFrameworkControlSet
-> UpdateAssessmentFrameworkControlSet -> Bool
$c== :: UpdateAssessmentFrameworkControlSet
-> UpdateAssessmentFrameworkControlSet -> Bool
Prelude.Eq, ReadPrec [UpdateAssessmentFrameworkControlSet]
ReadPrec UpdateAssessmentFrameworkControlSet
Int -> ReadS UpdateAssessmentFrameworkControlSet
ReadS [UpdateAssessmentFrameworkControlSet]
(Int -> ReadS UpdateAssessmentFrameworkControlSet)
-> ReadS [UpdateAssessmentFrameworkControlSet]
-> ReadPrec UpdateAssessmentFrameworkControlSet
-> ReadPrec [UpdateAssessmentFrameworkControlSet]
-> Read UpdateAssessmentFrameworkControlSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAssessmentFrameworkControlSet]
$creadListPrec :: ReadPrec [UpdateAssessmentFrameworkControlSet]
readPrec :: ReadPrec UpdateAssessmentFrameworkControlSet
$creadPrec :: ReadPrec UpdateAssessmentFrameworkControlSet
readList :: ReadS [UpdateAssessmentFrameworkControlSet]
$creadList :: ReadS [UpdateAssessmentFrameworkControlSet]
readsPrec :: Int -> ReadS UpdateAssessmentFrameworkControlSet
$creadsPrec :: Int -> ReadS UpdateAssessmentFrameworkControlSet
Prelude.Read, Int -> UpdateAssessmentFrameworkControlSet -> ShowS
[UpdateAssessmentFrameworkControlSet] -> ShowS
UpdateAssessmentFrameworkControlSet -> String
(Int -> UpdateAssessmentFrameworkControlSet -> ShowS)
-> (UpdateAssessmentFrameworkControlSet -> String)
-> ([UpdateAssessmentFrameworkControlSet] -> ShowS)
-> Show UpdateAssessmentFrameworkControlSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAssessmentFrameworkControlSet] -> ShowS
$cshowList :: [UpdateAssessmentFrameworkControlSet] -> ShowS
show :: UpdateAssessmentFrameworkControlSet -> String
$cshow :: UpdateAssessmentFrameworkControlSet -> String
showsPrec :: Int -> UpdateAssessmentFrameworkControlSet -> ShowS
$cshowsPrec :: Int -> UpdateAssessmentFrameworkControlSet -> ShowS
Prelude.Show, (forall x.
 UpdateAssessmentFrameworkControlSet
 -> Rep UpdateAssessmentFrameworkControlSet x)
-> (forall x.
    Rep UpdateAssessmentFrameworkControlSet x
    -> UpdateAssessmentFrameworkControlSet)
-> Generic UpdateAssessmentFrameworkControlSet
forall x.
Rep UpdateAssessmentFrameworkControlSet x
-> UpdateAssessmentFrameworkControlSet
forall x.
UpdateAssessmentFrameworkControlSet
-> Rep UpdateAssessmentFrameworkControlSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateAssessmentFrameworkControlSet x
-> UpdateAssessmentFrameworkControlSet
$cfrom :: forall x.
UpdateAssessmentFrameworkControlSet
-> Rep UpdateAssessmentFrameworkControlSet x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAssessmentFrameworkControlSet' 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:
--
-- 'controls', 'updateAssessmentFrameworkControlSet_controls' - The list of controls contained within the control set.
--
-- 'id', 'updateAssessmentFrameworkControlSet_id' - The unique identifier for the control set.
--
-- 'name', 'updateAssessmentFrameworkControlSet_name' - The name of the control set.
newUpdateAssessmentFrameworkControlSet ::
  -- | 'name'
  Prelude.Text ->
  UpdateAssessmentFrameworkControlSet
newUpdateAssessmentFrameworkControlSet :: Text -> UpdateAssessmentFrameworkControlSet
newUpdateAssessmentFrameworkControlSet Text
pName_ =
  UpdateAssessmentFrameworkControlSet' :: Maybe (NonEmpty CreateAssessmentFrameworkControl)
-> Maybe Text -> Text -> UpdateAssessmentFrameworkControlSet
UpdateAssessmentFrameworkControlSet'
    { $sel:controls:UpdateAssessmentFrameworkControlSet' :: Maybe (NonEmpty CreateAssessmentFrameworkControl)
controls =
        Maybe (NonEmpty CreateAssessmentFrameworkControl)
forall a. Maybe a
Prelude.Nothing,
      $sel:id:UpdateAssessmentFrameworkControlSet' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:UpdateAssessmentFrameworkControlSet' :: Text
name = Text
pName_
    }

-- | The list of controls contained within the control set.
updateAssessmentFrameworkControlSet_controls :: Lens.Lens' UpdateAssessmentFrameworkControlSet (Prelude.Maybe (Prelude.NonEmpty CreateAssessmentFrameworkControl))
updateAssessmentFrameworkControlSet_controls :: (Maybe (NonEmpty CreateAssessmentFrameworkControl)
 -> f (Maybe (NonEmpty CreateAssessmentFrameworkControl)))
-> UpdateAssessmentFrameworkControlSet
-> f UpdateAssessmentFrameworkControlSet
updateAssessmentFrameworkControlSet_controls = (UpdateAssessmentFrameworkControlSet
 -> Maybe (NonEmpty CreateAssessmentFrameworkControl))
-> (UpdateAssessmentFrameworkControlSet
    -> Maybe (NonEmpty CreateAssessmentFrameworkControl)
    -> UpdateAssessmentFrameworkControlSet)
-> Lens
     UpdateAssessmentFrameworkControlSet
     UpdateAssessmentFrameworkControlSet
     (Maybe (NonEmpty CreateAssessmentFrameworkControl))
     (Maybe (NonEmpty CreateAssessmentFrameworkControl))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssessmentFrameworkControlSet' {Maybe (NonEmpty CreateAssessmentFrameworkControl)
controls :: Maybe (NonEmpty CreateAssessmentFrameworkControl)
$sel:controls:UpdateAssessmentFrameworkControlSet' :: UpdateAssessmentFrameworkControlSet
-> Maybe (NonEmpty CreateAssessmentFrameworkControl)
controls} -> Maybe (NonEmpty CreateAssessmentFrameworkControl)
controls) (\s :: UpdateAssessmentFrameworkControlSet
s@UpdateAssessmentFrameworkControlSet' {} Maybe (NonEmpty CreateAssessmentFrameworkControl)
a -> UpdateAssessmentFrameworkControlSet
s {$sel:controls:UpdateAssessmentFrameworkControlSet' :: Maybe (NonEmpty CreateAssessmentFrameworkControl)
controls = Maybe (NonEmpty CreateAssessmentFrameworkControl)
a} :: UpdateAssessmentFrameworkControlSet) ((Maybe (NonEmpty CreateAssessmentFrameworkControl)
  -> f (Maybe (NonEmpty CreateAssessmentFrameworkControl)))
 -> UpdateAssessmentFrameworkControlSet
 -> f UpdateAssessmentFrameworkControlSet)
-> ((Maybe (NonEmpty CreateAssessmentFrameworkControl)
     -> f (Maybe (NonEmpty CreateAssessmentFrameworkControl)))
    -> Maybe (NonEmpty CreateAssessmentFrameworkControl)
    -> f (Maybe (NonEmpty CreateAssessmentFrameworkControl)))
-> (Maybe (NonEmpty CreateAssessmentFrameworkControl)
    -> f (Maybe (NonEmpty CreateAssessmentFrameworkControl)))
-> UpdateAssessmentFrameworkControlSet
-> f UpdateAssessmentFrameworkControlSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty CreateAssessmentFrameworkControl)
  (NonEmpty CreateAssessmentFrameworkControl)
  (NonEmpty CreateAssessmentFrameworkControl)
  (NonEmpty CreateAssessmentFrameworkControl)
-> Iso
     (Maybe (NonEmpty CreateAssessmentFrameworkControl))
     (Maybe (NonEmpty CreateAssessmentFrameworkControl))
     (Maybe (NonEmpty CreateAssessmentFrameworkControl))
     (Maybe (NonEmpty CreateAssessmentFrameworkControl))
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
  (NonEmpty CreateAssessmentFrameworkControl)
  (NonEmpty CreateAssessmentFrameworkControl)
  (NonEmpty CreateAssessmentFrameworkControl)
  (NonEmpty CreateAssessmentFrameworkControl)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The unique identifier for the control set.
updateAssessmentFrameworkControlSet_id :: Lens.Lens' UpdateAssessmentFrameworkControlSet (Prelude.Maybe Prelude.Text)
updateAssessmentFrameworkControlSet_id :: (Maybe Text -> f (Maybe Text))
-> UpdateAssessmentFrameworkControlSet
-> f UpdateAssessmentFrameworkControlSet
updateAssessmentFrameworkControlSet_id = (UpdateAssessmentFrameworkControlSet -> Maybe Text)
-> (UpdateAssessmentFrameworkControlSet
    -> Maybe Text -> UpdateAssessmentFrameworkControlSet)
-> Lens
     UpdateAssessmentFrameworkControlSet
     UpdateAssessmentFrameworkControlSet
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssessmentFrameworkControlSet' {Maybe Text
id :: Maybe Text
$sel:id:UpdateAssessmentFrameworkControlSet' :: UpdateAssessmentFrameworkControlSet -> Maybe Text
id} -> Maybe Text
id) (\s :: UpdateAssessmentFrameworkControlSet
s@UpdateAssessmentFrameworkControlSet' {} Maybe Text
a -> UpdateAssessmentFrameworkControlSet
s {$sel:id:UpdateAssessmentFrameworkControlSet' :: Maybe Text
id = Maybe Text
a} :: UpdateAssessmentFrameworkControlSet)

-- | The name of the control set.
updateAssessmentFrameworkControlSet_name :: Lens.Lens' UpdateAssessmentFrameworkControlSet Prelude.Text
updateAssessmentFrameworkControlSet_name :: (Text -> f Text)
-> UpdateAssessmentFrameworkControlSet
-> f UpdateAssessmentFrameworkControlSet
updateAssessmentFrameworkControlSet_name = (UpdateAssessmentFrameworkControlSet -> Text)
-> (UpdateAssessmentFrameworkControlSet
    -> Text -> UpdateAssessmentFrameworkControlSet)
-> Lens
     UpdateAssessmentFrameworkControlSet
     UpdateAssessmentFrameworkControlSet
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAssessmentFrameworkControlSet' {Text
name :: Text
$sel:name:UpdateAssessmentFrameworkControlSet' :: UpdateAssessmentFrameworkControlSet -> Text
name} -> Text
name) (\s :: UpdateAssessmentFrameworkControlSet
s@UpdateAssessmentFrameworkControlSet' {} Text
a -> UpdateAssessmentFrameworkControlSet
s {$sel:name:UpdateAssessmentFrameworkControlSet' :: Text
name = Text
a} :: UpdateAssessmentFrameworkControlSet)

instance
  Prelude.Hashable
    UpdateAssessmentFrameworkControlSet

instance
  Prelude.NFData
    UpdateAssessmentFrameworkControlSet

instance
  Core.ToJSON
    UpdateAssessmentFrameworkControlSet
  where
  toJSON :: UpdateAssessmentFrameworkControlSet -> Value
toJSON UpdateAssessmentFrameworkControlSet' {Maybe (NonEmpty CreateAssessmentFrameworkControl)
Maybe Text
Text
name :: Text
id :: Maybe Text
controls :: Maybe (NonEmpty CreateAssessmentFrameworkControl)
$sel:name:UpdateAssessmentFrameworkControlSet' :: UpdateAssessmentFrameworkControlSet -> Text
$sel:id:UpdateAssessmentFrameworkControlSet' :: UpdateAssessmentFrameworkControlSet -> Maybe Text
$sel:controls:UpdateAssessmentFrameworkControlSet' :: UpdateAssessmentFrameworkControlSet
-> Maybe (NonEmpty CreateAssessmentFrameworkControl)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"controls" Text -> NonEmpty CreateAssessmentFrameworkControl -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty CreateAssessmentFrameworkControl -> Pair)
-> Maybe (NonEmpty CreateAssessmentFrameworkControl) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty CreateAssessmentFrameworkControl)
controls,
            (Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
id,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
          ]
      )