{-# 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.QueryStringCacheKeys where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data QueryStringCacheKeys = QueryStringCacheKeys'
{
QueryStringCacheKeys -> Maybe [Text]
items :: Prelude.Maybe [Prelude.Text],
QueryStringCacheKeys -> Int
quantity :: Prelude.Int
}
deriving (QueryStringCacheKeys -> QueryStringCacheKeys -> Bool
(QueryStringCacheKeys -> QueryStringCacheKeys -> Bool)
-> (QueryStringCacheKeys -> QueryStringCacheKeys -> Bool)
-> Eq QueryStringCacheKeys
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueryStringCacheKeys -> QueryStringCacheKeys -> Bool
$c/= :: QueryStringCacheKeys -> QueryStringCacheKeys -> Bool
== :: QueryStringCacheKeys -> QueryStringCacheKeys -> Bool
$c== :: QueryStringCacheKeys -> QueryStringCacheKeys -> Bool
Prelude.Eq, ReadPrec [QueryStringCacheKeys]
ReadPrec QueryStringCacheKeys
Int -> ReadS QueryStringCacheKeys
ReadS [QueryStringCacheKeys]
(Int -> ReadS QueryStringCacheKeys)
-> ReadS [QueryStringCacheKeys]
-> ReadPrec QueryStringCacheKeys
-> ReadPrec [QueryStringCacheKeys]
-> Read QueryStringCacheKeys
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QueryStringCacheKeys]
$creadListPrec :: ReadPrec [QueryStringCacheKeys]
readPrec :: ReadPrec QueryStringCacheKeys
$creadPrec :: ReadPrec QueryStringCacheKeys
readList :: ReadS [QueryStringCacheKeys]
$creadList :: ReadS [QueryStringCacheKeys]
readsPrec :: Int -> ReadS QueryStringCacheKeys
$creadsPrec :: Int -> ReadS QueryStringCacheKeys
Prelude.Read, Int -> QueryStringCacheKeys -> ShowS
[QueryStringCacheKeys] -> ShowS
QueryStringCacheKeys -> String
(Int -> QueryStringCacheKeys -> ShowS)
-> (QueryStringCacheKeys -> String)
-> ([QueryStringCacheKeys] -> ShowS)
-> Show QueryStringCacheKeys
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueryStringCacheKeys] -> ShowS
$cshowList :: [QueryStringCacheKeys] -> ShowS
show :: QueryStringCacheKeys -> String
$cshow :: QueryStringCacheKeys -> String
showsPrec :: Int -> QueryStringCacheKeys -> ShowS
$cshowsPrec :: Int -> QueryStringCacheKeys -> ShowS
Prelude.Show, (forall x. QueryStringCacheKeys -> Rep QueryStringCacheKeys x)
-> (forall x. Rep QueryStringCacheKeys x -> QueryStringCacheKeys)
-> Generic QueryStringCacheKeys
forall x. Rep QueryStringCacheKeys x -> QueryStringCacheKeys
forall x. QueryStringCacheKeys -> Rep QueryStringCacheKeys x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QueryStringCacheKeys x -> QueryStringCacheKeys
$cfrom :: forall x. QueryStringCacheKeys -> Rep QueryStringCacheKeys x
Prelude.Generic)
newQueryStringCacheKeys ::
Prelude.Int ->
QueryStringCacheKeys
newQueryStringCacheKeys :: Int -> QueryStringCacheKeys
newQueryStringCacheKeys Int
pQuantity_ =
QueryStringCacheKeys' :: Maybe [Text] -> Int -> QueryStringCacheKeys
QueryStringCacheKeys'
{ $sel:items:QueryStringCacheKeys' :: Maybe [Text]
items = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:quantity:QueryStringCacheKeys' :: Int
quantity = Int
pQuantity_
}
queryStringCacheKeys_items :: Lens.Lens' QueryStringCacheKeys (Prelude.Maybe [Prelude.Text])
queryStringCacheKeys_items :: (Maybe [Text] -> f (Maybe [Text]))
-> QueryStringCacheKeys -> f QueryStringCacheKeys
queryStringCacheKeys_items = (QueryStringCacheKeys -> Maybe [Text])
-> (QueryStringCacheKeys -> Maybe [Text] -> QueryStringCacheKeys)
-> Lens
QueryStringCacheKeys
QueryStringCacheKeys
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryStringCacheKeys' {Maybe [Text]
items :: Maybe [Text]
$sel:items:QueryStringCacheKeys' :: QueryStringCacheKeys -> Maybe [Text]
items} -> Maybe [Text]
items) (\s :: QueryStringCacheKeys
s@QueryStringCacheKeys' {} Maybe [Text]
a -> QueryStringCacheKeys
s {$sel:items:QueryStringCacheKeys' :: Maybe [Text]
items = Maybe [Text]
a} :: QueryStringCacheKeys) ((Maybe [Text] -> f (Maybe [Text]))
-> QueryStringCacheKeys -> f QueryStringCacheKeys)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> QueryStringCacheKeys
-> f QueryStringCacheKeys
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
queryStringCacheKeys_quantity :: Lens.Lens' QueryStringCacheKeys Prelude.Int
queryStringCacheKeys_quantity :: (Int -> f Int) -> QueryStringCacheKeys -> f QueryStringCacheKeys
queryStringCacheKeys_quantity = (QueryStringCacheKeys -> Int)
-> (QueryStringCacheKeys -> Int -> QueryStringCacheKeys)
-> Lens QueryStringCacheKeys QueryStringCacheKeys Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryStringCacheKeys' {Int
quantity :: Int
$sel:quantity:QueryStringCacheKeys' :: QueryStringCacheKeys -> Int
quantity} -> Int
quantity) (\s :: QueryStringCacheKeys
s@QueryStringCacheKeys' {} Int
a -> QueryStringCacheKeys
s {$sel:quantity:QueryStringCacheKeys' :: Int
quantity = Int
a} :: QueryStringCacheKeys)
instance Core.FromXML QueryStringCacheKeys where
parseXML :: [Node] -> Either String QueryStringCacheKeys
parseXML [Node]
x =
Maybe [Text] -> Int -> QueryStringCacheKeys
QueryStringCacheKeys'
(Maybe [Text] -> Int -> QueryStringCacheKeys)
-> Either String (Maybe [Text])
-> Either String (Int -> QueryStringCacheKeys)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Items" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"Name")
)
Either String (Int -> QueryStringCacheKeys)
-> Either String Int -> Either String QueryStringCacheKeys
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Int
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Quantity")
instance Prelude.Hashable QueryStringCacheKeys
instance Prelude.NFData QueryStringCacheKeys
instance Core.ToXML QueryStringCacheKeys where
toXML :: QueryStringCacheKeys -> XML
toXML QueryStringCacheKeys' {Int
Maybe [Text]
quantity :: Int
items :: Maybe [Text]
$sel:quantity:QueryStringCacheKeys' :: QueryStringCacheKeys -> Int
$sel:items:QueryStringCacheKeys' :: QueryStringCacheKeys -> Maybe [Text]
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Items"
Name -> XML -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe XML -> XML
forall a. ToXML a => a -> XML
Core.toXML (Name -> [Text] -> XML
forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Core.toXMLList Name
"Name" ([Text] -> XML) -> Maybe [Text] -> Maybe XML
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
items),
Name
"Quantity" Name -> Int -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Int
quantity
]