module Stratosphere.CloudFront.Distribution (
        module Exports, Distribution(..), mkDistribution
    ) where
import qualified Data.Aeson as JSON
import qualified Stratosphere.Prelude as Prelude
import Stratosphere.Property
import {-# SOURCE #-} Stratosphere.CloudFront.Distribution.DistributionConfigProperty as Exports
import Stratosphere.ResourceProperties
import Stratosphere.Tag
data Distribution
  = -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distribution.html>
    Distribution {Distribution -> ()
haddock_workaround_ :: (),
                  -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distribution.html#cfn-cloudfront-distribution-distributionconfig>
                  Distribution -> DistributionConfigProperty
distributionConfig :: DistributionConfigProperty,
                  -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distribution.html#cfn-cloudfront-distribution-tags>
                  Distribution -> Maybe [Tag]
tags :: (Prelude.Maybe [Tag])}
  deriving stock (Distribution -> Distribution -> Bool
(Distribution -> Distribution -> Bool)
-> (Distribution -> Distribution -> Bool) -> Eq Distribution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Distribution -> Distribution -> Bool
== :: Distribution -> Distribution -> Bool
$c/= :: Distribution -> Distribution -> Bool
/= :: Distribution -> Distribution -> Bool
Prelude.Eq, Int -> Distribution -> ShowS
[Distribution] -> ShowS
Distribution -> String
(Int -> Distribution -> ShowS)
-> (Distribution -> String)
-> ([Distribution] -> ShowS)
-> Show Distribution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Distribution -> ShowS
showsPrec :: Int -> Distribution -> ShowS
$cshow :: Distribution -> String
show :: Distribution -> String
$cshowList :: [Distribution] -> ShowS
showList :: [Distribution] -> ShowS
Prelude.Show)
mkDistribution :: DistributionConfigProperty -> Distribution
mkDistribution :: DistributionConfigProperty -> Distribution
mkDistribution DistributionConfigProperty
distributionConfig
  = Distribution
      {haddock_workaround_ :: ()
haddock_workaround_ = (), distributionConfig :: DistributionConfigProperty
distributionConfig = DistributionConfigProperty
distributionConfig,
       tags :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing}
instance ToResourceProperties Distribution where
  toResourceProperties :: Distribution -> ResourceProperties
toResourceProperties Distribution {Maybe [Tag]
()
DistributionConfigProperty
haddock_workaround_ :: Distribution -> ()
distributionConfig :: Distribution -> DistributionConfigProperty
tags :: Distribution -> Maybe [Tag]
haddock_workaround_ :: ()
distributionConfig :: DistributionConfigProperty
tags :: Maybe [Tag]
..}
    = ResourceProperties
        {awsType :: Text
awsType = Text
"AWS::CloudFront::Distribution",
         supportsTags :: Bool
supportsTags = Bool
Prelude.True,
         properties :: Object
properties = [Item Object] -> Object
forall l. IsList l => [Item l] -> l
Prelude.fromList
                        ([(Key, Value)] -> [(Key, Value)] -> [(Key, Value)]
forall a. Semigroup a => a -> a -> a
(Prelude.<>)
                           [Key
"DistributionConfig" Key -> DistributionConfigProperty -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
JSON..= DistributionConfigProperty
distributionConfig]
                           ([Maybe (Key, Value)] -> [(Key, Value)]
forall a. [Maybe a] -> [a]
Prelude.catMaybes [Key -> [Tag] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
(JSON..=) Key
"Tags" ([Tag] -> (Key, Value)) -> Maybe [Tag] -> Maybe (Key, Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags]))}
instance JSON.ToJSON Distribution where
  toJSON :: Distribution -> Value
toJSON Distribution {Maybe [Tag]
()
DistributionConfigProperty
haddock_workaround_ :: Distribution -> ()
distributionConfig :: Distribution -> DistributionConfigProperty
tags :: Distribution -> Maybe [Tag]
haddock_workaround_ :: ()
distributionConfig :: DistributionConfigProperty
tags :: Maybe [Tag]
..}
    = [(Key, Value)] -> Value
JSON.object
        ([Item [(Key, Value)]] -> [(Key, Value)]
forall l. IsList l => [Item l] -> l
Prelude.fromList
           ([(Key, Value)] -> [(Key, Value)] -> [(Key, Value)]
forall a. Semigroup a => a -> a -> a
(Prelude.<>)
              [Key
"DistributionConfig" Key -> DistributionConfigProperty -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
JSON..= DistributionConfigProperty
distributionConfig]
              ([Maybe (Key, Value)] -> [(Key, Value)]
forall a. [Maybe a] -> [a]
Prelude.catMaybes [Key -> [Tag] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
(JSON..=) Key
"Tags" ([Tag] -> (Key, Value)) -> Maybe [Tag] -> Maybe (Key, Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags])))
instance Property "DistributionConfig" Distribution where
  type PropertyType "DistributionConfig" Distribution = DistributionConfigProperty
  set :: PropertyType "DistributionConfig" Distribution
-> Distribution -> Distribution
set PropertyType "DistributionConfig" Distribution
newValue Distribution {Maybe [Tag]
()
DistributionConfigProperty
haddock_workaround_ :: Distribution -> ()
distributionConfig :: Distribution -> DistributionConfigProperty
tags :: Distribution -> Maybe [Tag]
haddock_workaround_ :: ()
distributionConfig :: DistributionConfigProperty
tags :: Maybe [Tag]
..}
    = Distribution {distributionConfig :: DistributionConfigProperty
distributionConfig = PropertyType "DistributionConfig" Distribution
DistributionConfigProperty
newValue, Maybe [Tag]
()
haddock_workaround_ :: ()
tags :: Maybe [Tag]
haddock_workaround_ :: ()
tags :: Maybe [Tag]
..}
instance Property "Tags" Distribution where
  type PropertyType "Tags" Distribution = [Tag]
  set :: PropertyType "Tags" Distribution -> Distribution -> Distribution
set PropertyType "Tags" Distribution
newValue Distribution {Maybe [Tag]
()
DistributionConfigProperty
haddock_workaround_ :: Distribution -> ()
distributionConfig :: Distribution -> DistributionConfigProperty
tags :: Distribution -> Maybe [Tag]
haddock_workaround_ :: ()
distributionConfig :: DistributionConfigProperty
tags :: Maybe [Tag]
..}
    = Distribution {tags :: Maybe [Tag]
tags = [Tag] -> Maybe [Tag]
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure [Tag]
PropertyType "Tags" Distribution
newValue, ()
DistributionConfigProperty
haddock_workaround_ :: ()
distributionConfig :: DistributionConfigProperty
haddock_workaround_ :: ()
distributionConfig :: DistributionConfigProperty
..}