Skip to content

Commit

Permalink
Remove apiEndpoint and other comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Sumeet Badyal committed Dec 3, 2020
1 parent c47bb7e commit 9cd40c7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 27 deletions.
1 change: 0 additions & 1 deletion packages/@aws-cdk/aws-stepfunctions-tasks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ const restApi = new apigateway.RestApi(stack, 'MyRestApi');

const invokeJob = new tasks.ApiGatewayInvoke(stack, 'Invoke APIGW', {
api: restApi,
apiEndpoint: restApi.restApiId,
stageName: 'prod',
method: ApiGatewayMethodType.GET,
});
Expand Down
21 changes: 6 additions & 15 deletions packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/invoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ export interface ApiGatewayInvokeProps extends sfn.TaskStateBaseProps {
/** API to call */
readonly api: apigateway.IRestApi;

/**
* hostname of an API Gateway URL
* @example {ApiId}.execute-api.{region}.amazonaws.com
*/
readonly apiEndpoint: string;

/** Http method for the API */
readonly method: HttpMethod;

Expand All @@ -37,7 +31,7 @@ export interface ApiGatewayInvokeProps extends sfn.TaskStateBaseProps {

/**
* Name of the stage where the API is deployed to in API Gateway
* @default - Required for REST and $default for HTTP
* @default - Required for REST and $default for HTTP which acts as a catch-all for requests that don’t match any other routes
*/
readonly stageName?: string;

Expand Down Expand Up @@ -69,7 +63,7 @@ export interface ApiGatewayInvokeProps extends sfn.TaskStateBaseProps {

/**
* Authentication methods
* @default - NO_AUTH
* @default AuthType.NO_AUTH
*/
readonly authType?: AuthType;

Expand Down Expand Up @@ -104,8 +98,6 @@ export class ApiGatewayInvoke extends sfn.TaskStateBase {

/**
* Provides the API Gateway Invoke service integration task configuration
*/
/**
* @internal
*/
protected _renderTask(): any {
Expand All @@ -125,13 +117,13 @@ export class ApiGatewayInvoke extends sfn.TaskStateBase {
}

/**
* Gets the "execute-api" ARN
* @returns The "execute-api" ARN.
* @default "*" returns the execute API ARN for all methods/resources in
* this API.
* Gets the resource to attatched to the ExecuteAPI:Invoke
* @returns resource.
* @default "*" returns the execute API ARN for all methods/resources in this API.
* @param method The method (default `*`)
* @param path The resource path. Must start with '/' (default `*`)
* @param stage The stage (default `*`)
* @example {ApiId}/{stage}/{method}/{path}
*/
get arnForExecuteApi() {
return this.props.api.arnForExecuteApi(this.props.method, this.props.path, this.props.stageName);
Expand Down Expand Up @@ -204,7 +196,6 @@ export enum HttpMethod {

/**
* The authentication method used to call the endpoint
* @default NO_AUTH
*/
export enum AuthType {
/** Call the API direclty with no authorization method */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@ import { ApiGatewayInvoke, AuthType, HttpMethod } from '../../lib';
* Stack verification steps:
* * aws stepfunctions start-execution --state-machine-arn <deployed state machine arn> : should return execution arn
* * aws stepfunctions describe-execution --execution-arn <exection-arn generated before> : should return status as SUCCEEDED and a query-execution-id
* * aws apigateway test-invoke-method --rest-api-id <value> --resource-id <value> --http-method <value>: should return the same response as the state machine
* * aws apigateway test-invoke-method --rest-api-id <value> --resource-id <value> --http-method <value>: should return the same response body and status as in the task succeeded/failed execution
*/
const app = new cdk.App();
const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-apigateway-invoke-integ');
const restApi = new apigateway.RestApi(stack, 'MyRestApi');

const hello = new apigateway.LambdaIntegration(new lambda.Function(stack, 'Hello', {
runtime: lambda.Runtime.NODEJS_10_X,
handler: 'index.handler',
code: lambda.Code.inline(`exports.handler = ${helloCode}`),
}));

function helloCode(_event: any, _context: any, callback: any) {
return callback(undefined, {
statusCode: 200,
body: 'hello, world!',
});
}

const hello = new apigateway.LambdaIntegration(new lambda.Function(stack, 'Hello', {
runtime: lambda.Runtime.NODEJS_10_X,
handler: 'index.handler',
code: lambda.Code.inline(`exports.handler = ${helloCode}`),
}));

restApi.root.addMethod('ANY', hello);

const invokeJob = new ApiGatewayInvoke(stack, 'Invoke APIGW', {
api: restApi,
apiEndpoint: restApi.restApiId,
stageName: 'prod',
method: HttpMethod.GET,
authType: AuthType.IAM_ROLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('Invoke API', () => {
// WHEN
const task = new ApiGatewayInvoke(stack, 'Invoke', {
api: restApi,
apiEndpoint: restApi.restApiId,
method: HttpMethod.GET,
stageName: '$default',
path: 'path',
Expand Down Expand Up @@ -74,7 +73,6 @@ describe('Invoke API', () => {
const task = new ApiGatewayInvoke(stack, 'Invoke', {
integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN,
api: restApi,
apiEndpoint: restApi.restApiId,
method: HttpMethod.GET,
headers: taskToken,
stageName: '$default',
Expand Down Expand Up @@ -134,7 +132,6 @@ describe('Invoke API', () => {
new ApiGatewayInvoke(stack, 'Invoke', {
integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN,
api: restApi,
apiEndpoint: restApi.restApiId,
method: HttpMethod.GET,
authType: AuthType.RESOURCE_POLICY,
});
Expand Down

0 comments on commit 9cd40c7

Please sign in to comment.