Skip to content

Commit

Permalink
feat(appmesh): rename the class HttpRouteMatchMethod to HttpRouteMeth…
Browse files Browse the repository at this point in the history
…od (#15466)

Renaming `HttpRouteMatchMethod` to `HttpRouteMethod`.
Also move it into its own file since this class is going to be used by multiple classes.

BREAKING CHANGE: the class `HttpRouteMatchMethod` has been renamed to `HttpRouteMethod`

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
Seiya6329 authored Jul 8, 2021
1 parent bd94be8 commit fc01d22
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 56 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-appmesh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ router.addRoute('route-http2', {
],
match: {
prefixPath: '/',
method: appmesh.HttpRouteMatchMethod.POST,
method: appmesh.HttpRouteMethod.POST,
protocol: appmesh.HttpRouteProtocol.HTTPS,
headers: [
// All specified headers must match for the route to match.
Expand Down
49 changes: 49 additions & 0 deletions packages/@aws-cdk/aws-appmesh/lib/http-route-method.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Supported values for matching routes based on the HTTP request method
*/
export enum HttpRouteMethod {
/**
* GET request
*/
GET = 'GET',

/**
* HEAD request
*/
HEAD = 'HEAD',

/**
* POST request
*/
POST = 'POST',

/**
* PUT request
*/
PUT = 'PUT',

/**
* DELETE request
*/
DELETE = 'DELETE',

/**
* CONNECT request
*/
CONNECT = 'CONNECT',

/**
* OPTIONS request
*/
OPTIONS = 'OPTIONS',

/**
* TRACE request
*/
TRACE = 'TRACE',

/**
* PATCH request
*/
PATCH = 'PATCH',
}
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-appmesh/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ export * from './health-checks';
export * from './listener-tls-options';
export * from './tls-validation';
export * from './tls-client-policy';
export * from './http-route-method';
55 changes: 3 additions & 52 deletions packages/@aws-cdk/aws-appmesh/lib/route-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as cdk from '@aws-cdk/core';
import { CfnRoute } from './appmesh.generated';
import { HttpTimeout, GrpcTimeout, Protocol, TcpTimeout } from './shared-interfaces';
import { HttpRouteMethod } from './http-route-method';
import { GrpcTimeout, HttpTimeout, Protocol, TcpTimeout } from './shared-interfaces';
import { IVirtualNode } from './virtual-node';

// keep this import separate from other imports to reduce chance for merge conflicts with v2-main
Expand Down Expand Up @@ -49,7 +50,7 @@ export interface HttpRouteMatch {
*
* @default - do not match on request method
*/
readonly method?: HttpRouteMatchMethod;
readonly method?: HttpRouteMethod;

/**
* The client request protocol to match on. Applicable only for HTTP2 routes.
Expand All @@ -59,56 +60,6 @@ export interface HttpRouteMatch {
readonly protocol?: HttpRouteProtocol;
}

/**
* Supported values for matching routes based on the HTTP request method
*/
export enum HttpRouteMatchMethod {
/**
* GET request
*/
GET = 'GET',

/**
* HEAD request
*/
HEAD = 'HEAD',

/**
* POST request
*/
POST = 'POST',

/**
* PUT request
*/
PUT = 'PUT',

/**
* DELETE request
*/
DELETE = 'DELETE',

/**
* CONNECT request
*/
CONNECT = 'CONNECT',

/**
* OPTIONS request
*/
OPTIONS = 'OPTIONS',

/**
* TRACE request
*/
TRACE = 'TRACE',

/**
* PATCH request
*/
PATCH = 'PATCH',
}

/**
* Supported :scheme options for HTTP2
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-appmesh/test/integ.mesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ router.addRoute('route-matching', {
weightedTargets: [{ virtualNode: node3 }],
match: {
prefixPath: '/',
method: appmesh.HttpRouteMatchMethod.POST,
method: appmesh.HttpRouteMethod.POST,
protocol: appmesh.HttpRouteProtocol.HTTPS,
headers: [
appmesh.HttpHeaderMatch.valueIs('Content-Type', 'application/json'),
Expand Down
3 changes: 1 addition & 2 deletions packages/@aws-cdk/aws-appmesh/test/test.route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ABSENT, expect, haveResourceLike } from '@aws-cdk/assert-internal';
import * as cdk from '@aws-cdk/core';
import { Test } from 'nodeunit';

import * as appmesh from '../lib';

export = {
Expand Down Expand Up @@ -751,7 +750,7 @@ export = {
weightedTargets: [{ virtualNode }],
match: {
prefixPath: '/',
method: appmesh.HttpRouteMatchMethod.GET,
method: appmesh.HttpRouteMethod.GET,
},
}),
});
Expand Down

0 comments on commit fc01d22

Please sign in to comment.