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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.EdgePresetDeploymentType

-- | The output configuration.
--
-- /See:/ 'newEdgeOutputConfig' smart constructor.
data EdgeOutputConfig = EdgeOutputConfig'
  { -- | The deployment type SageMaker Edge Manager will create. Currently only
    -- supports Amazon Web Services IoT Greengrass Version 2 components.
    EdgeOutputConfig -> Maybe EdgePresetDeploymentType
presetDeploymentType :: Prelude.Maybe EdgePresetDeploymentType,
    -- | The Amazon Web Services Key Management Service (Amazon Web Services KMS)
    -- key that Amazon SageMaker uses to encrypt data on the storage volume
    -- after compilation job. If you don\'t provide a KMS key ID, Amazon
    -- SageMaker uses the default KMS key for Amazon S3 for your role\'s
    -- account.
    EdgeOutputConfig -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The configuration used to create deployment artifacts. Specify
    -- configuration options with a JSON string. The available configuration
    -- options for each type are:
    --
    -- -   @ComponentName@ (optional) - Name of the GreenGrass V2 component. If
    --     not specified, the default name generated consists of
    --     \"SagemakerEdgeManager\" and the name of your SageMaker Edge Manager
    --     packaging job.
    --
    -- -   @ComponentDescription@ (optional) - Description of the component.
    --
    -- -   @ComponentVersion@ (optional) - The version of the component.
    --
    --     Amazon Web Services IoT Greengrass uses semantic versions for
    --     components. Semantic versions follow a /major.minor.patch/ number
    --     system. For example, version 1.0.0 represents the first major
    --     release for a component. For more information, see the
    --     <https://semver.org/ semantic version specification>.
    --
    -- -   @PlatformOS@ (optional) - The name of the operating system for the
    --     platform. Supported platforms include Windows and Linux.
    --
    -- -   @PlatformArchitecture@ (optional) - The processor architecture for
    --     the platform.
    --
    --     Supported architectures Windows include: Windows32_x86,
    --     Windows64_x64.
    --
    --     Supported architectures for Linux include: Linux x86_64, Linux
    --     ARMV8.
    EdgeOutputConfig -> Maybe Text
presetDeploymentConfig :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Simple Storage (S3) bucker URI.
    EdgeOutputConfig -> Text
s3OutputLocation :: Prelude.Text
  }
  deriving (EdgeOutputConfig -> EdgeOutputConfig -> Bool
(EdgeOutputConfig -> EdgeOutputConfig -> Bool)
-> (EdgeOutputConfig -> EdgeOutputConfig -> Bool)
-> Eq EdgeOutputConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EdgeOutputConfig -> EdgeOutputConfig -> Bool
$c/= :: EdgeOutputConfig -> EdgeOutputConfig -> Bool
== :: EdgeOutputConfig -> EdgeOutputConfig -> Bool
$c== :: EdgeOutputConfig -> EdgeOutputConfig -> Bool
Prelude.Eq, ReadPrec [EdgeOutputConfig]
ReadPrec EdgeOutputConfig
Int -> ReadS EdgeOutputConfig
ReadS [EdgeOutputConfig]
(Int -> ReadS EdgeOutputConfig)
-> ReadS [EdgeOutputConfig]
-> ReadPrec EdgeOutputConfig
-> ReadPrec [EdgeOutputConfig]
-> Read EdgeOutputConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EdgeOutputConfig]
$creadListPrec :: ReadPrec [EdgeOutputConfig]
readPrec :: ReadPrec EdgeOutputConfig
$creadPrec :: ReadPrec EdgeOutputConfig
readList :: ReadS [EdgeOutputConfig]
$creadList :: ReadS [EdgeOutputConfig]
readsPrec :: Int -> ReadS EdgeOutputConfig
$creadsPrec :: Int -> ReadS EdgeOutputConfig
Prelude.Read, Int -> EdgeOutputConfig -> ShowS
[EdgeOutputConfig] -> ShowS
EdgeOutputConfig -> String
(Int -> EdgeOutputConfig -> ShowS)
-> (EdgeOutputConfig -> String)
-> ([EdgeOutputConfig] -> ShowS)
-> Show EdgeOutputConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EdgeOutputConfig] -> ShowS
$cshowList :: [EdgeOutputConfig] -> ShowS
show :: EdgeOutputConfig -> String
$cshow :: EdgeOutputConfig -> String
showsPrec :: Int -> EdgeOutputConfig -> ShowS
$cshowsPrec :: Int -> EdgeOutputConfig -> ShowS
Prelude.Show, (forall x. EdgeOutputConfig -> Rep EdgeOutputConfig x)
-> (forall x. Rep EdgeOutputConfig x -> EdgeOutputConfig)
-> Generic EdgeOutputConfig
forall x. Rep EdgeOutputConfig x -> EdgeOutputConfig
forall x. EdgeOutputConfig -> Rep EdgeOutputConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EdgeOutputConfig x -> EdgeOutputConfig
$cfrom :: forall x. EdgeOutputConfig -> Rep EdgeOutputConfig x
Prelude.Generic)

-- |
-- Create a value of 'EdgeOutputConfig' 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:
--
-- 'presetDeploymentType', 'edgeOutputConfig_presetDeploymentType' - The deployment type SageMaker Edge Manager will create. Currently only
-- supports Amazon Web Services IoT Greengrass Version 2 components.
--
-- 'kmsKeyId', 'edgeOutputConfig_kmsKeyId' - The Amazon Web Services Key Management Service (Amazon Web Services KMS)
-- key that Amazon SageMaker uses to encrypt data on the storage volume
-- after compilation job. If you don\'t provide a KMS key ID, Amazon
-- SageMaker uses the default KMS key for Amazon S3 for your role\'s
-- account.
--
-- 'presetDeploymentConfig', 'edgeOutputConfig_presetDeploymentConfig' - The configuration used to create deployment artifacts. Specify
-- configuration options with a JSON string. The available configuration
-- options for each type are:
--
-- -   @ComponentName@ (optional) - Name of the GreenGrass V2 component. If
--     not specified, the default name generated consists of
--     \"SagemakerEdgeManager\" and the name of your SageMaker Edge Manager
--     packaging job.
--
-- -   @ComponentDescription@ (optional) - Description of the component.
--
-- -   @ComponentVersion@ (optional) - The version of the component.
--
--     Amazon Web Services IoT Greengrass uses semantic versions for
--     components. Semantic versions follow a /major.minor.patch/ number
--     system. For example, version 1.0.0 represents the first major
--     release for a component. For more information, see the
--     <https://semver.org/ semantic version specification>.
--
-- -   @PlatformOS@ (optional) - The name of the operating system for the
--     platform. Supported platforms include Windows and Linux.
--
-- -   @PlatformArchitecture@ (optional) - The processor architecture for
--     the platform.
--
--     Supported architectures Windows include: Windows32_x86,
--     Windows64_x64.
--
--     Supported architectures for Linux include: Linux x86_64, Linux
--     ARMV8.
--
-- 's3OutputLocation', 'edgeOutputConfig_s3OutputLocation' - The Amazon Simple Storage (S3) bucker URI.
newEdgeOutputConfig ::
  -- | 's3OutputLocation'
  Prelude.Text ->
  EdgeOutputConfig
newEdgeOutputConfig :: Text -> EdgeOutputConfig
newEdgeOutputConfig Text
pS3OutputLocation_ =
  EdgeOutputConfig' :: Maybe EdgePresetDeploymentType
-> Maybe Text -> Maybe Text -> Text -> EdgeOutputConfig
EdgeOutputConfig'
    { $sel:presetDeploymentType:EdgeOutputConfig' :: Maybe EdgePresetDeploymentType
presetDeploymentType =
        Maybe EdgePresetDeploymentType
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:EdgeOutputConfig' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:presetDeploymentConfig:EdgeOutputConfig' :: Maybe Text
presetDeploymentConfig = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3OutputLocation:EdgeOutputConfig' :: Text
s3OutputLocation = Text
pS3OutputLocation_
    }

-- | The deployment type SageMaker Edge Manager will create. Currently only
-- supports Amazon Web Services IoT Greengrass Version 2 components.
edgeOutputConfig_presetDeploymentType :: Lens.Lens' EdgeOutputConfig (Prelude.Maybe EdgePresetDeploymentType)
edgeOutputConfig_presetDeploymentType :: (Maybe EdgePresetDeploymentType
 -> f (Maybe EdgePresetDeploymentType))
-> EdgeOutputConfig -> f EdgeOutputConfig
edgeOutputConfig_presetDeploymentType = (EdgeOutputConfig -> Maybe EdgePresetDeploymentType)
-> (EdgeOutputConfig
    -> Maybe EdgePresetDeploymentType -> EdgeOutputConfig)
-> Lens
     EdgeOutputConfig
     EdgeOutputConfig
     (Maybe EdgePresetDeploymentType)
     (Maybe EdgePresetDeploymentType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeOutputConfig' {Maybe EdgePresetDeploymentType
presetDeploymentType :: Maybe EdgePresetDeploymentType
$sel:presetDeploymentType:EdgeOutputConfig' :: EdgeOutputConfig -> Maybe EdgePresetDeploymentType
presetDeploymentType} -> Maybe EdgePresetDeploymentType
presetDeploymentType) (\s :: EdgeOutputConfig
s@EdgeOutputConfig' {} Maybe EdgePresetDeploymentType
a -> EdgeOutputConfig
s {$sel:presetDeploymentType:EdgeOutputConfig' :: Maybe EdgePresetDeploymentType
presetDeploymentType = Maybe EdgePresetDeploymentType
a} :: EdgeOutputConfig)

-- | The Amazon Web Services Key Management Service (Amazon Web Services KMS)
-- key that Amazon SageMaker uses to encrypt data on the storage volume
-- after compilation job. If you don\'t provide a KMS key ID, Amazon
-- SageMaker uses the default KMS key for Amazon S3 for your role\'s
-- account.
edgeOutputConfig_kmsKeyId :: Lens.Lens' EdgeOutputConfig (Prelude.Maybe Prelude.Text)
edgeOutputConfig_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> EdgeOutputConfig -> f EdgeOutputConfig
edgeOutputConfig_kmsKeyId = (EdgeOutputConfig -> Maybe Text)
-> (EdgeOutputConfig -> Maybe Text -> EdgeOutputConfig)
-> Lens EdgeOutputConfig EdgeOutputConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeOutputConfig' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:EdgeOutputConfig' :: EdgeOutputConfig -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: EdgeOutputConfig
s@EdgeOutputConfig' {} Maybe Text
a -> EdgeOutputConfig
s {$sel:kmsKeyId:EdgeOutputConfig' :: Maybe Text
kmsKeyId = Maybe Text
a} :: EdgeOutputConfig)

-- | The configuration used to create deployment artifacts. Specify
-- configuration options with a JSON string. The available configuration
-- options for each type are:
--
-- -   @ComponentName@ (optional) - Name of the GreenGrass V2 component. If
--     not specified, the default name generated consists of
--     \"SagemakerEdgeManager\" and the name of your SageMaker Edge Manager
--     packaging job.
--
-- -   @ComponentDescription@ (optional) - Description of the component.
--
-- -   @ComponentVersion@ (optional) - The version of the component.
--
--     Amazon Web Services IoT Greengrass uses semantic versions for
--     components. Semantic versions follow a /major.minor.patch/ number
--     system. For example, version 1.0.0 represents the first major
--     release for a component. For more information, see the
--     <https://semver.org/ semantic version specification>.
--
-- -   @PlatformOS@ (optional) - The name of the operating system for the
--     platform. Supported platforms include Windows and Linux.
--
-- -   @PlatformArchitecture@ (optional) - The processor architecture for
--     the platform.
--
--     Supported architectures Windows include: Windows32_x86,
--     Windows64_x64.
--
--     Supported architectures for Linux include: Linux x86_64, Linux
--     ARMV8.
edgeOutputConfig_presetDeploymentConfig :: Lens.Lens' EdgeOutputConfig (Prelude.Maybe Prelude.Text)
edgeOutputConfig_presetDeploymentConfig :: (Maybe Text -> f (Maybe Text))
-> EdgeOutputConfig -> f EdgeOutputConfig
edgeOutputConfig_presetDeploymentConfig = (EdgeOutputConfig -> Maybe Text)
-> (EdgeOutputConfig -> Maybe Text -> EdgeOutputConfig)
-> Lens EdgeOutputConfig EdgeOutputConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeOutputConfig' {Maybe Text
presetDeploymentConfig :: Maybe Text
$sel:presetDeploymentConfig:EdgeOutputConfig' :: EdgeOutputConfig -> Maybe Text
presetDeploymentConfig} -> Maybe Text
presetDeploymentConfig) (\s :: EdgeOutputConfig
s@EdgeOutputConfig' {} Maybe Text
a -> EdgeOutputConfig
s {$sel:presetDeploymentConfig:EdgeOutputConfig' :: Maybe Text
presetDeploymentConfig = Maybe Text
a} :: EdgeOutputConfig)

-- | The Amazon Simple Storage (S3) bucker URI.
edgeOutputConfig_s3OutputLocation :: Lens.Lens' EdgeOutputConfig Prelude.Text
edgeOutputConfig_s3OutputLocation :: (Text -> f Text) -> EdgeOutputConfig -> f EdgeOutputConfig
edgeOutputConfig_s3OutputLocation = (EdgeOutputConfig -> Text)
-> (EdgeOutputConfig -> Text -> EdgeOutputConfig)
-> Lens EdgeOutputConfig EdgeOutputConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeOutputConfig' {Text
s3OutputLocation :: Text
$sel:s3OutputLocation:EdgeOutputConfig' :: EdgeOutputConfig -> Text
s3OutputLocation} -> Text
s3OutputLocation) (\s :: EdgeOutputConfig
s@EdgeOutputConfig' {} Text
a -> EdgeOutputConfig
s {$sel:s3OutputLocation:EdgeOutputConfig' :: Text
s3OutputLocation = Text
a} :: EdgeOutputConfig)

instance Core.FromJSON EdgeOutputConfig where
  parseJSON :: Value -> Parser EdgeOutputConfig
parseJSON =
    String
-> (Object -> Parser EdgeOutputConfig)
-> Value
-> Parser EdgeOutputConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EdgeOutputConfig"
      ( \Object
x ->
          Maybe EdgePresetDeploymentType
-> Maybe Text -> Maybe Text -> Text -> EdgeOutputConfig
EdgeOutputConfig'
            (Maybe EdgePresetDeploymentType
 -> Maybe Text -> Maybe Text -> Text -> EdgeOutputConfig)
-> Parser (Maybe EdgePresetDeploymentType)
-> Parser (Maybe Text -> Maybe Text -> Text -> EdgeOutputConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe EdgePresetDeploymentType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PresetDeploymentType")
            Parser (Maybe Text -> Maybe Text -> Text -> EdgeOutputConfig)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Text -> EdgeOutputConfig)
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
"KmsKeyId")
            Parser (Maybe Text -> Text -> EdgeOutputConfig)
-> Parser (Maybe Text) -> Parser (Text -> EdgeOutputConfig)
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
"PresetDeploymentConfig")
            Parser (Text -> EdgeOutputConfig)
-> Parser Text -> Parser EdgeOutputConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3OutputLocation")
      )

instance Prelude.Hashable EdgeOutputConfig

instance Prelude.NFData EdgeOutputConfig

instance Core.ToJSON EdgeOutputConfig where
  toJSON :: EdgeOutputConfig -> Value
toJSON EdgeOutputConfig' {Maybe Text
Maybe EdgePresetDeploymentType
Text
s3OutputLocation :: Text
presetDeploymentConfig :: Maybe Text
kmsKeyId :: Maybe Text
presetDeploymentType :: Maybe EdgePresetDeploymentType
$sel:s3OutputLocation:EdgeOutputConfig' :: EdgeOutputConfig -> Text
$sel:presetDeploymentConfig:EdgeOutputConfig' :: EdgeOutputConfig -> Maybe Text
$sel:kmsKeyId:EdgeOutputConfig' :: EdgeOutputConfig -> Maybe Text
$sel:presetDeploymentType:EdgeOutputConfig' :: EdgeOutputConfig -> Maybe EdgePresetDeploymentType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"PresetDeploymentType" Text -> EdgePresetDeploymentType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EdgePresetDeploymentType -> Pair)
-> Maybe EdgePresetDeploymentType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EdgePresetDeploymentType
presetDeploymentType,
            (Text
"KmsKeyId" 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
kmsKeyId,
            (Text
"PresetDeploymentConfig" 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
presetDeploymentConfig,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"S3OutputLocation" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3OutputLocation)
          ]
      )