{-# 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.ContentTypeProfiles where
import Amazonka.CloudFront.Types.ContentTypeProfile
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 ContentTypeProfiles = ContentTypeProfiles'
{
ContentTypeProfiles -> Maybe [ContentTypeProfile]
items :: Prelude.Maybe [ContentTypeProfile],
ContentTypeProfiles -> Int
quantity :: Prelude.Int
}
deriving (ContentTypeProfiles -> ContentTypeProfiles -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContentTypeProfiles -> ContentTypeProfiles -> Bool
$c/= :: ContentTypeProfiles -> ContentTypeProfiles -> Bool
== :: ContentTypeProfiles -> ContentTypeProfiles -> Bool
$c== :: ContentTypeProfiles -> ContentTypeProfiles -> Bool
Prelude.Eq, ReadPrec [ContentTypeProfiles]
ReadPrec ContentTypeProfiles
Int -> ReadS ContentTypeProfiles
ReadS [ContentTypeProfiles]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContentTypeProfiles]
$creadListPrec :: ReadPrec [ContentTypeProfiles]
readPrec :: ReadPrec ContentTypeProfiles
$creadPrec :: ReadPrec ContentTypeProfiles
readList :: ReadS [ContentTypeProfiles]
$creadList :: ReadS [ContentTypeProfiles]
readsPrec :: Int -> ReadS ContentTypeProfiles
$creadsPrec :: Int -> ReadS ContentTypeProfiles
Prelude.Read, Int -> ContentTypeProfiles -> ShowS
[ContentTypeProfiles] -> ShowS
ContentTypeProfiles -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContentTypeProfiles] -> ShowS
$cshowList :: [ContentTypeProfiles] -> ShowS
show :: ContentTypeProfiles -> String
$cshow :: ContentTypeProfiles -> String
showsPrec :: Int -> ContentTypeProfiles -> ShowS
$cshowsPrec :: Int -> ContentTypeProfiles -> ShowS
Prelude.Show, forall x. Rep ContentTypeProfiles x -> ContentTypeProfiles
forall x. ContentTypeProfiles -> Rep ContentTypeProfiles x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContentTypeProfiles x -> ContentTypeProfiles
$cfrom :: forall x. ContentTypeProfiles -> Rep ContentTypeProfiles x
Prelude.Generic)
newContentTypeProfiles ::
Prelude.Int ->
ContentTypeProfiles
newContentTypeProfiles :: Int -> ContentTypeProfiles
newContentTypeProfiles Int
pQuantity_ =
ContentTypeProfiles'
{ $sel:items:ContentTypeProfiles' :: Maybe [ContentTypeProfile]
items = forall a. Maybe a
Prelude.Nothing,
$sel:quantity:ContentTypeProfiles' :: Int
quantity = Int
pQuantity_
}
contentTypeProfiles_items :: Lens.Lens' ContentTypeProfiles (Prelude.Maybe [ContentTypeProfile])
contentTypeProfiles_items :: Lens' ContentTypeProfiles (Maybe [ContentTypeProfile])
contentTypeProfiles_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContentTypeProfiles' {Maybe [ContentTypeProfile]
items :: Maybe [ContentTypeProfile]
$sel:items:ContentTypeProfiles' :: ContentTypeProfiles -> Maybe [ContentTypeProfile]
items} -> Maybe [ContentTypeProfile]
items) (\s :: ContentTypeProfiles
s@ContentTypeProfiles' {} Maybe [ContentTypeProfile]
a -> ContentTypeProfiles
s {$sel:items:ContentTypeProfiles' :: Maybe [ContentTypeProfile]
items = Maybe [ContentTypeProfile]
a} :: ContentTypeProfiles) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
contentTypeProfiles_quantity :: Lens.Lens' ContentTypeProfiles Prelude.Int
contentTypeProfiles_quantity :: Lens' ContentTypeProfiles Int
contentTypeProfiles_quantity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContentTypeProfiles' {Int
quantity :: Int
$sel:quantity:ContentTypeProfiles' :: ContentTypeProfiles -> Int
quantity} -> Int
quantity) (\s :: ContentTypeProfiles
s@ContentTypeProfiles' {} Int
a -> ContentTypeProfiles
s {$sel:quantity:ContentTypeProfiles' :: Int
quantity = Int
a} :: ContentTypeProfiles)
instance Data.FromXML ContentTypeProfiles where
parseXML :: [Node] -> Either String ContentTypeProfiles
parseXML [Node]
x =
Maybe [ContentTypeProfile] -> Int -> ContentTypeProfiles
ContentTypeProfiles'
forall (f :: * -> *) a b. Functor 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 (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"ContentTypeProfile")
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Quantity")
instance Prelude.Hashable ContentTypeProfiles where
hashWithSalt :: Int -> ContentTypeProfiles -> Int
hashWithSalt Int
_salt ContentTypeProfiles' {Int
Maybe [ContentTypeProfile]
quantity :: Int
items :: Maybe [ContentTypeProfile]
$sel:quantity:ContentTypeProfiles' :: ContentTypeProfiles -> Int
$sel:items:ContentTypeProfiles' :: ContentTypeProfiles -> Maybe [ContentTypeProfile]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ContentTypeProfile]
items
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
quantity
instance Prelude.NFData ContentTypeProfiles where
rnf :: ContentTypeProfiles -> ()
rnf ContentTypeProfiles' {Int
Maybe [ContentTypeProfile]
quantity :: Int
items :: Maybe [ContentTypeProfile]
$sel:quantity:ContentTypeProfiles' :: ContentTypeProfiles -> Int
$sel:items:ContentTypeProfiles' :: ContentTypeProfiles -> Maybe [ContentTypeProfile]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [ContentTypeProfile]
items
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
quantity
instance Data.ToXML ContentTypeProfiles where
toXML :: ContentTypeProfiles -> XML
toXML ContentTypeProfiles' {Int
Maybe [ContentTypeProfile]
quantity :: Int
items :: Maybe [ContentTypeProfile]
$sel:quantity:ContentTypeProfiles' :: ContentTypeProfiles -> Int
$sel:items:ContentTypeProfiles' :: ContentTypeProfiles -> Maybe [ContentTypeProfile]
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Items"
forall a. ToXML a => Name -> a -> XML
Data.@= forall a. ToXML a => a -> XML
Data.toXML
( forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Data.toXMLList Name
"ContentTypeProfile"
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ContentTypeProfile]
items
),
Name
"Quantity" forall a. ToXML a => Name -> a -> XML
Data.@= Int
quantity
]