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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | JSON to provide to your Lambda function as input.
    MaintenanceWindowLambdaParameters -> Maybe (Sensitive Base64)
payload :: Prelude.Maybe (Core.Sensitive Core.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,
    -- | 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
  }
  deriving (MaintenanceWindowLambdaParameters
-> MaintenanceWindowLambdaParameters -> Bool
(MaintenanceWindowLambdaParameters
 -> MaintenanceWindowLambdaParameters -> Bool)
-> (MaintenanceWindowLambdaParameters
    -> MaintenanceWindowLambdaParameters -> Bool)
-> Eq MaintenanceWindowLambdaParameters
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
(Int -> MaintenanceWindowLambdaParameters -> ShowS)
-> (MaintenanceWindowLambdaParameters -> String)
-> ([MaintenanceWindowLambdaParameters] -> ShowS)
-> Show MaintenanceWindowLambdaParameters
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.
 MaintenanceWindowLambdaParameters
 -> Rep MaintenanceWindowLambdaParameters x)
-> (forall x.
    Rep MaintenanceWindowLambdaParameters x
    -> MaintenanceWindowLambdaParameters)
-> Generic MaintenanceWindowLambdaParameters
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:
--
-- '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.
--
-- '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.
newMaintenanceWindowLambdaParameters ::
  MaintenanceWindowLambdaParameters
newMaintenanceWindowLambdaParameters :: MaintenanceWindowLambdaParameters
newMaintenanceWindowLambdaParameters =
  MaintenanceWindowLambdaParameters' :: Maybe (Sensitive Base64)
-> Maybe Text -> Maybe Text -> MaintenanceWindowLambdaParameters
MaintenanceWindowLambdaParameters'
    { $sel:payload:MaintenanceWindowLambdaParameters' :: Maybe (Sensitive Base64)
payload =
        Maybe (Sensitive Base64)
forall a. Maybe a
Prelude.Nothing,
      $sel:qualifier:MaintenanceWindowLambdaParameters' :: Maybe Text
qualifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clientContext:MaintenanceWindowLambdaParameters' :: Maybe Text
clientContext = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe ByteString -> f (Maybe ByteString))
-> MaintenanceWindowLambdaParameters
-> f MaintenanceWindowLambdaParameters
maintenanceWindowLambdaParameters_payload = (MaintenanceWindowLambdaParameters -> Maybe (Sensitive Base64))
-> (MaintenanceWindowLambdaParameters
    -> Maybe (Sensitive Base64) -> MaintenanceWindowLambdaParameters)
-> Lens
     MaintenanceWindowLambdaParameters
     MaintenanceWindowLambdaParameters
     (Maybe (Sensitive Base64))
     (Maybe (Sensitive Base64))
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) ((Maybe (Sensitive Base64) -> f (Maybe (Sensitive Base64)))
 -> MaintenanceWindowLambdaParameters
 -> f MaintenanceWindowLambdaParameters)
-> ((Maybe ByteString -> f (Maybe ByteString))
    -> Maybe (Sensitive Base64) -> f (Maybe (Sensitive Base64)))
-> (Maybe ByteString -> f (Maybe ByteString))
-> MaintenanceWindowLambdaParameters
-> f MaintenanceWindowLambdaParameters
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Base64) (Sensitive Base64) ByteString ByteString
-> Iso
     (Maybe (Sensitive Base64))
     (Maybe (Sensitive Base64))
     (Maybe ByteString)
     (Maybe ByteString)
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 (Exchange ByteString ByteString Base64 (Identity Base64)
-> Exchange
     ByteString
     ByteString
     (Sensitive Base64)
     (Identity (Sensitive Base64))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Exchange ByteString ByteString Base64 (Identity Base64)
 -> Exchange
      ByteString
      ByteString
      (Sensitive Base64)
      (Identity (Sensitive Base64)))
-> (Exchange ByteString ByteString ByteString (Identity ByteString)
    -> Exchange ByteString ByteString Base64 (Identity Base64))
-> AnIso
     (Sensitive Base64) (Sensitive Base64) ByteString ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Exchange ByteString ByteString ByteString (Identity ByteString)
-> Exchange ByteString ByteString Base64 (Identity Base64)
Iso' Base64 ByteString
Core._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 :: (Maybe Text -> f (Maybe Text))
-> MaintenanceWindowLambdaParameters
-> f MaintenanceWindowLambdaParameters
maintenanceWindowLambdaParameters_qualifier = (MaintenanceWindowLambdaParameters -> Maybe Text)
-> (MaintenanceWindowLambdaParameters
    -> Maybe Text -> MaintenanceWindowLambdaParameters)
-> Lens
     MaintenanceWindowLambdaParameters
     MaintenanceWindowLambdaParameters
     (Maybe Text)
     (Maybe Text)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> MaintenanceWindowLambdaParameters
-> f MaintenanceWindowLambdaParameters
maintenanceWindowLambdaParameters_clientContext = (MaintenanceWindowLambdaParameters -> Maybe Text)
-> (MaintenanceWindowLambdaParameters
    -> Maybe Text -> MaintenanceWindowLambdaParameters)
-> Lens
     MaintenanceWindowLambdaParameters
     MaintenanceWindowLambdaParameters
     (Maybe Text)
     (Maybe Text)
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)

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

instance
  Prelude.Hashable
    MaintenanceWindowLambdaParameters

instance
  Prelude.NFData
    MaintenanceWindowLambdaParameters

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