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