packages feed

amazonka-ssm-2.0: gen/Amazonka/SSM/Types/PatchRuleGroup.hs

{-# 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.SSM.Types.PatchRuleGroup
-- 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.SSM.Types.PatchRuleGroup 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
import Amazonka.SSM.Types.PatchRule

-- | A set of rules defining the approval rules for a patch baseline.
--
-- /See:/ 'newPatchRuleGroup' smart constructor.
data PatchRuleGroup = PatchRuleGroup'
  { -- | The rules that make up the rule group.
    patchRules :: [PatchRule]
  }
  deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)

-- |
-- Create a value of 'PatchRuleGroup' 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:
--
-- 'patchRules', 'patchRuleGroup_patchRules' - The rules that make up the rule group.
newPatchRuleGroup ::
  PatchRuleGroup
newPatchRuleGroup =
  PatchRuleGroup' {patchRules = Prelude.mempty}

-- | The rules that make up the rule group.
patchRuleGroup_patchRules :: Lens.Lens' PatchRuleGroup [PatchRule]
patchRuleGroup_patchRules = Lens.lens (\PatchRuleGroup' {patchRules} -> patchRules) (\s@PatchRuleGroup' {} a -> s {patchRules = a} :: PatchRuleGroup) Prelude.. Lens.coerced

instance Data.FromJSON PatchRuleGroup where
  parseJSON =
    Data.withObject
      "PatchRuleGroup"
      ( \x ->
          PatchRuleGroup'
            Prelude.<$> (x Data..:? "PatchRules" Data..!= Prelude.mempty)
      )

instance Prelude.Hashable PatchRuleGroup where
  hashWithSalt _salt PatchRuleGroup' {..} =
    _salt `Prelude.hashWithSalt` patchRules

instance Prelude.NFData PatchRuleGroup where
  rnf PatchRuleGroup' {..} = Prelude.rnf patchRules

instance Data.ToJSON PatchRuleGroup where
  toJSON PatchRuleGroup' {..} =
    Data.object
      ( Prelude.catMaybes
          [Prelude.Just ("PatchRules" Data..= patchRules)]
      )