{-# 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.XRay.Types.BackendConnectionErrors
-- 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.XRay.Types.BackendConnectionErrors where

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

-- |
--
-- /See:/ 'newBackendConnectionErrors' smart constructor.
data BackendConnectionErrors = BackendConnectionErrors'
  { BackendConnectionErrors -> Maybe Int
otherCount :: Prelude.Maybe Prelude.Int,
    BackendConnectionErrors -> Maybe Int
timeoutCount :: Prelude.Maybe Prelude.Int,
    BackendConnectionErrors -> Maybe Int
hTTPCode5XXCount :: Prelude.Maybe Prelude.Int,
    BackendConnectionErrors -> Maybe Int
connectionRefusedCount :: Prelude.Maybe Prelude.Int,
    BackendConnectionErrors -> Maybe Int
hTTPCode4XXCount :: Prelude.Maybe Prelude.Int,
    BackendConnectionErrors -> Maybe Int
unknownHostCount :: Prelude.Maybe Prelude.Int
  }
  deriving (BackendConnectionErrors -> BackendConnectionErrors -> Bool
(BackendConnectionErrors -> BackendConnectionErrors -> Bool)
-> (BackendConnectionErrors -> BackendConnectionErrors -> Bool)
-> Eq BackendConnectionErrors
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BackendConnectionErrors -> BackendConnectionErrors -> Bool
$c/= :: BackendConnectionErrors -> BackendConnectionErrors -> Bool
== :: BackendConnectionErrors -> BackendConnectionErrors -> Bool
$c== :: BackendConnectionErrors -> BackendConnectionErrors -> Bool
Prelude.Eq, ReadPrec [BackendConnectionErrors]
ReadPrec BackendConnectionErrors
Int -> ReadS BackendConnectionErrors
ReadS [BackendConnectionErrors]
(Int -> ReadS BackendConnectionErrors)
-> ReadS [BackendConnectionErrors]
-> ReadPrec BackendConnectionErrors
-> ReadPrec [BackendConnectionErrors]
-> Read BackendConnectionErrors
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BackendConnectionErrors]
$creadListPrec :: ReadPrec [BackendConnectionErrors]
readPrec :: ReadPrec BackendConnectionErrors
$creadPrec :: ReadPrec BackendConnectionErrors
readList :: ReadS [BackendConnectionErrors]
$creadList :: ReadS [BackendConnectionErrors]
readsPrec :: Int -> ReadS BackendConnectionErrors
$creadsPrec :: Int -> ReadS BackendConnectionErrors
Prelude.Read, Int -> BackendConnectionErrors -> ShowS
[BackendConnectionErrors] -> ShowS
BackendConnectionErrors -> String
(Int -> BackendConnectionErrors -> ShowS)
-> (BackendConnectionErrors -> String)
-> ([BackendConnectionErrors] -> ShowS)
-> Show BackendConnectionErrors
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BackendConnectionErrors] -> ShowS
$cshowList :: [BackendConnectionErrors] -> ShowS
show :: BackendConnectionErrors -> String
$cshow :: BackendConnectionErrors -> String
showsPrec :: Int -> BackendConnectionErrors -> ShowS
$cshowsPrec :: Int -> BackendConnectionErrors -> ShowS
Prelude.Show, (forall x.
 BackendConnectionErrors -> Rep BackendConnectionErrors x)
-> (forall x.
    Rep BackendConnectionErrors x -> BackendConnectionErrors)
-> Generic BackendConnectionErrors
forall x. Rep BackendConnectionErrors x -> BackendConnectionErrors
forall x. BackendConnectionErrors -> Rep BackendConnectionErrors x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BackendConnectionErrors x -> BackendConnectionErrors
$cfrom :: forall x. BackendConnectionErrors -> Rep BackendConnectionErrors x
Prelude.Generic)

-- |
-- Create a value of 'BackendConnectionErrors' 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:
--
-- 'otherCount', 'backendConnectionErrors_otherCount' -
--
-- 'timeoutCount', 'backendConnectionErrors_timeoutCount' -
--
-- 'hTTPCode5XXCount', 'backendConnectionErrors_hTTPCode5XXCount' -
--
-- 'connectionRefusedCount', 'backendConnectionErrors_connectionRefusedCount' -
--
-- 'hTTPCode4XXCount', 'backendConnectionErrors_hTTPCode4XXCount' -
--
-- 'unknownHostCount', 'backendConnectionErrors_unknownHostCount' -
newBackendConnectionErrors ::
  BackendConnectionErrors
newBackendConnectionErrors :: BackendConnectionErrors
newBackendConnectionErrors =
  BackendConnectionErrors' :: Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> BackendConnectionErrors
BackendConnectionErrors'
    { $sel:otherCount:BackendConnectionErrors' :: Maybe Int
otherCount =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:timeoutCount:BackendConnectionErrors' :: Maybe Int
timeoutCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:hTTPCode5XXCount:BackendConnectionErrors' :: Maybe Int
hTTPCode5XXCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionRefusedCount:BackendConnectionErrors' :: Maybe Int
connectionRefusedCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:hTTPCode4XXCount:BackendConnectionErrors' :: Maybe Int
hTTPCode4XXCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:unknownHostCount:BackendConnectionErrors' :: Maybe Int
unknownHostCount = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- |
backendConnectionErrors_otherCount :: Lens.Lens' BackendConnectionErrors (Prelude.Maybe Prelude.Int)
backendConnectionErrors_otherCount :: (Maybe Int -> f (Maybe Int))
-> BackendConnectionErrors -> f BackendConnectionErrors
backendConnectionErrors_otherCount = (BackendConnectionErrors -> Maybe Int)
-> (BackendConnectionErrors
    -> Maybe Int -> BackendConnectionErrors)
-> Lens
     BackendConnectionErrors
     BackendConnectionErrors
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendConnectionErrors' {Maybe Int
otherCount :: Maybe Int
$sel:otherCount:BackendConnectionErrors' :: BackendConnectionErrors -> Maybe Int
otherCount} -> Maybe Int
otherCount) (\s :: BackendConnectionErrors
s@BackendConnectionErrors' {} Maybe Int
a -> BackendConnectionErrors
s {$sel:otherCount:BackendConnectionErrors' :: Maybe Int
otherCount = Maybe Int
a} :: BackendConnectionErrors)

-- |
backendConnectionErrors_timeoutCount :: Lens.Lens' BackendConnectionErrors (Prelude.Maybe Prelude.Int)
backendConnectionErrors_timeoutCount :: (Maybe Int -> f (Maybe Int))
-> BackendConnectionErrors -> f BackendConnectionErrors
backendConnectionErrors_timeoutCount = (BackendConnectionErrors -> Maybe Int)
-> (BackendConnectionErrors
    -> Maybe Int -> BackendConnectionErrors)
-> Lens
     BackendConnectionErrors
     BackendConnectionErrors
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendConnectionErrors' {Maybe Int
timeoutCount :: Maybe Int
$sel:timeoutCount:BackendConnectionErrors' :: BackendConnectionErrors -> Maybe Int
timeoutCount} -> Maybe Int
timeoutCount) (\s :: BackendConnectionErrors
s@BackendConnectionErrors' {} Maybe Int
a -> BackendConnectionErrors
s {$sel:timeoutCount:BackendConnectionErrors' :: Maybe Int
timeoutCount = Maybe Int
a} :: BackendConnectionErrors)

-- |
backendConnectionErrors_hTTPCode5XXCount :: Lens.Lens' BackendConnectionErrors (Prelude.Maybe Prelude.Int)
backendConnectionErrors_hTTPCode5XXCount :: (Maybe Int -> f (Maybe Int))
-> BackendConnectionErrors -> f BackendConnectionErrors
backendConnectionErrors_hTTPCode5XXCount = (BackendConnectionErrors -> Maybe Int)
-> (BackendConnectionErrors
    -> Maybe Int -> BackendConnectionErrors)
-> Lens
     BackendConnectionErrors
     BackendConnectionErrors
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendConnectionErrors' {Maybe Int
hTTPCode5XXCount :: Maybe Int
$sel:hTTPCode5XXCount:BackendConnectionErrors' :: BackendConnectionErrors -> Maybe Int
hTTPCode5XXCount} -> Maybe Int
hTTPCode5XXCount) (\s :: BackendConnectionErrors
s@BackendConnectionErrors' {} Maybe Int
a -> BackendConnectionErrors
s {$sel:hTTPCode5XXCount:BackendConnectionErrors' :: Maybe Int
hTTPCode5XXCount = Maybe Int
a} :: BackendConnectionErrors)

-- |
backendConnectionErrors_connectionRefusedCount :: Lens.Lens' BackendConnectionErrors (Prelude.Maybe Prelude.Int)
backendConnectionErrors_connectionRefusedCount :: (Maybe Int -> f (Maybe Int))
-> BackendConnectionErrors -> f BackendConnectionErrors
backendConnectionErrors_connectionRefusedCount = (BackendConnectionErrors -> Maybe Int)
-> (BackendConnectionErrors
    -> Maybe Int -> BackendConnectionErrors)
-> Lens
     BackendConnectionErrors
     BackendConnectionErrors
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendConnectionErrors' {Maybe Int
connectionRefusedCount :: Maybe Int
$sel:connectionRefusedCount:BackendConnectionErrors' :: BackendConnectionErrors -> Maybe Int
connectionRefusedCount} -> Maybe Int
connectionRefusedCount) (\s :: BackendConnectionErrors
s@BackendConnectionErrors' {} Maybe Int
a -> BackendConnectionErrors
s {$sel:connectionRefusedCount:BackendConnectionErrors' :: Maybe Int
connectionRefusedCount = Maybe Int
a} :: BackendConnectionErrors)

-- |
backendConnectionErrors_hTTPCode4XXCount :: Lens.Lens' BackendConnectionErrors (Prelude.Maybe Prelude.Int)
backendConnectionErrors_hTTPCode4XXCount :: (Maybe Int -> f (Maybe Int))
-> BackendConnectionErrors -> f BackendConnectionErrors
backendConnectionErrors_hTTPCode4XXCount = (BackendConnectionErrors -> Maybe Int)
-> (BackendConnectionErrors
    -> Maybe Int -> BackendConnectionErrors)
-> Lens
     BackendConnectionErrors
     BackendConnectionErrors
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendConnectionErrors' {Maybe Int
hTTPCode4XXCount :: Maybe Int
$sel:hTTPCode4XXCount:BackendConnectionErrors' :: BackendConnectionErrors -> Maybe Int
hTTPCode4XXCount} -> Maybe Int
hTTPCode4XXCount) (\s :: BackendConnectionErrors
s@BackendConnectionErrors' {} Maybe Int
a -> BackendConnectionErrors
s {$sel:hTTPCode4XXCount:BackendConnectionErrors' :: Maybe Int
hTTPCode4XXCount = Maybe Int
a} :: BackendConnectionErrors)

-- |
backendConnectionErrors_unknownHostCount :: Lens.Lens' BackendConnectionErrors (Prelude.Maybe Prelude.Int)
backendConnectionErrors_unknownHostCount :: (Maybe Int -> f (Maybe Int))
-> BackendConnectionErrors -> f BackendConnectionErrors
backendConnectionErrors_unknownHostCount = (BackendConnectionErrors -> Maybe Int)
-> (BackendConnectionErrors
    -> Maybe Int -> BackendConnectionErrors)
-> Lens
     BackendConnectionErrors
     BackendConnectionErrors
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BackendConnectionErrors' {Maybe Int
unknownHostCount :: Maybe Int
$sel:unknownHostCount:BackendConnectionErrors' :: BackendConnectionErrors -> Maybe Int
unknownHostCount} -> Maybe Int
unknownHostCount) (\s :: BackendConnectionErrors
s@BackendConnectionErrors' {} Maybe Int
a -> BackendConnectionErrors
s {$sel:unknownHostCount:BackendConnectionErrors' :: Maybe Int
unknownHostCount = Maybe Int
a} :: BackendConnectionErrors)

instance Prelude.Hashable BackendConnectionErrors

instance Prelude.NFData BackendConnectionErrors

instance Core.ToJSON BackendConnectionErrors where
  toJSON :: BackendConnectionErrors -> Value
toJSON BackendConnectionErrors' {Maybe Int
unknownHostCount :: Maybe Int
hTTPCode4XXCount :: Maybe Int
connectionRefusedCount :: Maybe Int
hTTPCode5XXCount :: Maybe Int
timeoutCount :: Maybe Int
otherCount :: Maybe Int
$sel:unknownHostCount:BackendConnectionErrors' :: BackendConnectionErrors -> Maybe Int
$sel:hTTPCode4XXCount:BackendConnectionErrors' :: BackendConnectionErrors -> Maybe Int
$sel:connectionRefusedCount:BackendConnectionErrors' :: BackendConnectionErrors -> Maybe Int
$sel:hTTPCode5XXCount:BackendConnectionErrors' :: BackendConnectionErrors -> Maybe Int
$sel:timeoutCount:BackendConnectionErrors' :: BackendConnectionErrors -> Maybe Int
$sel:otherCount:BackendConnectionErrors' :: BackendConnectionErrors -> Maybe Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"OtherCount" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
otherCount,
            (Text
"TimeoutCount" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
timeoutCount,
            (Text
"HTTPCode5XXCount" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
hTTPCode5XXCount,
            (Text
"ConnectionRefusedCount" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
connectionRefusedCount,
            (Text
"HTTPCode4XXCount" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
hTTPCode4XXCount,
            (Text
"UnknownHostCount" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
unknownHostCount
          ]
      )