Add manually managed AWS package files

This checkin contains all the non-generated package files.  This includes
the package metadata, utility functions like utils/instanceMaps, and the
module layouts (these being a candidate for auto-generation down the road).

In addition, the install script has been updated fo reflect the new layout.
This commit is contained in:
joeduffy 2017-04-28 15:38:45 -07:00
parent ec03441a15
commit 3a4866f7c1
20 changed files with 388 additions and 15 deletions

3
lib/aws/.gitignore vendored
View file

@ -1,3 +1,2 @@
.coconut/
node_modules/
/bin/

View file

@ -4,23 +4,22 @@
set -e # bail on errors
echo Compiling:
cocojs # compile the package
pushd provider/ && # compile the resource provider
go build -o ../.coconut/bin/coco-resource-aws &&
popd
echo Verifying:
coco pack verify # ensure the package verifies
echo Sharing NPM links:
yarn link # let NPM references resolve easily.
pushd pack/ > /dev/null && # compile the package
cocojs &&
coco pack verify && # ensure the package verifies.
yarn link && # let NPM references resolve easily.
cp -R ./.coconut/bin/ ../bin &&
popd > /dev/null
pushd provider/ > /dev/null && # compile the resource provider
go build -o ../bin/coco-resource-aws &&
popd > /dev/null
COCOLIB=/usr/local/coconut/lib
THISLIB=$COCOLIB/aws/
echo Installing Coconut AWS library to $THISLIB:
mkdir -p $COCOLIB # ensure the target library directory exists
rm -rf $THISLIB # clean the target
cp -Rv ./.coconut/bin/ $THISLIB # copy to the standard library location
mkdir -p $COCOLIB # ensure the target library directory exists
rm -rf $THISLIB # clean the target
cp -R ./bin/ $THISLIB # copy to the standard library location
echo Done.

3
lib/aws/pack/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
.coconut/
node_modules/

View file

@ -0,0 +1,5 @@
name: aws
description: A collection of AWS resources as Coconut stacks.
dependencies:
coconut: "*"

View file

@ -0,0 +1,16 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
export * from "./account";
export * from "./apiKey";
export * from "./authorizer";
export * from "./basePathMapping";
export * from "./clientCertificate";
export * from "./deployment";
export * from "./method";
export * from "./model";
export * from "./resource";
export * from "./restAPI";
export * from "./stage";
export * from "./usagePlan";
export * from "./usagePlanKey";

View file

@ -0,0 +1,4 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
export * from "./alarm";

View file

@ -0,0 +1,24 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
import {Region} from "../types";
// region configures the target region for a deployment. The provider explicitly does not recognize AWS_REGION,
// to minimize the possibility of accidental deployment differences due to a changing environment variable.
export let region: Region | undefined;
// requireRegion fetches the AWS region, requiring that it exists; if it has not been configured, an error is thrown.
export function requireRegion(): Region {
if (region === undefined) {
throw new Error("No AWS region has been configured");
}
return region;
}
// accessKeyId configures the access key ID used to access AWS. This is a secret. If not provided, the
// provider will look in the standard places (~/.aws/credentials, AWS_ACCESS_KEY_ID, etc).
export let accessKeyId: string | undefined;
// secretAcessKey configures the secret access key used to access AWS. This is a secret. If not provided, the
// provider will look in the standard places (~/.aws/credentials, AWS_SECRET_ACCESS_KEY, etc).
export let secretAccessKey: string | undefined; // the secret access key used to access AWS.

14
lib/aws/pack/ec2/index.ts Normal file
View file

@ -0,0 +1,14 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
export * from "./instance";
export * from "./internetGateway";
export * from "./route";
export * from "./routeTable";
export * from "./securityGroup";
export * from "./securityGroupEgress";
export * from "./securityGroupIngress";
export * from "./subnet";
export * from "./vpc";
export * from "./vpcGatewayAttachment";
export * from "./vpcPeeringConnection";

View file

@ -0,0 +1,7 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
export * from "./group";
export * from "./policy";
export * from "./role";
export * from "./user";

16
lib/aws/pack/index.ts Normal file
View file

@ -0,0 +1,16 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
export * from "./types";
import * as apigateway from "./apigateway";
import * as cloudwatch from "./cloudwatch";
import * as config from "./config";
import * as ec2 from "./ec2";
import * as iam from "./iam";
import * as kms from "./kms";
import * as lambda from "./lambda";
import * as s3 from "./s3";
import * as sns from "./sns";
import * as sqs from "./sqs";
export {apigateway, cloudwatch, config, ec2, iam, kms, lambda, s3, sns, sqs};

View file

@ -0,0 +1,4 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
export * from "./key";

View file

@ -0,0 +1,5 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
export * from "./function";
export * from "./permission";

15
lib/aws/pack/package.json Normal file
View file

@ -0,0 +1,15 @@
{
"name": "@coconut/aws",
"main": ".coconut/bin/index.js",
"typings": ".coconut/bin/index.d.ts",
"scripts": {
"build": "tsc"
},
"devDependencies": {
"typescript": "^2.1.4"
},
"peerDependencies": {
"@coconut/coconut": "*"
}
}

6
lib/aws/pack/s3/index.ts Normal file
View file

@ -0,0 +1,6 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
export * from "./acl";
export * from "./bucket";
export * from "./object";

View file

@ -0,0 +1,4 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
export * from "./topic";

View file

@ -0,0 +1,4 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
export * from "./queue";

View file

@ -0,0 +1,81 @@
{
"compilerOptions": {
"outDir": ".coconut/bin",
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"sourceMap": true,
"stripInternal": true,
"experimentalDecorators": true,
"pretty": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"forceConsistentCasingInFileNames": true,
"strictNullChecks": true
},
"files": [
"index.ts",
"types.ts",
"apigateway/index.ts",
"apigateway/account.ts",
"apigateway/apiKey.ts",
"apigateway/authorizer.ts",
"apigateway/basePathMapping.ts",
"apigateway/clientCertificate.ts",
"apigateway/deployment.ts",
"apigateway/method.ts",
"apigateway/model.ts",
"apigateway/resource.ts",
"apigateway/restAPI.ts",
"apigateway/stage.ts",
"apigateway/usagePlan.ts",
"apigateway/usagePlanKey.ts",
"config/index.ts",
"cloudwatch/index.ts",
"cloudwatch/alarm.ts",
"ec2/index.ts",
"ec2/internetGateway.ts",
"ec2/route.ts",
"ec2/routeTable.ts",
"ec2/securityGroup.ts",
"ec2/securityGroupEgress.ts",
"ec2/securityGroupIngress.ts",
"ec2/subnet.ts",
"ec2/vpc.ts",
"ec2/vpcGatewayAttachment.ts",
"ec2/vpcPeeringConnection.ts",
"iam/index.ts",
"iam/group.ts",
"iam/policy.ts",
"iam/role.ts",
"iam/user.ts",
"kms/index.ts",
"kms/key.ts",
"lambda/index.ts",
"lambda/function.ts",
"lambda/permission.ts",
"s3/index.ts",
"s3/bucket.ts",
"s3/object.ts",
"sns/index.ts",
"sns/topic.ts",
"sqs/index.ts",
"sqs/queue.ts",
"utils/index.ts",
"utils/instanceMaps.ts"
]
}

View file

@ -0,0 +1,4 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
export * from "./instanceMaps";

View file

@ -0,0 +1,156 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
// This file defines some maps that correspond to the recommended AWS Marketplace values:
// http://docs.aws.amazon.com/servicecatalog/latest/adminguide/catalogs_marketplace-products.html
// Ultimately, this lets us choose a recommended Amazon Linux AMI; see:
// https://aws.amazon.com/amazon-linux-ami/instance-type-matrix/
import * as config from "../config";
// instanceTypeArch is a map of instance type to its architecture.
export let instanceTypeArch: {
[instanceType: string]: string
} = {
"t1.micro" : "PV64" ,
"t2.nano" : "HVM64",
"t2.micro" : "HVM64",
"t2.small" : "HVM64",
"t2.medium" : "HVM64",
"t2.large" : "HVM64",
"m1.small" : "PV64" ,
"m1.medium" : "PV64" ,
"m1.large" : "PV64" ,
"m1.xlarge" : "PV64" ,
"m2.xlarge" : "PV64" ,
"m2.2xlarge" : "PV64" ,
"m2.4xlarge" : "PV64" ,
"m3.medium" : "HVM64",
"m3.large" : "HVM64",
"m3.xlarge" : "HVM64",
"m3.2xlarge" : "HVM64",
"m4.large" : "HVM64",
"m4.xlarge" : "HVM64",
"m4.2xlarge" : "HVM64",
"m4.4xlarge" : "HVM64",
"m4.10xlarge": "HVM64",
"c1.medium" : "PV64" ,
"c1.xlarge" : "PV64" ,
"c3.large" : "HVM64",
"c3.xlarge" : "HVM64",
"c3.2xlarge" : "HVM64",
"c3.4xlarge" : "HVM64",
"c3.8xlarge" : "HVM64",
"c4.large" : "HVM64",
"c4.xlarge" : "HVM64",
"c4.2xlarge" : "HVM64",
"c4.4xlarge" : "HVM64",
"c4.8xlarge" : "HVM64",
"g2.2xlarge" : "HVMG2",
"g2.8xlarge" : "HVMG2",
"r3.large" : "HVM64",
"r3.xlarge" : "HVM64",
"r3.2xlarge" : "HVM64",
"r3.4xlarge" : "HVM64",
"r3.8xlarge" : "HVM64",
"i2.xlarge" : "HVM64",
"i2.2xlarge" : "HVM64",
"i2.4xlarge" : "HVM64",
"i2.8xlarge" : "HVM64",
"d2.xlarge" : "HVM64",
"d2.2xlarge" : "HVM64",
"d2.4xlarge" : "HVM64",
"d2.8xlarge" : "HVM64",
"hi1.4xlarge": "HVM64",
"hs1.8xlarge": "HVM64",
"cr1.8xlarge": "HVM64",
"cc2.8xlarge": "HVM64",
};
// regionArchLinuxAMI is a map from region to inner maps from architecture to the recommended Linux AMI.
export let regionArchLinuxAMI: {
[region: string]: { [arch: string]: string; }
} = {
"us-east-1": {
"PV64" : "ami-2a69aa47",
"HVM64": "ami-6869aa05",
"HVMG2": "ami-648d9973",
},
"us-west-2": {
"PV64" : "ami-7f77b31f",
"HVM64": "ami-7172b611",
"HVMG2": "ami-09cd7a69",
},
"us-west-1": {
"PV64" : "ami-a2490dc2",
"HVM64": "ami-31490d51",
"HVMG2": "ami-1e5f0e7e",
},
"eu-west-1": {
"PV64" : "ami-4cdd453f",
"HVM64": "ami-f9dd458a",
"HVMG2": "ami-b4694ac7",
},
"eu-west-2": {
"PV64" : "NOT_SUPPORTED",
"HVM64": "ami-886369ec",
"HVMG2": "NOT_SUPPORTED",
},
"eu-central-1": {
"PV64" : "ami-6527cf0a",
"HVM64": "ami-ea26ce85",
"HVMG2": "ami-de5191b1",
},
"ap-northeast-1": {
"PV64" : "ami-3e42b65f",
"HVM64": "ami-374db956",
"HVMG2": "ami-df9ff4b8",
},
"ap-northeast-2": {
"PV64" : "NOT_SUPPORTED",
"HVM64": "ami-2b408b45",
"HVMG2": "NOT_SUPPORTED",
},
"ap-southeast-1": {
"PV64" : "ami-df9e4cbc",
"HVM64": "ami-a59b49c6",
"HVMG2": "ami-8d8d23ee",
},
"ap-southeast-2": {
"PV64" : "ami-63351d00",
"HVM64": "ami-dc361ebf",
"HVMG2": "ami-cbaf94a8",
},
"ap-south-1": {
"PV64" : "NOT_SUPPORTED",
"HVM64": "ami-ffbdd790",
"HVMG2": "ami-decdbab1",
},
"us-east-2": {
"PV64" : "NOT_SUPPORTED",
"HVM64": "ami-f6035893",
"HVMG2": "NOT_SUPPORTED",
},
"ca-central-1": {
"PV64" : "NOT_SUPPORTED",
"HVM64": "ami-730ebd17",
"HVMG2": "NOT_SUPPORTED",
},
"sa-east-1": {
"PV64" : "ami-1ad34676",
"HVM64": "ami-6dd04501",
"HVMG2": "NOT_SUPPORTED",
},
"cn-north-1": {
"PV64" : "ami-77559f1a",
"HVM64": "ami-8e6aa0e3",
"HVMG2": "NOT_SUPPORTED",
}
};
// getLinuxAMI gets the recommended Linux AMI for the given instance in the current AWS region.
export function getLinuxAMI(instanceType: string): string {
let region = config.requireRegion();
let arch = instanceTypeArch[instanceType];
return regionArchLinuxAMI[region][arch];
}

7
lib/aws/pack/yarn.lock Normal file
View file

@ -0,0 +1,7 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
typescript@^2.1.4:
version "2.2.0"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.2.0.tgz#626f2fc70087d2480f21ebb12c1888288c8614e3"