-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge master into feature/serverlessland
- Loading branch information
Showing
18 changed files
with
8,402 additions
and
3,188 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/*! | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { ClientWrapper } from './clientWrapper' | ||
import { | ||
APIGatewayClient as ApiGatewayClientSDK, | ||
GetResourcesCommand, | ||
GetResourcesRequest, | ||
GetRestApisCommand, | ||
GetRestApisRequest, | ||
GetStagesCommand, | ||
Resource, | ||
Resources, | ||
RestApi, | ||
RestApis, | ||
Stages, | ||
TestInvokeMethodCommand, | ||
TestInvokeMethodRequest, | ||
TestInvokeMethodResponse, | ||
} from '@aws-sdk/client-api-gateway' | ||
|
||
export class ApiGatewayClient extends ClientWrapper<ApiGatewayClientSDK> { | ||
public constructor(regionCode: string) { | ||
super(regionCode, ApiGatewayClientSDK) | ||
} | ||
|
||
public async *getResourcesForApi(apiId: string): AsyncIterableIterator<Resource> { | ||
const request: GetResourcesRequest = { | ||
restApiId: apiId, | ||
} | ||
|
||
do { | ||
const response: Resources = await this.makeRequest(GetResourcesCommand, request) | ||
|
||
if (response.items !== undefined && response.items.length > 0) { | ||
yield* response.items | ||
} | ||
|
||
request.position = response.position | ||
} while (request.position !== undefined) | ||
} | ||
|
||
public async getStages(apiId: string): Promise<Stages> { | ||
return this.makeRequest(GetStagesCommand, { | ||
restApiId: apiId, | ||
}) | ||
} | ||
|
||
public async *listApis(): AsyncIterableIterator<RestApi> { | ||
const request: GetRestApisRequest = {} | ||
|
||
do { | ||
const response: RestApis = await this.makeRequest(GetRestApisCommand, request) | ||
|
||
if (response.items !== undefined && response.items.length > 0) { | ||
yield* response.items | ||
} | ||
|
||
request.position = response.position | ||
} while (request.position !== undefined) | ||
} | ||
|
||
public async testInvokeMethod( | ||
apiId: string, | ||
resourceId: string, | ||
method: string, | ||
body: string, | ||
pathWithQueryString: string | undefined | ||
): Promise<TestInvokeMethodResponse> { | ||
const request: TestInvokeMethodRequest = { | ||
restApiId: apiId, | ||
resourceId: resourceId, | ||
httpMethod: method, | ||
body: body, | ||
} | ||
if (pathWithQueryString) { | ||
request.pathWithQueryString = pathWithQueryString | ||
} | ||
|
||
return this.makeRequest(TestInvokeMethodCommand, request) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.