{-# 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.Support.Types.SeverityLevel
-- 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.Support.Types.SeverityLevel where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A code and name pair that represents the severity level of a support
-- case. The available values depend on the support plan for the account.
-- For more information, see
-- <https://docs.aws.amazon.com/awssupport/latest/user/case-management.html#choosing-severity Choosing a severity>
-- in the /AWS Support User Guide/.
--
-- /See:/ 'newSeverityLevel' smart constructor.
data SeverityLevel = SeverityLevel'
  { -- | The name of the severity level that corresponds to the severity level
    -- code.
    --
    -- The values returned by the API are different from the values that appear
    -- in the AWS Support Center. For example, the API uses the code @low@, but
    -- the name appears as General guidance in Support Center.
    --
    -- The following are the API code names and how they appear in the console:
    --
    -- -   @low@ - General guidance
    --
    -- -   @normal@ - System impaired
    --
    -- -   @high@ - Production system impaired
    --
    -- -   @urgent@ - Production system down
    --
    -- -   @critical@ - Business-critical system down
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/awssupport/latest/user/case-management.html#choosing-severity Choosing a severity>
    -- in the /AWS Support User Guide/.
    SeverityLevel -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The code for case severity level.
    --
    -- Valid values: @low@ | @normal@ | @high@ | @urgent@ | @critical@
    SeverityLevel -> Maybe Text
code :: Prelude.Maybe Prelude.Text
  }
  deriving (SeverityLevel -> SeverityLevel -> Bool
(SeverityLevel -> SeverityLevel -> Bool)
-> (SeverityLevel -> SeverityLevel -> Bool) -> Eq SeverityLevel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SeverityLevel -> SeverityLevel -> Bool
$c/= :: SeverityLevel -> SeverityLevel -> Bool
== :: SeverityLevel -> SeverityLevel -> Bool
$c== :: SeverityLevel -> SeverityLevel -> Bool
Prelude.Eq, ReadPrec [SeverityLevel]
ReadPrec SeverityLevel
Int -> ReadS SeverityLevel
ReadS [SeverityLevel]
(Int -> ReadS SeverityLevel)
-> ReadS [SeverityLevel]
-> ReadPrec SeverityLevel
-> ReadPrec [SeverityLevel]
-> Read SeverityLevel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SeverityLevel]
$creadListPrec :: ReadPrec [SeverityLevel]
readPrec :: ReadPrec SeverityLevel
$creadPrec :: ReadPrec SeverityLevel
readList :: ReadS [SeverityLevel]
$creadList :: ReadS [SeverityLevel]
readsPrec :: Int -> ReadS SeverityLevel
$creadsPrec :: Int -> ReadS SeverityLevel
Prelude.Read, Int -> SeverityLevel -> ShowS
[SeverityLevel] -> ShowS
SeverityLevel -> String
(Int -> SeverityLevel -> ShowS)
-> (SeverityLevel -> String)
-> ([SeverityLevel] -> ShowS)
-> Show SeverityLevel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SeverityLevel] -> ShowS
$cshowList :: [SeverityLevel] -> ShowS
show :: SeverityLevel -> String
$cshow :: SeverityLevel -> String
showsPrec :: Int -> SeverityLevel -> ShowS
$cshowsPrec :: Int -> SeverityLevel -> ShowS
Prelude.Show, (forall x. SeverityLevel -> Rep SeverityLevel x)
-> (forall x. Rep SeverityLevel x -> SeverityLevel)
-> Generic SeverityLevel
forall x. Rep SeverityLevel x -> SeverityLevel
forall x. SeverityLevel -> Rep SeverityLevel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SeverityLevel x -> SeverityLevel
$cfrom :: forall x. SeverityLevel -> Rep SeverityLevel x
Prelude.Generic)

-- |
-- Create a value of 'SeverityLevel' 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:
--
-- 'name', 'severityLevel_name' - The name of the severity level that corresponds to the severity level
-- code.
--
-- The values returned by the API are different from the values that appear
-- in the AWS Support Center. For example, the API uses the code @low@, but
-- the name appears as General guidance in Support Center.
--
-- The following are the API code names and how they appear in the console:
--
-- -   @low@ - General guidance
--
-- -   @normal@ - System impaired
--
-- -   @high@ - Production system impaired
--
-- -   @urgent@ - Production system down
--
-- -   @critical@ - Business-critical system down
--
-- For more information, see
-- <https://docs.aws.amazon.com/awssupport/latest/user/case-management.html#choosing-severity Choosing a severity>
-- in the /AWS Support User Guide/.
--
-- 'code', 'severityLevel_code' - The code for case severity level.
--
-- Valid values: @low@ | @normal@ | @high@ | @urgent@ | @critical@
newSeverityLevel ::
  SeverityLevel
newSeverityLevel :: SeverityLevel
newSeverityLevel =
  SeverityLevel' :: Maybe Text -> Maybe Text -> SeverityLevel
SeverityLevel'
    { $sel:name:SeverityLevel' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:code:SeverityLevel' :: Maybe Text
code = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the severity level that corresponds to the severity level
-- code.
--
-- The values returned by the API are different from the values that appear
-- in the AWS Support Center. For example, the API uses the code @low@, but
-- the name appears as General guidance in Support Center.
--
-- The following are the API code names and how they appear in the console:
--
-- -   @low@ - General guidance
--
-- -   @normal@ - System impaired
--
-- -   @high@ - Production system impaired
--
-- -   @urgent@ - Production system down
--
-- -   @critical@ - Business-critical system down
--
-- For more information, see
-- <https://docs.aws.amazon.com/awssupport/latest/user/case-management.html#choosing-severity Choosing a severity>
-- in the /AWS Support User Guide/.
severityLevel_name :: Lens.Lens' SeverityLevel (Prelude.Maybe Prelude.Text)
severityLevel_name :: (Maybe Text -> f (Maybe Text)) -> SeverityLevel -> f SeverityLevel
severityLevel_name = (SeverityLevel -> Maybe Text)
-> (SeverityLevel -> Maybe Text -> SeverityLevel)
-> Lens SeverityLevel SeverityLevel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SeverityLevel' {Maybe Text
name :: Maybe Text
$sel:name:SeverityLevel' :: SeverityLevel -> Maybe Text
name} -> Maybe Text
name) (\s :: SeverityLevel
s@SeverityLevel' {} Maybe Text
a -> SeverityLevel
s {$sel:name:SeverityLevel' :: Maybe Text
name = Maybe Text
a} :: SeverityLevel)

-- | The code for case severity level.
--
-- Valid values: @low@ | @normal@ | @high@ | @urgent@ | @critical@
severityLevel_code :: Lens.Lens' SeverityLevel (Prelude.Maybe Prelude.Text)
severityLevel_code :: (Maybe Text -> f (Maybe Text)) -> SeverityLevel -> f SeverityLevel
severityLevel_code = (SeverityLevel -> Maybe Text)
-> (SeverityLevel -> Maybe Text -> SeverityLevel)
-> Lens SeverityLevel SeverityLevel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SeverityLevel' {Maybe Text
code :: Maybe Text
$sel:code:SeverityLevel' :: SeverityLevel -> Maybe Text
code} -> Maybe Text
code) (\s :: SeverityLevel
s@SeverityLevel' {} Maybe Text
a -> SeverityLevel
s {$sel:code:SeverityLevel' :: Maybe Text
code = Maybe Text
a} :: SeverityLevel)

instance Core.FromJSON SeverityLevel where
  parseJSON :: Value -> Parser SeverityLevel
parseJSON =
    String
-> (Object -> Parser SeverityLevel)
-> Value
-> Parser SeverityLevel
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SeverityLevel"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> SeverityLevel
SeverityLevel'
            (Maybe Text -> Maybe Text -> SeverityLevel)
-> Parser (Maybe Text) -> Parser (Maybe Text -> SeverityLevel)
forall (f :: * -> *) a b. Functor 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
"name") Parser (Maybe Text -> SeverityLevel)
-> Parser (Maybe Text) -> Parser SeverityLevel
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
"code")
      )

instance Prelude.Hashable SeverityLevel

instance Prelude.NFData SeverityLevel