runway.hooks.staticsite.upload_staticsite module¶
CFNgin hook for syncing static website to S3 bucket.
-
runway.hooks.staticsite.upload_staticsite.
get_archives_to_prune
(archives, hook_data)[source]¶ Return list of keys to delete.
- Parameters
archives (Dict) – The full list of file archives
hook_data (Dict) – CFNgin hook data
-
runway.hooks.staticsite.upload_staticsite.
sync
(context, provider, **kwargs)[source]¶ Sync static website to S3 bucket.
- Parameters
context (
runway.cfngin.context.Context
) – The context instance.provider (
runway.cfngin.providers.base.BaseProvider
) – The provider instance.
-
runway.hooks.staticsite.upload_staticsite.
display_static_website_url
(website_url_handle, provider, context)[source]¶ Based on the url handle display the static website url.
- Parameters
website_url_handle (str) – the Output handle for the website url
provider (
runway.cfngin.providers.base.BaseProvider
) – The provider instance.context (
runway.cfngin.context.Context
) – context instance
-
runway.hooks.staticsite.upload_staticsite.
update_ssm_hash
(context, session)[source]¶ Update the SSM hash with the new tracking data.
- Parameters
context (
runway.cfngin.context.Context
) – context instancesession (
runway.cfngin.session.Session
) – CFNgin session
-
runway.hooks.staticsite.upload_staticsite.
get_distribution_data
(context, provider, **kwargs)[source]¶ Retrieve information about the distribution.
- Parameters
context (
runway.cfngin.context.Context
) – The context instance.provider (
runway.cfngin.providers.base.BaseProvider
) – The provider instance
-
runway.hooks.staticsite.upload_staticsite.
invalidate_distribution
(session, identifier='', path='', domain='', **_)[source]¶ Invalidate the current distribution.
- Parameters
session (Session) – The current CFNgin session.
identifier (string) – The distribution id.
path (string) – The distribution path.
domain (string) – The distribution domain.
-
runway.hooks.staticsite.upload_staticsite.
prune_archives
(context, session)[source]¶ Prune the archives from the bucket.
- Parameters
context (
runway.cfngin.context.Context
) – The context instance.session (
runway.cfngin.session.Session
) – The CFNgin session.
-
runway.hooks.staticsite.upload_staticsite.
auto_detect_content_type
(filename)[source]¶ Auto detects the content type based on the filename.
-
runway.hooks.staticsite.upload_staticsite.
get_content_type
(extra_file)[source]¶ Return the content type of the file.
-
runway.hooks.staticsite.upload_staticsite.
get_content
(extra_file)[source]¶ Get serialized content based on content_type.
-
runway.hooks.staticsite.upload_staticsite.
calculate_hash_of_extra_files
(extra_files)[source]¶ Return a hash of all of the given extra files.
Adapted from stacker.hooks.aws_lambda; used according to its license: https://github.com/cloudtools/stacker/blob/1.4.0/LICENSE
All attributes of the extra file object are included when hashing: name, content_type, content, and file data.
-
runway.hooks.staticsite.upload_staticsite.
get_ssm_value
(session, name)[source]¶ Get the ssm parameter value.
-
runway.hooks.staticsite.upload_staticsite.
set_ssm_value
(session, name, value, description='')[source]¶ Set the ssm parameter.
-
runway.hooks.staticsite.upload_staticsite.
sync_extra_files
(context, bucket, extra_files, **kwargs)[source]¶ Sync static website extra files to S3 bucket.
- Parameters
context (
runway.cfngin.context.Context
) – The context instance.bucket (str) – The static site bucket name.
extra_files (List[Dict[str, str]]) – List of files and file content that should be uploaded.