{-# 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.CodeDeploy.Types.DeploymentConfigInfo
-- 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.CodeDeploy.Types.DeploymentConfigInfo where

import Amazonka.CodeDeploy.Types.ComputePlatform
import Amazonka.CodeDeploy.Types.MinimumHealthyHosts
import Amazonka.CodeDeploy.Types.TrafficRoutingConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about a deployment configuration.
--
-- /See:/ 'newDeploymentConfigInfo' smart constructor.
data DeploymentConfigInfo = DeploymentConfigInfo'
  { -- | The deployment configuration name.
    DeploymentConfigInfo -> Maybe Text
deploymentConfigName :: Prelude.Maybe Prelude.Text,
    -- | The destination platform type for the deployment (@Lambda@, @Server@, or
    -- @ECS@).
    DeploymentConfigInfo -> Maybe ComputePlatform
computePlatform :: Prelude.Maybe ComputePlatform,
    -- | Information about the number or percentage of minimum healthy instance.
    DeploymentConfigInfo -> Maybe MinimumHealthyHosts
minimumHealthyHosts :: Prelude.Maybe MinimumHealthyHosts,
    -- | The configuration that specifies how the deployment traffic is routed.
    -- Used for deployments with a Lambda or ECS compute platform only.
    DeploymentConfigInfo -> Maybe TrafficRoutingConfig
trafficRoutingConfig :: Prelude.Maybe TrafficRoutingConfig,
    -- | The deployment configuration ID.
    DeploymentConfigInfo -> Maybe Text
deploymentConfigId :: Prelude.Maybe Prelude.Text,
    -- | The time at which the deployment configuration was created.
    DeploymentConfigInfo -> Maybe POSIX
createTime :: Prelude.Maybe Core.POSIX
  }
  deriving (DeploymentConfigInfo -> DeploymentConfigInfo -> Bool
(DeploymentConfigInfo -> DeploymentConfigInfo -> Bool)
-> (DeploymentConfigInfo -> DeploymentConfigInfo -> Bool)
-> Eq DeploymentConfigInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeploymentConfigInfo -> DeploymentConfigInfo -> Bool
$c/= :: DeploymentConfigInfo -> DeploymentConfigInfo -> Bool
== :: DeploymentConfigInfo -> DeploymentConfigInfo -> Bool
$c== :: DeploymentConfigInfo -> DeploymentConfigInfo -> Bool
Prelude.Eq, ReadPrec [DeploymentConfigInfo]
ReadPrec DeploymentConfigInfo
Int -> ReadS DeploymentConfigInfo
ReadS [DeploymentConfigInfo]
(Int -> ReadS DeploymentConfigInfo)
-> ReadS [DeploymentConfigInfo]
-> ReadPrec DeploymentConfigInfo
-> ReadPrec [DeploymentConfigInfo]
-> Read DeploymentConfigInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeploymentConfigInfo]
$creadListPrec :: ReadPrec [DeploymentConfigInfo]
readPrec :: ReadPrec DeploymentConfigInfo
$creadPrec :: ReadPrec DeploymentConfigInfo
readList :: ReadS [DeploymentConfigInfo]
$creadList :: ReadS [DeploymentConfigInfo]
readsPrec :: Int -> ReadS DeploymentConfigInfo
$creadsPrec :: Int -> ReadS DeploymentConfigInfo
Prelude.Read, Int -> DeploymentConfigInfo -> ShowS
[DeploymentConfigInfo] -> ShowS
DeploymentConfigInfo -> String
(Int -> DeploymentConfigInfo -> ShowS)
-> (DeploymentConfigInfo -> String)
-> ([DeploymentConfigInfo] -> ShowS)
-> Show DeploymentConfigInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeploymentConfigInfo] -> ShowS
$cshowList :: [DeploymentConfigInfo] -> ShowS
show :: DeploymentConfigInfo -> String
$cshow :: DeploymentConfigInfo -> String
showsPrec :: Int -> DeploymentConfigInfo -> ShowS
$cshowsPrec :: Int -> DeploymentConfigInfo -> ShowS
Prelude.Show, (forall x. DeploymentConfigInfo -> Rep DeploymentConfigInfo x)
-> (forall x. Rep DeploymentConfigInfo x -> DeploymentConfigInfo)
-> Generic DeploymentConfigInfo
forall x. Rep DeploymentConfigInfo x -> DeploymentConfigInfo
forall x. DeploymentConfigInfo -> Rep DeploymentConfigInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeploymentConfigInfo x -> DeploymentConfigInfo
$cfrom :: forall x. DeploymentConfigInfo -> Rep DeploymentConfigInfo x
Prelude.Generic)

-- |
-- Create a value of 'DeploymentConfigInfo' 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:
--
-- 'deploymentConfigName', 'deploymentConfigInfo_deploymentConfigName' - The deployment configuration name.
--
-- 'computePlatform', 'deploymentConfigInfo_computePlatform' - The destination platform type for the deployment (@Lambda@, @Server@, or
-- @ECS@).
--
-- 'minimumHealthyHosts', 'deploymentConfigInfo_minimumHealthyHosts' - Information about the number or percentage of minimum healthy instance.
--
-- 'trafficRoutingConfig', 'deploymentConfigInfo_trafficRoutingConfig' - The configuration that specifies how the deployment traffic is routed.
-- Used for deployments with a Lambda or ECS compute platform only.
--
-- 'deploymentConfigId', 'deploymentConfigInfo_deploymentConfigId' - The deployment configuration ID.
--
-- 'createTime', 'deploymentConfigInfo_createTime' - The time at which the deployment configuration was created.
newDeploymentConfigInfo ::
  DeploymentConfigInfo
newDeploymentConfigInfo :: DeploymentConfigInfo
newDeploymentConfigInfo =
  DeploymentConfigInfo' :: Maybe Text
-> Maybe ComputePlatform
-> Maybe MinimumHealthyHosts
-> Maybe TrafficRoutingConfig
-> Maybe Text
-> Maybe POSIX
-> DeploymentConfigInfo
DeploymentConfigInfo'
    { $sel:deploymentConfigName:DeploymentConfigInfo' :: Maybe Text
deploymentConfigName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:computePlatform:DeploymentConfigInfo' :: Maybe ComputePlatform
computePlatform = Maybe ComputePlatform
forall a. Maybe a
Prelude.Nothing,
      $sel:minimumHealthyHosts:DeploymentConfigInfo' :: Maybe MinimumHealthyHosts
minimumHealthyHosts = Maybe MinimumHealthyHosts
forall a. Maybe a
Prelude.Nothing,
      $sel:trafficRoutingConfig:DeploymentConfigInfo' :: Maybe TrafficRoutingConfig
trafficRoutingConfig = Maybe TrafficRoutingConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentConfigId:DeploymentConfigInfo' :: Maybe Text
deploymentConfigId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createTime:DeploymentConfigInfo' :: Maybe POSIX
createTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The deployment configuration name.
deploymentConfigInfo_deploymentConfigName :: Lens.Lens' DeploymentConfigInfo (Prelude.Maybe Prelude.Text)
deploymentConfigInfo_deploymentConfigName :: (Maybe Text -> f (Maybe Text))
-> DeploymentConfigInfo -> f DeploymentConfigInfo
deploymentConfigInfo_deploymentConfigName = (DeploymentConfigInfo -> Maybe Text)
-> (DeploymentConfigInfo -> Maybe Text -> DeploymentConfigInfo)
-> Lens
     DeploymentConfigInfo DeploymentConfigInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentConfigInfo' {Maybe Text
deploymentConfigName :: Maybe Text
$sel:deploymentConfigName:DeploymentConfigInfo' :: DeploymentConfigInfo -> Maybe Text
deploymentConfigName} -> Maybe Text
deploymentConfigName) (\s :: DeploymentConfigInfo
s@DeploymentConfigInfo' {} Maybe Text
a -> DeploymentConfigInfo
s {$sel:deploymentConfigName:DeploymentConfigInfo' :: Maybe Text
deploymentConfigName = Maybe Text
a} :: DeploymentConfigInfo)

-- | The destination platform type for the deployment (@Lambda@, @Server@, or
-- @ECS@).
deploymentConfigInfo_computePlatform :: Lens.Lens' DeploymentConfigInfo (Prelude.Maybe ComputePlatform)
deploymentConfigInfo_computePlatform :: (Maybe ComputePlatform -> f (Maybe ComputePlatform))
-> DeploymentConfigInfo -> f DeploymentConfigInfo
deploymentConfigInfo_computePlatform = (DeploymentConfigInfo -> Maybe ComputePlatform)
-> (DeploymentConfigInfo
    -> Maybe ComputePlatform -> DeploymentConfigInfo)
-> Lens
     DeploymentConfigInfo
     DeploymentConfigInfo
     (Maybe ComputePlatform)
     (Maybe ComputePlatform)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentConfigInfo' {Maybe ComputePlatform
computePlatform :: Maybe ComputePlatform
$sel:computePlatform:DeploymentConfigInfo' :: DeploymentConfigInfo -> Maybe ComputePlatform
computePlatform} -> Maybe ComputePlatform
computePlatform) (\s :: DeploymentConfigInfo
s@DeploymentConfigInfo' {} Maybe ComputePlatform
a -> DeploymentConfigInfo
s {$sel:computePlatform:DeploymentConfigInfo' :: Maybe ComputePlatform
computePlatform = Maybe ComputePlatform
a} :: DeploymentConfigInfo)

-- | Information about the number or percentage of minimum healthy instance.
deploymentConfigInfo_minimumHealthyHosts :: Lens.Lens' DeploymentConfigInfo (Prelude.Maybe MinimumHealthyHosts)
deploymentConfigInfo_minimumHealthyHosts :: (Maybe MinimumHealthyHosts -> f (Maybe MinimumHealthyHosts))
-> DeploymentConfigInfo -> f DeploymentConfigInfo
deploymentConfigInfo_minimumHealthyHosts = (DeploymentConfigInfo -> Maybe MinimumHealthyHosts)
-> (DeploymentConfigInfo
    -> Maybe MinimumHealthyHosts -> DeploymentConfigInfo)
-> Lens
     DeploymentConfigInfo
     DeploymentConfigInfo
     (Maybe MinimumHealthyHosts)
     (Maybe MinimumHealthyHosts)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentConfigInfo' {Maybe MinimumHealthyHosts
minimumHealthyHosts :: Maybe MinimumHealthyHosts
$sel:minimumHealthyHosts:DeploymentConfigInfo' :: DeploymentConfigInfo -> Maybe MinimumHealthyHosts
minimumHealthyHosts} -> Maybe MinimumHealthyHosts
minimumHealthyHosts) (\s :: DeploymentConfigInfo
s@DeploymentConfigInfo' {} Maybe MinimumHealthyHosts
a -> DeploymentConfigInfo
s {$sel:minimumHealthyHosts:DeploymentConfigInfo' :: Maybe MinimumHealthyHosts
minimumHealthyHosts = Maybe MinimumHealthyHosts
a} :: DeploymentConfigInfo)

-- | The configuration that specifies how the deployment traffic is routed.
-- Used for deployments with a Lambda or ECS compute platform only.
deploymentConfigInfo_trafficRoutingConfig :: Lens.Lens' DeploymentConfigInfo (Prelude.Maybe TrafficRoutingConfig)
deploymentConfigInfo_trafficRoutingConfig :: (Maybe TrafficRoutingConfig -> f (Maybe TrafficRoutingConfig))
-> DeploymentConfigInfo -> f DeploymentConfigInfo
deploymentConfigInfo_trafficRoutingConfig = (DeploymentConfigInfo -> Maybe TrafficRoutingConfig)
-> (DeploymentConfigInfo
    -> Maybe TrafficRoutingConfig -> DeploymentConfigInfo)
-> Lens
     DeploymentConfigInfo
     DeploymentConfigInfo
     (Maybe TrafficRoutingConfig)
     (Maybe TrafficRoutingConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentConfigInfo' {Maybe TrafficRoutingConfig
trafficRoutingConfig :: Maybe TrafficRoutingConfig
$sel:trafficRoutingConfig:DeploymentConfigInfo' :: DeploymentConfigInfo -> Maybe TrafficRoutingConfig
trafficRoutingConfig} -> Maybe TrafficRoutingConfig
trafficRoutingConfig) (\s :: DeploymentConfigInfo
s@DeploymentConfigInfo' {} Maybe TrafficRoutingConfig
a -> DeploymentConfigInfo
s {$sel:trafficRoutingConfig:DeploymentConfigInfo' :: Maybe TrafficRoutingConfig
trafficRoutingConfig = Maybe TrafficRoutingConfig
a} :: DeploymentConfigInfo)

-- | The deployment configuration ID.
deploymentConfigInfo_deploymentConfigId :: Lens.Lens' DeploymentConfigInfo (Prelude.Maybe Prelude.Text)
deploymentConfigInfo_deploymentConfigId :: (Maybe Text -> f (Maybe Text))
-> DeploymentConfigInfo -> f DeploymentConfigInfo
deploymentConfigInfo_deploymentConfigId = (DeploymentConfigInfo -> Maybe Text)
-> (DeploymentConfigInfo -> Maybe Text -> DeploymentConfigInfo)
-> Lens
     DeploymentConfigInfo DeploymentConfigInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentConfigInfo' {Maybe Text
deploymentConfigId :: Maybe Text
$sel:deploymentConfigId:DeploymentConfigInfo' :: DeploymentConfigInfo -> Maybe Text
deploymentConfigId} -> Maybe Text
deploymentConfigId) (\s :: DeploymentConfigInfo
s@DeploymentConfigInfo' {} Maybe Text
a -> DeploymentConfigInfo
s {$sel:deploymentConfigId:DeploymentConfigInfo' :: Maybe Text
deploymentConfigId = Maybe Text
a} :: DeploymentConfigInfo)

-- | The time at which the deployment configuration was created.
deploymentConfigInfo_createTime :: Lens.Lens' DeploymentConfigInfo (Prelude.Maybe Prelude.UTCTime)
deploymentConfigInfo_createTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DeploymentConfigInfo -> f DeploymentConfigInfo
deploymentConfigInfo_createTime = (DeploymentConfigInfo -> Maybe POSIX)
-> (DeploymentConfigInfo -> Maybe POSIX -> DeploymentConfigInfo)
-> Lens
     DeploymentConfigInfo
     DeploymentConfigInfo
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentConfigInfo' {Maybe POSIX
createTime :: Maybe POSIX
$sel:createTime:DeploymentConfigInfo' :: DeploymentConfigInfo -> Maybe POSIX
createTime} -> Maybe POSIX
createTime) (\s :: DeploymentConfigInfo
s@DeploymentConfigInfo' {} Maybe POSIX
a -> DeploymentConfigInfo
s {$sel:createTime:DeploymentConfigInfo' :: Maybe POSIX
createTime = Maybe POSIX
a} :: DeploymentConfigInfo) ((Maybe POSIX -> f (Maybe POSIX))
 -> DeploymentConfigInfo -> f DeploymentConfigInfo)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DeploymentConfigInfo
-> f DeploymentConfigInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON DeploymentConfigInfo where
  parseJSON :: Value -> Parser DeploymentConfigInfo
parseJSON =
    String
-> (Object -> Parser DeploymentConfigInfo)
-> Value
-> Parser DeploymentConfigInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DeploymentConfigInfo"
      ( \Object
x ->
          Maybe Text
-> Maybe ComputePlatform
-> Maybe MinimumHealthyHosts
-> Maybe TrafficRoutingConfig
-> Maybe Text
-> Maybe POSIX
-> DeploymentConfigInfo
DeploymentConfigInfo'
            (Maybe Text
 -> Maybe ComputePlatform
 -> Maybe MinimumHealthyHosts
 -> Maybe TrafficRoutingConfig
 -> Maybe Text
 -> Maybe POSIX
 -> DeploymentConfigInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe ComputePlatform
      -> Maybe MinimumHealthyHosts
      -> Maybe TrafficRoutingConfig
      -> Maybe Text
      -> Maybe POSIX
      -> DeploymentConfigInfo)
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
"deploymentConfigName")
            Parser
  (Maybe ComputePlatform
   -> Maybe MinimumHealthyHosts
   -> Maybe TrafficRoutingConfig
   -> Maybe Text
   -> Maybe POSIX
   -> DeploymentConfigInfo)
-> Parser (Maybe ComputePlatform)
-> Parser
     (Maybe MinimumHealthyHosts
      -> Maybe TrafficRoutingConfig
      -> Maybe Text
      -> Maybe POSIX
      -> DeploymentConfigInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ComputePlatform)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"computePlatform")
            Parser
  (Maybe MinimumHealthyHosts
   -> Maybe TrafficRoutingConfig
   -> Maybe Text
   -> Maybe POSIX
   -> DeploymentConfigInfo)
-> Parser (Maybe MinimumHealthyHosts)
-> Parser
     (Maybe TrafficRoutingConfig
      -> Maybe Text -> Maybe POSIX -> DeploymentConfigInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MinimumHealthyHosts)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"minimumHealthyHosts")
            Parser
  (Maybe TrafficRoutingConfig
   -> Maybe Text -> Maybe POSIX -> DeploymentConfigInfo)
-> Parser (Maybe TrafficRoutingConfig)
-> Parser (Maybe Text -> Maybe POSIX -> DeploymentConfigInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TrafficRoutingConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"trafficRoutingConfig")
            Parser (Maybe Text -> Maybe POSIX -> DeploymentConfigInfo)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> DeploymentConfigInfo)
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
"deploymentConfigId")
            Parser (Maybe POSIX -> DeploymentConfigInfo)
-> Parser (Maybe POSIX) -> Parser DeploymentConfigInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"createTime")
      )

instance Prelude.Hashable DeploymentConfigInfo

instance Prelude.NFData DeploymentConfigInfo