{-# 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.ElasticBeanstalk.Types.StatusCodes
-- 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.ElasticBeanstalk.Types.StatusCodes where

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

-- | Represents the percentage of requests over the last 10 seconds that
-- resulted in each type of status code response. For more information, see
-- <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html Status Code Definitions>.
--
-- /See:/ 'newStatusCodes' smart constructor.
data StatusCodes = StatusCodes'
  { -- | The percentage of requests over the last 10 seconds that resulted in a
    -- 2xx (200, 201, etc.) status code.
    StatusCodes -> Maybe Int
status2xx :: Prelude.Maybe Prelude.Int,
    -- | The percentage of requests over the last 10 seconds that resulted in a
    -- 3xx (300, 301, etc.) status code.
    StatusCodes -> Maybe Int
status3xx :: Prelude.Maybe Prelude.Int,
    -- | The percentage of requests over the last 10 seconds that resulted in a
    -- 4xx (400, 401, etc.) status code.
    StatusCodes -> Maybe Int
status4xx :: Prelude.Maybe Prelude.Int,
    -- | The percentage of requests over the last 10 seconds that resulted in a
    -- 5xx (500, 501, etc.) status code.
    StatusCodes -> Maybe Int
status5xx :: Prelude.Maybe Prelude.Int
  }
  deriving (StatusCodes -> StatusCodes -> Bool
(StatusCodes -> StatusCodes -> Bool)
-> (StatusCodes -> StatusCodes -> Bool) -> Eq StatusCodes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StatusCodes -> StatusCodes -> Bool
$c/= :: StatusCodes -> StatusCodes -> Bool
== :: StatusCodes -> StatusCodes -> Bool
$c== :: StatusCodes -> StatusCodes -> Bool
Prelude.Eq, ReadPrec [StatusCodes]
ReadPrec StatusCodes
Int -> ReadS StatusCodes
ReadS [StatusCodes]
(Int -> ReadS StatusCodes)
-> ReadS [StatusCodes]
-> ReadPrec StatusCodes
-> ReadPrec [StatusCodes]
-> Read StatusCodes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StatusCodes]
$creadListPrec :: ReadPrec [StatusCodes]
readPrec :: ReadPrec StatusCodes
$creadPrec :: ReadPrec StatusCodes
readList :: ReadS [StatusCodes]
$creadList :: ReadS [StatusCodes]
readsPrec :: Int -> ReadS StatusCodes
$creadsPrec :: Int -> ReadS StatusCodes
Prelude.Read, Int -> StatusCodes -> ShowS
[StatusCodes] -> ShowS
StatusCodes -> String
(Int -> StatusCodes -> ShowS)
-> (StatusCodes -> String)
-> ([StatusCodes] -> ShowS)
-> Show StatusCodes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StatusCodes] -> ShowS
$cshowList :: [StatusCodes] -> ShowS
show :: StatusCodes -> String
$cshow :: StatusCodes -> String
showsPrec :: Int -> StatusCodes -> ShowS
$cshowsPrec :: Int -> StatusCodes -> ShowS
Prelude.Show, (forall x. StatusCodes -> Rep StatusCodes x)
-> (forall x. Rep StatusCodes x -> StatusCodes)
-> Generic StatusCodes
forall x. Rep StatusCodes x -> StatusCodes
forall x. StatusCodes -> Rep StatusCodes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StatusCodes x -> StatusCodes
$cfrom :: forall x. StatusCodes -> Rep StatusCodes x
Prelude.Generic)

-- |
-- Create a value of 'StatusCodes' 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:
--
-- 'status2xx', 'statusCodes_status2xx' - The percentage of requests over the last 10 seconds that resulted in a
-- 2xx (200, 201, etc.) status code.
--
-- 'status3xx', 'statusCodes_status3xx' - The percentage of requests over the last 10 seconds that resulted in a
-- 3xx (300, 301, etc.) status code.
--
-- 'status4xx', 'statusCodes_status4xx' - The percentage of requests over the last 10 seconds that resulted in a
-- 4xx (400, 401, etc.) status code.
--
-- 'status5xx', 'statusCodes_status5xx' - The percentage of requests over the last 10 seconds that resulted in a
-- 5xx (500, 501, etc.) status code.
newStatusCodes ::
  StatusCodes
newStatusCodes :: StatusCodes
newStatusCodes =
  StatusCodes' :: Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> StatusCodes
StatusCodes'
    { $sel:status2xx:StatusCodes' :: Maybe Int
status2xx = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:status3xx:StatusCodes' :: Maybe Int
status3xx = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:status4xx:StatusCodes' :: Maybe Int
status4xx = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:status5xx:StatusCodes' :: Maybe Int
status5xx = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The percentage of requests over the last 10 seconds that resulted in a
-- 2xx (200, 201, etc.) status code.
statusCodes_status2xx :: Lens.Lens' StatusCodes (Prelude.Maybe Prelude.Int)
statusCodes_status2xx :: (Maybe Int -> f (Maybe Int)) -> StatusCodes -> f StatusCodes
statusCodes_status2xx = (StatusCodes -> Maybe Int)
-> (StatusCodes -> Maybe Int -> StatusCodes)
-> Lens StatusCodes StatusCodes (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatusCodes' {Maybe Int
status2xx :: Maybe Int
$sel:status2xx:StatusCodes' :: StatusCodes -> Maybe Int
status2xx} -> Maybe Int
status2xx) (\s :: StatusCodes
s@StatusCodes' {} Maybe Int
a -> StatusCodes
s {$sel:status2xx:StatusCodes' :: Maybe Int
status2xx = Maybe Int
a} :: StatusCodes)

-- | The percentage of requests over the last 10 seconds that resulted in a
-- 3xx (300, 301, etc.) status code.
statusCodes_status3xx :: Lens.Lens' StatusCodes (Prelude.Maybe Prelude.Int)
statusCodes_status3xx :: (Maybe Int -> f (Maybe Int)) -> StatusCodes -> f StatusCodes
statusCodes_status3xx = (StatusCodes -> Maybe Int)
-> (StatusCodes -> Maybe Int -> StatusCodes)
-> Lens StatusCodes StatusCodes (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatusCodes' {Maybe Int
status3xx :: Maybe Int
$sel:status3xx:StatusCodes' :: StatusCodes -> Maybe Int
status3xx} -> Maybe Int
status3xx) (\s :: StatusCodes
s@StatusCodes' {} Maybe Int
a -> StatusCodes
s {$sel:status3xx:StatusCodes' :: Maybe Int
status3xx = Maybe Int
a} :: StatusCodes)

-- | The percentage of requests over the last 10 seconds that resulted in a
-- 4xx (400, 401, etc.) status code.
statusCodes_status4xx :: Lens.Lens' StatusCodes (Prelude.Maybe Prelude.Int)
statusCodes_status4xx :: (Maybe Int -> f (Maybe Int)) -> StatusCodes -> f StatusCodes
statusCodes_status4xx = (StatusCodes -> Maybe Int)
-> (StatusCodes -> Maybe Int -> StatusCodes)
-> Lens StatusCodes StatusCodes (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatusCodes' {Maybe Int
status4xx :: Maybe Int
$sel:status4xx:StatusCodes' :: StatusCodes -> Maybe Int
status4xx} -> Maybe Int
status4xx) (\s :: StatusCodes
s@StatusCodes' {} Maybe Int
a -> StatusCodes
s {$sel:status4xx:StatusCodes' :: Maybe Int
status4xx = Maybe Int
a} :: StatusCodes)

-- | The percentage of requests over the last 10 seconds that resulted in a
-- 5xx (500, 501, etc.) status code.
statusCodes_status5xx :: Lens.Lens' StatusCodes (Prelude.Maybe Prelude.Int)
statusCodes_status5xx :: (Maybe Int -> f (Maybe Int)) -> StatusCodes -> f StatusCodes
statusCodes_status5xx = (StatusCodes -> Maybe Int)
-> (StatusCodes -> Maybe Int -> StatusCodes)
-> Lens StatusCodes StatusCodes (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatusCodes' {Maybe Int
status5xx :: Maybe Int
$sel:status5xx:StatusCodes' :: StatusCodes -> Maybe Int
status5xx} -> Maybe Int
status5xx) (\s :: StatusCodes
s@StatusCodes' {} Maybe Int
a -> StatusCodes
s {$sel:status5xx:StatusCodes' :: Maybe Int
status5xx = Maybe Int
a} :: StatusCodes)

instance Core.FromXML StatusCodes where
  parseXML :: [Node] -> Either String StatusCodes
parseXML [Node]
x =
    Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> StatusCodes
StatusCodes'
      (Maybe Int -> Maybe Int -> Maybe Int -> Maybe Int -> StatusCodes)
-> Either String (Maybe Int)
-> Either
     String (Maybe Int -> Maybe Int -> Maybe Int -> StatusCodes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Status2xx")
      Either String (Maybe Int -> Maybe Int -> Maybe Int -> StatusCodes)
-> Either String (Maybe Int)
-> Either String (Maybe Int -> Maybe Int -> StatusCodes)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Status3xx")
      Either String (Maybe Int -> Maybe Int -> StatusCodes)
-> Either String (Maybe Int)
-> Either String (Maybe Int -> StatusCodes)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Status4xx")
      Either String (Maybe Int -> StatusCodes)
-> Either String (Maybe Int) -> Either String StatusCodes
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Status5xx")

instance Prelude.Hashable StatusCodes

instance Prelude.NFData StatusCodes