{-# 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.SMS.Types.AppValidationConfiguration
-- 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.SMS.Types.AppValidationConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SMS.Types.AppValidationStrategy
import Amazonka.SMS.Types.SSMValidationParameters

-- | Configuration for validating an application.
--
-- /See:/ 'newAppValidationConfiguration' smart constructor.
data AppValidationConfiguration = AppValidationConfiguration'
  { -- | The validation parameters.
    AppValidationConfiguration -> Maybe SSMValidationParameters
ssmValidationParameters :: Prelude.Maybe SSMValidationParameters,
    -- | The name of the configuration.
    AppValidationConfiguration -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ID of the validation.
    AppValidationConfiguration -> Maybe Text
validationId :: Prelude.Maybe Prelude.Text,
    -- | The validation strategy.
    AppValidationConfiguration -> Maybe AppValidationStrategy
appValidationStrategy :: Prelude.Maybe AppValidationStrategy
  }
  deriving (AppValidationConfiguration -> AppValidationConfiguration -> Bool
(AppValidationConfiguration -> AppValidationConfiguration -> Bool)
-> (AppValidationConfiguration
    -> AppValidationConfiguration -> Bool)
-> Eq AppValidationConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AppValidationConfiguration -> AppValidationConfiguration -> Bool
$c/= :: AppValidationConfiguration -> AppValidationConfiguration -> Bool
== :: AppValidationConfiguration -> AppValidationConfiguration -> Bool
$c== :: AppValidationConfiguration -> AppValidationConfiguration -> Bool
Prelude.Eq, ReadPrec [AppValidationConfiguration]
ReadPrec AppValidationConfiguration
Int -> ReadS AppValidationConfiguration
ReadS [AppValidationConfiguration]
(Int -> ReadS AppValidationConfiguration)
-> ReadS [AppValidationConfiguration]
-> ReadPrec AppValidationConfiguration
-> ReadPrec [AppValidationConfiguration]
-> Read AppValidationConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AppValidationConfiguration]
$creadListPrec :: ReadPrec [AppValidationConfiguration]
readPrec :: ReadPrec AppValidationConfiguration
$creadPrec :: ReadPrec AppValidationConfiguration
readList :: ReadS [AppValidationConfiguration]
$creadList :: ReadS [AppValidationConfiguration]
readsPrec :: Int -> ReadS AppValidationConfiguration
$creadsPrec :: Int -> ReadS AppValidationConfiguration
Prelude.Read, Int -> AppValidationConfiguration -> ShowS
[AppValidationConfiguration] -> ShowS
AppValidationConfiguration -> String
(Int -> AppValidationConfiguration -> ShowS)
-> (AppValidationConfiguration -> String)
-> ([AppValidationConfiguration] -> ShowS)
-> Show AppValidationConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AppValidationConfiguration] -> ShowS
$cshowList :: [AppValidationConfiguration] -> ShowS
show :: AppValidationConfiguration -> String
$cshow :: AppValidationConfiguration -> String
showsPrec :: Int -> AppValidationConfiguration -> ShowS
$cshowsPrec :: Int -> AppValidationConfiguration -> ShowS
Prelude.Show, (forall x.
 AppValidationConfiguration -> Rep AppValidationConfiguration x)
-> (forall x.
    Rep AppValidationConfiguration x -> AppValidationConfiguration)
-> Generic AppValidationConfiguration
forall x.
Rep AppValidationConfiguration x -> AppValidationConfiguration
forall x.
AppValidationConfiguration -> Rep AppValidationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AppValidationConfiguration x -> AppValidationConfiguration
$cfrom :: forall x.
AppValidationConfiguration -> Rep AppValidationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'AppValidationConfiguration' 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:
--
-- 'ssmValidationParameters', 'appValidationConfiguration_ssmValidationParameters' - The validation parameters.
--
-- 'name', 'appValidationConfiguration_name' - The name of the configuration.
--
-- 'validationId', 'appValidationConfiguration_validationId' - The ID of the validation.
--
-- 'appValidationStrategy', 'appValidationConfiguration_appValidationStrategy' - The validation strategy.
newAppValidationConfiguration ::
  AppValidationConfiguration
newAppValidationConfiguration :: AppValidationConfiguration
newAppValidationConfiguration =
  AppValidationConfiguration' :: Maybe SSMValidationParameters
-> Maybe Text
-> Maybe Text
-> Maybe AppValidationStrategy
-> AppValidationConfiguration
AppValidationConfiguration'
    { $sel:ssmValidationParameters:AppValidationConfiguration' :: Maybe SSMValidationParameters
ssmValidationParameters =
        Maybe SSMValidationParameters
forall a. Maybe a
Prelude.Nothing,
      $sel:name:AppValidationConfiguration' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:validationId:AppValidationConfiguration' :: Maybe Text
validationId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:appValidationStrategy:AppValidationConfiguration' :: Maybe AppValidationStrategy
appValidationStrategy = Maybe AppValidationStrategy
forall a. Maybe a
Prelude.Nothing
    }

-- | The validation parameters.
appValidationConfiguration_ssmValidationParameters :: Lens.Lens' AppValidationConfiguration (Prelude.Maybe SSMValidationParameters)
appValidationConfiguration_ssmValidationParameters :: (Maybe SSMValidationParameters
 -> f (Maybe SSMValidationParameters))
-> AppValidationConfiguration -> f AppValidationConfiguration
appValidationConfiguration_ssmValidationParameters = (AppValidationConfiguration -> Maybe SSMValidationParameters)
-> (AppValidationConfiguration
    -> Maybe SSMValidationParameters -> AppValidationConfiguration)
-> Lens
     AppValidationConfiguration
     AppValidationConfiguration
     (Maybe SSMValidationParameters)
     (Maybe SSMValidationParameters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppValidationConfiguration' {Maybe SSMValidationParameters
ssmValidationParameters :: Maybe SSMValidationParameters
$sel:ssmValidationParameters:AppValidationConfiguration' :: AppValidationConfiguration -> Maybe SSMValidationParameters
ssmValidationParameters} -> Maybe SSMValidationParameters
ssmValidationParameters) (\s :: AppValidationConfiguration
s@AppValidationConfiguration' {} Maybe SSMValidationParameters
a -> AppValidationConfiguration
s {$sel:ssmValidationParameters:AppValidationConfiguration' :: Maybe SSMValidationParameters
ssmValidationParameters = Maybe SSMValidationParameters
a} :: AppValidationConfiguration)

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

-- | The ID of the validation.
appValidationConfiguration_validationId :: Lens.Lens' AppValidationConfiguration (Prelude.Maybe Prelude.Text)
appValidationConfiguration_validationId :: (Maybe Text -> f (Maybe Text))
-> AppValidationConfiguration -> f AppValidationConfiguration
appValidationConfiguration_validationId = (AppValidationConfiguration -> Maybe Text)
-> (AppValidationConfiguration
    -> Maybe Text -> AppValidationConfiguration)
-> Lens
     AppValidationConfiguration
     AppValidationConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppValidationConfiguration' {Maybe Text
validationId :: Maybe Text
$sel:validationId:AppValidationConfiguration' :: AppValidationConfiguration -> Maybe Text
validationId} -> Maybe Text
validationId) (\s :: AppValidationConfiguration
s@AppValidationConfiguration' {} Maybe Text
a -> AppValidationConfiguration
s {$sel:validationId:AppValidationConfiguration' :: Maybe Text
validationId = Maybe Text
a} :: AppValidationConfiguration)

-- | The validation strategy.
appValidationConfiguration_appValidationStrategy :: Lens.Lens' AppValidationConfiguration (Prelude.Maybe AppValidationStrategy)
appValidationConfiguration_appValidationStrategy :: (Maybe AppValidationStrategy -> f (Maybe AppValidationStrategy))
-> AppValidationConfiguration -> f AppValidationConfiguration
appValidationConfiguration_appValidationStrategy = (AppValidationConfiguration -> Maybe AppValidationStrategy)
-> (AppValidationConfiguration
    -> Maybe AppValidationStrategy -> AppValidationConfiguration)
-> Lens
     AppValidationConfiguration
     AppValidationConfiguration
     (Maybe AppValidationStrategy)
     (Maybe AppValidationStrategy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AppValidationConfiguration' {Maybe AppValidationStrategy
appValidationStrategy :: Maybe AppValidationStrategy
$sel:appValidationStrategy:AppValidationConfiguration' :: AppValidationConfiguration -> Maybe AppValidationStrategy
appValidationStrategy} -> Maybe AppValidationStrategy
appValidationStrategy) (\s :: AppValidationConfiguration
s@AppValidationConfiguration' {} Maybe AppValidationStrategy
a -> AppValidationConfiguration
s {$sel:appValidationStrategy:AppValidationConfiguration' :: Maybe AppValidationStrategy
appValidationStrategy = Maybe AppValidationStrategy
a} :: AppValidationConfiguration)

instance Core.FromJSON AppValidationConfiguration where
  parseJSON :: Value -> Parser AppValidationConfiguration
parseJSON =
    String
-> (Object -> Parser AppValidationConfiguration)
-> Value
-> Parser AppValidationConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AppValidationConfiguration"
      ( \Object
x ->
          Maybe SSMValidationParameters
-> Maybe Text
-> Maybe Text
-> Maybe AppValidationStrategy
-> AppValidationConfiguration
AppValidationConfiguration'
            (Maybe SSMValidationParameters
 -> Maybe Text
 -> Maybe Text
 -> Maybe AppValidationStrategy
 -> AppValidationConfiguration)
-> Parser (Maybe SSMValidationParameters)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe AppValidationStrategy
      -> AppValidationConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SSMValidationParameters)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ssmValidationParameters")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe AppValidationStrategy
   -> AppValidationConfiguration)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe AppValidationStrategy -> AppValidationConfiguration)
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
   -> Maybe AppValidationStrategy -> AppValidationConfiguration)
-> Parser (Maybe Text)
-> Parser
     (Maybe AppValidationStrategy -> AppValidationConfiguration)
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
"validationId")
            Parser (Maybe AppValidationStrategy -> AppValidationConfiguration)
-> Parser (Maybe AppValidationStrategy)
-> Parser AppValidationConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AppValidationStrategy)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"appValidationStrategy")
      )

instance Prelude.Hashable AppValidationConfiguration

instance Prelude.NFData AppValidationConfiguration

instance Core.ToJSON AppValidationConfiguration where
  toJSON :: AppValidationConfiguration -> Value
toJSON AppValidationConfiguration' {Maybe Text
Maybe AppValidationStrategy
Maybe SSMValidationParameters
appValidationStrategy :: Maybe AppValidationStrategy
validationId :: Maybe Text
name :: Maybe Text
ssmValidationParameters :: Maybe SSMValidationParameters
$sel:appValidationStrategy:AppValidationConfiguration' :: AppValidationConfiguration -> Maybe AppValidationStrategy
$sel:validationId:AppValidationConfiguration' :: AppValidationConfiguration -> Maybe Text
$sel:name:AppValidationConfiguration' :: AppValidationConfiguration -> Maybe Text
$sel:ssmValidationParameters:AppValidationConfiguration' :: AppValidationConfiguration -> Maybe SSMValidationParameters
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ssmValidationParameters" Text -> SSMValidationParameters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SSMValidationParameters -> Pair)
-> Maybe SSMValidationParameters -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SSMValidationParameters
ssmValidationParameters,
            (Text
"name" 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
name,
            (Text
"validationId" 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
validationId,
            (Text
"appValidationStrategy" Text -> AppValidationStrategy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AppValidationStrategy -> Pair)
-> Maybe AppValidationStrategy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AppValidationStrategy
appValidationStrategy
          ]
      )