Class: Serverkit::Resources::CloudFrontWebDistribution

Inherits:
Base
  • Object
show all
Includes:
Aws::ClientOptionsGeneratable
Defined in:
lib/serverkit/resources/cloud_front_web_distribution.rb

Constant Summary collapse

DEFAULT_DISTRIBUTION_CONFIG =
{
  comment: "Created by serverkit-aws",
  default_cache_behavior: {
    forwarded_values: {
      cookies: {
        forward: "none",
      },
      query_string: false,
    },
    min_ttl: 0,
    trusted_signers: {
      enabled: false,
      quantity: 0,
    },
    viewer_protocol_policy: "allow-all",
  },
  enabled: true,
}

Instance Method Summary collapse

Instance Method Details

#applyObject

Note:

Override



36
37
38
39
40
41
42
43
# File 'lib/serverkit/resources/cloud_front_web_distribution.rb', line 36

def apply
  client.create_distribution(
    distribution_config: DEFAULT_DISTRIBUTION_CONFIG.deep_merge(
      distribution_config.deep_symbolize_keys,
    )
  )
rescue ::Aws::CloudFront::Errors::DistributionAlreadyExists
end

#checkObject

Note:

Override



46
47
48
# File 'lib/serverkit/resources/cloud_front_web_distribution.rb', line 46

def check
  false
end

#recheckObject

Note:

Override



51
52
53
# File 'lib/serverkit/resources/cloud_front_web_distribution.rb', line 51

def recheck
  true
end