{-# 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.QueryStringNames where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data QueryStringNames = QueryStringNames'
{
QueryStringNames -> Maybe [Text]
items :: Prelude.Maybe [Prelude.Text],
QueryStringNames -> Int
quantity :: Prelude.Int
}
deriving (QueryStringNames -> QueryStringNames -> Bool
(QueryStringNames -> QueryStringNames -> Bool)
-> (QueryStringNames -> QueryStringNames -> Bool)
-> Eq QueryStringNames
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueryStringNames -> QueryStringNames -> Bool
$c/= :: QueryStringNames -> QueryStringNames -> Bool
== :: QueryStringNames -> QueryStringNames -> Bool
$c== :: QueryStringNames -> QueryStringNames -> Bool
Prelude.Eq, ReadPrec [QueryStringNames]
ReadPrec QueryStringNames
Int -> ReadS QueryStringNames
ReadS [QueryStringNames]
(Int -> ReadS QueryStringNames)
-> ReadS [QueryStringNames]
-> ReadPrec QueryStringNames
-> ReadPrec [QueryStringNames]
-> Read QueryStringNames
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QueryStringNames]
$creadListPrec :: ReadPrec [QueryStringNames]
readPrec :: ReadPrec QueryStringNames
$creadPrec :: ReadPrec QueryStringNames
readList :: ReadS [QueryStringNames]
$creadList :: ReadS [QueryStringNames]
readsPrec :: Int -> ReadS QueryStringNames
$creadsPrec :: Int -> ReadS QueryStringNames
Prelude.Read, Int -> QueryStringNames -> ShowS
[QueryStringNames] -> ShowS
QueryStringNames -> String
(Int -> QueryStringNames -> ShowS)
-> (QueryStringNames -> String)
-> ([QueryStringNames] -> ShowS)
-> Show QueryStringNames
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueryStringNames] -> ShowS
$cshowList :: [QueryStringNames] -> ShowS
show :: QueryStringNames -> String
$cshow :: QueryStringNames -> String
showsPrec :: Int -> QueryStringNames -> ShowS
$cshowsPrec :: Int -> QueryStringNames -> ShowS
Prelude.Show, (forall x. QueryStringNames -> Rep QueryStringNames x)
-> (forall x. Rep QueryStringNames x -> QueryStringNames)
-> Generic QueryStringNames
forall x. Rep QueryStringNames x -> QueryStringNames
forall x. QueryStringNames -> Rep QueryStringNames x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QueryStringNames x -> QueryStringNames
$cfrom :: forall x. QueryStringNames -> Rep QueryStringNames x
Prelude.Generic)
newQueryStringNames ::
Prelude.Int ->
QueryStringNames
newQueryStringNames :: Int -> QueryStringNames
newQueryStringNames Int
pQuantity_ =
QueryStringNames' :: Maybe [Text] -> Int -> QueryStringNames
QueryStringNames'
{ $sel:items:QueryStringNames' :: Maybe [Text]
items = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:quantity:QueryStringNames' :: Int
quantity = Int
pQuantity_
}
queryStringNames_items :: Lens.Lens' QueryStringNames (Prelude.Maybe [Prelude.Text])
queryStringNames_items :: (Maybe [Text] -> f (Maybe [Text]))
-> QueryStringNames -> f QueryStringNames
queryStringNames_items = (QueryStringNames -> Maybe [Text])
-> (QueryStringNames -> Maybe [Text] -> QueryStringNames)
-> Lens
QueryStringNames QueryStringNames (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryStringNames' {Maybe [Text]
items :: Maybe [Text]
$sel:items:QueryStringNames' :: QueryStringNames -> Maybe [Text]
items} -> Maybe [Text]
items) (\s :: QueryStringNames
s@QueryStringNames' {} Maybe [Text]
a -> QueryStringNames
s {$sel:items:QueryStringNames' :: Maybe [Text]
items = Maybe [Text]
a} :: QueryStringNames) ((Maybe [Text] -> f (Maybe [Text]))
-> QueryStringNames -> f QueryStringNames)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> QueryStringNames
-> f QueryStringNames
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
queryStringNames_quantity :: Lens.Lens' QueryStringNames Prelude.Int
queryStringNames_quantity :: (Int -> f Int) -> QueryStringNames -> f QueryStringNames
queryStringNames_quantity = (QueryStringNames -> Int)
-> (QueryStringNames -> Int -> QueryStringNames)
-> Lens QueryStringNames QueryStringNames Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryStringNames' {Int
quantity :: Int
$sel:quantity:QueryStringNames' :: QueryStringNames -> Int
quantity} -> Int
quantity) (\s :: QueryStringNames
s@QueryStringNames' {} Int
a -> QueryStringNames
s {$sel:quantity:QueryStringNames' :: Int
quantity = Int
a} :: QueryStringNames)
instance Core.FromXML QueryStringNames where
parseXML :: [Node] -> Either String QueryStringNames
parseXML [Node]
x =
Maybe [Text] -> Int -> QueryStringNames
QueryStringNames'
(Maybe [Text] -> Int -> QueryStringNames)
-> Either String (Maybe [Text])
-> Either String (Int -> QueryStringNames)
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 -> QueryStringNames)
-> Either String Int -> Either String QueryStringNames
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 QueryStringNames
instance Prelude.NFData QueryStringNames
instance Core.ToXML QueryStringNames where
toXML :: QueryStringNames -> XML
toXML QueryStringNames' {Int
Maybe [Text]
quantity :: Int
items :: Maybe [Text]
$sel:quantity:QueryStringNames' :: QueryStringNames -> Int
$sel:items:QueryStringNames' :: QueryStringNames -> 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
]