{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

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

-- | Undocumented member.
deploymentTarget_cloudFormationTarget :: Lens.Lens' DeploymentTarget (Prelude.Maybe CloudFormationTarget)
deploymentTarget_cloudFormationTarget :: Lens' DeploymentTarget (Maybe CloudFormationTarget)
deploymentTarget_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)

-- | 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 :: Lens' DeploymentTarget (Maybe DeploymentTargetType)
deploymentTarget_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 Amazon ECS
-- compute platform.
deploymentTarget_ecsTarget :: Lens.Lens' DeploymentTarget (Prelude.Maybe ECSTarget)
deploymentTarget_ecsTarget :: Lens' DeploymentTarget (Maybe ECSTarget)
deploymentTarget_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)

-- | 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 :: Lens' DeploymentTarget (Maybe InstanceTarget)
deploymentTarget_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)

-- | Information about the target for a deployment that uses the Lambda
-- compute platform.
deploymentTarget_lambdaTarget :: Lens.Lens' DeploymentTarget (Prelude.Maybe LambdaTarget)
deploymentTarget_lambdaTarget :: Lens' DeploymentTarget (Maybe LambdaTarget)
deploymentTarget_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 Data.FromJSON DeploymentTarget where
  parseJSON :: Value -> Parser DeploymentTarget
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DeploymentTarget"
      ( \Object
x ->
          Maybe CloudFormationTarget
-> Maybe DeploymentTargetType
-> Maybe ECSTarget
-> Maybe InstanceTarget
-> Maybe LambdaTarget
-> DeploymentTarget
DeploymentTarget'
            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
"cloudFormationTarget")
            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
"deploymentTargetType")
            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
"ecsTarget")
            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
"instanceTarget")
            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
"lambdaTarget")
      )

instance Prelude.Hashable DeploymentTarget where
  hashWithSalt :: Int -> DeploymentTarget -> Int
hashWithSalt Int
_salt DeploymentTarget' {Maybe DeploymentTargetType
Maybe LambdaTarget
Maybe InstanceTarget
Maybe ECSTarget
Maybe CloudFormationTarget
lambdaTarget :: Maybe LambdaTarget
instanceTarget :: Maybe InstanceTarget
ecsTarget :: Maybe ECSTarget
deploymentTargetType :: Maybe DeploymentTargetType
cloudFormationTarget :: Maybe CloudFormationTarget
$sel:lambdaTarget:DeploymentTarget' :: DeploymentTarget -> Maybe LambdaTarget
$sel:instanceTarget:DeploymentTarget' :: DeploymentTarget -> Maybe InstanceTarget
$sel:ecsTarget:DeploymentTarget' :: DeploymentTarget -> Maybe ECSTarget
$sel:deploymentTargetType:DeploymentTarget' :: DeploymentTarget -> Maybe DeploymentTargetType
$sel:cloudFormationTarget:DeploymentTarget' :: DeploymentTarget -> Maybe CloudFormationTarget
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CloudFormationTarget
cloudFormationTarget
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DeploymentTargetType
deploymentTargetType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ECSTarget
ecsTarget
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstanceTarget
instanceTarget
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LambdaTarget
lambdaTarget

instance Prelude.NFData DeploymentTarget where
  rnf :: DeploymentTarget -> ()
rnf DeploymentTarget' {Maybe DeploymentTargetType
Maybe LambdaTarget
Maybe InstanceTarget
Maybe ECSTarget
Maybe CloudFormationTarget
lambdaTarget :: Maybe LambdaTarget
instanceTarget :: Maybe InstanceTarget
ecsTarget :: Maybe ECSTarget
deploymentTargetType :: Maybe DeploymentTargetType
cloudFormationTarget :: Maybe CloudFormationTarget
$sel:lambdaTarget:DeploymentTarget' :: DeploymentTarget -> Maybe LambdaTarget
$sel:instanceTarget:DeploymentTarget' :: DeploymentTarget -> Maybe InstanceTarget
$sel:ecsTarget:DeploymentTarget' :: DeploymentTarget -> Maybe ECSTarget
$sel:deploymentTargetType:DeploymentTarget' :: DeploymentTarget -> Maybe DeploymentTargetType
$sel:cloudFormationTarget:DeploymentTarget' :: DeploymentTarget -> Maybe CloudFormationTarget
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CloudFormationTarget
cloudFormationTarget
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DeploymentTargetType
deploymentTargetType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ECSTarget
ecsTarget
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InstanceTarget
instanceTarget
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LambdaTarget
lambdaTarget