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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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,
    -- | 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,
    -- | 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 Core.ISO8601,
    -- | The version label of the application version in the deployment.
    Deployment -> Maybe Text
versionLabel :: Prelude.Maybe Prelude.Text
  }
  deriving (Deployment -> Deployment -> Bool
(Deployment -> Deployment -> Bool)
-> (Deployment -> Deployment -> Bool) -> Eq Deployment
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]
(Int -> ReadS Deployment)
-> ReadS [Deployment]
-> ReadPrec Deployment
-> ReadPrec [Deployment]
-> Read 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
(Int -> Deployment -> ShowS)
-> (Deployment -> String)
-> ([Deployment] -> ShowS)
-> Show Deployment
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. Deployment -> Rep Deployment x)
-> (forall x. Rep Deployment x -> Deployment) -> Generic Deployment
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.
--
-- 'status', 'deployment_status' - The status of the deployment:
--
-- -   @In Progress@ : The deployment is in progress.
--
-- -   @Deployed@ : The deployment succeeded.
--
-- -   @Failed@ : The deployment failed.
--
-- 'deploymentTime', 'deployment_deploymentTime' - For in-progress deployments, the time that the deployment started.
--
-- For completed deployments, the time that the deployment ended.
--
-- 'versionLabel', 'deployment_versionLabel' - The version label of the application version in the deployment.
newDeployment ::
  Deployment
newDeployment :: Deployment
newDeployment =
  Deployment' :: Maybe Integer
-> Maybe Text -> Maybe ISO8601 -> Maybe Text -> Deployment
Deployment'
    { $sel:deploymentId:Deployment' :: Maybe Integer
deploymentId = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:status:Deployment' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentTime:Deployment' :: Maybe ISO8601
deploymentTime = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:versionLabel:Deployment' :: Maybe Text
versionLabel = Maybe Text
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 :: (Maybe Integer -> f (Maybe Integer)) -> Deployment -> f Deployment
deployment_deploymentId = (Deployment -> Maybe Integer)
-> (Deployment -> Maybe Integer -> Deployment)
-> Lens Deployment Deployment (Maybe Integer) (Maybe Integer)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> Deployment -> f Deployment
deployment_status = (Deployment -> Maybe Text)
-> (Deployment -> Maybe Text -> Deployment)
-> Lens Deployment Deployment (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Deployment -> f Deployment
deployment_deploymentTime = (Deployment -> Maybe ISO8601)
-> (Deployment -> Maybe ISO8601 -> Deployment)
-> Lens Deployment Deployment (Maybe ISO8601) (Maybe ISO8601)
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) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> Deployment -> f Deployment)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Deployment
-> f Deployment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The version label of the application version in the deployment.
deployment_versionLabel :: Lens.Lens' Deployment (Prelude.Maybe Prelude.Text)
deployment_versionLabel :: (Maybe Text -> f (Maybe Text)) -> Deployment -> f Deployment
deployment_versionLabel = (Deployment -> Maybe Text)
-> (Deployment -> Maybe Text -> Deployment)
-> Lens Deployment Deployment (Maybe Text) (Maybe Text)
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 Core.FromXML Deployment where
  parseXML :: [Node] -> Either String Deployment
parseXML [Node]
x =
    Maybe Integer
-> Maybe Text -> Maybe ISO8601 -> Maybe Text -> Deployment
Deployment'
      (Maybe Integer
 -> Maybe Text -> Maybe ISO8601 -> Maybe Text -> Deployment)
-> Either String (Maybe Integer)
-> Either
     String (Maybe Text -> Maybe ISO8601 -> Maybe Text -> Deployment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Integer)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DeploymentId")
      Either
  String (Maybe Text -> Maybe ISO8601 -> Maybe Text -> Deployment)
-> Either String (Maybe Text)
-> Either String (Maybe ISO8601 -> Maybe Text -> Deployment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Status")
      Either String (Maybe ISO8601 -> Maybe Text -> Deployment)
-> Either String (Maybe ISO8601)
-> Either String (Maybe Text -> Deployment)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DeploymentTime")
      Either String (Maybe Text -> Deployment)
-> Either String (Maybe Text) -> Either String Deployment
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"VersionLabel")

instance Prelude.Hashable Deployment

instance Prelude.NFData Deployment