{-# 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.Cloud9.Types.EnvironmentLifecycle
-- 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.Cloud9.Types.EnvironmentLifecycle where

import Amazonka.Cloud9.Types.EnvironmentLifecycleStatus
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 current creation or deletion lifecycle state of an
-- Cloud9 development environment.
--
-- /See:/ 'newEnvironmentLifecycle' smart constructor.
data EnvironmentLifecycle = EnvironmentLifecycle'
  { -- | If the environment failed to delete, the Amazon Resource Name (ARN) of
    -- the related Amazon Web Services resource.
    EnvironmentLifecycle -> Maybe Text
failureResource :: Prelude.Maybe Prelude.Text,
    -- | Any informational message about the lifecycle state of the environment.
    EnvironmentLifecycle -> Maybe Text
reason :: Prelude.Maybe Prelude.Text,
    -- | The current creation or deletion lifecycle state of the environment.
    --
    -- -   @CREATING@: The environment is in the process of being created.
    --
    -- -   @CREATED@: The environment was successfully created.
    --
    -- -   @CREATE_FAILED@: The environment failed to be created.
    --
    -- -   @DELETING@: The environment is in the process of being deleted.
    --
    -- -   @DELETE_FAILED@: The environment failed to delete.
    EnvironmentLifecycle -> Maybe EnvironmentLifecycleStatus
status :: Prelude.Maybe EnvironmentLifecycleStatus
  }
  deriving (EnvironmentLifecycle -> EnvironmentLifecycle -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnvironmentLifecycle -> EnvironmentLifecycle -> Bool
$c/= :: EnvironmentLifecycle -> EnvironmentLifecycle -> Bool
== :: EnvironmentLifecycle -> EnvironmentLifecycle -> Bool
$c== :: EnvironmentLifecycle -> EnvironmentLifecycle -> Bool
Prelude.Eq, ReadPrec [EnvironmentLifecycle]
ReadPrec EnvironmentLifecycle
Int -> ReadS EnvironmentLifecycle
ReadS [EnvironmentLifecycle]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnvironmentLifecycle]
$creadListPrec :: ReadPrec [EnvironmentLifecycle]
readPrec :: ReadPrec EnvironmentLifecycle
$creadPrec :: ReadPrec EnvironmentLifecycle
readList :: ReadS [EnvironmentLifecycle]
$creadList :: ReadS [EnvironmentLifecycle]
readsPrec :: Int -> ReadS EnvironmentLifecycle
$creadsPrec :: Int -> ReadS EnvironmentLifecycle
Prelude.Read, Int -> EnvironmentLifecycle -> ShowS
[EnvironmentLifecycle] -> ShowS
EnvironmentLifecycle -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnvironmentLifecycle] -> ShowS
$cshowList :: [EnvironmentLifecycle] -> ShowS
show :: EnvironmentLifecycle -> String
$cshow :: EnvironmentLifecycle -> String
showsPrec :: Int -> EnvironmentLifecycle -> ShowS
$cshowsPrec :: Int -> EnvironmentLifecycle -> ShowS
Prelude.Show, forall x. Rep EnvironmentLifecycle x -> EnvironmentLifecycle
forall x. EnvironmentLifecycle -> Rep EnvironmentLifecycle x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnvironmentLifecycle x -> EnvironmentLifecycle
$cfrom :: forall x. EnvironmentLifecycle -> Rep EnvironmentLifecycle x
Prelude.Generic)

-- |
-- Create a value of 'EnvironmentLifecycle' 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:
--
-- 'failureResource', 'environmentLifecycle_failureResource' - If the environment failed to delete, the Amazon Resource Name (ARN) of
-- the related Amazon Web Services resource.
--
-- 'reason', 'environmentLifecycle_reason' - Any informational message about the lifecycle state of the environment.
--
-- 'status', 'environmentLifecycle_status' - The current creation or deletion lifecycle state of the environment.
--
-- -   @CREATING@: The environment is in the process of being created.
--
-- -   @CREATED@: The environment was successfully created.
--
-- -   @CREATE_FAILED@: The environment failed to be created.
--
-- -   @DELETING@: The environment is in the process of being deleted.
--
-- -   @DELETE_FAILED@: The environment failed to delete.
newEnvironmentLifecycle ::
  EnvironmentLifecycle
newEnvironmentLifecycle :: EnvironmentLifecycle
newEnvironmentLifecycle =
  EnvironmentLifecycle'
    { $sel:failureResource:EnvironmentLifecycle' :: Maybe Text
failureResource =
        forall a. Maybe a
Prelude.Nothing,
      $sel:reason:EnvironmentLifecycle' :: Maybe Text
reason = forall a. Maybe a
Prelude.Nothing,
      $sel:status:EnvironmentLifecycle' :: Maybe EnvironmentLifecycleStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | If the environment failed to delete, the Amazon Resource Name (ARN) of
-- the related Amazon Web Services resource.
environmentLifecycle_failureResource :: Lens.Lens' EnvironmentLifecycle (Prelude.Maybe Prelude.Text)
environmentLifecycle_failureResource :: Lens' EnvironmentLifecycle (Maybe Text)
environmentLifecycle_failureResource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentLifecycle' {Maybe Text
failureResource :: Maybe Text
$sel:failureResource:EnvironmentLifecycle' :: EnvironmentLifecycle -> Maybe Text
failureResource} -> Maybe Text
failureResource) (\s :: EnvironmentLifecycle
s@EnvironmentLifecycle' {} Maybe Text
a -> EnvironmentLifecycle
s {$sel:failureResource:EnvironmentLifecycle' :: Maybe Text
failureResource = Maybe Text
a} :: EnvironmentLifecycle)

-- | Any informational message about the lifecycle state of the environment.
environmentLifecycle_reason :: Lens.Lens' EnvironmentLifecycle (Prelude.Maybe Prelude.Text)
environmentLifecycle_reason :: Lens' EnvironmentLifecycle (Maybe Text)
environmentLifecycle_reason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentLifecycle' {Maybe Text
reason :: Maybe Text
$sel:reason:EnvironmentLifecycle' :: EnvironmentLifecycle -> Maybe Text
reason} -> Maybe Text
reason) (\s :: EnvironmentLifecycle
s@EnvironmentLifecycle' {} Maybe Text
a -> EnvironmentLifecycle
s {$sel:reason:EnvironmentLifecycle' :: Maybe Text
reason = Maybe Text
a} :: EnvironmentLifecycle)

-- | The current creation or deletion lifecycle state of the environment.
--
-- -   @CREATING@: The environment is in the process of being created.
--
-- -   @CREATED@: The environment was successfully created.
--
-- -   @CREATE_FAILED@: The environment failed to be created.
--
-- -   @DELETING@: The environment is in the process of being deleted.
--
-- -   @DELETE_FAILED@: The environment failed to delete.
environmentLifecycle_status :: Lens.Lens' EnvironmentLifecycle (Prelude.Maybe EnvironmentLifecycleStatus)
environmentLifecycle_status :: Lens' EnvironmentLifecycle (Maybe EnvironmentLifecycleStatus)
environmentLifecycle_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentLifecycle' {Maybe EnvironmentLifecycleStatus
status :: Maybe EnvironmentLifecycleStatus
$sel:status:EnvironmentLifecycle' :: EnvironmentLifecycle -> Maybe EnvironmentLifecycleStatus
status} -> Maybe EnvironmentLifecycleStatus
status) (\s :: EnvironmentLifecycle
s@EnvironmentLifecycle' {} Maybe EnvironmentLifecycleStatus
a -> EnvironmentLifecycle
s {$sel:status:EnvironmentLifecycle' :: Maybe EnvironmentLifecycleStatus
status = Maybe EnvironmentLifecycleStatus
a} :: EnvironmentLifecycle)

instance Data.FromJSON EnvironmentLifecycle where
  parseJSON :: Value -> Parser EnvironmentLifecycle
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EnvironmentLifecycle"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe EnvironmentLifecycleStatus
-> EnvironmentLifecycle
EnvironmentLifecycle'
            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
"failureResource")
            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
"reason")
            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
"status")
      )

instance Prelude.Hashable EnvironmentLifecycle where
  hashWithSalt :: Int -> EnvironmentLifecycle -> Int
hashWithSalt Int
_salt EnvironmentLifecycle' {Maybe Text
Maybe EnvironmentLifecycleStatus
status :: Maybe EnvironmentLifecycleStatus
reason :: Maybe Text
failureResource :: Maybe Text
$sel:status:EnvironmentLifecycle' :: EnvironmentLifecycle -> Maybe EnvironmentLifecycleStatus
$sel:reason:EnvironmentLifecycle' :: EnvironmentLifecycle -> Maybe Text
$sel:failureResource:EnvironmentLifecycle' :: EnvironmentLifecycle -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
failureResource
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
reason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EnvironmentLifecycleStatus
status

instance Prelude.NFData EnvironmentLifecycle where
  rnf :: EnvironmentLifecycle -> ()
rnf EnvironmentLifecycle' {Maybe Text
Maybe EnvironmentLifecycleStatus
status :: Maybe EnvironmentLifecycleStatus
reason :: Maybe Text
failureResource :: Maybe Text
$sel:status:EnvironmentLifecycle' :: EnvironmentLifecycle -> Maybe EnvironmentLifecycleStatus
$sel:reason:EnvironmentLifecycle' :: EnvironmentLifecycle -> Maybe Text
$sel:failureResource:EnvironmentLifecycle' :: EnvironmentLifecycle -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
failureResource
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
reason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EnvironmentLifecycleStatus
status