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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(ContainerServiceStateDetail
 -> ContainerServiceStateDetail -> Bool)
-> (ContainerServiceStateDetail
    -> ContainerServiceStateDetail -> Bool)
-> Eq ContainerServiceStateDetail
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]
(Int -> ReadS ContainerServiceStateDetail)
-> ReadS [ContainerServiceStateDetail]
-> ReadPrec ContainerServiceStateDetail
-> ReadPrec [ContainerServiceStateDetail]
-> Read 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
(Int -> ContainerServiceStateDetail -> ShowS)
-> (ContainerServiceStateDetail -> String)
-> ([ContainerServiceStateDetail] -> ShowS)
-> Show ContainerServiceStateDetail
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.
 ContainerServiceStateDetail -> Rep ContainerServiceStateDetail x)
-> (forall x.
    Rep ContainerServiceStateDetail x -> ContainerServiceStateDetail)
-> Generic ContainerServiceStateDetail
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' :: Maybe ContainerServiceStateDetailCode
-> Maybe Text -> ContainerServiceStateDetail
ContainerServiceStateDetail'
    { $sel:code:ContainerServiceStateDetail' :: Maybe ContainerServiceStateDetailCode
code =
        Maybe ContainerServiceStateDetailCode
forall a. Maybe a
Prelude.Nothing,
      $sel:message:ContainerServiceStateDetail' :: Maybe Text
message = Maybe Text
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 :: (Maybe ContainerServiceStateDetailCode
 -> f (Maybe ContainerServiceStateDetailCode))
-> ContainerServiceStateDetail -> f ContainerServiceStateDetail
containerServiceStateDetail_code = (ContainerServiceStateDetail
 -> Maybe ContainerServiceStateDetailCode)
-> (ContainerServiceStateDetail
    -> Maybe ContainerServiceStateDetailCode
    -> ContainerServiceStateDetail)
-> Lens
     ContainerServiceStateDetail
     ContainerServiceStateDetail
     (Maybe ContainerServiceStateDetailCode)
     (Maybe ContainerServiceStateDetailCode)
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 :: (Maybe Text -> f (Maybe Text))
-> ContainerServiceStateDetail -> f ContainerServiceStateDetail
containerServiceStateDetail_message = (ContainerServiceStateDetail -> Maybe Text)
-> (ContainerServiceStateDetail
    -> Maybe Text -> ContainerServiceStateDetail)
-> Lens
     ContainerServiceStateDetail
     ContainerServiceStateDetail
     (Maybe Text)
     (Maybe Text)
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 Core.FromJSON ContainerServiceStateDetail where
  parseJSON :: Value -> Parser ContainerServiceStateDetail
parseJSON =
    String
-> (Object -> Parser ContainerServiceStateDetail)
-> Value
-> Parser ContainerServiceStateDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ContainerServiceStateDetail"
      ( \Object
x ->
          Maybe ContainerServiceStateDetailCode
-> Maybe Text -> ContainerServiceStateDetail
ContainerServiceStateDetail'
            (Maybe ContainerServiceStateDetailCode
 -> Maybe Text -> ContainerServiceStateDetail)
-> Parser (Maybe ContainerServiceStateDetailCode)
-> Parser (Maybe Text -> ContainerServiceStateDetail)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ContainerServiceStateDetailCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"code")
            Parser (Maybe Text -> ContainerServiceStateDetail)
-> Parser (Maybe Text) -> Parser ContainerServiceStateDetail
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"message")
      )

instance Prelude.Hashable ContainerServiceStateDetail

instance Prelude.NFData ContainerServiceStateDetail