{-# 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.StandardsSubscriptionRequest
-- 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.StandardsSubscriptionRequest where

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

-- | The standard that you want to enable.
--
-- /See:/ 'newStandardsSubscriptionRequest' smart constructor.
data StandardsSubscriptionRequest = StandardsSubscriptionRequest'
  { -- | A key-value pair of input for the standard.
    StandardsSubscriptionRequest -> Maybe (HashMap Text Text)
standardsInput :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The ARN of the standard that you want to enable. To view the list of
    -- available standards and their ARNs, use the @DescribeStandards@
    -- operation.
    StandardsSubscriptionRequest -> Text
standardsArn :: Prelude.Text
  }
  deriving (StandardsSubscriptionRequest
-> StandardsSubscriptionRequest -> Bool
(StandardsSubscriptionRequest
 -> StandardsSubscriptionRequest -> Bool)
-> (StandardsSubscriptionRequest
    -> StandardsSubscriptionRequest -> Bool)
-> Eq StandardsSubscriptionRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StandardsSubscriptionRequest
-> StandardsSubscriptionRequest -> Bool
$c/= :: StandardsSubscriptionRequest
-> StandardsSubscriptionRequest -> Bool
== :: StandardsSubscriptionRequest
-> StandardsSubscriptionRequest -> Bool
$c== :: StandardsSubscriptionRequest
-> StandardsSubscriptionRequest -> Bool
Prelude.Eq, ReadPrec [StandardsSubscriptionRequest]
ReadPrec StandardsSubscriptionRequest
Int -> ReadS StandardsSubscriptionRequest
ReadS [StandardsSubscriptionRequest]
(Int -> ReadS StandardsSubscriptionRequest)
-> ReadS [StandardsSubscriptionRequest]
-> ReadPrec StandardsSubscriptionRequest
-> ReadPrec [StandardsSubscriptionRequest]
-> Read StandardsSubscriptionRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StandardsSubscriptionRequest]
$creadListPrec :: ReadPrec [StandardsSubscriptionRequest]
readPrec :: ReadPrec StandardsSubscriptionRequest
$creadPrec :: ReadPrec StandardsSubscriptionRequest
readList :: ReadS [StandardsSubscriptionRequest]
$creadList :: ReadS [StandardsSubscriptionRequest]
readsPrec :: Int -> ReadS StandardsSubscriptionRequest
$creadsPrec :: Int -> ReadS StandardsSubscriptionRequest
Prelude.Read, Int -> StandardsSubscriptionRequest -> ShowS
[StandardsSubscriptionRequest] -> ShowS
StandardsSubscriptionRequest -> String
(Int -> StandardsSubscriptionRequest -> ShowS)
-> (StandardsSubscriptionRequest -> String)
-> ([StandardsSubscriptionRequest] -> ShowS)
-> Show StandardsSubscriptionRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StandardsSubscriptionRequest] -> ShowS
$cshowList :: [StandardsSubscriptionRequest] -> ShowS
show :: StandardsSubscriptionRequest -> String
$cshow :: StandardsSubscriptionRequest -> String
showsPrec :: Int -> StandardsSubscriptionRequest -> ShowS
$cshowsPrec :: Int -> StandardsSubscriptionRequest -> ShowS
Prelude.Show, (forall x.
 StandardsSubscriptionRequest -> Rep StandardsSubscriptionRequest x)
-> (forall x.
    Rep StandardsSubscriptionRequest x -> StandardsSubscriptionRequest)
-> Generic StandardsSubscriptionRequest
forall x.
Rep StandardsSubscriptionRequest x -> StandardsSubscriptionRequest
forall x.
StandardsSubscriptionRequest -> Rep StandardsSubscriptionRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StandardsSubscriptionRequest x -> StandardsSubscriptionRequest
$cfrom :: forall x.
StandardsSubscriptionRequest -> Rep StandardsSubscriptionRequest x
Prelude.Generic)

-- |
-- Create a value of 'StandardsSubscriptionRequest' 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:
--
-- 'standardsInput', 'standardsSubscriptionRequest_standardsInput' - A key-value pair of input for the standard.
--
-- 'standardsArn', 'standardsSubscriptionRequest_standardsArn' - The ARN of the standard that you want to enable. To view the list of
-- available standards and their ARNs, use the @DescribeStandards@
-- operation.
newStandardsSubscriptionRequest ::
  -- | 'standardsArn'
  Prelude.Text ->
  StandardsSubscriptionRequest
newStandardsSubscriptionRequest :: Text -> StandardsSubscriptionRequest
newStandardsSubscriptionRequest Text
pStandardsArn_ =
  StandardsSubscriptionRequest' :: Maybe (HashMap Text Text) -> Text -> StandardsSubscriptionRequest
StandardsSubscriptionRequest'
    { $sel:standardsInput:StandardsSubscriptionRequest' :: Maybe (HashMap Text Text)
standardsInput =
        Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:standardsArn:StandardsSubscriptionRequest' :: Text
standardsArn = Text
pStandardsArn_
    }

-- | A key-value pair of input for the standard.
standardsSubscriptionRequest_standardsInput :: Lens.Lens' StandardsSubscriptionRequest (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
standardsSubscriptionRequest_standardsInput :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> StandardsSubscriptionRequest -> f StandardsSubscriptionRequest
standardsSubscriptionRequest_standardsInput = (StandardsSubscriptionRequest -> Maybe (HashMap Text Text))
-> (StandardsSubscriptionRequest
    -> Maybe (HashMap Text Text) -> StandardsSubscriptionRequest)
-> Lens
     StandardsSubscriptionRequest
     StandardsSubscriptionRequest
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StandardsSubscriptionRequest' {Maybe (HashMap Text Text)
standardsInput :: Maybe (HashMap Text Text)
$sel:standardsInput:StandardsSubscriptionRequest' :: StandardsSubscriptionRequest -> Maybe (HashMap Text Text)
standardsInput} -> Maybe (HashMap Text Text)
standardsInput) (\s :: StandardsSubscriptionRequest
s@StandardsSubscriptionRequest' {} Maybe (HashMap Text Text)
a -> StandardsSubscriptionRequest
s {$sel:standardsInput:StandardsSubscriptionRequest' :: Maybe (HashMap Text Text)
standardsInput = Maybe (HashMap Text Text)
a} :: StandardsSubscriptionRequest) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> StandardsSubscriptionRequest -> f StandardsSubscriptionRequest)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> StandardsSubscriptionRequest
-> f StandardsSubscriptionRequest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ARN of the standard that you want to enable. To view the list of
-- available standards and their ARNs, use the @DescribeStandards@
-- operation.
standardsSubscriptionRequest_standardsArn :: Lens.Lens' StandardsSubscriptionRequest Prelude.Text
standardsSubscriptionRequest_standardsArn :: (Text -> f Text)
-> StandardsSubscriptionRequest -> f StandardsSubscriptionRequest
standardsSubscriptionRequest_standardsArn = (StandardsSubscriptionRequest -> Text)
-> (StandardsSubscriptionRequest
    -> Text -> StandardsSubscriptionRequest)
-> Lens
     StandardsSubscriptionRequest StandardsSubscriptionRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StandardsSubscriptionRequest' {Text
standardsArn :: Text
$sel:standardsArn:StandardsSubscriptionRequest' :: StandardsSubscriptionRequest -> Text
standardsArn} -> Text
standardsArn) (\s :: StandardsSubscriptionRequest
s@StandardsSubscriptionRequest' {} Text
a -> StandardsSubscriptionRequest
s {$sel:standardsArn:StandardsSubscriptionRequest' :: Text
standardsArn = Text
a} :: StandardsSubscriptionRequest)

instance
  Prelude.Hashable
    StandardsSubscriptionRequest

instance Prelude.NFData StandardsSubscriptionRequest

instance Core.ToJSON StandardsSubscriptionRequest where
  toJSON :: StandardsSubscriptionRequest -> Value
toJSON StandardsSubscriptionRequest' {Maybe (HashMap Text Text)
Text
standardsArn :: Text
standardsInput :: Maybe (HashMap Text Text)
$sel:standardsArn:StandardsSubscriptionRequest' :: StandardsSubscriptionRequest -> Text
$sel:standardsInput:StandardsSubscriptionRequest' :: StandardsSubscriptionRequest -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"StandardsInput" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
standardsInput,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"StandardsArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
standardsArn)
          ]
      )