{-# 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.CachedMethods where
import Amazonka.CloudFront.Types.Method
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 CachedMethods = CachedMethods'
{
CachedMethods -> Int
quantity :: Prelude.Int,
CachedMethods -> [Method]
items :: [Method]
}
deriving (CachedMethods -> CachedMethods -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CachedMethods -> CachedMethods -> Bool
$c/= :: CachedMethods -> CachedMethods -> Bool
== :: CachedMethods -> CachedMethods -> Bool
$c== :: CachedMethods -> CachedMethods -> Bool
Prelude.Eq, ReadPrec [CachedMethods]
ReadPrec CachedMethods
Int -> ReadS CachedMethods
ReadS [CachedMethods]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CachedMethods]
$creadListPrec :: ReadPrec [CachedMethods]
readPrec :: ReadPrec CachedMethods
$creadPrec :: ReadPrec CachedMethods
readList :: ReadS [CachedMethods]
$creadList :: ReadS [CachedMethods]
readsPrec :: Int -> ReadS CachedMethods
$creadsPrec :: Int -> ReadS CachedMethods
Prelude.Read, Int -> CachedMethods -> ShowS
[CachedMethods] -> ShowS
CachedMethods -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CachedMethods] -> ShowS
$cshowList :: [CachedMethods] -> ShowS
show :: CachedMethods -> String
$cshow :: CachedMethods -> String
showsPrec :: Int -> CachedMethods -> ShowS
$cshowsPrec :: Int -> CachedMethods -> ShowS
Prelude.Show, forall x. Rep CachedMethods x -> CachedMethods
forall x. CachedMethods -> Rep CachedMethods x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CachedMethods x -> CachedMethods
$cfrom :: forall x. CachedMethods -> Rep CachedMethods x
Prelude.Generic)
newCachedMethods ::
Prelude.Int ->
CachedMethods
newCachedMethods :: Int -> CachedMethods
newCachedMethods Int
pQuantity_ =
CachedMethods'
{ $sel:quantity:CachedMethods' :: Int
quantity = Int
pQuantity_,
$sel:items:CachedMethods' :: [Method]
items = forall a. Monoid a => a
Prelude.mempty
}
cachedMethods_quantity :: Lens.Lens' CachedMethods Prelude.Int
cachedMethods_quantity :: Lens' CachedMethods Int
cachedMethods_quantity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CachedMethods' {Int
quantity :: Int
$sel:quantity:CachedMethods' :: CachedMethods -> Int
quantity} -> Int
quantity) (\s :: CachedMethods
s@CachedMethods' {} Int
a -> CachedMethods
s {$sel:quantity:CachedMethods' :: Int
quantity = Int
a} :: CachedMethods)
cachedMethods_items :: Lens.Lens' CachedMethods [Method]
cachedMethods_items :: Lens' CachedMethods [Method]
cachedMethods_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CachedMethods' {[Method]
items :: [Method]
$sel:items:CachedMethods' :: CachedMethods -> [Method]
items} -> [Method]
items) (\s :: CachedMethods
s@CachedMethods' {} [Method]
a -> CachedMethods
s {$sel:items:CachedMethods' :: [Method]
items = [Method]
a} :: CachedMethods) 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 CachedMethods where
parseXML :: [Node] -> Either String CachedMethods
parseXML [Node]
x =
Int -> [Method] -> CachedMethods
CachedMethods'
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 [a]
Data.parseXMLList Text
"Method"
)
instance Prelude.Hashable CachedMethods where
hashWithSalt :: Int -> CachedMethods -> Int
hashWithSalt Int
_salt CachedMethods' {Int
[Method]
items :: [Method]
quantity :: Int
$sel:items:CachedMethods' :: CachedMethods -> [Method]
$sel:quantity:CachedMethods' :: CachedMethods -> Int
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
quantity
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Method]
items
instance Prelude.NFData CachedMethods where
rnf :: CachedMethods -> ()
rnf CachedMethods' {Int
[Method]
items :: [Method]
quantity :: Int
$sel:items:CachedMethods' :: CachedMethods -> [Method]
$sel:quantity:CachedMethods' :: CachedMethods -> 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 [Method]
items
instance Data.ToXML CachedMethods where
toXML :: CachedMethods -> XML
toXML CachedMethods' {Int
[Method]
items :: [Method]
quantity :: Int
$sel:items:CachedMethods' :: CachedMethods -> [Method]
$sel:quantity:CachedMethods' :: CachedMethods -> 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
"Method" [Method]
items
]