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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.StandardsStatus

-- | A resource that represents your subscription to a supported standard.
--
-- /See:/ 'newStandardsSubscription' smart constructor.
data StandardsSubscription = StandardsSubscription'
  { -- | The ARN of a resource that represents your subscription to a supported
    -- standard.
    StandardsSubscription -> Text
standardsSubscriptionArn :: Prelude.Text,
    -- | The ARN of a standard.
    StandardsSubscription -> Text
standardsArn :: Prelude.Text,
    -- | A key-value pair of input for the standard.
    StandardsSubscription -> HashMap Text Text
standardsInput :: Prelude.HashMap Prelude.Text Prelude.Text,
    -- | The status of the standard subscription.
    --
    -- The status values are as follows:
    --
    -- -   @PENDING@ - Standard is in the process of being enabled.
    --
    -- -   @READY@ - Standard is enabled.
    --
    -- -   @INCOMPLETE@ - Standard could not be enabled completely. Some
    --     controls may not be available.
    --
    -- -   @DELETING@ - Standard is in the process of being disabled.
    --
    -- -   @FAILED@ - Standard could not be disabled.
    StandardsSubscription -> StandardsStatus
standardsStatus :: StandardsStatus
  }
  deriving (StandardsSubscription -> StandardsSubscription -> Bool
(StandardsSubscription -> StandardsSubscription -> Bool)
-> (StandardsSubscription -> StandardsSubscription -> Bool)
-> Eq StandardsSubscription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StandardsSubscription -> StandardsSubscription -> Bool
$c/= :: StandardsSubscription -> StandardsSubscription -> Bool
== :: StandardsSubscription -> StandardsSubscription -> Bool
$c== :: StandardsSubscription -> StandardsSubscription -> Bool
Prelude.Eq, ReadPrec [StandardsSubscription]
ReadPrec StandardsSubscription
Int -> ReadS StandardsSubscription
ReadS [StandardsSubscription]
(Int -> ReadS StandardsSubscription)
-> ReadS [StandardsSubscription]
-> ReadPrec StandardsSubscription
-> ReadPrec [StandardsSubscription]
-> Read StandardsSubscription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StandardsSubscription]
$creadListPrec :: ReadPrec [StandardsSubscription]
readPrec :: ReadPrec StandardsSubscription
$creadPrec :: ReadPrec StandardsSubscription
readList :: ReadS [StandardsSubscription]
$creadList :: ReadS [StandardsSubscription]
readsPrec :: Int -> ReadS StandardsSubscription
$creadsPrec :: Int -> ReadS StandardsSubscription
Prelude.Read, Int -> StandardsSubscription -> ShowS
[StandardsSubscription] -> ShowS
StandardsSubscription -> String
(Int -> StandardsSubscription -> ShowS)
-> (StandardsSubscription -> String)
-> ([StandardsSubscription] -> ShowS)
-> Show StandardsSubscription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StandardsSubscription] -> ShowS
$cshowList :: [StandardsSubscription] -> ShowS
show :: StandardsSubscription -> String
$cshow :: StandardsSubscription -> String
showsPrec :: Int -> StandardsSubscription -> ShowS
$cshowsPrec :: Int -> StandardsSubscription -> ShowS
Prelude.Show, (forall x. StandardsSubscription -> Rep StandardsSubscription x)
-> (forall x. Rep StandardsSubscription x -> StandardsSubscription)
-> Generic StandardsSubscription
forall x. Rep StandardsSubscription x -> StandardsSubscription
forall x. StandardsSubscription -> Rep StandardsSubscription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StandardsSubscription x -> StandardsSubscription
$cfrom :: forall x. StandardsSubscription -> Rep StandardsSubscription x
Prelude.Generic)

-- |
-- Create a value of 'StandardsSubscription' 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:
--
-- 'standardsSubscriptionArn', 'standardsSubscription_standardsSubscriptionArn' - The ARN of a resource that represents your subscription to a supported
-- standard.
--
-- 'standardsArn', 'standardsSubscription_standardsArn' - The ARN of a standard.
--
-- 'standardsInput', 'standardsSubscription_standardsInput' - A key-value pair of input for the standard.
--
-- 'standardsStatus', 'standardsSubscription_standardsStatus' - The status of the standard subscription.
--
-- The status values are as follows:
--
-- -   @PENDING@ - Standard is in the process of being enabled.
--
-- -   @READY@ - Standard is enabled.
--
-- -   @INCOMPLETE@ - Standard could not be enabled completely. Some
--     controls may not be available.
--
-- -   @DELETING@ - Standard is in the process of being disabled.
--
-- -   @FAILED@ - Standard could not be disabled.
newStandardsSubscription ::
  -- | 'standardsSubscriptionArn'
  Prelude.Text ->
  -- | 'standardsArn'
  Prelude.Text ->
  -- | 'standardsStatus'
  StandardsStatus ->
  StandardsSubscription
newStandardsSubscription :: Text -> Text -> StandardsStatus -> StandardsSubscription
newStandardsSubscription
  Text
pStandardsSubscriptionArn_
  Text
pStandardsArn_
  StandardsStatus
pStandardsStatus_ =
    StandardsSubscription' :: Text
-> Text
-> HashMap Text Text
-> StandardsStatus
-> StandardsSubscription
StandardsSubscription'
      { $sel:standardsSubscriptionArn:StandardsSubscription' :: Text
standardsSubscriptionArn =
          Text
pStandardsSubscriptionArn_,
        $sel:standardsArn:StandardsSubscription' :: Text
standardsArn = Text
pStandardsArn_,
        $sel:standardsInput:StandardsSubscription' :: HashMap Text Text
standardsInput = HashMap Text Text
forall a. Monoid a => a
Prelude.mempty,
        $sel:standardsStatus:StandardsSubscription' :: StandardsStatus
standardsStatus = StandardsStatus
pStandardsStatus_
      }

-- | The ARN of a resource that represents your subscription to a supported
-- standard.
standardsSubscription_standardsSubscriptionArn :: Lens.Lens' StandardsSubscription Prelude.Text
standardsSubscription_standardsSubscriptionArn :: (Text -> f Text)
-> StandardsSubscription -> f StandardsSubscription
standardsSubscription_standardsSubscriptionArn = (StandardsSubscription -> Text)
-> (StandardsSubscription -> Text -> StandardsSubscription)
-> Lens StandardsSubscription StandardsSubscription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StandardsSubscription' {Text
standardsSubscriptionArn :: Text
$sel:standardsSubscriptionArn:StandardsSubscription' :: StandardsSubscription -> Text
standardsSubscriptionArn} -> Text
standardsSubscriptionArn) (\s :: StandardsSubscription
s@StandardsSubscription' {} Text
a -> StandardsSubscription
s {$sel:standardsSubscriptionArn:StandardsSubscription' :: Text
standardsSubscriptionArn = Text
a} :: StandardsSubscription)

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

-- | A key-value pair of input for the standard.
standardsSubscription_standardsInput :: Lens.Lens' StandardsSubscription (Prelude.HashMap Prelude.Text Prelude.Text)
standardsSubscription_standardsInput :: (HashMap Text Text -> f (HashMap Text Text))
-> StandardsSubscription -> f StandardsSubscription
standardsSubscription_standardsInput = (StandardsSubscription -> HashMap Text Text)
-> (StandardsSubscription
    -> HashMap Text Text -> StandardsSubscription)
-> Lens
     StandardsSubscription
     StandardsSubscription
     (HashMap Text Text)
     (HashMap Text Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StandardsSubscription' {HashMap Text Text
standardsInput :: HashMap Text Text
$sel:standardsInput:StandardsSubscription' :: StandardsSubscription -> HashMap Text Text
standardsInput} -> HashMap Text Text
standardsInput) (\s :: StandardsSubscription
s@StandardsSubscription' {} HashMap Text Text
a -> StandardsSubscription
s {$sel:standardsInput:StandardsSubscription' :: HashMap Text Text
standardsInput = HashMap Text Text
a} :: StandardsSubscription) ((HashMap Text Text -> f (HashMap Text Text))
 -> StandardsSubscription -> f StandardsSubscription)
-> ((HashMap Text Text -> f (HashMap Text Text))
    -> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> StandardsSubscription
-> f StandardsSubscription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The status of the standard subscription.
--
-- The status values are as follows:
--
-- -   @PENDING@ - Standard is in the process of being enabled.
--
-- -   @READY@ - Standard is enabled.
--
-- -   @INCOMPLETE@ - Standard could not be enabled completely. Some
--     controls may not be available.
--
-- -   @DELETING@ - Standard is in the process of being disabled.
--
-- -   @FAILED@ - Standard could not be disabled.
standardsSubscription_standardsStatus :: Lens.Lens' StandardsSubscription StandardsStatus
standardsSubscription_standardsStatus :: (StandardsStatus -> f StandardsStatus)
-> StandardsSubscription -> f StandardsSubscription
standardsSubscription_standardsStatus = (StandardsSubscription -> StandardsStatus)
-> (StandardsSubscription
    -> StandardsStatus -> StandardsSubscription)
-> Lens
     StandardsSubscription
     StandardsSubscription
     StandardsStatus
     StandardsStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StandardsSubscription' {StandardsStatus
standardsStatus :: StandardsStatus
$sel:standardsStatus:StandardsSubscription' :: StandardsSubscription -> StandardsStatus
standardsStatus} -> StandardsStatus
standardsStatus) (\s :: StandardsSubscription
s@StandardsSubscription' {} StandardsStatus
a -> StandardsSubscription
s {$sel:standardsStatus:StandardsSubscription' :: StandardsStatus
standardsStatus = StandardsStatus
a} :: StandardsSubscription)

instance Core.FromJSON StandardsSubscription where
  parseJSON :: Value -> Parser StandardsSubscription
parseJSON =
    String
-> (Object -> Parser StandardsSubscription)
-> Value
-> Parser StandardsSubscription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StandardsSubscription"
      ( \Object
x ->
          Text
-> Text
-> HashMap Text Text
-> StandardsStatus
-> StandardsSubscription
StandardsSubscription'
            (Text
 -> Text
 -> HashMap Text Text
 -> StandardsStatus
 -> StandardsSubscription)
-> Parser Text
-> Parser
     (Text
      -> HashMap Text Text -> StandardsStatus -> StandardsSubscription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"StandardsSubscriptionArn")
            Parser
  (Text
   -> HashMap Text Text -> StandardsStatus -> StandardsSubscription)
-> Parser Text
-> Parser
     (HashMap Text Text -> StandardsStatus -> StandardsSubscription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"StandardsArn")
            Parser
  (HashMap Text Text -> StandardsStatus -> StandardsSubscription)
-> Parser (HashMap Text Text)
-> Parser (StandardsStatus -> StandardsSubscription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (HashMap Text Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StandardsInput" Parser (Maybe (HashMap Text Text))
-> HashMap Text Text -> Parser (HashMap Text Text)
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= HashMap Text Text
forall a. Monoid a => a
Prelude.mempty)
            Parser (StandardsStatus -> StandardsSubscription)
-> Parser StandardsStatus -> Parser StandardsSubscription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser StandardsStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"StandardsStatus")
      )

instance Prelude.Hashable StandardsSubscription

instance Prelude.NFData StandardsSubscription