{-# 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.AccessRules where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types.AccessType
import qualified Amazonka.Prelude as Prelude
data AccessRules = AccessRules'
{
AccessRules -> Maybe AccessType
getObject :: Prelude.Maybe AccessType,
AccessRules -> Maybe Bool
allowPublicOverrides :: Prelude.Maybe Prelude.Bool
}
deriving (AccessRules -> AccessRules -> Bool
(AccessRules -> AccessRules -> Bool)
-> (AccessRules -> AccessRules -> Bool) -> Eq AccessRules
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccessRules -> AccessRules -> Bool
$c/= :: AccessRules -> AccessRules -> Bool
== :: AccessRules -> AccessRules -> Bool
$c== :: AccessRules -> AccessRules -> Bool
Prelude.Eq, ReadPrec [AccessRules]
ReadPrec AccessRules
Int -> ReadS AccessRules
ReadS [AccessRules]
(Int -> ReadS AccessRules)
-> ReadS [AccessRules]
-> ReadPrec AccessRules
-> ReadPrec [AccessRules]
-> Read AccessRules
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccessRules]
$creadListPrec :: ReadPrec [AccessRules]
readPrec :: ReadPrec AccessRules
$creadPrec :: ReadPrec AccessRules
readList :: ReadS [AccessRules]
$creadList :: ReadS [AccessRules]
readsPrec :: Int -> ReadS AccessRules
$creadsPrec :: Int -> ReadS AccessRules
Prelude.Read, Int -> AccessRules -> ShowS
[AccessRules] -> ShowS
AccessRules -> String
(Int -> AccessRules -> ShowS)
-> (AccessRules -> String)
-> ([AccessRules] -> ShowS)
-> Show AccessRules
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccessRules] -> ShowS
$cshowList :: [AccessRules] -> ShowS
show :: AccessRules -> String
$cshow :: AccessRules -> String
showsPrec :: Int -> AccessRules -> ShowS
$cshowsPrec :: Int -> AccessRules -> ShowS
Prelude.Show, (forall x. AccessRules -> Rep AccessRules x)
-> (forall x. Rep AccessRules x -> AccessRules)
-> Generic AccessRules
forall x. Rep AccessRules x -> AccessRules
forall x. AccessRules -> Rep AccessRules x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccessRules x -> AccessRules
$cfrom :: forall x. AccessRules -> Rep AccessRules x
Prelude.Generic)
newAccessRules ::
AccessRules
newAccessRules :: AccessRules
newAccessRules =
AccessRules' :: Maybe AccessType -> Maybe Bool -> AccessRules
AccessRules'
{ $sel:getObject:AccessRules' :: Maybe AccessType
getObject = Maybe AccessType
forall a. Maybe a
Prelude.Nothing,
$sel:allowPublicOverrides:AccessRules' :: Maybe Bool
allowPublicOverrides = Maybe Bool
forall a. Maybe a
Prelude.Nothing
}
accessRules_getObject :: Lens.Lens' AccessRules (Prelude.Maybe AccessType)
accessRules_getObject :: (Maybe AccessType -> f (Maybe AccessType))
-> AccessRules -> f AccessRules
accessRules_getObject = (AccessRules -> Maybe AccessType)
-> (AccessRules -> Maybe AccessType -> AccessRules)
-> Lens
AccessRules AccessRules (Maybe AccessType) (Maybe AccessType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessRules' {Maybe AccessType
getObject :: Maybe AccessType
$sel:getObject:AccessRules' :: AccessRules -> Maybe AccessType
getObject} -> Maybe AccessType
getObject) (\s :: AccessRules
s@AccessRules' {} Maybe AccessType
a -> AccessRules
s {$sel:getObject:AccessRules' :: Maybe AccessType
getObject = Maybe AccessType
a} :: AccessRules)
accessRules_allowPublicOverrides :: Lens.Lens' AccessRules (Prelude.Maybe Prelude.Bool)
accessRules_allowPublicOverrides :: (Maybe Bool -> f (Maybe Bool)) -> AccessRules -> f AccessRules
accessRules_allowPublicOverrides = (AccessRules -> Maybe Bool)
-> (AccessRules -> Maybe Bool -> AccessRules)
-> Lens AccessRules AccessRules (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessRules' {Maybe Bool
allowPublicOverrides :: Maybe Bool
$sel:allowPublicOverrides:AccessRules' :: AccessRules -> Maybe Bool
allowPublicOverrides} -> Maybe Bool
allowPublicOverrides) (\s :: AccessRules
s@AccessRules' {} Maybe Bool
a -> AccessRules
s {$sel:allowPublicOverrides:AccessRules' :: Maybe Bool
allowPublicOverrides = Maybe Bool
a} :: AccessRules)
instance Core.FromJSON AccessRules where
parseJSON :: Value -> Parser AccessRules
parseJSON =
String
-> (Object -> Parser AccessRules) -> Value -> Parser AccessRules
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AccessRules"
( \Object
x ->
Maybe AccessType -> Maybe Bool -> AccessRules
AccessRules'
(Maybe AccessType -> Maybe Bool -> AccessRules)
-> Parser (Maybe AccessType) -> Parser (Maybe Bool -> AccessRules)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AccessType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"getObject")
Parser (Maybe Bool -> AccessRules)
-> Parser (Maybe Bool) -> Parser AccessRules
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"allowPublicOverrides")
)
instance Prelude.Hashable AccessRules
instance Prelude.NFData AccessRules
instance Core.ToJSON AccessRules where
toJSON :: AccessRules -> Value
toJSON AccessRules' {Maybe Bool
Maybe AccessType
allowPublicOverrides :: Maybe Bool
getObject :: Maybe AccessType
$sel:allowPublicOverrides:AccessRules' :: AccessRules -> Maybe Bool
$sel:getObject:AccessRules' :: AccessRules -> Maybe AccessType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"getObject" Text -> AccessType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AccessType -> Pair) -> Maybe AccessType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AccessType
getObject,
(Text
"allowPublicOverrides" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
allowPublicOverrides
]
)