{-# 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.IoT.Types.DocumentParameter
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoT.Types.DocumentParameter where

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

-- | A map of key-value pairs containing the patterns that need to be
-- replaced in a managed template job document schema. You can use the
-- description of each key as a guidance to specify the inputs during
-- runtime when creating a job.
--
-- @documentParameters@ can only be used when creating jobs from Amazon Web
-- Services managed templates. This parameter can\'t be used with custom
-- job templates or to create jobs from them.
--
-- /See:/ 'newDocumentParameter' smart constructor.
data DocumentParameter = DocumentParameter'
  { -- | Description of the map field containing the patterns that need to be
    -- replaced in a managed template job document schema.
    DocumentParameter -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | An example illustrating a pattern that need to be replaced in a managed
    -- template job document schema.
    DocumentParameter -> Maybe Text
example :: Prelude.Maybe Prelude.Text,
    -- | Key of the map field containing the patterns that need to be replaced in
    -- a managed template job document schema.
    DocumentParameter -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether a pattern that needs to be replaced in a managed
    -- template job document schema is optional or required.
    DocumentParameter -> Maybe Bool
optional :: Prelude.Maybe Prelude.Bool,
    -- | A regular expression of the patterns that need to be replaced in a
    -- managed template job document schema.
    DocumentParameter -> Maybe Text
regex :: Prelude.Maybe Prelude.Text
  }
  deriving (DocumentParameter -> DocumentParameter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DocumentParameter -> DocumentParameter -> Bool
$c/= :: DocumentParameter -> DocumentParameter -> Bool
== :: DocumentParameter -> DocumentParameter -> Bool
$c== :: DocumentParameter -> DocumentParameter -> Bool
Prelude.Eq, ReadPrec [DocumentParameter]
ReadPrec DocumentParameter
Int -> ReadS DocumentParameter
ReadS [DocumentParameter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DocumentParameter]
$creadListPrec :: ReadPrec [DocumentParameter]
readPrec :: ReadPrec DocumentParameter
$creadPrec :: ReadPrec DocumentParameter
readList :: ReadS [DocumentParameter]
$creadList :: ReadS [DocumentParameter]
readsPrec :: Int -> ReadS DocumentParameter
$creadsPrec :: Int -> ReadS DocumentParameter
Prelude.Read, Int -> DocumentParameter -> ShowS
[DocumentParameter] -> ShowS
DocumentParameter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DocumentParameter] -> ShowS
$cshowList :: [DocumentParameter] -> ShowS
show :: DocumentParameter -> String
$cshow :: DocumentParameter -> String
showsPrec :: Int -> DocumentParameter -> ShowS
$cshowsPrec :: Int -> DocumentParameter -> ShowS
Prelude.Show, forall x. Rep DocumentParameter x -> DocumentParameter
forall x. DocumentParameter -> Rep DocumentParameter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DocumentParameter x -> DocumentParameter
$cfrom :: forall x. DocumentParameter -> Rep DocumentParameter x
Prelude.Generic)

-- |
-- Create a value of 'DocumentParameter' 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:
--
-- 'description', 'documentParameter_description' - Description of the map field containing the patterns that need to be
-- replaced in a managed template job document schema.
--
-- 'example', 'documentParameter_example' - An example illustrating a pattern that need to be replaced in a managed
-- template job document schema.
--
-- 'key', 'documentParameter_key' - Key of the map field containing the patterns that need to be replaced in
-- a managed template job document schema.
--
-- 'optional', 'documentParameter_optional' - Specifies whether a pattern that needs to be replaced in a managed
-- template job document schema is optional or required.
--
-- 'regex', 'documentParameter_regex' - A regular expression of the patterns that need to be replaced in a
-- managed template job document schema.
newDocumentParameter ::
  DocumentParameter
newDocumentParameter :: DocumentParameter
newDocumentParameter =
  DocumentParameter'
    { $sel:description:DocumentParameter' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:example:DocumentParameter' :: Maybe Text
example = forall a. Maybe a
Prelude.Nothing,
      $sel:key:DocumentParameter' :: Maybe Text
key = forall a. Maybe a
Prelude.Nothing,
      $sel:optional:DocumentParameter' :: Maybe Bool
optional = forall a. Maybe a
Prelude.Nothing,
      $sel:regex:DocumentParameter' :: Maybe Text
regex = forall a. Maybe a
Prelude.Nothing
    }

-- | Description of the map field containing the patterns that need to be
-- replaced in a managed template job document schema.
documentParameter_description :: Lens.Lens' DocumentParameter (Prelude.Maybe Prelude.Text)
documentParameter_description :: Lens' DocumentParameter (Maybe Text)
documentParameter_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentParameter' {Maybe Text
description :: Maybe Text
$sel:description:DocumentParameter' :: DocumentParameter -> Maybe Text
description} -> Maybe Text
description) (\s :: DocumentParameter
s@DocumentParameter' {} Maybe Text
a -> DocumentParameter
s {$sel:description:DocumentParameter' :: Maybe Text
description = Maybe Text
a} :: DocumentParameter)

-- | An example illustrating a pattern that need to be replaced in a managed
-- template job document schema.
documentParameter_example :: Lens.Lens' DocumentParameter (Prelude.Maybe Prelude.Text)
documentParameter_example :: Lens' DocumentParameter (Maybe Text)
documentParameter_example = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentParameter' {Maybe Text
example :: Maybe Text
$sel:example:DocumentParameter' :: DocumentParameter -> Maybe Text
example} -> Maybe Text
example) (\s :: DocumentParameter
s@DocumentParameter' {} Maybe Text
a -> DocumentParameter
s {$sel:example:DocumentParameter' :: Maybe Text
example = Maybe Text
a} :: DocumentParameter)

-- | Key of the map field containing the patterns that need to be replaced in
-- a managed template job document schema.
documentParameter_key :: Lens.Lens' DocumentParameter (Prelude.Maybe Prelude.Text)
documentParameter_key :: Lens' DocumentParameter (Maybe Text)
documentParameter_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentParameter' {Maybe Text
key :: Maybe Text
$sel:key:DocumentParameter' :: DocumentParameter -> Maybe Text
key} -> Maybe Text
key) (\s :: DocumentParameter
s@DocumentParameter' {} Maybe Text
a -> DocumentParameter
s {$sel:key:DocumentParameter' :: Maybe Text
key = Maybe Text
a} :: DocumentParameter)

-- | Specifies whether a pattern that needs to be replaced in a managed
-- template job document schema is optional or required.
documentParameter_optional :: Lens.Lens' DocumentParameter (Prelude.Maybe Prelude.Bool)
documentParameter_optional :: Lens' DocumentParameter (Maybe Bool)
documentParameter_optional = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentParameter' {Maybe Bool
optional :: Maybe Bool
$sel:optional:DocumentParameter' :: DocumentParameter -> Maybe Bool
optional} -> Maybe Bool
optional) (\s :: DocumentParameter
s@DocumentParameter' {} Maybe Bool
a -> DocumentParameter
s {$sel:optional:DocumentParameter' :: Maybe Bool
optional = Maybe Bool
a} :: DocumentParameter)

-- | A regular expression of the patterns that need to be replaced in a
-- managed template job document schema.
documentParameter_regex :: Lens.Lens' DocumentParameter (Prelude.Maybe Prelude.Text)
documentParameter_regex :: Lens' DocumentParameter (Maybe Text)
documentParameter_regex = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentParameter' {Maybe Text
regex :: Maybe Text
$sel:regex:DocumentParameter' :: DocumentParameter -> Maybe Text
regex} -> Maybe Text
regex) (\s :: DocumentParameter
s@DocumentParameter' {} Maybe Text
a -> DocumentParameter
s {$sel:regex:DocumentParameter' :: Maybe Text
regex = Maybe Text
a} :: DocumentParameter)

instance Data.FromJSON DocumentParameter where
  parseJSON :: Value -> Parser DocumentParameter
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DocumentParameter"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> DocumentParameter
DocumentParameter'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"example")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"key")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"optional")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"regex")
      )

instance Prelude.Hashable DocumentParameter where
  hashWithSalt :: Int -> DocumentParameter -> Int
hashWithSalt Int
_salt DocumentParameter' {Maybe Bool
Maybe Text
regex :: Maybe Text
optional :: Maybe Bool
key :: Maybe Text
example :: Maybe Text
description :: Maybe Text
$sel:regex:DocumentParameter' :: DocumentParameter -> Maybe Text
$sel:optional:DocumentParameter' :: DocumentParameter -> Maybe Bool
$sel:key:DocumentParameter' :: DocumentParameter -> Maybe Text
$sel:example:DocumentParameter' :: DocumentParameter -> Maybe Text
$sel:description:DocumentParameter' :: DocumentParameter -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
example
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
key
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
optional
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
regex

instance Prelude.NFData DocumentParameter where
  rnf :: DocumentParameter -> ()
rnf DocumentParameter' {Maybe Bool
Maybe Text
regex :: Maybe Text
optional :: Maybe Bool
key :: Maybe Text
example :: Maybe Text
description :: Maybe Text
$sel:regex:DocumentParameter' :: DocumentParameter -> Maybe Text
$sel:optional:DocumentParameter' :: DocumentParameter -> Maybe Bool
$sel:key:DocumentParameter' :: DocumentParameter -> Maybe Text
$sel:example:DocumentParameter' :: DocumentParameter -> Maybe Text
$sel:description:DocumentParameter' :: DocumentParameter -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
example
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
key
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
optional
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
regex