{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.DescribeSeverityLevels
-- 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)
--
-- Returns the list of severity levels that you can assign to a support
-- case. The severity level for a case is also a field in the CaseDetails
-- data type that you include for a CreateCase request.
--
-- -   You must have a Business or Enterprise Support plan to use the AWS
--     Support API.
--
-- -   If you call the AWS Support API from an account that does not have a
--     Business or Enterprise Support plan, the
--     @SubscriptionRequiredException@ error message appears. For
--     information about changing your support plan, see
--     <http://aws.amazon.com/premiumsupport/ AWS Support>.
module Amazonka.Support.DescribeSeverityLevels
  ( -- * Creating a Request
    DescribeSeverityLevels (..),
    newDescribeSeverityLevels,

    -- * Request Lenses
    describeSeverityLevels_language,

    -- * Destructuring the Response
    DescribeSeverityLevelsResponse (..),
    newDescribeSeverityLevelsResponse,

    -- * Response Lenses
    describeSeverityLevelsResponse_severityLevels,
    describeSeverityLevelsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Support.Types

-- | /See:/ 'newDescribeSeverityLevels' smart constructor.
data DescribeSeverityLevels = DescribeSeverityLevels'
  { -- | The ISO 639-1 code for the language in which AWS provides support. AWS
    -- Support currently supports English (\"en\") and Japanese (\"ja\").
    -- Language parameters must be passed explicitly for operations that take
    -- them.
    DescribeSeverityLevels -> Maybe Text
language :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeSeverityLevels -> DescribeSeverityLevels -> Bool
(DescribeSeverityLevels -> DescribeSeverityLevels -> Bool)
-> (DescribeSeverityLevels -> DescribeSeverityLevels -> Bool)
-> Eq DescribeSeverityLevels
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeSeverityLevels -> DescribeSeverityLevels -> Bool
$c/= :: DescribeSeverityLevels -> DescribeSeverityLevels -> Bool
== :: DescribeSeverityLevels -> DescribeSeverityLevels -> Bool
$c== :: DescribeSeverityLevels -> DescribeSeverityLevels -> Bool
Prelude.Eq, ReadPrec [DescribeSeverityLevels]
ReadPrec DescribeSeverityLevels
Int -> ReadS DescribeSeverityLevels
ReadS [DescribeSeverityLevels]
(Int -> ReadS DescribeSeverityLevels)
-> ReadS [DescribeSeverityLevels]
-> ReadPrec DescribeSeverityLevels
-> ReadPrec [DescribeSeverityLevels]
-> Read DescribeSeverityLevels
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeSeverityLevels]
$creadListPrec :: ReadPrec [DescribeSeverityLevels]
readPrec :: ReadPrec DescribeSeverityLevels
$creadPrec :: ReadPrec DescribeSeverityLevels
readList :: ReadS [DescribeSeverityLevels]
$creadList :: ReadS [DescribeSeverityLevels]
readsPrec :: Int -> ReadS DescribeSeverityLevels
$creadsPrec :: Int -> ReadS DescribeSeverityLevels
Prelude.Read, Int -> DescribeSeverityLevels -> ShowS
[DescribeSeverityLevels] -> ShowS
DescribeSeverityLevels -> String
(Int -> DescribeSeverityLevels -> ShowS)
-> (DescribeSeverityLevels -> String)
-> ([DescribeSeverityLevels] -> ShowS)
-> Show DescribeSeverityLevels
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeSeverityLevels] -> ShowS
$cshowList :: [DescribeSeverityLevels] -> ShowS
show :: DescribeSeverityLevels -> String
$cshow :: DescribeSeverityLevels -> String
showsPrec :: Int -> DescribeSeverityLevels -> ShowS
$cshowsPrec :: Int -> DescribeSeverityLevels -> ShowS
Prelude.Show, (forall x. DescribeSeverityLevels -> Rep DescribeSeverityLevels x)
-> (forall x.
    Rep DescribeSeverityLevels x -> DescribeSeverityLevels)
-> Generic DescribeSeverityLevels
forall x. Rep DescribeSeverityLevels x -> DescribeSeverityLevels
forall x. DescribeSeverityLevels -> Rep DescribeSeverityLevels x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeSeverityLevels x -> DescribeSeverityLevels
$cfrom :: forall x. DescribeSeverityLevels -> Rep DescribeSeverityLevels x
Prelude.Generic)

-- |
-- Create a value of 'DescribeSeverityLevels' 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:
--
-- 'language', 'describeSeverityLevels_language' - The ISO 639-1 code for the language in which AWS provides support. AWS
-- Support currently supports English (\"en\") and Japanese (\"ja\").
-- Language parameters must be passed explicitly for operations that take
-- them.
newDescribeSeverityLevels ::
  DescribeSeverityLevels
newDescribeSeverityLevels :: DescribeSeverityLevels
newDescribeSeverityLevels =
  DescribeSeverityLevels' :: Maybe Text -> DescribeSeverityLevels
DescribeSeverityLevels' {$sel:language:DescribeSeverityLevels' :: Maybe Text
language = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The ISO 639-1 code for the language in which AWS provides support. AWS
-- Support currently supports English (\"en\") and Japanese (\"ja\").
-- Language parameters must be passed explicitly for operations that take
-- them.
describeSeverityLevels_language :: Lens.Lens' DescribeSeverityLevels (Prelude.Maybe Prelude.Text)
describeSeverityLevels_language :: (Maybe Text -> f (Maybe Text))
-> DescribeSeverityLevels -> f DescribeSeverityLevels
describeSeverityLevels_language = (DescribeSeverityLevels -> Maybe Text)
-> (DescribeSeverityLevels -> Maybe Text -> DescribeSeverityLevels)
-> Lens
     DescribeSeverityLevels
     DescribeSeverityLevels
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSeverityLevels' {Maybe Text
language :: Maybe Text
$sel:language:DescribeSeverityLevels' :: DescribeSeverityLevels -> Maybe Text
language} -> Maybe Text
language) (\s :: DescribeSeverityLevels
s@DescribeSeverityLevels' {} Maybe Text
a -> DescribeSeverityLevels
s {$sel:language:DescribeSeverityLevels' :: Maybe Text
language = Maybe Text
a} :: DescribeSeverityLevels)

instance Core.AWSRequest DescribeSeverityLevels where
  type
    AWSResponse DescribeSeverityLevels =
      DescribeSeverityLevelsResponse
  request :: DescribeSeverityLevels -> Request DescribeSeverityLevels
request = Service -> DescribeSeverityLevels -> Request DescribeSeverityLevels
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeSeverityLevels
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeSeverityLevels)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeSeverityLevels))
-> Logger
-> Service
-> Proxy DescribeSeverityLevels
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeSeverityLevels)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [SeverityLevel] -> Int -> DescribeSeverityLevelsResponse
DescribeSeverityLevelsResponse'
            (Maybe [SeverityLevel] -> Int -> DescribeSeverityLevelsResponse)
-> Either String (Maybe [SeverityLevel])
-> Either String (Int -> DescribeSeverityLevelsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [SeverityLevel]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"severityLevels" Either String (Maybe (Maybe [SeverityLevel]))
-> Maybe [SeverityLevel] -> Either String (Maybe [SeverityLevel])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [SeverityLevel]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> DescribeSeverityLevelsResponse)
-> Either String Int
-> Either String DescribeSeverityLevelsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeSeverityLevels

instance Prelude.NFData DescribeSeverityLevels

instance Core.ToHeaders DescribeSeverityLevels where
  toHeaders :: DescribeSeverityLevels -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeSeverityLevels -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSSupport_20130415.DescribeSeverityLevels" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DescribeSeverityLevels where
  toJSON :: DescribeSeverityLevels -> Value
toJSON DescribeSeverityLevels' {Maybe Text
language :: Maybe Text
$sel:language:DescribeSeverityLevels' :: DescribeSeverityLevels -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"language" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
language]
      )

instance Core.ToPath DescribeSeverityLevels where
  toPath :: DescribeSeverityLevels -> ByteString
toPath = ByteString -> DescribeSeverityLevels -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DescribeSeverityLevels where
  toQuery :: DescribeSeverityLevels -> QueryString
toQuery = QueryString -> DescribeSeverityLevels -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | The list of severity levels returned by the DescribeSeverityLevels
-- operation.
--
-- /See:/ 'newDescribeSeverityLevelsResponse' smart constructor.
data DescribeSeverityLevelsResponse = DescribeSeverityLevelsResponse'
  { -- | The available severity levels for the support case. Available severity
    -- levels are defined by your service level agreement with AWS.
    DescribeSeverityLevelsResponse -> Maybe [SeverityLevel]
severityLevels :: Prelude.Maybe [SeverityLevel],
    -- | The response's http status code.
    DescribeSeverityLevelsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeSeverityLevelsResponse
-> DescribeSeverityLevelsResponse -> Bool
(DescribeSeverityLevelsResponse
 -> DescribeSeverityLevelsResponse -> Bool)
-> (DescribeSeverityLevelsResponse
    -> DescribeSeverityLevelsResponse -> Bool)
-> Eq DescribeSeverityLevelsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeSeverityLevelsResponse
-> DescribeSeverityLevelsResponse -> Bool
$c/= :: DescribeSeverityLevelsResponse
-> DescribeSeverityLevelsResponse -> Bool
== :: DescribeSeverityLevelsResponse
-> DescribeSeverityLevelsResponse -> Bool
$c== :: DescribeSeverityLevelsResponse
-> DescribeSeverityLevelsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeSeverityLevelsResponse]
ReadPrec DescribeSeverityLevelsResponse
Int -> ReadS DescribeSeverityLevelsResponse
ReadS [DescribeSeverityLevelsResponse]
(Int -> ReadS DescribeSeverityLevelsResponse)
-> ReadS [DescribeSeverityLevelsResponse]
-> ReadPrec DescribeSeverityLevelsResponse
-> ReadPrec [DescribeSeverityLevelsResponse]
-> Read DescribeSeverityLevelsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeSeverityLevelsResponse]
$creadListPrec :: ReadPrec [DescribeSeverityLevelsResponse]
readPrec :: ReadPrec DescribeSeverityLevelsResponse
$creadPrec :: ReadPrec DescribeSeverityLevelsResponse
readList :: ReadS [DescribeSeverityLevelsResponse]
$creadList :: ReadS [DescribeSeverityLevelsResponse]
readsPrec :: Int -> ReadS DescribeSeverityLevelsResponse
$creadsPrec :: Int -> ReadS DescribeSeverityLevelsResponse
Prelude.Read, Int -> DescribeSeverityLevelsResponse -> ShowS
[DescribeSeverityLevelsResponse] -> ShowS
DescribeSeverityLevelsResponse -> String
(Int -> DescribeSeverityLevelsResponse -> ShowS)
-> (DescribeSeverityLevelsResponse -> String)
-> ([DescribeSeverityLevelsResponse] -> ShowS)
-> Show DescribeSeverityLevelsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeSeverityLevelsResponse] -> ShowS
$cshowList :: [DescribeSeverityLevelsResponse] -> ShowS
show :: DescribeSeverityLevelsResponse -> String
$cshow :: DescribeSeverityLevelsResponse -> String
showsPrec :: Int -> DescribeSeverityLevelsResponse -> ShowS
$cshowsPrec :: Int -> DescribeSeverityLevelsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeSeverityLevelsResponse
 -> Rep DescribeSeverityLevelsResponse x)
-> (forall x.
    Rep DescribeSeverityLevelsResponse x
    -> DescribeSeverityLevelsResponse)
-> Generic DescribeSeverityLevelsResponse
forall x.
Rep DescribeSeverityLevelsResponse x
-> DescribeSeverityLevelsResponse
forall x.
DescribeSeverityLevelsResponse
-> Rep DescribeSeverityLevelsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeSeverityLevelsResponse x
-> DescribeSeverityLevelsResponse
$cfrom :: forall x.
DescribeSeverityLevelsResponse
-> Rep DescribeSeverityLevelsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeSeverityLevelsResponse' 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:
--
-- 'severityLevels', 'describeSeverityLevelsResponse_severityLevels' - The available severity levels for the support case. Available severity
-- levels are defined by your service level agreement with AWS.
--
-- 'httpStatus', 'describeSeverityLevelsResponse_httpStatus' - The response's http status code.
newDescribeSeverityLevelsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeSeverityLevelsResponse
newDescribeSeverityLevelsResponse :: Int -> DescribeSeverityLevelsResponse
newDescribeSeverityLevelsResponse Int
pHttpStatus_ =
  DescribeSeverityLevelsResponse' :: Maybe [SeverityLevel] -> Int -> DescribeSeverityLevelsResponse
DescribeSeverityLevelsResponse'
    { $sel:severityLevels:DescribeSeverityLevelsResponse' :: Maybe [SeverityLevel]
severityLevels =
        Maybe [SeverityLevel]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeSeverityLevelsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The available severity levels for the support case. Available severity
-- levels are defined by your service level agreement with AWS.
describeSeverityLevelsResponse_severityLevels :: Lens.Lens' DescribeSeverityLevelsResponse (Prelude.Maybe [SeverityLevel])
describeSeverityLevelsResponse_severityLevels :: (Maybe [SeverityLevel] -> f (Maybe [SeverityLevel]))
-> DescribeSeverityLevelsResponse
-> f DescribeSeverityLevelsResponse
describeSeverityLevelsResponse_severityLevels = (DescribeSeverityLevelsResponse -> Maybe [SeverityLevel])
-> (DescribeSeverityLevelsResponse
    -> Maybe [SeverityLevel] -> DescribeSeverityLevelsResponse)
-> Lens
     DescribeSeverityLevelsResponse
     DescribeSeverityLevelsResponse
     (Maybe [SeverityLevel])
     (Maybe [SeverityLevel])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSeverityLevelsResponse' {Maybe [SeverityLevel]
severityLevels :: Maybe [SeverityLevel]
$sel:severityLevels:DescribeSeverityLevelsResponse' :: DescribeSeverityLevelsResponse -> Maybe [SeverityLevel]
severityLevels} -> Maybe [SeverityLevel]
severityLevels) (\s :: DescribeSeverityLevelsResponse
s@DescribeSeverityLevelsResponse' {} Maybe [SeverityLevel]
a -> DescribeSeverityLevelsResponse
s {$sel:severityLevels:DescribeSeverityLevelsResponse' :: Maybe [SeverityLevel]
severityLevels = Maybe [SeverityLevel]
a} :: DescribeSeverityLevelsResponse) ((Maybe [SeverityLevel] -> f (Maybe [SeverityLevel]))
 -> DescribeSeverityLevelsResponse
 -> f DescribeSeverityLevelsResponse)
-> ((Maybe [SeverityLevel] -> f (Maybe [SeverityLevel]))
    -> Maybe [SeverityLevel] -> f (Maybe [SeverityLevel]))
-> (Maybe [SeverityLevel] -> f (Maybe [SeverityLevel]))
-> DescribeSeverityLevelsResponse
-> f DescribeSeverityLevelsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SeverityLevel] [SeverityLevel] [SeverityLevel] [SeverityLevel]
-> Iso
     (Maybe [SeverityLevel])
     (Maybe [SeverityLevel])
     (Maybe [SeverityLevel])
     (Maybe [SeverityLevel])
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
  [SeverityLevel] [SeverityLevel] [SeverityLevel] [SeverityLevel]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
describeSeverityLevelsResponse_httpStatus :: Lens.Lens' DescribeSeverityLevelsResponse Prelude.Int
describeSeverityLevelsResponse_httpStatus :: (Int -> f Int)
-> DescribeSeverityLevelsResponse
-> f DescribeSeverityLevelsResponse
describeSeverityLevelsResponse_httpStatus = (DescribeSeverityLevelsResponse -> Int)
-> (DescribeSeverityLevelsResponse
    -> Int -> DescribeSeverityLevelsResponse)
-> Lens
     DescribeSeverityLevelsResponse
     DescribeSeverityLevelsResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSeverityLevelsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeSeverityLevelsResponse' :: DescribeSeverityLevelsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeSeverityLevelsResponse
s@DescribeSeverityLevelsResponse' {} Int
a -> DescribeSeverityLevelsResponse
s {$sel:httpStatus:DescribeSeverityLevelsResponse' :: Int
httpStatus = Int
a} :: DescribeSeverityLevelsResponse)

instance
  Prelude.NFData
    DescribeSeverityLevelsResponse