|
3 | 3 | * SPDX-License-Identifier: Apache-2.0 |
4 | 4 | */ |
5 | 5 |
|
6 | | -import { AppRunner } from 'aws-sdk' |
7 | | -import globals from '../extensionGlobals' |
| 6 | +import { |
| 7 | + CreateConnectionCommandInput, |
| 8 | + CreateConnectionCommandOutput, |
| 9 | + CreateServiceCommandInput, |
| 10 | + CreateServiceCommandOutput, |
| 11 | + DeleteServiceCommandInput, |
| 12 | + DeleteServiceCommandOutput, |
| 13 | + DescribeServiceCommandInput, |
| 14 | + DescribeServiceCommandOutput, |
| 15 | + ListConnectionsCommandInput, |
| 16 | + ListConnectionsCommandOutput, |
| 17 | + ListOperationsCommandInput, |
| 18 | + ListOperationsCommandOutput, |
| 19 | + ListServicesCommandInput, |
| 20 | + ListServicesCommandOutput, |
| 21 | + PauseServiceCommandInput, |
| 22 | + PauseServiceCommandOutput, |
| 23 | + ResumeServiceCommandInput, |
| 24 | + ResumeServiceCommandOutput, |
| 25 | + StartDeploymentCommandInput, |
| 26 | + StartDeploymentCommandOutput, |
| 27 | + UpdateServiceCommandInput, |
| 28 | + UpdateServiceCommandOutput, |
| 29 | + AppRunnerClient as AppRunnerClientSDK, |
| 30 | + CreateServiceCommand, |
| 31 | + ListServicesCommand, |
| 32 | + PauseServiceCommand, |
| 33 | + ResumeServiceCommand, |
| 34 | + UpdateServiceCommand, |
| 35 | + CreateConnectionCommand, |
| 36 | + ListConnectionsCommand, |
| 37 | + DescribeServiceCommand, |
| 38 | + StartDeploymentCommand, |
| 39 | + ListOperationsCommand, |
| 40 | + DeleteServiceCommand, |
| 41 | +} from '@aws-sdk/client-apprunner' |
| 42 | +import { ClientWrapper } from './clientWrapper' |
8 | 43 |
|
9 | | -export class AppRunnerClient { |
10 | | - public constructor(public readonly regionCode: string) {} |
11 | | - |
12 | | - public async createService(request: AppRunner.CreateServiceRequest): Promise<AppRunner.CreateServiceResponse> { |
13 | | - return (await this.createSdkClient()).createService(request).promise() |
| 44 | +export class AppRunnerClient extends ClientWrapper<AppRunnerClientSDK> { |
| 45 | + public constructor(regionCode: string) { |
| 46 | + super(regionCode, AppRunnerClientSDK) |
14 | 47 | } |
15 | 48 |
|
16 | | - public async listServices(request: AppRunner.ListServicesRequest): Promise<AppRunner.ListServicesResponse> { |
17 | | - return (await this.createSdkClient()).listServices(request).promise() |
| 49 | + public async createService(request: CreateServiceCommandInput): Promise<CreateServiceCommandOutput> { |
| 50 | + return this.makeRequest(CreateServiceCommand, request) |
18 | 51 | } |
19 | 52 |
|
20 | | - public async pauseService(request: AppRunner.PauseServiceRequest): Promise<AppRunner.PauseServiceResponse> { |
21 | | - return (await this.createSdkClient()).pauseService(request).promise() |
| 53 | + public async listServices(request: ListServicesCommandInput): Promise<ListServicesCommandOutput> { |
| 54 | + return this.makeRequest(ListServicesCommand, request) |
22 | 55 | } |
23 | 56 |
|
24 | | - public async resumeService(request: AppRunner.ResumeServiceRequest): Promise<AppRunner.ResumeServiceResponse> { |
25 | | - return (await this.createSdkClient()).resumeService(request).promise() |
| 57 | + public async pauseService(request: PauseServiceCommandInput): Promise<PauseServiceCommandOutput> { |
| 58 | + return this.makeRequest(PauseServiceCommand, request) |
26 | 59 | } |
27 | 60 |
|
28 | | - public async updateService(request: AppRunner.UpdateServiceRequest): Promise<AppRunner.UpdateServiceResponse> { |
29 | | - return (await this.createSdkClient()).updateService(request).promise() |
| 61 | + public async resumeService(request: ResumeServiceCommandInput): Promise<ResumeServiceCommandOutput> { |
| 62 | + return this.makeRequest(ResumeServiceCommand, request) |
30 | 63 | } |
31 | 64 |
|
32 | | - public async createConnection( |
33 | | - request: AppRunner.CreateConnectionRequest |
34 | | - ): Promise<AppRunner.CreateConnectionResponse> { |
35 | | - return (await this.createSdkClient()).createConnection(request).promise() |
| 65 | + public async updateService(request: UpdateServiceCommandInput): Promise<UpdateServiceCommandOutput> { |
| 66 | + return this.makeRequest(UpdateServiceCommand, request) |
36 | 67 | } |
37 | 68 |
|
38 | | - public async listConnections( |
39 | | - request: AppRunner.ListConnectionsRequest = {} |
40 | | - ): Promise<AppRunner.ListConnectionsResponse> { |
41 | | - return (await this.createSdkClient()).listConnections(request).promise() |
| 69 | + public async createConnection(request: CreateConnectionCommandInput): Promise<CreateConnectionCommandOutput> { |
| 70 | + return this.makeRequest(CreateConnectionCommand, request) |
42 | 71 | } |
43 | 72 |
|
44 | | - public async describeService( |
45 | | - request: AppRunner.DescribeServiceRequest |
46 | | - ): Promise<AppRunner.DescribeServiceResponse> { |
47 | | - return (await this.createSdkClient()).describeService(request).promise() |
| 73 | + public async listConnections(request: ListConnectionsCommandInput = {}): Promise<ListConnectionsCommandOutput> { |
| 74 | + return this.makeRequest(ListConnectionsCommand, request) |
48 | 75 | } |
49 | 76 |
|
50 | | - public async startDeployment( |
51 | | - request: AppRunner.StartDeploymentRequest |
52 | | - ): Promise<AppRunner.StartDeploymentResponse> { |
53 | | - return (await this.createSdkClient()).startDeployment(request).promise() |
| 77 | + public async describeService(request: DescribeServiceCommandInput): Promise<DescribeServiceCommandOutput> { |
| 78 | + return this.makeRequest(DescribeServiceCommand, request) |
54 | 79 | } |
55 | 80 |
|
56 | | - public async listOperations(request: AppRunner.ListOperationsRequest): Promise<AppRunner.ListOperationsResponse> { |
57 | | - return (await this.createSdkClient()).listOperations(request).promise() |
| 81 | + public async startDeployment(request: StartDeploymentCommandInput): Promise<StartDeploymentCommandOutput> { |
| 82 | + return this.makeRequest(StartDeploymentCommand, request) |
58 | 83 | } |
59 | 84 |
|
60 | | - public async deleteService(request: AppRunner.DeleteServiceRequest): Promise<AppRunner.DeleteServiceResponse> { |
61 | | - return (await this.createSdkClient()).deleteService(request).promise() |
| 85 | + public async listOperations(request: ListOperationsCommandInput): Promise<ListOperationsCommandOutput> { |
| 86 | + return this.makeRequest(ListOperationsCommand, request) |
62 | 87 | } |
63 | 88 |
|
64 | | - protected async createSdkClient(): Promise<AppRunner> { |
65 | | - return await globals.sdkClientBuilder.createAwsService(AppRunner, undefined, this.regionCode) |
| 89 | + public async deleteService(request: DeleteServiceCommandInput): Promise<DeleteServiceCommandOutput> { |
| 90 | + return this.makeRequest(DeleteServiceCommand, request) |
66 | 91 | } |
67 | 92 | } |
0 commit comments