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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SMS.Types.ScriptType
import Amazonka.SMS.Types.Source

-- | Contains validation parameters.
--
-- /See:/ 'newSSMValidationParameters' smart constructor.
data SSMValidationParameters = SSMValidationParameters'
  { -- | The ID of the instance. The instance must have the following tag:
    -- UserForSMSApplicationValidation=true.
    SSMValidationParameters -> Maybe Text
instanceId :: Prelude.Maybe Prelude.Text,
    -- | The command to run the validation script
    SSMValidationParameters -> Maybe Text
command :: Prelude.Maybe Prelude.Text,
    -- | The timeout interval, in seconds.
    SSMValidationParameters -> Maybe Natural
executionTimeoutSeconds :: Prelude.Maybe Prelude.Natural,
    -- | The type of validation script.
    SSMValidationParameters -> Maybe ScriptType
scriptType :: Prelude.Maybe ScriptType,
    -- | The location of the validation script.
    SSMValidationParameters -> Maybe Source
source :: Prelude.Maybe Source,
    -- | The name of the S3 bucket for output.
    SSMValidationParameters -> Maybe Text
outputS3BucketName :: Prelude.Maybe Prelude.Text
  }
  deriving (SSMValidationParameters -> SSMValidationParameters -> Bool
(SSMValidationParameters -> SSMValidationParameters -> Bool)
-> (SSMValidationParameters -> SSMValidationParameters -> Bool)
-> Eq SSMValidationParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SSMValidationParameters -> SSMValidationParameters -> Bool
$c/= :: SSMValidationParameters -> SSMValidationParameters -> Bool
== :: SSMValidationParameters -> SSMValidationParameters -> Bool
$c== :: SSMValidationParameters -> SSMValidationParameters -> Bool
Prelude.Eq, ReadPrec [SSMValidationParameters]
ReadPrec SSMValidationParameters
Int -> ReadS SSMValidationParameters
ReadS [SSMValidationParameters]
(Int -> ReadS SSMValidationParameters)
-> ReadS [SSMValidationParameters]
-> ReadPrec SSMValidationParameters
-> ReadPrec [SSMValidationParameters]
-> Read SSMValidationParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SSMValidationParameters]
$creadListPrec :: ReadPrec [SSMValidationParameters]
readPrec :: ReadPrec SSMValidationParameters
$creadPrec :: ReadPrec SSMValidationParameters
readList :: ReadS [SSMValidationParameters]
$creadList :: ReadS [SSMValidationParameters]
readsPrec :: Int -> ReadS SSMValidationParameters
$creadsPrec :: Int -> ReadS SSMValidationParameters
Prelude.Read, Int -> SSMValidationParameters -> ShowS
[SSMValidationParameters] -> ShowS
SSMValidationParameters -> String
(Int -> SSMValidationParameters -> ShowS)
-> (SSMValidationParameters -> String)
-> ([SSMValidationParameters] -> ShowS)
-> Show SSMValidationParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SSMValidationParameters] -> ShowS
$cshowList :: [SSMValidationParameters] -> ShowS
show :: SSMValidationParameters -> String
$cshow :: SSMValidationParameters -> String
showsPrec :: Int -> SSMValidationParameters -> ShowS
$cshowsPrec :: Int -> SSMValidationParameters -> ShowS
Prelude.Show, (forall x.
 SSMValidationParameters -> Rep SSMValidationParameters x)
-> (forall x.
    Rep SSMValidationParameters x -> SSMValidationParameters)
-> Generic SSMValidationParameters
forall x. Rep SSMValidationParameters x -> SSMValidationParameters
forall x. SSMValidationParameters -> Rep SSMValidationParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SSMValidationParameters x -> SSMValidationParameters
$cfrom :: forall x. SSMValidationParameters -> Rep SSMValidationParameters x
Prelude.Generic)

-- |
-- Create a value of 'SSMValidationParameters' 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:
--
-- 'instanceId', 'sSMValidationParameters_instanceId' - The ID of the instance. The instance must have the following tag:
-- UserForSMSApplicationValidation=true.
--
-- 'command', 'sSMValidationParameters_command' - The command to run the validation script
--
-- 'executionTimeoutSeconds', 'sSMValidationParameters_executionTimeoutSeconds' - The timeout interval, in seconds.
--
-- 'scriptType', 'sSMValidationParameters_scriptType' - The type of validation script.
--
-- 'source', 'sSMValidationParameters_source' - The location of the validation script.
--
-- 'outputS3BucketName', 'sSMValidationParameters_outputS3BucketName' - The name of the S3 bucket for output.
newSSMValidationParameters ::
  SSMValidationParameters
newSSMValidationParameters :: SSMValidationParameters
newSSMValidationParameters =
  SSMValidationParameters' :: Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe ScriptType
-> Maybe Source
-> Maybe Text
-> SSMValidationParameters
SSMValidationParameters'
    { $sel:instanceId:SSMValidationParameters' :: Maybe Text
instanceId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:command:SSMValidationParameters' :: Maybe Text
command = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:executionTimeoutSeconds:SSMValidationParameters' :: Maybe Natural
executionTimeoutSeconds = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:scriptType:SSMValidationParameters' :: Maybe ScriptType
scriptType = Maybe ScriptType
forall a. Maybe a
Prelude.Nothing,
      $sel:source:SSMValidationParameters' :: Maybe Source
source = Maybe Source
forall a. Maybe a
Prelude.Nothing,
      $sel:outputS3BucketName:SSMValidationParameters' :: Maybe Text
outputS3BucketName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the instance. The instance must have the following tag:
-- UserForSMSApplicationValidation=true.
sSMValidationParameters_instanceId :: Lens.Lens' SSMValidationParameters (Prelude.Maybe Prelude.Text)
sSMValidationParameters_instanceId :: (Maybe Text -> f (Maybe Text))
-> SSMValidationParameters -> f SSMValidationParameters
sSMValidationParameters_instanceId = (SSMValidationParameters -> Maybe Text)
-> (SSMValidationParameters
    -> Maybe Text -> SSMValidationParameters)
-> Lens
     SSMValidationParameters
     SSMValidationParameters
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SSMValidationParameters' {Maybe Text
instanceId :: Maybe Text
$sel:instanceId:SSMValidationParameters' :: SSMValidationParameters -> Maybe Text
instanceId} -> Maybe Text
instanceId) (\s :: SSMValidationParameters
s@SSMValidationParameters' {} Maybe Text
a -> SSMValidationParameters
s {$sel:instanceId:SSMValidationParameters' :: Maybe Text
instanceId = Maybe Text
a} :: SSMValidationParameters)

-- | The command to run the validation script
sSMValidationParameters_command :: Lens.Lens' SSMValidationParameters (Prelude.Maybe Prelude.Text)
sSMValidationParameters_command :: (Maybe Text -> f (Maybe Text))
-> SSMValidationParameters -> f SSMValidationParameters
sSMValidationParameters_command = (SSMValidationParameters -> Maybe Text)
-> (SSMValidationParameters
    -> Maybe Text -> SSMValidationParameters)
-> Lens
     SSMValidationParameters
     SSMValidationParameters
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SSMValidationParameters' {Maybe Text
command :: Maybe Text
$sel:command:SSMValidationParameters' :: SSMValidationParameters -> Maybe Text
command} -> Maybe Text
command) (\s :: SSMValidationParameters
s@SSMValidationParameters' {} Maybe Text
a -> SSMValidationParameters
s {$sel:command:SSMValidationParameters' :: Maybe Text
command = Maybe Text
a} :: SSMValidationParameters)

-- | The timeout interval, in seconds.
sSMValidationParameters_executionTimeoutSeconds :: Lens.Lens' SSMValidationParameters (Prelude.Maybe Prelude.Natural)
sSMValidationParameters_executionTimeoutSeconds :: (Maybe Natural -> f (Maybe Natural))
-> SSMValidationParameters -> f SSMValidationParameters
sSMValidationParameters_executionTimeoutSeconds = (SSMValidationParameters -> Maybe Natural)
-> (SSMValidationParameters
    -> Maybe Natural -> SSMValidationParameters)
-> Lens
     SSMValidationParameters
     SSMValidationParameters
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SSMValidationParameters' {Maybe Natural
executionTimeoutSeconds :: Maybe Natural
$sel:executionTimeoutSeconds:SSMValidationParameters' :: SSMValidationParameters -> Maybe Natural
executionTimeoutSeconds} -> Maybe Natural
executionTimeoutSeconds) (\s :: SSMValidationParameters
s@SSMValidationParameters' {} Maybe Natural
a -> SSMValidationParameters
s {$sel:executionTimeoutSeconds:SSMValidationParameters' :: Maybe Natural
executionTimeoutSeconds = Maybe Natural
a} :: SSMValidationParameters)

-- | The type of validation script.
sSMValidationParameters_scriptType :: Lens.Lens' SSMValidationParameters (Prelude.Maybe ScriptType)
sSMValidationParameters_scriptType :: (Maybe ScriptType -> f (Maybe ScriptType))
-> SSMValidationParameters -> f SSMValidationParameters
sSMValidationParameters_scriptType = (SSMValidationParameters -> Maybe ScriptType)
-> (SSMValidationParameters
    -> Maybe ScriptType -> SSMValidationParameters)
-> Lens
     SSMValidationParameters
     SSMValidationParameters
     (Maybe ScriptType)
     (Maybe ScriptType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SSMValidationParameters' {Maybe ScriptType
scriptType :: Maybe ScriptType
$sel:scriptType:SSMValidationParameters' :: SSMValidationParameters -> Maybe ScriptType
scriptType} -> Maybe ScriptType
scriptType) (\s :: SSMValidationParameters
s@SSMValidationParameters' {} Maybe ScriptType
a -> SSMValidationParameters
s {$sel:scriptType:SSMValidationParameters' :: Maybe ScriptType
scriptType = Maybe ScriptType
a} :: SSMValidationParameters)

-- | The location of the validation script.
sSMValidationParameters_source :: Lens.Lens' SSMValidationParameters (Prelude.Maybe Source)
sSMValidationParameters_source :: (Maybe Source -> f (Maybe Source))
-> SSMValidationParameters -> f SSMValidationParameters
sSMValidationParameters_source = (SSMValidationParameters -> Maybe Source)
-> (SSMValidationParameters
    -> Maybe Source -> SSMValidationParameters)
-> Lens
     SSMValidationParameters
     SSMValidationParameters
     (Maybe Source)
     (Maybe Source)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SSMValidationParameters' {Maybe Source
source :: Maybe Source
$sel:source:SSMValidationParameters' :: SSMValidationParameters -> Maybe Source
source} -> Maybe Source
source) (\s :: SSMValidationParameters
s@SSMValidationParameters' {} Maybe Source
a -> SSMValidationParameters
s {$sel:source:SSMValidationParameters' :: Maybe Source
source = Maybe Source
a} :: SSMValidationParameters)

-- | The name of the S3 bucket for output.
sSMValidationParameters_outputS3BucketName :: Lens.Lens' SSMValidationParameters (Prelude.Maybe Prelude.Text)
sSMValidationParameters_outputS3BucketName :: (Maybe Text -> f (Maybe Text))
-> SSMValidationParameters -> f SSMValidationParameters
sSMValidationParameters_outputS3BucketName = (SSMValidationParameters -> Maybe Text)
-> (SSMValidationParameters
    -> Maybe Text -> SSMValidationParameters)
-> Lens
     SSMValidationParameters
     SSMValidationParameters
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SSMValidationParameters' {Maybe Text
outputS3BucketName :: Maybe Text
$sel:outputS3BucketName:SSMValidationParameters' :: SSMValidationParameters -> Maybe Text
outputS3BucketName} -> Maybe Text
outputS3BucketName) (\s :: SSMValidationParameters
s@SSMValidationParameters' {} Maybe Text
a -> SSMValidationParameters
s {$sel:outputS3BucketName:SSMValidationParameters' :: Maybe Text
outputS3BucketName = Maybe Text
a} :: SSMValidationParameters)

instance Core.FromJSON SSMValidationParameters where
  parseJSON :: Value -> Parser SSMValidationParameters
parseJSON =
    String
-> (Object -> Parser SSMValidationParameters)
-> Value
-> Parser SSMValidationParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SSMValidationParameters"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe ScriptType
-> Maybe Source
-> Maybe Text
-> SSMValidationParameters
SSMValidationParameters'
            (Maybe Text
 -> Maybe Text
 -> Maybe Natural
 -> Maybe ScriptType
 -> Maybe Source
 -> Maybe Text
 -> SSMValidationParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Natural
      -> Maybe ScriptType
      -> Maybe Source
      -> Maybe Text
      -> SSMValidationParameters)
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
"instanceId")
            Parser
  (Maybe Text
   -> Maybe Natural
   -> Maybe ScriptType
   -> Maybe Source
   -> Maybe Text
   -> SSMValidationParameters)
-> Parser (Maybe Text)
-> Parser
     (Maybe Natural
      -> Maybe ScriptType
      -> Maybe Source
      -> Maybe Text
      -> SSMValidationParameters)
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
"command")
            Parser
  (Maybe Natural
   -> Maybe ScriptType
   -> Maybe Source
   -> Maybe Text
   -> SSMValidationParameters)
-> Parser (Maybe Natural)
-> Parser
     (Maybe ScriptType
      -> Maybe Source -> Maybe Text -> SSMValidationParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"executionTimeoutSeconds")
            Parser
  (Maybe ScriptType
   -> Maybe Source -> Maybe Text -> SSMValidationParameters)
-> Parser (Maybe ScriptType)
-> Parser (Maybe Source -> Maybe Text -> SSMValidationParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ScriptType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"scriptType")
            Parser (Maybe Source -> Maybe Text -> SSMValidationParameters)
-> Parser (Maybe Source)
-> Parser (Maybe Text -> SSMValidationParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Source)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"source")
            Parser (Maybe Text -> SSMValidationParameters)
-> Parser (Maybe Text) -> Parser SSMValidationParameters
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
"outputS3BucketName")
      )

instance Prelude.Hashable SSMValidationParameters

instance Prelude.NFData SSMValidationParameters

instance Core.ToJSON SSMValidationParameters where
  toJSON :: SSMValidationParameters -> Value
toJSON SSMValidationParameters' {Maybe Natural
Maybe Text
Maybe ScriptType
Maybe Source
outputS3BucketName :: Maybe Text
source :: Maybe Source
scriptType :: Maybe ScriptType
executionTimeoutSeconds :: Maybe Natural
command :: Maybe Text
instanceId :: Maybe Text
$sel:outputS3BucketName:SSMValidationParameters' :: SSMValidationParameters -> Maybe Text
$sel:source:SSMValidationParameters' :: SSMValidationParameters -> Maybe Source
$sel:scriptType:SSMValidationParameters' :: SSMValidationParameters -> Maybe ScriptType
$sel:executionTimeoutSeconds:SSMValidationParameters' :: SSMValidationParameters -> Maybe Natural
$sel:command:SSMValidationParameters' :: SSMValidationParameters -> Maybe Text
$sel:instanceId:SSMValidationParameters' :: SSMValidationParameters -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"instanceId" 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
instanceId,
            (Text
"command" 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
command,
            (Text
"executionTimeoutSeconds" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
executionTimeoutSeconds,
            (Text
"scriptType" Text -> ScriptType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ScriptType -> Pair) -> Maybe ScriptType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ScriptType
scriptType,
            (Text
"source" Text -> Source -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Source -> Pair) -> Maybe Source -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Source
source,
            (Text
"outputS3BucketName" 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
outputS3BucketName
          ]
      )