Skip to content

Commit

Permalink
refactor: update all enum members to be UPPER_CASE (#2918)
Browse files Browse the repository at this point in the history
Updating enum members in all constructs to be UPPER_CASE.

This is in accordance with the new construct library guidelines.

**Fixes #2287**

BREAKING CHANGE: all enum members were changed from `PascalCase` to `TRUMP_CASE`
  • Loading branch information
shivlaks authored Jun 20, 2019
1 parent d9d3a99 commit dbf3e17
Show file tree
Hide file tree
Showing 224 changed files with 1,446 additions and 1,445 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ class FakeAction extends codepipeline.Action {
super({
actionName,
artifactBounds: { minInputs: 0, maxInputs: 5, minOutputs: 0, maxOutputs: 5 },
category: codepipeline.ActionCategory.Test,
category: codepipeline.ActionCategory.TEST,
provider: 'Test',
});

Expand Down
24 changes: 12 additions & 12 deletions packages/@aws-cdk/aws-apigateway/lib/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ export enum ContentHandling {
/**
* Converts a request payload from a base64-encoded string to a binary blob.
*/
ConvertToBinary = 'CONVERT_TO_BINARY',
CONVERT_TO_BINARY = 'CONVERT_TO_BINARY',

/**
* Converts a request payload from a binary blob to a base64-encoded string.
*/
ConvertToText = 'CONVERT_TO_TEXT'
CONVERT_TO_TEXT = 'CONVERT_TO_TEXT'
}

export enum IntegrationType {
Expand All @@ -170,67 +170,67 @@ export enum IntegrationType {
* integration. With any other AWS service action, this is known as AWS
* integration.
*/
Aws = 'AWS',
AWS = 'AWS',

/**
* For integrating the API method request with the Lambda function-invoking
* action with the client request passed through as-is. This integration is
* also referred to as the Lambda proxy integration
*/
AwsProxy = 'AWS_PROXY',
AWS_PROXY = 'AWS_PROXY',

/**
* For integrating the API method request with an HTTP endpoint, including a
* private HTTP endpoint within a VPC. This integration is also referred to
* as the HTTP custom integration.
*/
Http = 'HTTP',
HTTP = 'HTTP',

/**
* For integrating the API method request with an HTTP endpoint, including a
* private HTTP endpoint within a VPC, with the client request passed
* through as-is. This is also referred to as the HTTP proxy integration
*/
HttpProxy = 'HTTP_PROXY',
HTTP_PROXY = 'HTTP_PROXY',

/**
* For integrating the API method request with API Gateway as a "loop-back"
* endpoint without invoking any backend.
*/
Mock = 'MOCK'
MOCK = 'MOCK'
}

export enum PassthroughBehavior {
/**
* Passes the request body for unmapped content types through to the
* integration back end without transformation.
*/
WhenNoMatch = 'WHEN_NO_MATCH',
WHEN_NO_MATCH = 'WHEN_NO_MATCH',

/**
* Rejects unmapped content types with an HTTP 415 'Unsupported Media Type'
* response
*/
Never = 'NEVER',
NEVER = 'NEVER',

/**
* Allows pass-through when the integration has NO content types mapped to
* templates. However if there is at least one content type defined,
* unmapped content types will be rejected with the same 415 response.
*/
WhenNoTemplates = 'WHEN_NO_TEMPLATES'
WHEN_NO_TEMPLATES = 'WHEN_NO_TEMPLATES'
}

export enum ConnectionType {
/**
* For connections through the public routable internet
*/
Internet = 'INTERNET',
INTERNET = 'INTERNET',

/**
* For private connections between API Gateway and a network load balancer in a VPC
*/
VpcLink = 'VPC_LINK'
VPC_LINK = 'VPC_LINK'
}

export interface IntegrationResponse {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/lib/integrations/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class AwsIntegration extends Integration {

constructor(props: AwsIntegrationProps) {
const backend = props.subdomain ? `${props.subdomain}.${props.service}` : props.service;
const type = props.proxy ? IntegrationType.AwsProxy : IntegrationType.Aws;
const type = props.proxy ? IntegrationType.AWS_PROXY : IntegrationType.AWS;
const { apiType, apiValue } = parseAwsApiCall(props.path, props.action, props.actionParameters);
super({
type,
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/lib/integrations/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class HttpIntegration extends Integration {
const proxy = props.proxy !== undefined ? props.proxy : true;
const method = props.httpMethod || 'GET';
super({
type: proxy ? IntegrationType.HttpProxy : IntegrationType.Http,
type: proxy ? IntegrationType.HTTP_PROXY : IntegrationType.HTTP,
integrationHttpMethod: method,
uri: url,
options: props.options,
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/lib/integrations/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Integration, IntegrationOptions, IntegrationType } from '../integration
export class MockIntegration extends Integration {
constructor(options?: IntegrationOptions) {
super({
type: IntegrationType.Mock,
type: IntegrationType.MOCK,
options
});
}
Expand Down
12 changes: 6 additions & 6 deletions packages/@aws-cdk/aws-apigateway/lib/method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class Method extends Resource {
httpMethod: this.httpMethod,
operationName: options.operationName || defaultMethodOptions.operationName,
apiKeyRequired: options.apiKeyRequired || defaultMethodOptions.apiKeyRequired,
authorizationType: options.authorizationType || defaultMethodOptions.authorizationType || AuthorizationType.None,
authorizationType: options.authorizationType || defaultMethodOptions.authorizationType || AuthorizationType.NONE,
authorizerId: authorizer && authorizer.authorizerId,
requestParameters: options.requestParameters,
integration: this.renderIntegration(props.integration),
Expand Down Expand Up @@ -183,11 +183,11 @@ export class Method extends Resource {
throw new Error(`'credentialsPassthrough' and 'credentialsRole' are mutually exclusive`);
}

if (options.connectionType === ConnectionType.VpcLink && options.vpcLink === undefined) {
if (options.connectionType === ConnectionType.VPC_LINK && options.vpcLink === undefined) {
throw new Error(`'connectionType' of VPC_LINK requires 'vpcLink' prop to be set`);
}

if (options.connectionType === ConnectionType.Internet && options.vpcLink !== undefined) {
if (options.connectionType === ConnectionType.INTERNET && options.vpcLink !== undefined) {
throw new Error(`cannot set 'vpcLink' where 'connectionType' is INTERNET`);
}

Expand Down Expand Up @@ -249,7 +249,7 @@ export enum AuthorizationType {
/**
* Open access.
*/
None = 'NONE',
NONE = 'NONE',

/**
* Use AWS IAM permissions.
Expand All @@ -259,10 +259,10 @@ export enum AuthorizationType {
/**
* Use a custom authorizer.
*/
Custom = 'CUSTOM',
CUSTOM = 'CUSTOM',

/**
* Use an AWS Cognito user pool.
*/
Cognito = 'COGNITO_USER_POOLS',
COGNITO = 'COGNITO_USER_POOLS',
}
10 changes: 5 additions & 5 deletions packages/@aws-cdk/aws-apigateway/lib/restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,29 +363,29 @@ export enum ApiKeySourceType {
/**
* To read the API key from the `X-API-Key` header of a request.
*/
Header = 'HEADER',
HEADER = 'HEADER',

/**
* To read the API key from the `UsageIdentifierKey` from a custom authorizer.
*/
Authorizer = 'AUTHORIZER',
AUTHORIZER = 'AUTHORIZER',
}

export enum EndpointType {
/**
* For an edge-optimized API and its custom domain name.
*/
Edge = 'EDGE',
EDGE = 'EDGE',

/**
* For a regional API and its custom domain name.
*/
Regional = 'REGIONAL',
REGIONAL = 'REGIONAL',

/**
* For a private API and its custom domain name.
*/
Private = 'PRIVATE'
PRIVATE = 'PRIVATE'
}

class RootResource extends ResourceBase {
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-apigateway/lib/stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ export interface StageProps extends StageOptions {
}

export enum MethodLoggingLevel {
Off = 'OFF',
Error = 'ERROR',
Info = 'INFO'
OFF = 'OFF',
ERROR = 'ERROR',
INFO = 'INFO'
}

export interface MethodDeploymentOptions {
Expand Down
8 changes: 4 additions & 4 deletions packages/@aws-cdk/aws-apigateway/lib/usage-plan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ export interface ThrottleSettings {
* Time period for which quota settings apply.
*/
export enum Period {
Day = 'DAY',
Week = 'WEEK',
Month = 'MONTH'
DAY = 'DAY',
WEEK = 'WEEK',
MONTH = 'MONTH'
}

/**
Expand Down Expand Up @@ -76,7 +76,7 @@ export interface ThrottlingPerMethod {
}

/**
* Type of Usage Plan Key. Currently the only supported type is 'API_KEY'
* Type of Usage Plan Key. Currently the only supported type is 'ApiKey'
*/
export enum UsagePlanKeyType {
ApiKey = 'API_KEY'
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-apigateway/test/integ.restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Test extends cdk.Stack {
cacheClusterEnabled: true,
stageName: 'beta',
description: 'beta stage',
loggingLevel: apigateway.MethodLoggingLevel.Info,
loggingLevel: apigateway.MethodLoggingLevel.INFO,
dataTraceEnabled: true,
methodOptions: {
'/api/appliances/GET': {
Expand Down Expand Up @@ -61,7 +61,7 @@ class Test extends cdk.Stack {
throttle: { rateLimit: 5 },
quota: {
limit: 10000,
period: apigateway.Period.Month
period: apigateway.Period.MONTH
}
});
plan.addApiStage({
Expand Down
16 changes: 8 additions & 8 deletions packages/@aws-cdk/aws-apigateway/test/test.method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export = {
'use default integration from api'(test: Test) {
// GIVEN
const stack = new cdk.Stack();
const defaultIntegration = new apigateway.Integration({ type: apigateway.IntegrationType.HttpProxy, uri: 'https://amazon.com' });
const defaultIntegration = new apigateway.Integration({ type: apigateway.IntegrationType.HTTP_PROXY, uri: 'https://amazon.com' });
const api = new apigateway.RestApi(stack, 'test-api', {
cloudWatchRole: false,
deploy: false,
Expand Down Expand Up @@ -223,7 +223,7 @@ export = {

// WHEN
api.root.addMethod('GET', new apigateway.Integration({
type: apigateway.IntegrationType.AwsProxy,
type: apigateway.IntegrationType.AWS_PROXY,
options: {
credentialsRole: role
}
Expand All @@ -245,7 +245,7 @@ export = {

// WHEN
api.root.addMethod('GET', new apigateway.Integration({
type: apigateway.IntegrationType.AwsProxy,
type: apigateway.IntegrationType.AWS_PROXY,
options: {
credentialsPassthrough: true
}
Expand All @@ -268,7 +268,7 @@ export = {

// WHEN
const integration = new apigateway.Integration({
type: apigateway.IntegrationType.AwsProxy,
type: apigateway.IntegrationType.AWS_PROXY,
options: {
credentialsPassthrough: true,
credentialsRole: role
Expand All @@ -287,10 +287,10 @@ export = {

// WHEN
const integration = new apigateway.Integration({
type: apigateway.IntegrationType.HttpProxy,
type: apigateway.IntegrationType.HTTP_PROXY,
integrationHttpMethod: 'ANY',
options: {
connectionType: ConnectionType.VpcLink,
connectionType: ConnectionType.VPC_LINK,
}
});

Expand All @@ -313,10 +313,10 @@ export = {

// WHEN
const integration = new apigateway.Integration({
type: apigateway.IntegrationType.HttpProxy,
type: apigateway.IntegrationType.HTTP_PROXY,
integrationHttpMethod: 'ANY',
options: {
connectionType: ConnectionType.Internet,
connectionType: ConnectionType.INTERNET,
vpcLink: link
}
});
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-apigateway/test/test.restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ export = {

// WHEN
const api = new apigateway.RestApi(stack, 'api', {
endpointTypes: [ apigateway.EndpointType.Edge, apigateway.EndpointType.Private ]
endpointTypes: [ apigateway.EndpointType.EDGE, apigateway.EndpointType.PRIVATE ]
});

api.root.addMethod('GET');
Expand Down Expand Up @@ -547,7 +547,7 @@ export = {
// CASE #2: should inherit integration from root and method options, but
// "authorizationType" will be overridden to "None" instead of "IAM"
child.addMethod('POST', undefined, {
authorizationType: apigateway.AuthorizationType.Cognito
authorizationType: apigateway.AuthorizationType.COGNITO
});

const child2 = api.root.addResource('child2', {
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-apigateway/test/test.stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export = {
// WHEN
new apigateway.Stage(stack, 'my-stage', {
deployment,
loggingLevel: apigateway.MethodLoggingLevel.Info,
loggingLevel: apigateway.MethodLoggingLevel.INFO,
throttlingRateLimit: 12
});

Expand Down Expand Up @@ -107,11 +107,11 @@ export = {
// WHEN
new apigateway.Stage(stack, 'my-stage', {
deployment,
loggingLevel: apigateway.MethodLoggingLevel.Info,
loggingLevel: apigateway.MethodLoggingLevel.INFO,
throttlingRateLimit: 12,
methodOptions: {
'/goo/bar/GET': {
loggingLevel: apigateway.MethodLoggingLevel.Error,
loggingLevel: apigateway.MethodLoggingLevel.ERROR,
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/test/test.usage-plan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export = {
new apigateway.UsagePlan(stack, 'my-usage-plan', {
quota: {
limit: 10000,
period: apigateway.Period.Month
period: apigateway.Period.MONTH
}
});

Expand Down
Loading

0 comments on commit dbf3e17

Please sign in to comment.