{-# 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.Lightsail.Types.Origin where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types.OriginProtocolPolicyEnum
import Amazonka.Lightsail.Types.RegionName
import Amazonka.Lightsail.Types.ResourceType
import qualified Amazonka.Prelude as Prelude
data Origin = Origin'
{
Origin -> Maybe RegionName
regionName :: Prelude.Maybe RegionName,
Origin -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
Origin -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
Origin -> Maybe OriginProtocolPolicyEnum
protocolPolicy :: Prelude.Maybe OriginProtocolPolicyEnum
}
deriving (Origin -> Origin -> Bool
(Origin -> Origin -> Bool)
-> (Origin -> Origin -> Bool) -> Eq Origin
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Origin -> Origin -> Bool
$c/= :: Origin -> Origin -> Bool
== :: Origin -> Origin -> Bool
$c== :: Origin -> Origin -> Bool
Prelude.Eq, ReadPrec [Origin]
ReadPrec Origin
Int -> ReadS Origin
ReadS [Origin]
(Int -> ReadS Origin)
-> ReadS [Origin]
-> ReadPrec Origin
-> ReadPrec [Origin]
-> Read Origin
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Origin]
$creadListPrec :: ReadPrec [Origin]
readPrec :: ReadPrec Origin
$creadPrec :: ReadPrec Origin
readList :: ReadS [Origin]
$creadList :: ReadS [Origin]
readsPrec :: Int -> ReadS Origin
$creadsPrec :: Int -> ReadS Origin
Prelude.Read, Int -> Origin -> ShowS
[Origin] -> ShowS
Origin -> String
(Int -> Origin -> ShowS)
-> (Origin -> String) -> ([Origin] -> ShowS) -> Show Origin
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Origin] -> ShowS
$cshowList :: [Origin] -> ShowS
show :: Origin -> String
$cshow :: Origin -> String
showsPrec :: Int -> Origin -> ShowS
$cshowsPrec :: Int -> Origin -> ShowS
Prelude.Show, (forall x. Origin -> Rep Origin x)
-> (forall x. Rep Origin x -> Origin) -> Generic Origin
forall x. Rep Origin x -> Origin
forall x. Origin -> Rep Origin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Origin x -> Origin
$cfrom :: forall x. Origin -> Rep Origin x
Prelude.Generic)
newOrigin ::
Origin
newOrigin :: Origin
newOrigin =
Origin' :: Maybe RegionName
-> Maybe ResourceType
-> Maybe Text
-> Maybe OriginProtocolPolicyEnum
-> Origin
Origin'
{ $sel:regionName:Origin' :: Maybe RegionName
regionName = Maybe RegionName
forall a. Maybe a
Prelude.Nothing,
$sel:resourceType:Origin' :: Maybe ResourceType
resourceType = Maybe ResourceType
forall a. Maybe a
Prelude.Nothing,
$sel:name:Origin' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:protocolPolicy:Origin' :: Maybe OriginProtocolPolicyEnum
protocolPolicy = Maybe OriginProtocolPolicyEnum
forall a. Maybe a
Prelude.Nothing
}
origin_regionName :: Lens.Lens' Origin (Prelude.Maybe RegionName)
origin_regionName :: (Maybe RegionName -> f (Maybe RegionName)) -> Origin -> f Origin
origin_regionName = (Origin -> Maybe RegionName)
-> (Origin -> Maybe RegionName -> Origin)
-> Lens Origin Origin (Maybe RegionName) (Maybe RegionName)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Origin' {Maybe RegionName
regionName :: Maybe RegionName
$sel:regionName:Origin' :: Origin -> Maybe RegionName
regionName} -> Maybe RegionName
regionName) (\s :: Origin
s@Origin' {} Maybe RegionName
a -> Origin
s {$sel:regionName:Origin' :: Maybe RegionName
regionName = Maybe RegionName
a} :: Origin)
origin_resourceType :: Lens.Lens' Origin (Prelude.Maybe ResourceType)
origin_resourceType :: (Maybe ResourceType -> f (Maybe ResourceType))
-> Origin -> f Origin
origin_resourceType = (Origin -> Maybe ResourceType)
-> (Origin -> Maybe ResourceType -> Origin)
-> Lens Origin Origin (Maybe ResourceType) (Maybe ResourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Origin' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:Origin' :: Origin -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: Origin
s@Origin' {} Maybe ResourceType
a -> Origin
s {$sel:resourceType:Origin' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: Origin)
origin_name :: Lens.Lens' Origin (Prelude.Maybe Prelude.Text)
origin_name :: (Maybe Text -> f (Maybe Text)) -> Origin -> f Origin
origin_name = (Origin -> Maybe Text)
-> (Origin -> Maybe Text -> Origin)
-> Lens Origin Origin (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Origin' {Maybe Text
name :: Maybe Text
$sel:name:Origin' :: Origin -> Maybe Text
name} -> Maybe Text
name) (\s :: Origin
s@Origin' {} Maybe Text
a -> Origin
s {$sel:name:Origin' :: Maybe Text
name = Maybe Text
a} :: Origin)
origin_protocolPolicy :: Lens.Lens' Origin (Prelude.Maybe OriginProtocolPolicyEnum)
origin_protocolPolicy :: (Maybe OriginProtocolPolicyEnum
-> f (Maybe OriginProtocolPolicyEnum))
-> Origin -> f Origin
origin_protocolPolicy = (Origin -> Maybe OriginProtocolPolicyEnum)
-> (Origin -> Maybe OriginProtocolPolicyEnum -> Origin)
-> Lens
Origin
Origin
(Maybe OriginProtocolPolicyEnum)
(Maybe OriginProtocolPolicyEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Origin' {Maybe OriginProtocolPolicyEnum
protocolPolicy :: Maybe OriginProtocolPolicyEnum
$sel:protocolPolicy:Origin' :: Origin -> Maybe OriginProtocolPolicyEnum
protocolPolicy} -> Maybe OriginProtocolPolicyEnum
protocolPolicy) (\s :: Origin
s@Origin' {} Maybe OriginProtocolPolicyEnum
a -> Origin
s {$sel:protocolPolicy:Origin' :: Maybe OriginProtocolPolicyEnum
protocolPolicy = Maybe OriginProtocolPolicyEnum
a} :: Origin)
instance Core.FromJSON Origin where
parseJSON :: Value -> Parser Origin
parseJSON =
String -> (Object -> Parser Origin) -> Value -> Parser Origin
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Origin"
( \Object
x ->
Maybe RegionName
-> Maybe ResourceType
-> Maybe Text
-> Maybe OriginProtocolPolicyEnum
-> Origin
Origin'
(Maybe RegionName
-> Maybe ResourceType
-> Maybe Text
-> Maybe OriginProtocolPolicyEnum
-> Origin)
-> Parser (Maybe RegionName)
-> Parser
(Maybe ResourceType
-> Maybe Text -> Maybe OriginProtocolPolicyEnum -> Origin)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe RegionName)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"regionName")
Parser
(Maybe ResourceType
-> Maybe Text -> Maybe OriginProtocolPolicyEnum -> Origin)
-> Parser (Maybe ResourceType)
-> Parser (Maybe Text -> Maybe OriginProtocolPolicyEnum -> Origin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResourceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resourceType")
Parser (Maybe Text -> Maybe OriginProtocolPolicyEnum -> Origin)
-> Parser (Maybe Text)
-> Parser (Maybe OriginProtocolPolicyEnum -> Origin)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
Parser (Maybe OriginProtocolPolicyEnum -> Origin)
-> Parser (Maybe OriginProtocolPolicyEnum) -> Parser Origin
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe OriginProtocolPolicyEnum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"protocolPolicy")
)
instance Prelude.Hashable Origin
instance Prelude.NFData Origin