{-# 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.SSM.Types.Parameter
-- 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.SSM.Types.Parameter where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.ParameterType

-- | An Amazon Web Services Systems Manager parameter in Parameter Store.
--
-- /See:/ 'newParameter' smart constructor.
data Parameter = Parameter'
  { -- | Date the parameter was last changed or updated and the parameter version
    -- was created.
    Parameter -> Maybe POSIX
lastModifiedDate :: Prelude.Maybe Core.POSIX,
    -- | Either the version number or the label used to retrieve the parameter
    -- value. Specify selectors by using one of the following formats:
    --
    -- parameter_name:version
    --
    -- parameter_name:label
    Parameter -> Maybe Text
selector :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the parameter.
    Parameter -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The parameter value.
    Parameter -> Maybe (Sensitive Text)
value :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | Applies to parameters that reference information in other Amazon Web
    -- Services services. @SourceResult@ is the raw result or response from the
    -- source.
    Parameter -> Maybe Text
sourceResult :: Prelude.Maybe Prelude.Text,
    -- | The name of the parameter.
    Parameter -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The parameter version.
    Parameter -> Maybe Integer
version :: Prelude.Maybe Prelude.Integer,
    -- | The type of parameter. Valid values include the following: @String@,
    -- @StringList@, and @SecureString@.
    Parameter -> Maybe ParameterType
type' :: Prelude.Maybe ParameterType,
    -- | The data type of the parameter, such as @text@ or @aws:ec2:image@. The
    -- default is @text@.
    Parameter -> Maybe Text
dataType :: Prelude.Maybe Prelude.Text
  }
  deriving (Parameter -> Parameter -> Bool
(Parameter -> Parameter -> Bool)
-> (Parameter -> Parameter -> Bool) -> Eq Parameter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Parameter -> Parameter -> Bool
$c/= :: Parameter -> Parameter -> Bool
== :: Parameter -> Parameter -> Bool
$c== :: Parameter -> Parameter -> Bool
Prelude.Eq, Int -> Parameter -> ShowS
[Parameter] -> ShowS
Parameter -> String
(Int -> Parameter -> ShowS)
-> (Parameter -> String)
-> ([Parameter] -> ShowS)
-> Show Parameter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Parameter] -> ShowS
$cshowList :: [Parameter] -> ShowS
show :: Parameter -> String
$cshow :: Parameter -> String
showsPrec :: Int -> Parameter -> ShowS
$cshowsPrec :: Int -> Parameter -> ShowS
Prelude.Show, (forall x. Parameter -> Rep Parameter x)
-> (forall x. Rep Parameter x -> Parameter) -> Generic Parameter
forall x. Rep Parameter x -> Parameter
forall x. Parameter -> Rep Parameter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Parameter x -> Parameter
$cfrom :: forall x. Parameter -> Rep Parameter x
Prelude.Generic)

-- |
-- Create a value of 'Parameter' 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:
--
-- 'lastModifiedDate', 'parameter_lastModifiedDate' - Date the parameter was last changed or updated and the parameter version
-- was created.
--
-- 'selector', 'parameter_selector' - Either the version number or the label used to retrieve the parameter
-- value. Specify selectors by using one of the following formats:
--
-- parameter_name:version
--
-- parameter_name:label
--
-- 'arn', 'parameter_arn' - The Amazon Resource Name (ARN) of the parameter.
--
-- 'value', 'parameter_value' - The parameter value.
--
-- 'sourceResult', 'parameter_sourceResult' - Applies to parameters that reference information in other Amazon Web
-- Services services. @SourceResult@ is the raw result or response from the
-- source.
--
-- 'name', 'parameter_name' - The name of the parameter.
--
-- 'version', 'parameter_version' - The parameter version.
--
-- 'type'', 'parameter_type' - The type of parameter. Valid values include the following: @String@,
-- @StringList@, and @SecureString@.
--
-- 'dataType', 'parameter_dataType' - The data type of the parameter, such as @text@ or @aws:ec2:image@. The
-- default is @text@.
newParameter ::
  Parameter
newParameter :: Parameter
newParameter =
  Parameter' :: Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe Text
-> Maybe Text
-> Maybe Integer
-> Maybe ParameterType
-> Maybe Text
-> Parameter
Parameter'
    { $sel:lastModifiedDate:Parameter' :: Maybe POSIX
lastModifiedDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:selector:Parameter' :: Maybe Text
selector = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:Parameter' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:value:Parameter' :: Maybe (Sensitive Text)
value = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceResult:Parameter' :: Maybe Text
sourceResult = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Parameter' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:version:Parameter' :: Maybe Integer
version = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:type':Parameter' :: Maybe ParameterType
type' = Maybe ParameterType
forall a. Maybe a
Prelude.Nothing,
      $sel:dataType:Parameter' :: Maybe Text
dataType = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Date the parameter was last changed or updated and the parameter version
-- was created.
parameter_lastModifiedDate :: Lens.Lens' Parameter (Prelude.Maybe Prelude.UTCTime)
parameter_lastModifiedDate :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Parameter -> f Parameter
parameter_lastModifiedDate = (Parameter -> Maybe POSIX)
-> (Parameter -> Maybe POSIX -> Parameter)
-> Lens Parameter Parameter (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Parameter' {Maybe POSIX
lastModifiedDate :: Maybe POSIX
$sel:lastModifiedDate:Parameter' :: Parameter -> Maybe POSIX
lastModifiedDate} -> Maybe POSIX
lastModifiedDate) (\s :: Parameter
s@Parameter' {} Maybe POSIX
a -> Parameter
s {$sel:lastModifiedDate:Parameter' :: Maybe POSIX
lastModifiedDate = Maybe POSIX
a} :: Parameter) ((Maybe POSIX -> f (Maybe POSIX)) -> Parameter -> f Parameter)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Parameter
-> f Parameter
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Either the version number or the label used to retrieve the parameter
-- value. Specify selectors by using one of the following formats:
--
-- parameter_name:version
--
-- parameter_name:label
parameter_selector :: Lens.Lens' Parameter (Prelude.Maybe Prelude.Text)
parameter_selector :: (Maybe Text -> f (Maybe Text)) -> Parameter -> f Parameter
parameter_selector = (Parameter -> Maybe Text)
-> (Parameter -> Maybe Text -> Parameter)
-> Lens Parameter Parameter (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Parameter' {Maybe Text
selector :: Maybe Text
$sel:selector:Parameter' :: Parameter -> Maybe Text
selector} -> Maybe Text
selector) (\s :: Parameter
s@Parameter' {} Maybe Text
a -> Parameter
s {$sel:selector:Parameter' :: Maybe Text
selector = Maybe Text
a} :: Parameter)

-- | The Amazon Resource Name (ARN) of the parameter.
parameter_arn :: Lens.Lens' Parameter (Prelude.Maybe Prelude.Text)
parameter_arn :: (Maybe Text -> f (Maybe Text)) -> Parameter -> f Parameter
parameter_arn = (Parameter -> Maybe Text)
-> (Parameter -> Maybe Text -> Parameter)
-> Lens Parameter Parameter (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Parameter' {Maybe Text
arn :: Maybe Text
$sel:arn:Parameter' :: Parameter -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Parameter
s@Parameter' {} Maybe Text
a -> Parameter
s {$sel:arn:Parameter' :: Maybe Text
arn = Maybe Text
a} :: Parameter)

-- | The parameter value.
parameter_value :: Lens.Lens' Parameter (Prelude.Maybe Prelude.Text)
parameter_value :: (Maybe Text -> f (Maybe Text)) -> Parameter -> f Parameter
parameter_value = (Parameter -> Maybe (Sensitive Text))
-> (Parameter -> Maybe (Sensitive Text) -> Parameter)
-> Lens
     Parameter
     Parameter
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Parameter' {Maybe (Sensitive Text)
value :: Maybe (Sensitive Text)
$sel:value:Parameter' :: Parameter -> Maybe (Sensitive Text)
value} -> Maybe (Sensitive Text)
value) (\s :: Parameter
s@Parameter' {} Maybe (Sensitive Text)
a -> Parameter
s {$sel:value:Parameter' :: Maybe (Sensitive Text)
value = Maybe (Sensitive Text)
a} :: Parameter) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> Parameter -> f Parameter)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> Parameter
-> f Parameter
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | Applies to parameters that reference information in other Amazon Web
-- Services services. @SourceResult@ is the raw result or response from the
-- source.
parameter_sourceResult :: Lens.Lens' Parameter (Prelude.Maybe Prelude.Text)
parameter_sourceResult :: (Maybe Text -> f (Maybe Text)) -> Parameter -> f Parameter
parameter_sourceResult = (Parameter -> Maybe Text)
-> (Parameter -> Maybe Text -> Parameter)
-> Lens Parameter Parameter (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Parameter' {Maybe Text
sourceResult :: Maybe Text
$sel:sourceResult:Parameter' :: Parameter -> Maybe Text
sourceResult} -> Maybe Text
sourceResult) (\s :: Parameter
s@Parameter' {} Maybe Text
a -> Parameter
s {$sel:sourceResult:Parameter' :: Maybe Text
sourceResult = Maybe Text
a} :: Parameter)

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

-- | The parameter version.
parameter_version :: Lens.Lens' Parameter (Prelude.Maybe Prelude.Integer)
parameter_version :: (Maybe Integer -> f (Maybe Integer)) -> Parameter -> f Parameter
parameter_version = (Parameter -> Maybe Integer)
-> (Parameter -> Maybe Integer -> Parameter)
-> Lens Parameter Parameter (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Parameter' {Maybe Integer
version :: Maybe Integer
$sel:version:Parameter' :: Parameter -> Maybe Integer
version} -> Maybe Integer
version) (\s :: Parameter
s@Parameter' {} Maybe Integer
a -> Parameter
s {$sel:version:Parameter' :: Maybe Integer
version = Maybe Integer
a} :: Parameter)

-- | The type of parameter. Valid values include the following: @String@,
-- @StringList@, and @SecureString@.
parameter_type :: Lens.Lens' Parameter (Prelude.Maybe ParameterType)
parameter_type :: (Maybe ParameterType -> f (Maybe ParameterType))
-> Parameter -> f Parameter
parameter_type = (Parameter -> Maybe ParameterType)
-> (Parameter -> Maybe ParameterType -> Parameter)
-> Lens
     Parameter Parameter (Maybe ParameterType) (Maybe ParameterType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Parameter' {Maybe ParameterType
type' :: Maybe ParameterType
$sel:type':Parameter' :: Parameter -> Maybe ParameterType
type'} -> Maybe ParameterType
type') (\s :: Parameter
s@Parameter' {} Maybe ParameterType
a -> Parameter
s {$sel:type':Parameter' :: Maybe ParameterType
type' = Maybe ParameterType
a} :: Parameter)

-- | The data type of the parameter, such as @text@ or @aws:ec2:image@. The
-- default is @text@.
parameter_dataType :: Lens.Lens' Parameter (Prelude.Maybe Prelude.Text)
parameter_dataType :: (Maybe Text -> f (Maybe Text)) -> Parameter -> f Parameter
parameter_dataType = (Parameter -> Maybe Text)
-> (Parameter -> Maybe Text -> Parameter)
-> Lens Parameter Parameter (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Parameter' {Maybe Text
dataType :: Maybe Text
$sel:dataType:Parameter' :: Parameter -> Maybe Text
dataType} -> Maybe Text
dataType) (\s :: Parameter
s@Parameter' {} Maybe Text
a -> Parameter
s {$sel:dataType:Parameter' :: Maybe Text
dataType = Maybe Text
a} :: Parameter)

instance Core.FromJSON Parameter where
  parseJSON :: Value -> Parser Parameter
parseJSON =
    String -> (Object -> Parser Parameter) -> Value -> Parser Parameter
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Parameter"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe Text
-> Maybe Text
-> Maybe Integer
-> Maybe ParameterType
-> Maybe Text
-> Parameter
Parameter'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe (Sensitive Text)
 -> Maybe Text
 -> Maybe Text
 -> Maybe Integer
 -> Maybe ParameterType
 -> Maybe Text
 -> Parameter)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe (Sensitive Text)
      -> Maybe Text
      -> Maybe Text
      -> Maybe Integer
      -> Maybe ParameterType
      -> Maybe Text
      -> Parameter)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastModifiedDate")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe (Sensitive Text)
   -> Maybe Text
   -> Maybe Text
   -> Maybe Integer
   -> Maybe ParameterType
   -> Maybe Text
   -> Parameter)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (Sensitive Text)
      -> Maybe Text
      -> Maybe Text
      -> Maybe Integer
      -> Maybe ParameterType
      -> Maybe Text
      -> Parameter)
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
"Selector")
            Parser
  (Maybe Text
   -> Maybe (Sensitive Text)
   -> Maybe Text
   -> Maybe Text
   -> Maybe Integer
   -> Maybe ParameterType
   -> Maybe Text
   -> Parameter)
-> Parser (Maybe Text)
-> Parser
     (Maybe (Sensitive Text)
      -> Maybe Text
      -> Maybe Text
      -> Maybe Integer
      -> Maybe ParameterType
      -> Maybe Text
      -> Parameter)
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
"ARN")
            Parser
  (Maybe (Sensitive Text)
   -> Maybe Text
   -> Maybe Text
   -> Maybe Integer
   -> Maybe ParameterType
   -> Maybe Text
   -> Parameter)
-> Parser (Maybe (Sensitive Text))
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Integer
      -> Maybe ParameterType
      -> Maybe Text
      -> Parameter)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Value")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Integer
   -> Maybe ParameterType
   -> Maybe Text
   -> Parameter)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Integer -> Maybe ParameterType -> Maybe Text -> Parameter)
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
"SourceResult")
            Parser
  (Maybe Text
   -> Maybe Integer -> Maybe ParameterType -> Maybe Text -> Parameter)
-> Parser (Maybe Text)
-> Parser
     (Maybe Integer -> Maybe ParameterType -> Maybe Text -> Parameter)
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 Integer -> Maybe ParameterType -> Maybe Text -> Parameter)
-> Parser (Maybe Integer)
-> Parser (Maybe ParameterType -> Maybe Text -> Parameter)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Version")
            Parser (Maybe ParameterType -> Maybe Text -> Parameter)
-> Parser (Maybe ParameterType) -> Parser (Maybe Text -> Parameter)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ParameterType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
            Parser (Maybe Text -> Parameter)
-> Parser (Maybe Text) -> Parser Parameter
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
"DataType")
      )

instance Prelude.Hashable Parameter

instance Prelude.NFData Parameter