{-# 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.ElasticBeanstalk.Types.Deployment
-- 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.ElasticBeanstalk.Types.Deployment 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

-- | Information about an application version deployment.
--
-- /See:/ 'newDeployment' smart constructor.
data Deployment = Deployment'
  { -- | The ID of the deployment. This number increases by one each time that
    -- you deploy source code or change instance configuration settings.
    Deployment -> Maybe Integer
deploymentId :: Prelude.Maybe Prelude.Integer,
    -- | For in-progress deployments, the time that the deployment started.
    --
    -- For completed deployments, the time that the deployment ended.
    Deployment -> Maybe ISO8601
deploymentTime :: Prelude.Maybe Data.ISO8601,
    -- | The status of the deployment:
    --
    -- -   @In Progress@ : The deployment is in progress.
    --
    -- -   @Deployed@ : The deployment succeeded.
    --
    -- -   @Failed@ : The deployment failed.
    Deployment -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The version label of the application version in the deployment.
    Deployment -> Maybe Text
versionLabel :: Prelude.Maybe Prelude.Text
  }
  deriving (Deployment -> Deployment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Deployment -> Deployment -> Bool
$c/= :: Deployment -> Deployment -> Bool
== :: Deployment -> Deployment -> Bool
$c== :: Deployment -> Deployment -> Bool
Prelude.Eq, ReadPrec [Deployment]
ReadPrec Deployment
Int -> ReadS Deployment
ReadS [Deployment]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Deployment]
$creadListPrec :: ReadPrec [Deployment]
readPrec :: ReadPrec Deployment
$creadPrec :: ReadPrec Deployment
readList :: ReadS [Deployment]
$creadList :: ReadS [Deployment]
readsPrec :: Int -> ReadS Deployment
$creadsPrec :: Int -> ReadS Deployment
Prelude.Read, Int -> Deployment -> ShowS
[Deployment] -> ShowS
Deployment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Deployment] -> ShowS
$cshowList :: [Deployment] -> ShowS
show :: Deployment -> String
$cshow :: Deployment -> String
showsPrec :: Int -> Deployment -> ShowS
$cshowsPrec :: Int -> Deployment -> ShowS
Prelude.Show, forall x. Rep Deployment x -> Deployment
forall x. Deployment -> Rep Deployment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Deployment x -> Deployment
$cfrom :: forall x. Deployment -> Rep Deployment x
Prelude.Generic)

-- |
-- Create a value of 'Deployment' 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:
--
-- 'deploymentId', 'deployment_deploymentId' - The ID of the deployment. This number increases by one each time that
-- you deploy source code or change instance configuration settings.
--
-- 'deploymentTime', 'deployment_deploymentTime' - For in-progress deployments, the time that the deployment started.
--
-- For completed deployments, the time that the deployment ended.
--
-- 'status', 'deployment_status' - The status of the deployment:
--
-- -   @In Progress@ : The deployment is in progress.
--
-- -   @Deployed@ : The deployment succeeded.
--
-- -   @Failed@ : The deployment failed.
--
-- 'versionLabel', 'deployment_versionLabel' - The version label of the application version in the deployment.
newDeployment ::
  Deployment
newDeployment :: Deployment
newDeployment =
  Deployment'
    { $sel:deploymentId:Deployment' :: Maybe Integer
deploymentId = forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentTime:Deployment' :: Maybe ISO8601
deploymentTime = forall a. Maybe a
Prelude.Nothing,
      $sel:status:Deployment' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing,
      $sel:versionLabel:Deployment' :: Maybe Text
versionLabel = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the deployment. This number increases by one each time that
-- you deploy source code or change instance configuration settings.
deployment_deploymentId :: Lens.Lens' Deployment (Prelude.Maybe Prelude.Integer)
deployment_deploymentId :: Lens' Deployment (Maybe Integer)
deployment_deploymentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deployment' {Maybe Integer
deploymentId :: Maybe Integer
$sel:deploymentId:Deployment' :: Deployment -> Maybe Integer
deploymentId} -> Maybe Integer
deploymentId) (\s :: Deployment
s@Deployment' {} Maybe Integer
a -> Deployment
s {$sel:deploymentId:Deployment' :: Maybe Integer
deploymentId = Maybe Integer
a} :: Deployment)

-- | For in-progress deployments, the time that the deployment started.
--
-- For completed deployments, the time that the deployment ended.
deployment_deploymentTime :: Lens.Lens' Deployment (Prelude.Maybe Prelude.UTCTime)
deployment_deploymentTime :: Lens' Deployment (Maybe UTCTime)
deployment_deploymentTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deployment' {Maybe ISO8601
deploymentTime :: Maybe ISO8601
$sel:deploymentTime:Deployment' :: Deployment -> Maybe ISO8601
deploymentTime} -> Maybe ISO8601
deploymentTime) (\s :: Deployment
s@Deployment' {} Maybe ISO8601
a -> Deployment
s {$sel:deploymentTime:Deployment' :: Maybe ISO8601
deploymentTime = Maybe ISO8601
a} :: Deployment) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The status of the deployment:
--
-- -   @In Progress@ : The deployment is in progress.
--
-- -   @Deployed@ : The deployment succeeded.
--
-- -   @Failed@ : The deployment failed.
deployment_status :: Lens.Lens' Deployment (Prelude.Maybe Prelude.Text)
deployment_status :: Lens' Deployment (Maybe Text)
deployment_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deployment' {Maybe Text
status :: Maybe Text
$sel:status:Deployment' :: Deployment -> Maybe Text
status} -> Maybe Text
status) (\s :: Deployment
s@Deployment' {} Maybe Text
a -> Deployment
s {$sel:status:Deployment' :: Maybe Text
status = Maybe Text
a} :: Deployment)

-- | The version label of the application version in the deployment.
deployment_versionLabel :: Lens.Lens' Deployment (Prelude.Maybe Prelude.Text)
deployment_versionLabel :: Lens' Deployment (Maybe Text)
deployment_versionLabel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Deployment' {Maybe Text
versionLabel :: Maybe Text
$sel:versionLabel:Deployment' :: Deployment -> Maybe Text
versionLabel} -> Maybe Text
versionLabel) (\s :: Deployment
s@Deployment' {} Maybe Text
a -> Deployment
s {$sel:versionLabel:Deployment' :: Maybe Text
versionLabel = Maybe Text
a} :: Deployment)

instance Data.FromXML Deployment where
  parseXML :: [Node] -> Either String Deployment
parseXML [Node]
x =
    Maybe Integer
-> Maybe ISO8601 -> Maybe Text -> Maybe Text -> Deployment
Deployment'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"DeploymentId")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"DeploymentTime")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Status")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"VersionLabel")

instance Prelude.Hashable Deployment where
  hashWithSalt :: Int -> Deployment -> Int
hashWithSalt Int
_salt Deployment' {Maybe Integer
Maybe Text
Maybe ISO8601
versionLabel :: Maybe Text
status :: Maybe Text
deploymentTime :: Maybe ISO8601
deploymentId :: Maybe Integer
$sel:versionLabel:Deployment' :: Deployment -> Maybe Text
$sel:status:Deployment' :: Deployment -> Maybe Text
$sel:deploymentTime:Deployment' :: Deployment -> Maybe ISO8601
$sel:deploymentId:Deployment' :: Deployment -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
deploymentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
deploymentTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
versionLabel

instance Prelude.NFData Deployment where
  rnf :: Deployment -> ()
rnf Deployment' {Maybe Integer
Maybe Text
Maybe ISO8601
versionLabel :: Maybe Text
status :: Maybe Text
deploymentTime :: Maybe ISO8601
deploymentId :: Maybe Integer
$sel:versionLabel:Deployment' :: Deployment -> Maybe Text
$sel:status:Deployment' :: Deployment -> Maybe Text
$sel:deploymentTime:Deployment' :: Deployment -> Maybe ISO8601
$sel:deploymentId:Deployment' :: Deployment -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
deploymentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
deploymentTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionLabel