{-# 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.Synthetics.Types.ArtifactConfigInput
-- 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.Synthetics.Types.ArtifactConfigInput where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Synthetics.Types.S3EncryptionConfig

-- | A structure that contains the configuration for canary artifacts,
-- including the encryption-at-rest settings for artifacts that the canary
-- uploads to Amazon S3.
--
-- /See:/ 'newArtifactConfigInput' smart constructor.
data ArtifactConfigInput = ArtifactConfigInput'
  { -- | A structure that contains the configuration of the encryption-at-rest
    -- settings for artifacts that the canary uploads to Amazon S3. Artifact
    -- encryption functionality is available only for canaries that use
    -- Synthetics runtime version syn-nodejs-puppeteer-3.3 or later. For more
    -- information, see
    -- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_artifact_encryption.html Encrypting canary artifacts>
    ArtifactConfigInput -> Maybe S3EncryptionConfig
s3Encryption :: Prelude.Maybe S3EncryptionConfig
  }
  deriving (ArtifactConfigInput -> ArtifactConfigInput -> Bool
(ArtifactConfigInput -> ArtifactConfigInput -> Bool)
-> (ArtifactConfigInput -> ArtifactConfigInput -> Bool)
-> Eq ArtifactConfigInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArtifactConfigInput -> ArtifactConfigInput -> Bool
$c/= :: ArtifactConfigInput -> ArtifactConfigInput -> Bool
== :: ArtifactConfigInput -> ArtifactConfigInput -> Bool
$c== :: ArtifactConfigInput -> ArtifactConfigInput -> Bool
Prelude.Eq, ReadPrec [ArtifactConfigInput]
ReadPrec ArtifactConfigInput
Int -> ReadS ArtifactConfigInput
ReadS [ArtifactConfigInput]
(Int -> ReadS ArtifactConfigInput)
-> ReadS [ArtifactConfigInput]
-> ReadPrec ArtifactConfigInput
-> ReadPrec [ArtifactConfigInput]
-> Read ArtifactConfigInput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ArtifactConfigInput]
$creadListPrec :: ReadPrec [ArtifactConfigInput]
readPrec :: ReadPrec ArtifactConfigInput
$creadPrec :: ReadPrec ArtifactConfigInput
readList :: ReadS [ArtifactConfigInput]
$creadList :: ReadS [ArtifactConfigInput]
readsPrec :: Int -> ReadS ArtifactConfigInput
$creadsPrec :: Int -> ReadS ArtifactConfigInput
Prelude.Read, Int -> ArtifactConfigInput -> ShowS
[ArtifactConfigInput] -> ShowS
ArtifactConfigInput -> String
(Int -> ArtifactConfigInput -> ShowS)
-> (ArtifactConfigInput -> String)
-> ([ArtifactConfigInput] -> ShowS)
-> Show ArtifactConfigInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArtifactConfigInput] -> ShowS
$cshowList :: [ArtifactConfigInput] -> ShowS
show :: ArtifactConfigInput -> String
$cshow :: ArtifactConfigInput -> String
showsPrec :: Int -> ArtifactConfigInput -> ShowS
$cshowsPrec :: Int -> ArtifactConfigInput -> ShowS
Prelude.Show, (forall x. ArtifactConfigInput -> Rep ArtifactConfigInput x)
-> (forall x. Rep ArtifactConfigInput x -> ArtifactConfigInput)
-> Generic ArtifactConfigInput
forall x. Rep ArtifactConfigInput x -> ArtifactConfigInput
forall x. ArtifactConfigInput -> Rep ArtifactConfigInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ArtifactConfigInput x -> ArtifactConfigInput
$cfrom :: forall x. ArtifactConfigInput -> Rep ArtifactConfigInput x
Prelude.Generic)

-- |
-- Create a value of 'ArtifactConfigInput' 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:
--
-- 's3Encryption', 'artifactConfigInput_s3Encryption' - A structure that contains the configuration of the encryption-at-rest
-- settings for artifacts that the canary uploads to Amazon S3. Artifact
-- encryption functionality is available only for canaries that use
-- Synthetics runtime version syn-nodejs-puppeteer-3.3 or later. For more
-- information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_artifact_encryption.html Encrypting canary artifacts>
newArtifactConfigInput ::
  ArtifactConfigInput
newArtifactConfigInput :: ArtifactConfigInput
newArtifactConfigInput =
  ArtifactConfigInput' :: Maybe S3EncryptionConfig -> ArtifactConfigInput
ArtifactConfigInput'
    { $sel:s3Encryption:ArtifactConfigInput' :: Maybe S3EncryptionConfig
s3Encryption =
        Maybe S3EncryptionConfig
forall a. Maybe a
Prelude.Nothing
    }

-- | A structure that contains the configuration of the encryption-at-rest
-- settings for artifacts that the canary uploads to Amazon S3. Artifact
-- encryption functionality is available only for canaries that use
-- Synthetics runtime version syn-nodejs-puppeteer-3.3 or later. For more
-- information, see
-- <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_artifact_encryption.html Encrypting canary artifacts>
artifactConfigInput_s3Encryption :: Lens.Lens' ArtifactConfigInput (Prelude.Maybe S3EncryptionConfig)
artifactConfigInput_s3Encryption :: (Maybe S3EncryptionConfig -> f (Maybe S3EncryptionConfig))
-> ArtifactConfigInput -> f ArtifactConfigInput
artifactConfigInput_s3Encryption = (ArtifactConfigInput -> Maybe S3EncryptionConfig)
-> (ArtifactConfigInput
    -> Maybe S3EncryptionConfig -> ArtifactConfigInput)
-> Lens
     ArtifactConfigInput
     ArtifactConfigInput
     (Maybe S3EncryptionConfig)
     (Maybe S3EncryptionConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArtifactConfigInput' {Maybe S3EncryptionConfig
s3Encryption :: Maybe S3EncryptionConfig
$sel:s3Encryption:ArtifactConfigInput' :: ArtifactConfigInput -> Maybe S3EncryptionConfig
s3Encryption} -> Maybe S3EncryptionConfig
s3Encryption) (\s :: ArtifactConfigInput
s@ArtifactConfigInput' {} Maybe S3EncryptionConfig
a -> ArtifactConfigInput
s {$sel:s3Encryption:ArtifactConfigInput' :: Maybe S3EncryptionConfig
s3Encryption = Maybe S3EncryptionConfig
a} :: ArtifactConfigInput)

instance Prelude.Hashable ArtifactConfigInput

instance Prelude.NFData ArtifactConfigInput

instance Core.ToJSON ArtifactConfigInput where
  toJSON :: ArtifactConfigInput -> Value
toJSON ArtifactConfigInput' {Maybe S3EncryptionConfig
s3Encryption :: Maybe S3EncryptionConfig
$sel:s3Encryption:ArtifactConfigInput' :: ArtifactConfigInput -> Maybe S3EncryptionConfig
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"S3Encryption" Text -> S3EncryptionConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (S3EncryptionConfig -> Pair)
-> Maybe S3EncryptionConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3EncryptionConfig
s3Encryption]
      )