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

-- | The parameters for a @LAMBDA@ task type.
--
-- For information about specifying and updating task parameters, see
-- RegisterTaskWithMaintenanceWindow and UpdateMaintenanceWindowTask.
--
-- @LoggingInfo@ has been deprecated. To specify an Amazon Simple Storage
-- Service (Amazon S3) bucket to contain logs, instead use the
-- @OutputS3BucketName@ and @OutputS3KeyPrefix@ options in the
-- @TaskInvocationParameters@ structure. For information about how Amazon
-- Web Services Systems Manager handles these options for the supported
-- maintenance window task types, see
-- MaintenanceWindowTaskInvocationParameters.
--
-- @TaskParameters@ has been deprecated. To specify parameters to pass to a
-- task when it runs, instead use the @Parameters@ option in the
-- @TaskInvocationParameters@ structure. For information about how Systems
-- Manager handles these options for the supported maintenance window task
-- types, see MaintenanceWindowTaskInvocationParameters.
--
-- For Lambda tasks, Systems Manager ignores any values specified for
-- TaskParameters and LoggingInfo.
--
-- /See:/ 'newMaintenanceWindowLambdaParameters' smart constructor.
data MaintenanceWindowLambdaParameters = MaintenanceWindowLambdaParameters'
  { -- | Pass client-specific information to the Lambda function that you are
    -- invoking. You can then process the client information in your Lambda
    -- function as you choose through the context variable.
    MaintenanceWindowLambdaParameters -> Maybe Text
clientContext :: Prelude.Maybe Prelude.Text,
    -- | JSON to provide to your Lambda function as input.
    MaintenanceWindowLambdaParameters -> Maybe (Sensitive Base64)
payload :: Prelude.Maybe (Data.Sensitive Data.Base64),
    -- | (Optional) Specify an Lambda function version or alias name. If you
    -- specify a function version, the operation uses the qualified function
    -- Amazon Resource Name (ARN) to invoke a specific Lambda function. If you
    -- specify an alias name, the operation uses the alias ARN to invoke the
    -- Lambda function version to which the alias points.
    MaintenanceWindowLambdaParameters -> Maybe Text
qualifier :: Prelude.Maybe Prelude.Text
  }
  deriving (MaintenanceWindowLambdaParameters
-> MaintenanceWindowLambdaParameters -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MaintenanceWindowLambdaParameters
-> MaintenanceWindowLambdaParameters -> Bool
$c/= :: MaintenanceWindowLambdaParameters
-> MaintenanceWindowLambdaParameters -> Bool
== :: MaintenanceWindowLambdaParameters
-> MaintenanceWindowLambdaParameters -> Bool
$c== :: MaintenanceWindowLambdaParameters
-> MaintenanceWindowLambdaParameters -> Bool
Prelude.Eq, Int -> MaintenanceWindowLambdaParameters -> ShowS
[MaintenanceWindowLambdaParameters] -> ShowS
MaintenanceWindowLambdaParameters -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MaintenanceWindowLambdaParameters] -> ShowS
$cshowList :: [MaintenanceWindowLambdaParameters] -> ShowS
show :: MaintenanceWindowLambdaParameters -> String
$cshow :: MaintenanceWindowLambdaParameters -> String
showsPrec :: Int -> MaintenanceWindowLambdaParameters -> ShowS
$cshowsPrec :: Int -> MaintenanceWindowLambdaParameters -> ShowS
Prelude.Show, forall x.
Rep MaintenanceWindowLambdaParameters x
-> MaintenanceWindowLambdaParameters
forall x.
MaintenanceWindowLambdaParameters
-> Rep MaintenanceWindowLambdaParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MaintenanceWindowLambdaParameters x
-> MaintenanceWindowLambdaParameters
$cfrom :: forall x.
MaintenanceWindowLambdaParameters
-> Rep MaintenanceWindowLambdaParameters x
Prelude.Generic)

-- |
-- Create a value of 'MaintenanceWindowLambdaParameters' 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:
--
-- 'clientContext', 'maintenanceWindowLambdaParameters_clientContext' - Pass client-specific information to the Lambda function that you are
-- invoking. You can then process the client information in your Lambda
-- function as you choose through the context variable.
--
-- 'payload', 'maintenanceWindowLambdaParameters_payload' - JSON to provide to your Lambda function as input.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
--
-- 'qualifier', 'maintenanceWindowLambdaParameters_qualifier' - (Optional) Specify an Lambda function version or alias name. If you
-- specify a function version, the operation uses the qualified function
-- Amazon Resource Name (ARN) to invoke a specific Lambda function. If you
-- specify an alias name, the operation uses the alias ARN to invoke the
-- Lambda function version to which the alias points.
newMaintenanceWindowLambdaParameters ::
  MaintenanceWindowLambdaParameters
newMaintenanceWindowLambdaParameters :: MaintenanceWindowLambdaParameters
newMaintenanceWindowLambdaParameters =
  MaintenanceWindowLambdaParameters'
    { $sel:clientContext:MaintenanceWindowLambdaParameters' :: Maybe Text
clientContext =
        forall a. Maybe a
Prelude.Nothing,
      $sel:payload:MaintenanceWindowLambdaParameters' :: Maybe (Sensitive Base64)
payload = forall a. Maybe a
Prelude.Nothing,
      $sel:qualifier:MaintenanceWindowLambdaParameters' :: Maybe Text
qualifier = forall a. Maybe a
Prelude.Nothing
    }

-- | Pass client-specific information to the Lambda function that you are
-- invoking. You can then process the client information in your Lambda
-- function as you choose through the context variable.
maintenanceWindowLambdaParameters_clientContext :: Lens.Lens' MaintenanceWindowLambdaParameters (Prelude.Maybe Prelude.Text)
maintenanceWindowLambdaParameters_clientContext :: Lens' MaintenanceWindowLambdaParameters (Maybe Text)
maintenanceWindowLambdaParameters_clientContext = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceWindowLambdaParameters' {Maybe Text
clientContext :: Maybe Text
$sel:clientContext:MaintenanceWindowLambdaParameters' :: MaintenanceWindowLambdaParameters -> Maybe Text
clientContext} -> Maybe Text
clientContext) (\s :: MaintenanceWindowLambdaParameters
s@MaintenanceWindowLambdaParameters' {} Maybe Text
a -> MaintenanceWindowLambdaParameters
s {$sel:clientContext:MaintenanceWindowLambdaParameters' :: Maybe Text
clientContext = Maybe Text
a} :: MaintenanceWindowLambdaParameters)

-- | JSON to provide to your Lambda function as input.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
maintenanceWindowLambdaParameters_payload :: Lens.Lens' MaintenanceWindowLambdaParameters (Prelude.Maybe Prelude.ByteString)
maintenanceWindowLambdaParameters_payload :: Lens' MaintenanceWindowLambdaParameters (Maybe ByteString)
maintenanceWindowLambdaParameters_payload = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceWindowLambdaParameters' {Maybe (Sensitive Base64)
payload :: Maybe (Sensitive Base64)
$sel:payload:MaintenanceWindowLambdaParameters' :: MaintenanceWindowLambdaParameters -> Maybe (Sensitive Base64)
payload} -> Maybe (Sensitive Base64)
payload) (\s :: MaintenanceWindowLambdaParameters
s@MaintenanceWindowLambdaParameters' {} Maybe (Sensitive Base64)
a -> MaintenanceWindowLambdaParameters
s {$sel:payload:MaintenanceWindowLambdaParameters' :: Maybe (Sensitive Base64)
payload = Maybe (Sensitive Base64)
a} :: MaintenanceWindowLambdaParameters) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 (forall a. Iso' (Sensitive a) a
Data._Sensitive forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Iso' Base64 ByteString
Data._Base64)

-- | (Optional) Specify an Lambda function version or alias name. If you
-- specify a function version, the operation uses the qualified function
-- Amazon Resource Name (ARN) to invoke a specific Lambda function. If you
-- specify an alias name, the operation uses the alias ARN to invoke the
-- Lambda function version to which the alias points.
maintenanceWindowLambdaParameters_qualifier :: Lens.Lens' MaintenanceWindowLambdaParameters (Prelude.Maybe Prelude.Text)
maintenanceWindowLambdaParameters_qualifier :: Lens' MaintenanceWindowLambdaParameters (Maybe Text)
maintenanceWindowLambdaParameters_qualifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MaintenanceWindowLambdaParameters' {Maybe Text
qualifier :: Maybe Text
$sel:qualifier:MaintenanceWindowLambdaParameters' :: MaintenanceWindowLambdaParameters -> Maybe Text
qualifier} -> Maybe Text
qualifier) (\s :: MaintenanceWindowLambdaParameters
s@MaintenanceWindowLambdaParameters' {} Maybe Text
a -> MaintenanceWindowLambdaParameters
s {$sel:qualifier:MaintenanceWindowLambdaParameters' :: Maybe Text
qualifier = Maybe Text
a} :: MaintenanceWindowLambdaParameters)

instance
  Data.FromJSON
    MaintenanceWindowLambdaParameters
  where
  parseJSON :: Value -> Parser MaintenanceWindowLambdaParameters
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MaintenanceWindowLambdaParameters"
      ( \Object
x ->
          Maybe Text
-> Maybe (Sensitive Base64)
-> Maybe Text
-> MaintenanceWindowLambdaParameters
MaintenanceWindowLambdaParameters'
            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
"ClientContext")
            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
"Payload")
            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
"Qualifier")
      )

instance
  Prelude.Hashable
    MaintenanceWindowLambdaParameters
  where
  hashWithSalt :: Int -> MaintenanceWindowLambdaParameters -> Int
hashWithSalt
    Int
_salt
    MaintenanceWindowLambdaParameters' {Maybe Text
Maybe (Sensitive Base64)
qualifier :: Maybe Text
payload :: Maybe (Sensitive Base64)
clientContext :: Maybe Text
$sel:qualifier:MaintenanceWindowLambdaParameters' :: MaintenanceWindowLambdaParameters -> Maybe Text
$sel:payload:MaintenanceWindowLambdaParameters' :: MaintenanceWindowLambdaParameters -> Maybe (Sensitive Base64)
$sel:clientContext:MaintenanceWindowLambdaParameters' :: MaintenanceWindowLambdaParameters -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientContext
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Base64)
payload
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
qualifier

instance
  Prelude.NFData
    MaintenanceWindowLambdaParameters
  where
  rnf :: MaintenanceWindowLambdaParameters -> ()
rnf MaintenanceWindowLambdaParameters' {Maybe Text
Maybe (Sensitive Base64)
qualifier :: Maybe Text
payload :: Maybe (Sensitive Base64)
clientContext :: Maybe Text
$sel:qualifier:MaintenanceWindowLambdaParameters' :: MaintenanceWindowLambdaParameters -> Maybe Text
$sel:payload:MaintenanceWindowLambdaParameters' :: MaintenanceWindowLambdaParameters -> Maybe (Sensitive Base64)
$sel:clientContext:MaintenanceWindowLambdaParameters' :: MaintenanceWindowLambdaParameters -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientContext
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Base64)
payload
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
qualifier

instance
  Data.ToJSON
    MaintenanceWindowLambdaParameters
  where
  toJSON :: MaintenanceWindowLambdaParameters -> Value
toJSON MaintenanceWindowLambdaParameters' {Maybe Text
Maybe (Sensitive Base64)
qualifier :: Maybe Text
payload :: Maybe (Sensitive Base64)
clientContext :: Maybe Text
$sel:qualifier:MaintenanceWindowLambdaParameters' :: MaintenanceWindowLambdaParameters -> Maybe Text
$sel:payload:MaintenanceWindowLambdaParameters' :: MaintenanceWindowLambdaParameters -> Maybe (Sensitive Base64)
$sel:clientContext:MaintenanceWindowLambdaParameters' :: MaintenanceWindowLambdaParameters -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ClientContext" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientContext,
            (Key
"Payload" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Base64)
payload,
            (Key
"Qualifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
qualifier
          ]
      )