{-# 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.SageMaker.Types.LabelingJobResourceConfig
-- 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.SageMaker.Types.LabelingJobResourceConfig where

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

-- | Configure encryption on the storage volume attached to the ML compute
-- instance used to run automated data labeling model training and
-- inference.
--
-- /See:/ 'newLabelingJobResourceConfig' smart constructor.
data LabelingJobResourceConfig = LabelingJobResourceConfig'
  { -- | The Amazon Web Services Key Management Service (Amazon Web Services KMS)
    -- key that Amazon SageMaker uses to encrypt data on the storage volume
    -- attached to the ML compute instance(s) that run the training and
    -- inference jobs used for automated data labeling.
    --
    -- You can only specify a @VolumeKmsKeyId@ when you create a labeling job
    -- with automated data labeling enabled using the API operation
    -- @CreateLabelingJob@. You cannot specify an Amazon Web Services KMS key
    -- to encrypt the storage volume used for automated data labeling model
    -- training and inference when you create a labeling job using the console.
    -- To learn more, see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/sms-security.html Output Data and Storage Volume Encryption>.
    --
    -- The @VolumeKmsKeyId@ can be any of the following formats:
    --
    -- -   KMS Key ID
    --
    --     @\"1234abcd-12ab-34cd-56ef-1234567890ab\"@
    --
    -- -   Amazon Resource Name (ARN) of a KMS Key
    --
    --     @\"arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab\"@
    LabelingJobResourceConfig -> Maybe Text
volumeKmsKeyId :: Prelude.Maybe Prelude.Text
  }
  deriving (LabelingJobResourceConfig -> LabelingJobResourceConfig -> Bool
(LabelingJobResourceConfig -> LabelingJobResourceConfig -> Bool)
-> (LabelingJobResourceConfig -> LabelingJobResourceConfig -> Bool)
-> Eq LabelingJobResourceConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LabelingJobResourceConfig -> LabelingJobResourceConfig -> Bool
$c/= :: LabelingJobResourceConfig -> LabelingJobResourceConfig -> Bool
== :: LabelingJobResourceConfig -> LabelingJobResourceConfig -> Bool
$c== :: LabelingJobResourceConfig -> LabelingJobResourceConfig -> Bool
Prelude.Eq, ReadPrec [LabelingJobResourceConfig]
ReadPrec LabelingJobResourceConfig
Int -> ReadS LabelingJobResourceConfig
ReadS [LabelingJobResourceConfig]
(Int -> ReadS LabelingJobResourceConfig)
-> ReadS [LabelingJobResourceConfig]
-> ReadPrec LabelingJobResourceConfig
-> ReadPrec [LabelingJobResourceConfig]
-> Read LabelingJobResourceConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LabelingJobResourceConfig]
$creadListPrec :: ReadPrec [LabelingJobResourceConfig]
readPrec :: ReadPrec LabelingJobResourceConfig
$creadPrec :: ReadPrec LabelingJobResourceConfig
readList :: ReadS [LabelingJobResourceConfig]
$creadList :: ReadS [LabelingJobResourceConfig]
readsPrec :: Int -> ReadS LabelingJobResourceConfig
$creadsPrec :: Int -> ReadS LabelingJobResourceConfig
Prelude.Read, Int -> LabelingJobResourceConfig -> ShowS
[LabelingJobResourceConfig] -> ShowS
LabelingJobResourceConfig -> String
(Int -> LabelingJobResourceConfig -> ShowS)
-> (LabelingJobResourceConfig -> String)
-> ([LabelingJobResourceConfig] -> ShowS)
-> Show LabelingJobResourceConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LabelingJobResourceConfig] -> ShowS
$cshowList :: [LabelingJobResourceConfig] -> ShowS
show :: LabelingJobResourceConfig -> String
$cshow :: LabelingJobResourceConfig -> String
showsPrec :: Int -> LabelingJobResourceConfig -> ShowS
$cshowsPrec :: Int -> LabelingJobResourceConfig -> ShowS
Prelude.Show, (forall x.
 LabelingJobResourceConfig -> Rep LabelingJobResourceConfig x)
-> (forall x.
    Rep LabelingJobResourceConfig x -> LabelingJobResourceConfig)
-> Generic LabelingJobResourceConfig
forall x.
Rep LabelingJobResourceConfig x -> LabelingJobResourceConfig
forall x.
LabelingJobResourceConfig -> Rep LabelingJobResourceConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LabelingJobResourceConfig x -> LabelingJobResourceConfig
$cfrom :: forall x.
LabelingJobResourceConfig -> Rep LabelingJobResourceConfig x
Prelude.Generic)

-- |
-- Create a value of 'LabelingJobResourceConfig' 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:
--
-- 'volumeKmsKeyId', 'labelingJobResourceConfig_volumeKmsKeyId' - The Amazon Web Services Key Management Service (Amazon Web Services KMS)
-- key that Amazon SageMaker uses to encrypt data on the storage volume
-- attached to the ML compute instance(s) that run the training and
-- inference jobs used for automated data labeling.
--
-- You can only specify a @VolumeKmsKeyId@ when you create a labeling job
-- with automated data labeling enabled using the API operation
-- @CreateLabelingJob@. You cannot specify an Amazon Web Services KMS key
-- to encrypt the storage volume used for automated data labeling model
-- training and inference when you create a labeling job using the console.
-- To learn more, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/sms-security.html Output Data and Storage Volume Encryption>.
--
-- The @VolumeKmsKeyId@ can be any of the following formats:
--
-- -   KMS Key ID
--
--     @\"1234abcd-12ab-34cd-56ef-1234567890ab\"@
--
-- -   Amazon Resource Name (ARN) of a KMS Key
--
--     @\"arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab\"@
newLabelingJobResourceConfig ::
  LabelingJobResourceConfig
newLabelingJobResourceConfig :: LabelingJobResourceConfig
newLabelingJobResourceConfig =
  LabelingJobResourceConfig' :: Maybe Text -> LabelingJobResourceConfig
LabelingJobResourceConfig'
    { $sel:volumeKmsKeyId:LabelingJobResourceConfig' :: Maybe Text
volumeKmsKeyId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Web Services Key Management Service (Amazon Web Services KMS)
-- key that Amazon SageMaker uses to encrypt data on the storage volume
-- attached to the ML compute instance(s) that run the training and
-- inference jobs used for automated data labeling.
--
-- You can only specify a @VolumeKmsKeyId@ when you create a labeling job
-- with automated data labeling enabled using the API operation
-- @CreateLabelingJob@. You cannot specify an Amazon Web Services KMS key
-- to encrypt the storage volume used for automated data labeling model
-- training and inference when you create a labeling job using the console.
-- To learn more, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/sms-security.html Output Data and Storage Volume Encryption>.
--
-- The @VolumeKmsKeyId@ can be any of the following formats:
--
-- -   KMS Key ID
--
--     @\"1234abcd-12ab-34cd-56ef-1234567890ab\"@
--
-- -   Amazon Resource Name (ARN) of a KMS Key
--
--     @\"arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab\"@
labelingJobResourceConfig_volumeKmsKeyId :: Lens.Lens' LabelingJobResourceConfig (Prelude.Maybe Prelude.Text)
labelingJobResourceConfig_volumeKmsKeyId :: (Maybe Text -> f (Maybe Text))
-> LabelingJobResourceConfig -> f LabelingJobResourceConfig
labelingJobResourceConfig_volumeKmsKeyId = (LabelingJobResourceConfig -> Maybe Text)
-> (LabelingJobResourceConfig
    -> Maybe Text -> LabelingJobResourceConfig)
-> Lens
     LabelingJobResourceConfig
     LabelingJobResourceConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LabelingJobResourceConfig' {Maybe Text
volumeKmsKeyId :: Maybe Text
$sel:volumeKmsKeyId:LabelingJobResourceConfig' :: LabelingJobResourceConfig -> Maybe Text
volumeKmsKeyId} -> Maybe Text
volumeKmsKeyId) (\s :: LabelingJobResourceConfig
s@LabelingJobResourceConfig' {} Maybe Text
a -> LabelingJobResourceConfig
s {$sel:volumeKmsKeyId:LabelingJobResourceConfig' :: Maybe Text
volumeKmsKeyId = Maybe Text
a} :: LabelingJobResourceConfig)

instance Core.FromJSON LabelingJobResourceConfig where
  parseJSON :: Value -> Parser LabelingJobResourceConfig
parseJSON =
    String
-> (Object -> Parser LabelingJobResourceConfig)
-> Value
-> Parser LabelingJobResourceConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LabelingJobResourceConfig"
      ( \Object
x ->
          Maybe Text -> LabelingJobResourceConfig
LabelingJobResourceConfig'
            (Maybe Text -> LabelingJobResourceConfig)
-> Parser (Maybe Text) -> Parser LabelingJobResourceConfig
forall (f :: * -> *) a b. Functor 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
"VolumeKmsKeyId")
      )

instance Prelude.Hashable LabelingJobResourceConfig

instance Prelude.NFData LabelingJobResourceConfig

instance Core.ToJSON LabelingJobResourceConfig where
  toJSON :: LabelingJobResourceConfig -> Value
toJSON LabelingJobResourceConfig' {Maybe Text
volumeKmsKeyId :: Maybe Text
$sel:volumeKmsKeyId:LabelingJobResourceConfig' :: LabelingJobResourceConfig -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"VolumeKmsKeyId" 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
volumeKmsKeyId
          ]
      )