33 * SPDX-License-Identifier: Apache-2.0
44 */
55
6- import { Schemas } from 'aws-sdk'
6+ import {
7+ DescribeCodeBindingCommand ,
8+ DescribeCodeBindingResponse ,
9+ DescribeSchemaCommand ,
10+ DescribeSchemaResponse ,
11+ GetCodeBindingSourceCommand ,
12+ GetCodeBindingSourceResponse ,
13+ ListRegistriesCommand ,
14+ ListRegistriesRequest ,
15+ ListRegistriesResponse ,
16+ ListSchemasCommand ,
17+ ListSchemasRequest ,
18+ ListSchemasResponse ,
19+ ListSchemaVersionsCommand ,
20+ ListSchemaVersionsRequest ,
21+ ListSchemaVersionsResponse ,
22+ PutCodeBindingCommand ,
23+ PutCodeBindingResponse ,
24+ RegistrySummary ,
25+ SchemasClient ,
26+ SchemaSummary ,
27+ SchemaVersionSummary ,
28+ SearchSchemasCommand ,
29+ SearchSchemasRequest ,
30+ SearchSchemasResponse ,
31+ SearchSchemaSummary ,
32+ } from '@aws-sdk/client-schemas'
733import globals from '../extensionGlobals'
834
935import { ClassToInterfaceType } from '../utilities/tsUtils'
@@ -12,13 +38,13 @@ export type SchemaClient = ClassToInterfaceType<DefaultSchemaClient>
1238export class DefaultSchemaClient {
1339 public constructor ( public readonly regionCode : string ) { }
1440
15- public async * listRegistries ( ) : AsyncIterableIterator < Schemas . RegistrySummary > {
16- const client = await this . createSdkClient ( )
41+ public async * listRegistries ( ) : AsyncIterableIterator < RegistrySummary > {
42+ const client = this . createSdkClient ( )
1743
18- const request : Schemas . ListRegistriesRequest = { }
44+ const request : ListRegistriesRequest = { }
1945
2046 do {
21- const response : Schemas . ListRegistriesResponse = await client . listRegistries ( request ) . promise ( )
47+ const response : ListRegistriesResponse = await client . send ( new ListRegistriesCommand ( request ) )
2248
2349 if ( response . Registries ) {
2450 yield * response . Registries
@@ -28,15 +54,15 @@ export class DefaultSchemaClient {
2854 } while ( request . NextToken )
2955 }
3056
31- public async * listSchemas ( registryName : string ) : AsyncIterableIterator < Schemas . SchemaSummary > {
32- const client = await this . createSdkClient ( )
57+ public async * listSchemas ( registryName : string ) : AsyncIterableIterator < SchemaSummary > {
58+ const client = this . createSdkClient ( )
3359
34- const request : Schemas . ListSchemasRequest = {
60+ const request : ListSchemasRequest = {
3561 RegistryName : registryName ,
3662 }
3763
3864 do {
39- const response : Schemas . ListSchemasResponse = await client . listSchemas ( request ) . promise ( )
65+ const response : ListSchemasResponse = await client . send ( new ListSchemasCommand ( request ) )
4066
4167 if ( response . Schemas ) {
4268 yield * response . Schemas
@@ -50,31 +76,31 @@ export class DefaultSchemaClient {
5076 registryName : string ,
5177 schemaName : string ,
5278 schemaVersion ?: string
53- ) : Promise < Schemas . DescribeSchemaResponse > {
54- const client = await this . createSdkClient ( )
79+ ) : Promise < DescribeSchemaResponse > {
80+ const client = this . createSdkClient ( )
5581
56- return await client
57- . describeSchema ( {
82+ return await client . send (
83+ new DescribeSchemaCommand ( {
5884 RegistryName : registryName ,
5985 SchemaName : schemaName ,
6086 SchemaVersion : schemaVersion ,
6187 } )
62- . promise ( )
88+ )
6389 }
6490
6591 public async * listSchemaVersions (
6692 registryName : string ,
6793 schemaName : string
68- ) : AsyncIterableIterator < Schemas . SchemaVersionSummary > {
69- const client = await this . createSdkClient ( )
94+ ) : AsyncIterableIterator < SchemaVersionSummary > {
95+ const client = this . createSdkClient ( )
7096
71- const request : Schemas . ListSchemaVersionsRequest = {
97+ const request : ListSchemaVersionsRequest = {
7298 RegistryName : registryName ,
7399 SchemaName : schemaName ,
74100 }
75101
76102 do {
77- const response : Schemas . ListSchemaVersionsResponse = await client . listSchemaVersions ( request ) . promise ( )
103+ const response : ListSchemaVersionsResponse = await client . send ( new ListSchemaVersionsCommand ( request ) )
78104
79105 if ( response . SchemaVersions ) {
80106 yield * response . SchemaVersions
@@ -84,19 +110,16 @@ export class DefaultSchemaClient {
84110 } while ( request . NextToken )
85111 }
86112
87- public async * searchSchemas (
88- keywords : string ,
89- registryName : string
90- ) : AsyncIterableIterator < Schemas . SearchSchemaSummary > {
91- const client = await this . createSdkClient ( )
113+ public async * searchSchemas ( keywords : string , registryName : string ) : AsyncIterableIterator < SearchSchemaSummary > {
114+ const client = this . createSdkClient ( )
92115
93- const request : Schemas . SearchSchemasRequest = {
116+ const request : SearchSchemasRequest = {
94117 Keywords : keywords ,
95118 RegistryName : registryName ,
96119 }
97120
98121 do {
99- const response : Schemas . SearchSchemasResponse = await client . searchSchemas ( request ) . promise ( )
122+ const response : SearchSchemasResponse = await client . send ( new SearchSchemasCommand ( request ) )
100123
101124 if ( response . Schemas ) {
102125 yield * response . Schemas
@@ -111,55 +134,58 @@ export class DefaultSchemaClient {
111134 registryName : string ,
112135 schemaName : string ,
113136 schemaVersion : string
114- ) : Promise < Schemas . GetCodeBindingSourceResponse > {
115- const client = await this . createSdkClient ( )
137+ ) : Promise < GetCodeBindingSourceResponse > {
138+ const client = this . createSdkClient ( )
116139
117- return await client
118- . getCodeBindingSource ( {
140+ return await client . send (
141+ new GetCodeBindingSourceCommand ( {
119142 Language : language ,
120143 RegistryName : registryName ,
121144 SchemaName : schemaName ,
122145 SchemaVersion : schemaVersion ,
123146 } )
124- . promise ( )
147+ )
125148 }
126149
127150 public async putCodeBinding (
128151 language : string ,
129152 registryName : string ,
130153 schemaName : string ,
131154 schemaVersion : string
132- ) : Promise < Schemas . PutCodeBindingResponse > {
133- const client = await this . createSdkClient ( )
155+ ) : Promise < PutCodeBindingResponse > {
156+ const client = this . createSdkClient ( )
134157
135- return await client
136- . putCodeBinding ( {
158+ return await client . send (
159+ new PutCodeBindingCommand ( {
137160 Language : language ,
138161 RegistryName : registryName ,
139162 SchemaName : schemaName ,
140163 SchemaVersion : schemaVersion ,
141164 } )
142- . promise ( )
165+ )
143166 }
144167 public async describeCodeBinding (
145168 language : string ,
146169 registryName : string ,
147170 schemaName : string ,
148171 schemaVersion : string
149- ) : Promise < Schemas . DescribeCodeBindingResponse > {
150- const client = await this . createSdkClient ( )
172+ ) : Promise < DescribeCodeBindingResponse > {
173+ const client = this . createSdkClient ( )
151174
152- return await client
153- . describeCodeBinding ( {
175+ return await client . send (
176+ new DescribeCodeBindingCommand ( {
154177 Language : language ,
155178 RegistryName : registryName ,
156179 SchemaName : schemaName ,
157180 SchemaVersion : schemaVersion ,
158181 } )
159- . promise ( )
182+ )
160183 }
161184
162- private async createSdkClient ( ) : Promise < Schemas > {
163- return await globals . sdkClientBuilder . createAwsService ( Schemas , undefined , this . regionCode )
185+ private createSdkClient ( ) : SchemasClient {
186+ return globals . sdkClientBuilderV3 . createAwsService ( {
187+ serviceClient : SchemasClient ,
188+ clientOptions : { region : this . regionCode } ,
189+ } )
164190 }
165191}
0 commit comments