{-# 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 #-}
module Amazonka.Connect.Types.Distribution where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data Distribution = Distribution'
{
Distribution -> Text
region :: Prelude.Text,
Distribution -> Natural
percentage :: Prelude.Natural
}
deriving (Distribution -> Distribution -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Distribution -> Distribution -> Bool
$c/= :: Distribution -> Distribution -> Bool
== :: Distribution -> Distribution -> Bool
$c== :: Distribution -> Distribution -> Bool
Prelude.Eq, ReadPrec [Distribution]
ReadPrec Distribution
Int -> ReadS Distribution
ReadS [Distribution]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Distribution]
$creadListPrec :: ReadPrec [Distribution]
readPrec :: ReadPrec Distribution
$creadPrec :: ReadPrec Distribution
readList :: ReadS [Distribution]
$creadList :: ReadS [Distribution]
readsPrec :: Int -> ReadS Distribution
$creadsPrec :: Int -> ReadS Distribution
Prelude.Read, Int -> Distribution -> ShowS
[Distribution] -> ShowS
Distribution -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Distribution] -> ShowS
$cshowList :: [Distribution] -> ShowS
show :: Distribution -> String
$cshow :: Distribution -> String
showsPrec :: Int -> Distribution -> ShowS
$cshowsPrec :: Int -> Distribution -> ShowS
Prelude.Show, forall x. Rep Distribution x -> Distribution
forall x. Distribution -> Rep Distribution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Distribution x -> Distribution
$cfrom :: forall x. Distribution -> Rep Distribution x
Prelude.Generic)
newDistribution ::
Prelude.Text ->
Prelude.Natural ->
Distribution
newDistribution :: Text -> Natural -> Distribution
newDistribution Text
pRegion_ Natural
pPercentage_ =
Distribution'
{ $sel:region:Distribution' :: Text
region = Text
pRegion_,
$sel:percentage:Distribution' :: Natural
percentage = Natural
pPercentage_
}
distribution_region :: Lens.Lens' Distribution Prelude.Text
distribution_region :: Lens' Distribution Text
distribution_region = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Distribution' {Text
region :: Text
$sel:region:Distribution' :: Distribution -> Text
region} -> Text
region) (\s :: Distribution
s@Distribution' {} Text
a -> Distribution
s {$sel:region:Distribution' :: Text
region = Text
a} :: Distribution)
distribution_percentage :: Lens.Lens' Distribution Prelude.Natural
distribution_percentage :: Lens' Distribution Natural
distribution_percentage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Distribution' {Natural
percentage :: Natural
$sel:percentage:Distribution' :: Distribution -> Natural
percentage} -> Natural
percentage) (\s :: Distribution
s@Distribution' {} Natural
a -> Distribution
s {$sel:percentage:Distribution' :: Natural
percentage = Natural
a} :: Distribution)
instance Data.FromJSON Distribution where
parseJSON :: Value -> Parser Distribution
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Distribution"
( \Object
x ->
Text -> Natural -> Distribution
Distribution'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Region")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Percentage")
)
instance Prelude.Hashable Distribution where
hashWithSalt :: Int -> Distribution -> Int
hashWithSalt Int
_salt Distribution' {Natural
Text
percentage :: Natural
region :: Text
$sel:percentage:Distribution' :: Distribution -> Natural
$sel:region:Distribution' :: Distribution -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
region
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
percentage
instance Prelude.NFData Distribution where
rnf :: Distribution -> ()
rnf Distribution' {Natural
Text
percentage :: Natural
region :: Text
$sel:percentage:Distribution' :: Distribution -> Natural
$sel:region:Distribution' :: Distribution -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
region
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
percentage
instance Data.ToJSON Distribution where
toJSON :: Distribution -> Value
toJSON Distribution' {Natural
Text
percentage :: Natural
region :: Text
$sel:percentage:Distribution' :: Distribution -> Natural
$sel:region:Distribution' :: Distribution -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Region" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
region),
forall a. a -> Maybe a
Prelude.Just (Key
"Percentage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
percentage)
]
)