easycdn

package module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 8 Imported by: 1

README

EasyCDN

EasyCDN is AWS CDK L3 Construct that takes care about configuration of the infrastructure required to securely deliver content through AWS CloudFront.

Build Status Git Hub Coverage Status npm

Inspiration

AWS CloudFront is a convenient approach for static content distribution. Unfortunately, it requires a boilerplate AWS CDK code to bootstrap the provisioning of required resources. This L3 Construct implements a high-order components on top of AWS CDK that simplify the deployment.

It is implemented as using jsii, making it available

Getting started

The latest version of the library is available at its main branch. All development, including new features and bug fixes, take place on the main branch using forking and pull requests as described in contribution guidelines.

npm install --save easycdn
Example of usage
import * as easy from 'easycdn'
const stack = new cdk.Stack(app, 'test', { /* ... */ })

// creation of CDN requires definition of
//  - site name
//  - tls certificate arn
const cdn = new easy.Cdn(stack, 'CDN',
  'cdn.example.com',
  'arn:aws:acm:us-east-1:000000000000:certificate/xxxxxxxx-xx...xxxx',
)

HowTo Contribute

The project is MIT licensed and accepts contributions via GitHub pull requests:

  1. Fork it and clone
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
git clone https://github.com/fogfish/easycdn
cd scud

npm install
npm run build
npm run test
npm run lint

HowTo Release Runtime

npm run build
npm run package

cp -R dist/go/easycdn github.com/fogfish/go-cdk-easycdn

License

See LICENSE

Documentation

Overview

EasyCDN is AWS CDK L3 Construct to spawn AWS CloudFront.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cdn_IsConstruct

func Cdn_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.

Returns: true if `x` is an object created from a class which extends `Construct`.

func NewCdn_Override

func NewCdn_Override(c Cdn, scope constructs.Construct, id *string, props *CdnProps)

Types

type Cdn

type Cdn interface {
	constructs.Construct
	Distribution() awscloudfront.CloudFrontWebDistribution
	// The tree node.
	Node() constructs.Node
	// Returns a string representation of this construct.
	ToString() *string
}

func NewCdn

func NewCdn(scope constructs.Construct, id *string, props *CdnProps) Cdn

type CdnProps

type CdnProps struct {
	Site              *string                   `field:"required" json:"site" yaml:"site"`
	TlsCertificateArn *string                   `field:"required" json:"tlsCertificateArn" yaml:"tlsCertificateArn"`
	Bucket            awss3.Bucket              `field:"optional" json:"bucket" yaml:"bucket"`
	HttpVersion       awscloudfront.HttpVersion `field:"optional" json:"httpVersion" yaml:"httpVersion"`
}

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL