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

import Amazonka.CodeDeploy.Types.CloudFormationTarget
import Amazonka.CodeDeploy.Types.DeploymentTargetType
import Amazonka.CodeDeploy.Types.ECSTarget
import Amazonka.CodeDeploy.Types.InstanceTarget
import Amazonka.CodeDeploy.Types.LambdaTarget
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the deployment target.
--
-- /See:/ 'newDeploymentTarget' smart constructor.
data DeploymentTarget = DeploymentTarget'
  { -- | Information about the target for a deployment that uses the
    -- EC2\/On-premises compute platform.
    DeploymentTarget -> Maybe InstanceTarget
instanceTarget :: Prelude.Maybe InstanceTarget,
    DeploymentTarget -> Maybe CloudFormationTarget
cloudFormationTarget :: Prelude.Maybe CloudFormationTarget,
    -- | Information about the target for a deployment that uses the Amazon ECS
    -- compute platform.
    DeploymentTarget -> Maybe ECSTarget
ecsTarget :: Prelude.Maybe ECSTarget,
    -- | The deployment type that is specific to the deployment\'s compute
    -- platform or deployments initiated by a CloudFormation stack update.
    DeploymentTarget -> Maybe DeploymentTargetType
deploymentTargetType :: Prelude.Maybe DeploymentTargetType,
    -- | Information about the target for a deployment that uses the AWS Lambda
    -- compute platform.
    DeploymentTarget -> Maybe LambdaTarget
lambdaTarget :: Prelude.Maybe LambdaTarget
  }
  deriving (DeploymentTarget -> DeploymentTarget -> Bool
(DeploymentTarget -> DeploymentTarget -> Bool)
-> (DeploymentTarget -> DeploymentTarget -> Bool)
-> Eq DeploymentTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeploymentTarget -> DeploymentTarget -> Bool
$c/= :: DeploymentTarget -> DeploymentTarget -> Bool
== :: DeploymentTarget -> DeploymentTarget -> Bool
$c== :: DeploymentTarget -> DeploymentTarget -> Bool
Prelude.Eq, ReadPrec [DeploymentTarget]
ReadPrec DeploymentTarget
Int -> ReadS DeploymentTarget
ReadS [DeploymentTarget]
(Int -> ReadS DeploymentTarget)
-> ReadS [DeploymentTarget]
-> ReadPrec DeploymentTarget
-> ReadPrec [DeploymentTarget]
-> Read DeploymentTarget
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeploymentTarget]
$creadListPrec :: ReadPrec [DeploymentTarget]
readPrec :: ReadPrec DeploymentTarget
$creadPrec :: ReadPrec DeploymentTarget
readList :: ReadS [DeploymentTarget]
$creadList :: ReadS [DeploymentTarget]
readsPrec :: Int -> ReadS DeploymentTarget
$creadsPrec :: Int -> ReadS DeploymentTarget
Prelude.Read, Int -> DeploymentTarget -> ShowS
[DeploymentTarget] -> ShowS
DeploymentTarget -> String
(Int -> DeploymentTarget -> ShowS)
-> (DeploymentTarget -> String)
-> ([DeploymentTarget] -> ShowS)
-> Show DeploymentTarget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeploymentTarget] -> ShowS
$cshowList :: [DeploymentTarget] -> ShowS
show :: DeploymentTarget -> String
$cshow :: DeploymentTarget -> String
showsPrec :: Int -> DeploymentTarget -> ShowS
$cshowsPrec :: Int -> DeploymentTarget -> ShowS
Prelude.Show, (forall x. DeploymentTarget -> Rep DeploymentTarget x)
-> (forall x. Rep DeploymentTarget x -> DeploymentTarget)
-> Generic DeploymentTarget
forall x. Rep DeploymentTarget x -> DeploymentTarget
forall x. DeploymentTarget -> Rep DeploymentTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeploymentTarget x -> DeploymentTarget
$cfrom :: forall x. DeploymentTarget -> Rep DeploymentTarget x
Prelude.Generic)

-- |
-- Create a value of 'DeploymentTarget' 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:
--
-- 'instanceTarget', 'deploymentTarget_instanceTarget' - Information about the target for a deployment that uses the
-- EC2\/On-premises compute platform.
--
-- 'cloudFormationTarget', 'deploymentTarget_cloudFormationTarget' - Undocumented member.
--
-- 'ecsTarget', 'deploymentTarget_ecsTarget' - Information about the target for a deployment that uses the Amazon ECS
-- compute platform.
--
-- 'deploymentTargetType', 'deploymentTarget_deploymentTargetType' - The deployment type that is specific to the deployment\'s compute
-- platform or deployments initiated by a CloudFormation stack update.
--
-- 'lambdaTarget', 'deploymentTarget_lambdaTarget' - Information about the target for a deployment that uses the AWS Lambda
-- compute platform.
newDeploymentTarget ::
  DeploymentTarget
newDeploymentTarget :: DeploymentTarget
newDeploymentTarget =
  DeploymentTarget' :: Maybe InstanceTarget
-> Maybe CloudFormationTarget
-> Maybe ECSTarget
-> Maybe DeploymentTargetType
-> Maybe LambdaTarget
-> DeploymentTarget
DeploymentTarget'
    { $sel:instanceTarget:DeploymentTarget' :: Maybe InstanceTarget
instanceTarget = Maybe InstanceTarget
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudFormationTarget:DeploymentTarget' :: Maybe CloudFormationTarget
cloudFormationTarget = Maybe CloudFormationTarget
forall a. Maybe a
Prelude.Nothing,
      $sel:ecsTarget:DeploymentTarget' :: Maybe ECSTarget
ecsTarget = Maybe ECSTarget
forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentTargetType:DeploymentTarget' :: Maybe DeploymentTargetType
deploymentTargetType = Maybe DeploymentTargetType
forall a. Maybe a
Prelude.Nothing,
      $sel:lambdaTarget:DeploymentTarget' :: Maybe LambdaTarget
lambdaTarget = Maybe LambdaTarget
forall a. Maybe a
Prelude.Nothing
    }

-- | Information about the target for a deployment that uses the
-- EC2\/On-premises compute platform.
deploymentTarget_instanceTarget :: Lens.Lens' DeploymentTarget (Prelude.Maybe InstanceTarget)
deploymentTarget_instanceTarget :: (Maybe InstanceTarget -> f (Maybe InstanceTarget))
-> DeploymentTarget -> f DeploymentTarget
deploymentTarget_instanceTarget = (DeploymentTarget -> Maybe InstanceTarget)
-> (DeploymentTarget -> Maybe InstanceTarget -> DeploymentTarget)
-> Lens
     DeploymentTarget
     DeploymentTarget
     (Maybe InstanceTarget)
     (Maybe InstanceTarget)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentTarget' {Maybe InstanceTarget
instanceTarget :: Maybe InstanceTarget
$sel:instanceTarget:DeploymentTarget' :: DeploymentTarget -> Maybe InstanceTarget
instanceTarget} -> Maybe InstanceTarget
instanceTarget) (\s :: DeploymentTarget
s@DeploymentTarget' {} Maybe InstanceTarget
a -> DeploymentTarget
s {$sel:instanceTarget:DeploymentTarget' :: Maybe InstanceTarget
instanceTarget = Maybe InstanceTarget
a} :: DeploymentTarget)

-- | Undocumented member.
deploymentTarget_cloudFormationTarget :: Lens.Lens' DeploymentTarget (Prelude.Maybe CloudFormationTarget)
deploymentTarget_cloudFormationTarget :: (Maybe CloudFormationTarget -> f (Maybe CloudFormationTarget))
-> DeploymentTarget -> f DeploymentTarget
deploymentTarget_cloudFormationTarget = (DeploymentTarget -> Maybe CloudFormationTarget)
-> (DeploymentTarget
    -> Maybe CloudFormationTarget -> DeploymentTarget)
-> Lens
     DeploymentTarget
     DeploymentTarget
     (Maybe CloudFormationTarget)
     (Maybe CloudFormationTarget)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentTarget' {Maybe CloudFormationTarget
cloudFormationTarget :: Maybe CloudFormationTarget
$sel:cloudFormationTarget:DeploymentTarget' :: DeploymentTarget -> Maybe CloudFormationTarget
cloudFormationTarget} -> Maybe CloudFormationTarget
cloudFormationTarget) (\s :: DeploymentTarget
s@DeploymentTarget' {} Maybe CloudFormationTarget
a -> DeploymentTarget
s {$sel:cloudFormationTarget:DeploymentTarget' :: Maybe CloudFormationTarget
cloudFormationTarget = Maybe CloudFormationTarget
a} :: DeploymentTarget)

-- | Information about the target for a deployment that uses the Amazon ECS
-- compute platform.
deploymentTarget_ecsTarget :: Lens.Lens' DeploymentTarget (Prelude.Maybe ECSTarget)
deploymentTarget_ecsTarget :: (Maybe ECSTarget -> f (Maybe ECSTarget))
-> DeploymentTarget -> f DeploymentTarget
deploymentTarget_ecsTarget = (DeploymentTarget -> Maybe ECSTarget)
-> (DeploymentTarget -> Maybe ECSTarget -> DeploymentTarget)
-> Lens
     DeploymentTarget
     DeploymentTarget
     (Maybe ECSTarget)
     (Maybe ECSTarget)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentTarget' {Maybe ECSTarget
ecsTarget :: Maybe ECSTarget
$sel:ecsTarget:DeploymentTarget' :: DeploymentTarget -> Maybe ECSTarget
ecsTarget} -> Maybe ECSTarget
ecsTarget) (\s :: DeploymentTarget
s@DeploymentTarget' {} Maybe ECSTarget
a -> DeploymentTarget
s {$sel:ecsTarget:DeploymentTarget' :: Maybe ECSTarget
ecsTarget = Maybe ECSTarget
a} :: DeploymentTarget)

-- | The deployment type that is specific to the deployment\'s compute
-- platform or deployments initiated by a CloudFormation stack update.
deploymentTarget_deploymentTargetType :: Lens.Lens' DeploymentTarget (Prelude.Maybe DeploymentTargetType)
deploymentTarget_deploymentTargetType :: (Maybe DeploymentTargetType -> f (Maybe DeploymentTargetType))
-> DeploymentTarget -> f DeploymentTarget
deploymentTarget_deploymentTargetType = (DeploymentTarget -> Maybe DeploymentTargetType)
-> (DeploymentTarget
    -> Maybe DeploymentTargetType -> DeploymentTarget)
-> Lens
     DeploymentTarget
     DeploymentTarget
     (Maybe DeploymentTargetType)
     (Maybe DeploymentTargetType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentTarget' {Maybe DeploymentTargetType
deploymentTargetType :: Maybe DeploymentTargetType
$sel:deploymentTargetType:DeploymentTarget' :: DeploymentTarget -> Maybe DeploymentTargetType
deploymentTargetType} -> Maybe DeploymentTargetType
deploymentTargetType) (\s :: DeploymentTarget
s@DeploymentTarget' {} Maybe DeploymentTargetType
a -> DeploymentTarget
s {$sel:deploymentTargetType:DeploymentTarget' :: Maybe DeploymentTargetType
deploymentTargetType = Maybe DeploymentTargetType
a} :: DeploymentTarget)

-- | Information about the target for a deployment that uses the AWS Lambda
-- compute platform.
deploymentTarget_lambdaTarget :: Lens.Lens' DeploymentTarget (Prelude.Maybe LambdaTarget)
deploymentTarget_lambdaTarget :: (Maybe LambdaTarget -> f (Maybe LambdaTarget))
-> DeploymentTarget -> f DeploymentTarget
deploymentTarget_lambdaTarget = (DeploymentTarget -> Maybe LambdaTarget)
-> (DeploymentTarget -> Maybe LambdaTarget -> DeploymentTarget)
-> Lens
     DeploymentTarget
     DeploymentTarget
     (Maybe LambdaTarget)
     (Maybe LambdaTarget)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentTarget' {Maybe LambdaTarget
lambdaTarget :: Maybe LambdaTarget
$sel:lambdaTarget:DeploymentTarget' :: DeploymentTarget -> Maybe LambdaTarget
lambdaTarget} -> Maybe LambdaTarget
lambdaTarget) (\s :: DeploymentTarget
s@DeploymentTarget' {} Maybe LambdaTarget
a -> DeploymentTarget
s {$sel:lambdaTarget:DeploymentTarget' :: Maybe LambdaTarget
lambdaTarget = Maybe LambdaTarget
a} :: DeploymentTarget)

instance Core.FromJSON DeploymentTarget where
  parseJSON :: Value -> Parser DeploymentTarget
parseJSON =
    String
-> (Object -> Parser DeploymentTarget)
-> Value
-> Parser DeploymentTarget
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DeploymentTarget"
      ( \Object
x ->
          Maybe InstanceTarget
-> Maybe CloudFormationTarget
-> Maybe ECSTarget
-> Maybe DeploymentTargetType
-> Maybe LambdaTarget
-> DeploymentTarget
DeploymentTarget'
            (Maybe InstanceTarget
 -> Maybe CloudFormationTarget
 -> Maybe ECSTarget
 -> Maybe DeploymentTargetType
 -> Maybe LambdaTarget
 -> DeploymentTarget)
-> Parser (Maybe InstanceTarget)
-> Parser
     (Maybe CloudFormationTarget
      -> Maybe ECSTarget
      -> Maybe DeploymentTargetType
      -> Maybe LambdaTarget
      -> DeploymentTarget)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe InstanceTarget)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"instanceTarget")
            Parser
  (Maybe CloudFormationTarget
   -> Maybe ECSTarget
   -> Maybe DeploymentTargetType
   -> Maybe LambdaTarget
   -> DeploymentTarget)
-> Parser (Maybe CloudFormationTarget)
-> Parser
     (Maybe ECSTarget
      -> Maybe DeploymentTargetType
      -> Maybe LambdaTarget
      -> DeploymentTarget)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CloudFormationTarget)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cloudFormationTarget")
            Parser
  (Maybe ECSTarget
   -> Maybe DeploymentTargetType
   -> Maybe LambdaTarget
   -> DeploymentTarget)
-> Parser (Maybe ECSTarget)
-> Parser
     (Maybe DeploymentTargetType
      -> Maybe LambdaTarget -> DeploymentTarget)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ECSTarget)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ecsTarget")
            Parser
  (Maybe DeploymentTargetType
   -> Maybe LambdaTarget -> DeploymentTarget)
-> Parser (Maybe DeploymentTargetType)
-> Parser (Maybe LambdaTarget -> DeploymentTarget)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DeploymentTargetType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"deploymentTargetType")
            Parser (Maybe LambdaTarget -> DeploymentTarget)
-> Parser (Maybe LambdaTarget) -> Parser DeploymentTarget
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LambdaTarget)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lambdaTarget")
      )

instance Prelude.Hashable DeploymentTarget

instance Prelude.NFData DeploymentTarget