{-# 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.Lightsail.Types.ContainerServiceStateDetail
-- 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.Lightsail.Types.ContainerServiceStateDetail where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types.ContainerServiceStateDetailCode
import qualified Amazonka.Prelude as Prelude

-- | Describes the current state of a container service.
--
-- /See:/ 'newContainerServiceStateDetail' smart constructor.
data ContainerServiceStateDetail = ContainerServiceStateDetail'
  { -- | The state code of the container service.
    --
    -- The following state codes are possible:
    --
    -- -   The following state codes are possible if your container service is
    --     in a @DEPLOYING@ or @UPDATING@ state:
    --
    --     -   @CREATING_SYSTEM_RESOURCES@ - The system resources for your
    --         container service are being created.
    --
    --     -   @CREATING_NETWORK_INFRASTRUCTURE@ - The network infrastructure
    --         for your container service are being created.
    --
    --     -   @PROVISIONING_CERTIFICATE@ - The SSL\/TLS certificate for your
    --         container service is being created.
    --
    --     -   @PROVISIONING_SERVICE@ - Your container service is being
    --         provisioned.
    --
    --     -   @CREATING_DEPLOYMENT@ - Your deployment is being created on your
    --         container service.
    --
    --     -   @EVALUATING_HEALTH_CHECK@ - The health of your deployment is
    --         being evaluated.
    --
    --     -   @ACTIVATING_DEPLOYMENT@ - Your deployment is being activated.
    --
    -- -   The following state codes are possible if your container service is
    --     in a @PENDING@ state:
    --
    --     -   @CERTIFICATE_LIMIT_EXCEEDED@ - The SSL\/TLS certificate required
    --         for your container service exceeds the maximum number of
    --         certificates allowed for your account.
    --
    --     -   @UNKNOWN_ERROR@ - An error was experienced when your container
    --         service was being created.
    ContainerServiceStateDetail
-> Maybe ContainerServiceStateDetailCode
code :: Prelude.Maybe ContainerServiceStateDetailCode,
    -- | A message that provides more information for the state code.
    --
    -- The state detail is populated only when a container service is in a
    -- @PENDING@, @DEPLOYING@, or @UPDATING@ state.
    ContainerServiceStateDetail -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (ContainerServiceStateDetail -> ContainerServiceStateDetail -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContainerServiceStateDetail -> ContainerServiceStateDetail -> Bool
$c/= :: ContainerServiceStateDetail -> ContainerServiceStateDetail -> Bool
== :: ContainerServiceStateDetail -> ContainerServiceStateDetail -> Bool
$c== :: ContainerServiceStateDetail -> ContainerServiceStateDetail -> Bool
Prelude.Eq, ReadPrec [ContainerServiceStateDetail]
ReadPrec ContainerServiceStateDetail
Int -> ReadS ContainerServiceStateDetail
ReadS [ContainerServiceStateDetail]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContainerServiceStateDetail]
$creadListPrec :: ReadPrec [ContainerServiceStateDetail]
readPrec :: ReadPrec ContainerServiceStateDetail
$creadPrec :: ReadPrec ContainerServiceStateDetail
readList :: ReadS [ContainerServiceStateDetail]
$creadList :: ReadS [ContainerServiceStateDetail]
readsPrec :: Int -> ReadS ContainerServiceStateDetail
$creadsPrec :: Int -> ReadS ContainerServiceStateDetail
Prelude.Read, Int -> ContainerServiceStateDetail -> ShowS
[ContainerServiceStateDetail] -> ShowS
ContainerServiceStateDetail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContainerServiceStateDetail] -> ShowS
$cshowList :: [ContainerServiceStateDetail] -> ShowS
show :: ContainerServiceStateDetail -> String
$cshow :: ContainerServiceStateDetail -> String
showsPrec :: Int -> ContainerServiceStateDetail -> ShowS
$cshowsPrec :: Int -> ContainerServiceStateDetail -> ShowS
Prelude.Show, forall x.
Rep ContainerServiceStateDetail x -> ContainerServiceStateDetail
forall x.
ContainerServiceStateDetail -> Rep ContainerServiceStateDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ContainerServiceStateDetail x -> ContainerServiceStateDetail
$cfrom :: forall x.
ContainerServiceStateDetail -> Rep ContainerServiceStateDetail x
Prelude.Generic)

-- |
-- Create a value of 'ContainerServiceStateDetail' 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:
--
-- 'code', 'containerServiceStateDetail_code' - The state code of the container service.
--
-- The following state codes are possible:
--
-- -   The following state codes are possible if your container service is
--     in a @DEPLOYING@ or @UPDATING@ state:
--
--     -   @CREATING_SYSTEM_RESOURCES@ - The system resources for your
--         container service are being created.
--
--     -   @CREATING_NETWORK_INFRASTRUCTURE@ - The network infrastructure
--         for your container service are being created.
--
--     -   @PROVISIONING_CERTIFICATE@ - The SSL\/TLS certificate for your
--         container service is being created.
--
--     -   @PROVISIONING_SERVICE@ - Your container service is being
--         provisioned.
--
--     -   @CREATING_DEPLOYMENT@ - Your deployment is being created on your
--         container service.
--
--     -   @EVALUATING_HEALTH_CHECK@ - The health of your deployment is
--         being evaluated.
--
--     -   @ACTIVATING_DEPLOYMENT@ - Your deployment is being activated.
--
-- -   The following state codes are possible if your container service is
--     in a @PENDING@ state:
--
--     -   @CERTIFICATE_LIMIT_EXCEEDED@ - The SSL\/TLS certificate required
--         for your container service exceeds the maximum number of
--         certificates allowed for your account.
--
--     -   @UNKNOWN_ERROR@ - An error was experienced when your container
--         service was being created.
--
-- 'message', 'containerServiceStateDetail_message' - A message that provides more information for the state code.
--
-- The state detail is populated only when a container service is in a
-- @PENDING@, @DEPLOYING@, or @UPDATING@ state.
newContainerServiceStateDetail ::
  ContainerServiceStateDetail
newContainerServiceStateDetail :: ContainerServiceStateDetail
newContainerServiceStateDetail =
  ContainerServiceStateDetail'
    { $sel:code:ContainerServiceStateDetail' :: Maybe ContainerServiceStateDetailCode
code =
        forall a. Maybe a
Prelude.Nothing,
      $sel:message:ContainerServiceStateDetail' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing
    }

-- | The state code of the container service.
--
-- The following state codes are possible:
--
-- -   The following state codes are possible if your container service is
--     in a @DEPLOYING@ or @UPDATING@ state:
--
--     -   @CREATING_SYSTEM_RESOURCES@ - The system resources for your
--         container service are being created.
--
--     -   @CREATING_NETWORK_INFRASTRUCTURE@ - The network infrastructure
--         for your container service are being created.
--
--     -   @PROVISIONING_CERTIFICATE@ - The SSL\/TLS certificate for your
--         container service is being created.
--
--     -   @PROVISIONING_SERVICE@ - Your container service is being
--         provisioned.
--
--     -   @CREATING_DEPLOYMENT@ - Your deployment is being created on your
--         container service.
--
--     -   @EVALUATING_HEALTH_CHECK@ - The health of your deployment is
--         being evaluated.
--
--     -   @ACTIVATING_DEPLOYMENT@ - Your deployment is being activated.
--
-- -   The following state codes are possible if your container service is
--     in a @PENDING@ state:
--
--     -   @CERTIFICATE_LIMIT_EXCEEDED@ - The SSL\/TLS certificate required
--         for your container service exceeds the maximum number of
--         certificates allowed for your account.
--
--     -   @UNKNOWN_ERROR@ - An error was experienced when your container
--         service was being created.
containerServiceStateDetail_code :: Lens.Lens' ContainerServiceStateDetail (Prelude.Maybe ContainerServiceStateDetailCode)
containerServiceStateDetail_code :: Lens'
  ContainerServiceStateDetail (Maybe ContainerServiceStateDetailCode)
containerServiceStateDetail_code = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerServiceStateDetail' {Maybe ContainerServiceStateDetailCode
code :: Maybe ContainerServiceStateDetailCode
$sel:code:ContainerServiceStateDetail' :: ContainerServiceStateDetail
-> Maybe ContainerServiceStateDetailCode
code} -> Maybe ContainerServiceStateDetailCode
code) (\s :: ContainerServiceStateDetail
s@ContainerServiceStateDetail' {} Maybe ContainerServiceStateDetailCode
a -> ContainerServiceStateDetail
s {$sel:code:ContainerServiceStateDetail' :: Maybe ContainerServiceStateDetailCode
code = Maybe ContainerServiceStateDetailCode
a} :: ContainerServiceStateDetail)

-- | A message that provides more information for the state code.
--
-- The state detail is populated only when a container service is in a
-- @PENDING@, @DEPLOYING@, or @UPDATING@ state.
containerServiceStateDetail_message :: Lens.Lens' ContainerServiceStateDetail (Prelude.Maybe Prelude.Text)
containerServiceStateDetail_message :: Lens' ContainerServiceStateDetail (Maybe Text)
containerServiceStateDetail_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerServiceStateDetail' {Maybe Text
message :: Maybe Text
$sel:message:ContainerServiceStateDetail' :: ContainerServiceStateDetail -> Maybe Text
message} -> Maybe Text
message) (\s :: ContainerServiceStateDetail
s@ContainerServiceStateDetail' {} Maybe Text
a -> ContainerServiceStateDetail
s {$sel:message:ContainerServiceStateDetail' :: Maybe Text
message = Maybe Text
a} :: ContainerServiceStateDetail)

instance Data.FromJSON ContainerServiceStateDetail where
  parseJSON :: Value -> Parser ContainerServiceStateDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ContainerServiceStateDetail"
      ( \Object
x ->
          Maybe ContainerServiceStateDetailCode
-> Maybe Text -> ContainerServiceStateDetail
ContainerServiceStateDetail'
            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
"code")
            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
"message")
      )

instance Prelude.Hashable ContainerServiceStateDetail where
  hashWithSalt :: Int -> ContainerServiceStateDetail -> Int
hashWithSalt Int
_salt ContainerServiceStateDetail' {Maybe Text
Maybe ContainerServiceStateDetailCode
message :: Maybe Text
code :: Maybe ContainerServiceStateDetailCode
$sel:message:ContainerServiceStateDetail' :: ContainerServiceStateDetail -> Maybe Text
$sel:code:ContainerServiceStateDetail' :: ContainerServiceStateDetail
-> Maybe ContainerServiceStateDetailCode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ContainerServiceStateDetailCode
code
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message

instance Prelude.NFData ContainerServiceStateDetail where
  rnf :: ContainerServiceStateDetail -> ()
rnf ContainerServiceStateDetail' {Maybe Text
Maybe ContainerServiceStateDetailCode
message :: Maybe Text
code :: Maybe ContainerServiceStateDetailCode
$sel:message:ContainerServiceStateDetail' :: ContainerServiceStateDetail -> Maybe Text
$sel:code:ContainerServiceStateDetail' :: ContainerServiceStateDetail
-> Maybe ContainerServiceStateDetailCode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ContainerServiceStateDetailCode
code seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message