{-# 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.DeploymentStage
-- 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.DeploymentStage 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.DeviceSelectionConfig
import Amazonka.SageMaker.Types.EdgeDeploymentConfig

-- | Contains information about a stage in an edge deployment plan.
--
-- /See:/ 'newDeploymentStage' smart constructor.
data DeploymentStage = DeploymentStage'
  { -- | Configuration of the deployment details.
    DeploymentStage -> Maybe EdgeDeploymentConfig
deploymentConfig :: Prelude.Maybe EdgeDeploymentConfig,
    -- | The name of the stage.
    DeploymentStage -> Text
stageName :: Prelude.Text,
    -- | Configuration of the devices in the stage.
    DeploymentStage -> DeviceSelectionConfig
deviceSelectionConfig :: DeviceSelectionConfig
  }
  deriving (DeploymentStage -> DeploymentStage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeploymentStage -> DeploymentStage -> Bool
$c/= :: DeploymentStage -> DeploymentStage -> Bool
== :: DeploymentStage -> DeploymentStage -> Bool
$c== :: DeploymentStage -> DeploymentStage -> Bool
Prelude.Eq, ReadPrec [DeploymentStage]
ReadPrec DeploymentStage
Int -> ReadS DeploymentStage
ReadS [DeploymentStage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeploymentStage]
$creadListPrec :: ReadPrec [DeploymentStage]
readPrec :: ReadPrec DeploymentStage
$creadPrec :: ReadPrec DeploymentStage
readList :: ReadS [DeploymentStage]
$creadList :: ReadS [DeploymentStage]
readsPrec :: Int -> ReadS DeploymentStage
$creadsPrec :: Int -> ReadS DeploymentStage
Prelude.Read, Int -> DeploymentStage -> ShowS
[DeploymentStage] -> ShowS
DeploymentStage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeploymentStage] -> ShowS
$cshowList :: [DeploymentStage] -> ShowS
show :: DeploymentStage -> String
$cshow :: DeploymentStage -> String
showsPrec :: Int -> DeploymentStage -> ShowS
$cshowsPrec :: Int -> DeploymentStage -> ShowS
Prelude.Show, forall x. Rep DeploymentStage x -> DeploymentStage
forall x. DeploymentStage -> Rep DeploymentStage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeploymentStage x -> DeploymentStage
$cfrom :: forall x. DeploymentStage -> Rep DeploymentStage x
Prelude.Generic)

-- |
-- Create a value of 'DeploymentStage' 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:
--
-- 'deploymentConfig', 'deploymentStage_deploymentConfig' - Configuration of the deployment details.
--
-- 'stageName', 'deploymentStage_stageName' - The name of the stage.
--
-- 'deviceSelectionConfig', 'deploymentStage_deviceSelectionConfig' - Configuration of the devices in the stage.
newDeploymentStage ::
  -- | 'stageName'
  Prelude.Text ->
  -- | 'deviceSelectionConfig'
  DeviceSelectionConfig ->
  DeploymentStage
newDeploymentStage :: Text -> DeviceSelectionConfig -> DeploymentStage
newDeploymentStage
  Text
pStageName_
  DeviceSelectionConfig
pDeviceSelectionConfig_ =
    DeploymentStage'
      { $sel:deploymentConfig:DeploymentStage' :: Maybe EdgeDeploymentConfig
deploymentConfig =
          forall a. Maybe a
Prelude.Nothing,
        $sel:stageName:DeploymentStage' :: Text
stageName = Text
pStageName_,
        $sel:deviceSelectionConfig:DeploymentStage' :: DeviceSelectionConfig
deviceSelectionConfig = DeviceSelectionConfig
pDeviceSelectionConfig_
      }

-- | Configuration of the deployment details.
deploymentStage_deploymentConfig :: Lens.Lens' DeploymentStage (Prelude.Maybe EdgeDeploymentConfig)
deploymentStage_deploymentConfig :: Lens' DeploymentStage (Maybe EdgeDeploymentConfig)
deploymentStage_deploymentConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentStage' {Maybe EdgeDeploymentConfig
deploymentConfig :: Maybe EdgeDeploymentConfig
$sel:deploymentConfig:DeploymentStage' :: DeploymentStage -> Maybe EdgeDeploymentConfig
deploymentConfig} -> Maybe EdgeDeploymentConfig
deploymentConfig) (\s :: DeploymentStage
s@DeploymentStage' {} Maybe EdgeDeploymentConfig
a -> DeploymentStage
s {$sel:deploymentConfig:DeploymentStage' :: Maybe EdgeDeploymentConfig
deploymentConfig = Maybe EdgeDeploymentConfig
a} :: DeploymentStage)

-- | The name of the stage.
deploymentStage_stageName :: Lens.Lens' DeploymentStage Prelude.Text
deploymentStage_stageName :: Lens' DeploymentStage Text
deploymentStage_stageName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentStage' {Text
stageName :: Text
$sel:stageName:DeploymentStage' :: DeploymentStage -> Text
stageName} -> Text
stageName) (\s :: DeploymentStage
s@DeploymentStage' {} Text
a -> DeploymentStage
s {$sel:stageName:DeploymentStage' :: Text
stageName = Text
a} :: DeploymentStage)

-- | Configuration of the devices in the stage.
deploymentStage_deviceSelectionConfig :: Lens.Lens' DeploymentStage DeviceSelectionConfig
deploymentStage_deviceSelectionConfig :: Lens' DeploymentStage DeviceSelectionConfig
deploymentStage_deviceSelectionConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentStage' {DeviceSelectionConfig
deviceSelectionConfig :: DeviceSelectionConfig
$sel:deviceSelectionConfig:DeploymentStage' :: DeploymentStage -> DeviceSelectionConfig
deviceSelectionConfig} -> DeviceSelectionConfig
deviceSelectionConfig) (\s :: DeploymentStage
s@DeploymentStage' {} DeviceSelectionConfig
a -> DeploymentStage
s {$sel:deviceSelectionConfig:DeploymentStage' :: DeviceSelectionConfig
deviceSelectionConfig = DeviceSelectionConfig
a} :: DeploymentStage)

instance Prelude.Hashable DeploymentStage where
  hashWithSalt :: Int -> DeploymentStage -> Int
hashWithSalt Int
_salt DeploymentStage' {Maybe EdgeDeploymentConfig
Text
DeviceSelectionConfig
deviceSelectionConfig :: DeviceSelectionConfig
stageName :: Text
deploymentConfig :: Maybe EdgeDeploymentConfig
$sel:deviceSelectionConfig:DeploymentStage' :: DeploymentStage -> DeviceSelectionConfig
$sel:stageName:DeploymentStage' :: DeploymentStage -> Text
$sel:deploymentConfig:DeploymentStage' :: DeploymentStage -> Maybe EdgeDeploymentConfig
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EdgeDeploymentConfig
deploymentConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
stageName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DeviceSelectionConfig
deviceSelectionConfig

instance Prelude.NFData DeploymentStage where
  rnf :: DeploymentStage -> ()
rnf DeploymentStage' {Maybe EdgeDeploymentConfig
Text
DeviceSelectionConfig
deviceSelectionConfig :: DeviceSelectionConfig
stageName :: Text
deploymentConfig :: Maybe EdgeDeploymentConfig
$sel:deviceSelectionConfig:DeploymentStage' :: DeploymentStage -> DeviceSelectionConfig
$sel:stageName:DeploymentStage' :: DeploymentStage -> Text
$sel:deploymentConfig:DeploymentStage' :: DeploymentStage -> Maybe EdgeDeploymentConfig
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe EdgeDeploymentConfig
deploymentConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
stageName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DeviceSelectionConfig
deviceSelectionConfig

instance Data.ToJSON DeploymentStage where
  toJSON :: DeploymentStage -> Value
toJSON DeploymentStage' {Maybe EdgeDeploymentConfig
Text
DeviceSelectionConfig
deviceSelectionConfig :: DeviceSelectionConfig
stageName :: Text
deploymentConfig :: Maybe EdgeDeploymentConfig
$sel:deviceSelectionConfig:DeploymentStage' :: DeploymentStage -> DeviceSelectionConfig
$sel:stageName:DeploymentStage' :: DeploymentStage -> Text
$sel:deploymentConfig:DeploymentStage' :: DeploymentStage -> Maybe EdgeDeploymentConfig
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DeploymentConfig" 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 EdgeDeploymentConfig
deploymentConfig,
            forall a. a -> Maybe a
Prelude.Just (Key
"StageName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
stageName),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"DeviceSelectionConfig"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DeviceSelectionConfig
deviceSelectionConfig
              )
          ]
      )