{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 Text
name :: Prelude.Maybe Prelude.Text,
Origin -> Maybe OriginProtocolPolicyEnum
protocolPolicy :: Prelude.Maybe OriginProtocolPolicyEnum,
Origin -> Maybe RegionName
regionName :: Prelude.Maybe RegionName,
Origin -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType
}
deriving (Origin -> Origin -> Bool
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]
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
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. 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'
{ $sel:name:Origin' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:protocolPolicy:Origin' :: Maybe OriginProtocolPolicyEnum
protocolPolicy = forall a. Maybe a
Prelude.Nothing,
$sel:regionName:Origin' :: Maybe RegionName
regionName = forall a. Maybe a
Prelude.Nothing,
$sel:resourceType:Origin' :: Maybe ResourceType
resourceType = forall a. Maybe a
Prelude.Nothing
}
origin_name :: Lens.Lens' Origin (Prelude.Maybe Prelude.Text)
origin_name :: Lens' Origin (Maybe Text)
origin_name = 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 :: Lens' Origin (Maybe OriginProtocolPolicyEnum)
origin_protocolPolicy = 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)
origin_regionName :: Lens.Lens' Origin (Prelude.Maybe RegionName)
origin_regionName :: Lens' Origin (Maybe RegionName)
origin_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 :: Lens' Origin (Maybe ResourceType)
origin_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)
instance Data.FromJSON Origin where
parseJSON :: Value -> Parser Origin
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Origin"
( \Object
x ->
Maybe Text
-> Maybe OriginProtocolPolicyEnum
-> Maybe RegionName
-> Maybe ResourceType
-> Origin
Origin'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"name")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"protocolPolicy")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"regionName")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"resourceType")
)
instance Prelude.Hashable Origin where
hashWithSalt :: Int -> Origin -> Int
hashWithSalt Int
_salt Origin' {Maybe Text
Maybe OriginProtocolPolicyEnum
Maybe RegionName
Maybe ResourceType
resourceType :: Maybe ResourceType
regionName :: Maybe RegionName
protocolPolicy :: Maybe OriginProtocolPolicyEnum
name :: Maybe Text
$sel:resourceType:Origin' :: Origin -> Maybe ResourceType
$sel:regionName:Origin' :: Origin -> Maybe RegionName
$sel:protocolPolicy:Origin' :: Origin -> Maybe OriginProtocolPolicyEnum
$sel:name:Origin' :: Origin -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OriginProtocolPolicyEnum
protocolPolicy
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RegionName
regionName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceType
resourceType
instance Prelude.NFData Origin where
rnf :: Origin -> ()
rnf Origin' {Maybe Text
Maybe OriginProtocolPolicyEnum
Maybe RegionName
Maybe ResourceType
resourceType :: Maybe ResourceType
regionName :: Maybe RegionName
protocolPolicy :: Maybe OriginProtocolPolicyEnum
name :: Maybe Text
$sel:resourceType:Origin' :: Origin -> Maybe ResourceType
$sel:regionName:Origin' :: Origin -> Maybe RegionName
$sel:protocolPolicy:Origin' :: Origin -> Maybe OriginProtocolPolicyEnum
$sel:name:Origin' :: Origin -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OriginProtocolPolicyEnum
protocolPolicy
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RegionName
regionName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceType
resourceType