{-# 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.CloudFront.Types.StatusCodes 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 StatusCodes = StatusCodes'
{
StatusCodes -> Int
quantity :: Prelude.Int,
StatusCodes -> NonEmpty Int
items :: Prelude.NonEmpty Prelude.Int
}
deriving (StatusCodes -> StatusCodes -> Bool
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]
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
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. 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)
newStatusCodes ::
Prelude.Int ->
Prelude.NonEmpty Prelude.Int ->
StatusCodes
newStatusCodes :: Int -> NonEmpty Int -> StatusCodes
newStatusCodes Int
pQuantity_ NonEmpty Int
pItems_ =
StatusCodes'
{ $sel:quantity:StatusCodes' :: Int
quantity = Int
pQuantity_,
$sel:items:StatusCodes' :: NonEmpty Int
items = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Int
pItems_
}
statusCodes_quantity :: Lens.Lens' StatusCodes Prelude.Int
statusCodes_quantity :: Lens' StatusCodes Int
statusCodes_quantity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatusCodes' {Int
quantity :: Int
$sel:quantity:StatusCodes' :: StatusCodes -> Int
quantity} -> Int
quantity) (\s :: StatusCodes
s@StatusCodes' {} Int
a -> StatusCodes
s {$sel:quantity:StatusCodes' :: Int
quantity = Int
a} :: StatusCodes)
statusCodes_items :: Lens.Lens' StatusCodes (Prelude.NonEmpty Prelude.Int)
statusCodes_items :: Lens' StatusCodes (NonEmpty Int)
statusCodes_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StatusCodes' {NonEmpty Int
items :: NonEmpty Int
$sel:items:StatusCodes' :: StatusCodes -> NonEmpty Int
items} -> NonEmpty Int
items) (\s :: StatusCodes
s@StatusCodes' {} NonEmpty Int
a -> StatusCodes
s {$sel:items:StatusCodes' :: NonEmpty Int
items = NonEmpty Int
a} :: StatusCodes) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromXML StatusCodes where
parseXML :: [Node] -> Either String StatusCodes
parseXML [Node]
x =
Int -> NonEmpty Int -> StatusCodes
StatusCodes'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Quantity")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Items"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall a. FromXML a => Text -> [Node] -> Either String (NonEmpty a)
Data.parseXMLList1 Text
"StatusCode"
)
instance Prelude.Hashable StatusCodes where
hashWithSalt :: Int -> StatusCodes -> Int
hashWithSalt Int
_salt StatusCodes' {Int
NonEmpty Int
items :: NonEmpty Int
quantity :: Int
$sel:items:StatusCodes' :: StatusCodes -> NonEmpty Int
$sel:quantity:StatusCodes' :: StatusCodes -> Int
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
quantity
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Int
items
instance Prelude.NFData StatusCodes where
rnf :: StatusCodes -> ()
rnf StatusCodes' {Int
NonEmpty Int
items :: NonEmpty Int
quantity :: Int
$sel:items:StatusCodes' :: StatusCodes -> NonEmpty Int
$sel:quantity:StatusCodes' :: StatusCodes -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
quantity
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Int
items
instance Data.ToXML StatusCodes where
toXML :: StatusCodes -> XML
toXML StatusCodes' {Int
NonEmpty Int
items :: NonEmpty Int
quantity :: Int
$sel:items:StatusCodes' :: StatusCodes -> NonEmpty Int
$sel:quantity:StatusCodes' :: StatusCodes -> Int
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Quantity" forall a. ToXML a => Name -> a -> XML
Data.@= Int
quantity,
Name
"Items" forall a. ToXML a => Name -> a -> XML
Data.@= forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Data.toXMLList Name
"StatusCode" NonEmpty Int
items
]