{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.LabelingJobResourceConfig 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
import Amazonka.SageMaker.Types.VpcConfig

-- | 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,
    LabelingJobResourceConfig -> Maybe VpcConfig
vpcConfig :: Prelude.Maybe VpcConfig
  }
  deriving (LabelingJobResourceConfig -> LabelingJobResourceConfig -> Bool
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]
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
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.
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\"@
--
-- 'vpcConfig', 'labelingJobResourceConfig_vpcConfig' - Undocumented member.
newLabelingJobResourceConfig ::
  LabelingJobResourceConfig
newLabelingJobResourceConfig :: LabelingJobResourceConfig
newLabelingJobResourceConfig =
  LabelingJobResourceConfig'
    { $sel:volumeKmsKeyId:LabelingJobResourceConfig' :: Maybe Text
volumeKmsKeyId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:vpcConfig:LabelingJobResourceConfig' :: Maybe VpcConfig
vpcConfig = 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 :: Lens' LabelingJobResourceConfig (Maybe Text)
labelingJobResourceConfig_volumeKmsKeyId = 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)

-- | Undocumented member.
labelingJobResourceConfig_vpcConfig :: Lens.Lens' LabelingJobResourceConfig (Prelude.Maybe VpcConfig)
labelingJobResourceConfig_vpcConfig :: Lens' LabelingJobResourceConfig (Maybe VpcConfig)
labelingJobResourceConfig_vpcConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LabelingJobResourceConfig' {Maybe VpcConfig
vpcConfig :: Maybe VpcConfig
$sel:vpcConfig:LabelingJobResourceConfig' :: LabelingJobResourceConfig -> Maybe VpcConfig
vpcConfig} -> Maybe VpcConfig
vpcConfig) (\s :: LabelingJobResourceConfig
s@LabelingJobResourceConfig' {} Maybe VpcConfig
a -> LabelingJobResourceConfig
s {$sel:vpcConfig:LabelingJobResourceConfig' :: Maybe VpcConfig
vpcConfig = Maybe VpcConfig
a} :: LabelingJobResourceConfig)

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

instance Prelude.Hashable LabelingJobResourceConfig where
  hashWithSalt :: Int -> LabelingJobResourceConfig -> Int
hashWithSalt Int
_salt LabelingJobResourceConfig' {Maybe Text
Maybe VpcConfig
vpcConfig :: Maybe VpcConfig
volumeKmsKeyId :: Maybe Text
$sel:vpcConfig:LabelingJobResourceConfig' :: LabelingJobResourceConfig -> Maybe VpcConfig
$sel:volumeKmsKeyId:LabelingJobResourceConfig' :: LabelingJobResourceConfig -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
volumeKmsKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VpcConfig
vpcConfig

instance Prelude.NFData LabelingJobResourceConfig where
  rnf :: LabelingJobResourceConfig -> ()
rnf LabelingJobResourceConfig' {Maybe Text
Maybe VpcConfig
vpcConfig :: Maybe VpcConfig
volumeKmsKeyId :: Maybe Text
$sel:vpcConfig:LabelingJobResourceConfig' :: LabelingJobResourceConfig -> Maybe VpcConfig
$sel:volumeKmsKeyId:LabelingJobResourceConfig' :: LabelingJobResourceConfig -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
volumeKmsKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VpcConfig
vpcConfig

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