{-# 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.SecurityHub.Types.Standard
-- 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.SecurityHub.Types.Standard where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides information about a specific standard.
--
-- /See:/ 'newStandard' smart constructor.
data Standard = Standard'
  { -- | The ARN of a standard.
    Standard -> Maybe Text
standardsArn :: Prelude.Maybe Prelude.Text,
    -- | Whether the standard is enabled by default. When Security Hub is enabled
    -- from the console, if a standard is enabled by default, the check box for
    -- that standard is selected by default.
    --
    -- When Security Hub is enabled using the @EnableSecurityHub@ API
    -- operation, the standard is enabled by default unless
    -- @EnableDefaultStandards@ is set to @false@.
    Standard -> Maybe Bool
enabledByDefault :: Prelude.Maybe Prelude.Bool,
    -- | The name of the standard.
    Standard -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | A description of the standard.
    Standard -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (Standard -> Standard -> Bool
(Standard -> Standard -> Bool)
-> (Standard -> Standard -> Bool) -> Eq Standard
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Standard -> Standard -> Bool
$c/= :: Standard -> Standard -> Bool
== :: Standard -> Standard -> Bool
$c== :: Standard -> Standard -> Bool
Prelude.Eq, ReadPrec [Standard]
ReadPrec Standard
Int -> ReadS Standard
ReadS [Standard]
(Int -> ReadS Standard)
-> ReadS [Standard]
-> ReadPrec Standard
-> ReadPrec [Standard]
-> Read Standard
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Standard]
$creadListPrec :: ReadPrec [Standard]
readPrec :: ReadPrec Standard
$creadPrec :: ReadPrec Standard
readList :: ReadS [Standard]
$creadList :: ReadS [Standard]
readsPrec :: Int -> ReadS Standard
$creadsPrec :: Int -> ReadS Standard
Prelude.Read, Int -> Standard -> ShowS
[Standard] -> ShowS
Standard -> String
(Int -> Standard -> ShowS)
-> (Standard -> String) -> ([Standard] -> ShowS) -> Show Standard
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Standard] -> ShowS
$cshowList :: [Standard] -> ShowS
show :: Standard -> String
$cshow :: Standard -> String
showsPrec :: Int -> Standard -> ShowS
$cshowsPrec :: Int -> Standard -> ShowS
Prelude.Show, (forall x. Standard -> Rep Standard x)
-> (forall x. Rep Standard x -> Standard) -> Generic Standard
forall x. Rep Standard x -> Standard
forall x. Standard -> Rep Standard x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Standard x -> Standard
$cfrom :: forall x. Standard -> Rep Standard x
Prelude.Generic)

-- |
-- Create a value of 'Standard' 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:
--
-- 'standardsArn', 'standard_standardsArn' - The ARN of a standard.
--
-- 'enabledByDefault', 'standard_enabledByDefault' - Whether the standard is enabled by default. When Security Hub is enabled
-- from the console, if a standard is enabled by default, the check box for
-- that standard is selected by default.
--
-- When Security Hub is enabled using the @EnableSecurityHub@ API
-- operation, the standard is enabled by default unless
-- @EnableDefaultStandards@ is set to @false@.
--
-- 'name', 'standard_name' - The name of the standard.
--
-- 'description', 'standard_description' - A description of the standard.
newStandard ::
  Standard
newStandard :: Standard
newStandard =
  Standard' :: Maybe Text -> Maybe Bool -> Maybe Text -> Maybe Text -> Standard
Standard'
    { $sel:standardsArn:Standard' :: Maybe Text
standardsArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:enabledByDefault:Standard' :: Maybe Bool
enabledByDefault = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Standard' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:Standard' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of a standard.
standard_standardsArn :: Lens.Lens' Standard (Prelude.Maybe Prelude.Text)
standard_standardsArn :: (Maybe Text -> f (Maybe Text)) -> Standard -> f Standard
standard_standardsArn = (Standard -> Maybe Text)
-> (Standard -> Maybe Text -> Standard)
-> Lens Standard Standard (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Standard' {Maybe Text
standardsArn :: Maybe Text
$sel:standardsArn:Standard' :: Standard -> Maybe Text
standardsArn} -> Maybe Text
standardsArn) (\s :: Standard
s@Standard' {} Maybe Text
a -> Standard
s {$sel:standardsArn:Standard' :: Maybe Text
standardsArn = Maybe Text
a} :: Standard)

-- | Whether the standard is enabled by default. When Security Hub is enabled
-- from the console, if a standard is enabled by default, the check box for
-- that standard is selected by default.
--
-- When Security Hub is enabled using the @EnableSecurityHub@ API
-- operation, the standard is enabled by default unless
-- @EnableDefaultStandards@ is set to @false@.
standard_enabledByDefault :: Lens.Lens' Standard (Prelude.Maybe Prelude.Bool)
standard_enabledByDefault :: (Maybe Bool -> f (Maybe Bool)) -> Standard -> f Standard
standard_enabledByDefault = (Standard -> Maybe Bool)
-> (Standard -> Maybe Bool -> Standard)
-> Lens Standard Standard (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Standard' {Maybe Bool
enabledByDefault :: Maybe Bool
$sel:enabledByDefault:Standard' :: Standard -> Maybe Bool
enabledByDefault} -> Maybe Bool
enabledByDefault) (\s :: Standard
s@Standard' {} Maybe Bool
a -> Standard
s {$sel:enabledByDefault:Standard' :: Maybe Bool
enabledByDefault = Maybe Bool
a} :: Standard)

-- | The name of the standard.
standard_name :: Lens.Lens' Standard (Prelude.Maybe Prelude.Text)
standard_name :: (Maybe Text -> f (Maybe Text)) -> Standard -> f Standard
standard_name = (Standard -> Maybe Text)
-> (Standard -> Maybe Text -> Standard)
-> Lens Standard Standard (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Standard' {Maybe Text
name :: Maybe Text
$sel:name:Standard' :: Standard -> Maybe Text
name} -> Maybe Text
name) (\s :: Standard
s@Standard' {} Maybe Text
a -> Standard
s {$sel:name:Standard' :: Maybe Text
name = Maybe Text
a} :: Standard)

-- | A description of the standard.
standard_description :: Lens.Lens' Standard (Prelude.Maybe Prelude.Text)
standard_description :: (Maybe Text -> f (Maybe Text)) -> Standard -> f Standard
standard_description = (Standard -> Maybe Text)
-> (Standard -> Maybe Text -> Standard)
-> Lens Standard Standard (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Standard' {Maybe Text
description :: Maybe Text
$sel:description:Standard' :: Standard -> Maybe Text
description} -> Maybe Text
description) (\s :: Standard
s@Standard' {} Maybe Text
a -> Standard
s {$sel:description:Standard' :: Maybe Text
description = Maybe Text
a} :: Standard)

instance Core.FromJSON Standard where
  parseJSON :: Value -> Parser Standard
parseJSON =
    String -> (Object -> Parser Standard) -> Value -> Parser Standard
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Standard"
      ( \Object
x ->
          Maybe Text -> Maybe Bool -> Maybe Text -> Maybe Text -> Standard
Standard'
            (Maybe Text -> Maybe Bool -> Maybe Text -> Maybe Text -> Standard)
-> Parser (Maybe Text)
-> Parser (Maybe Bool -> Maybe Text -> Maybe Text -> Standard)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StandardsArn")
            Parser (Maybe Bool -> Maybe Text -> Maybe Text -> Standard)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> Maybe Text -> Standard)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EnabledByDefault")
            Parser (Maybe Text -> Maybe Text -> Standard)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Standard)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser (Maybe Text -> Standard)
-> Parser (Maybe Text) -> Parser Standard
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Description")
      )

instance Prelude.Hashable Standard

instance Prelude.NFData Standard