Skip to content

Commit 151292b

Browse files
authored
refactor(schemas): migrate to aws-sdk v3 part 2 (aws#8093)
## Problem AWS SDK V2 is at EOL ## Solution Migrate Schemas to V3 --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 6d81ae2 commit 151292b

File tree

6 files changed

+20
-22
lines changed

6 files changed

+20
-22
lines changed

packages/core/src/eventSchemas/explorer/registryItemNode.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as nls from 'vscode-nls'
77
const localize = nls.loadMessageBundle()
88

9-
import { Schemas } from 'aws-sdk'
9+
import { RegistrySummary } from '@aws-sdk/client-schemas'
1010
import * as os from 'os'
1111
import * as vscode from 'vscode'
1212

@@ -25,7 +25,7 @@ export class RegistryItemNode extends AWSTreeNodeBase {
2525
public override readonly regionCode: string = this.client.regionCode
2626

2727
public constructor(
28-
private registryItemOutput: Schemas.RegistrySummary,
28+
private registryItemOutput: RegistrySummary,
2929
private readonly client: SchemaClient
3030
) {
3131
super('', vscode.TreeItemCollapsibleState.Collapsed)
@@ -56,7 +56,7 @@ export class RegistryItemNode extends AWSTreeNodeBase {
5656
})
5757
}
5858

59-
public update(registryItemOutput: Schemas.RegistrySummary): void {
59+
public update(registryItemOutput: RegistrySummary): void {
6060
this.registryItemOutput = registryItemOutput
6161
this.label = `${this.registryName}`
6262
let registryArn = ''

packages/core/src/eventSchemas/explorer/schemaItemNode.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import { Schemas } from 'aws-sdk'
7-
6+
import { SchemaSummary, SchemaVersionSummary } from '@aws-sdk/client-schemas'
87
import * as os from 'os'
98
import { SchemaClient } from '../../shared/clients/schemaClient'
109

@@ -15,7 +14,7 @@ import { localize } from '../../shared/utilities/vsCodeUtils'
1514

1615
export class SchemaItemNode extends AWSTreeNodeBase {
1716
public constructor(
18-
private schemaItem: Schemas.SchemaSummary,
17+
private schemaItem: SchemaSummary,
1918
public readonly client: SchemaClient,
2019
public readonly registryName: string
2120
) {
@@ -30,7 +29,7 @@ export class SchemaItemNode extends AWSTreeNodeBase {
3029
}
3130
}
3231

33-
public update(schemaItem: Schemas.SchemaSummary): void {
32+
public update(schemaItem: SchemaSummary): void {
3433
this.schemaItem = schemaItem
3534
this.label = this.schemaItem.SchemaName || ''
3635
let schemaArn = ''
@@ -50,7 +49,7 @@ export class SchemaItemNode extends AWSTreeNodeBase {
5049
return response.Content!
5150
}
5251

53-
public async listSchemaVersions(): Promise<Schemas.SchemaVersionSummary[]> {
52+
public async listSchemaVersions(): Promise<SchemaVersionSummary[]> {
5453
const versions = await toArrayAsync(this.client.listSchemaVersions(this.registryName, this.schemaName))
5554

5655
return versions

packages/core/src/eventSchemas/providers/schemasDataProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
*/
55

66
import * as AWS from '@aws-sdk/types'
7-
import { Schemas } from 'aws-sdk'
87
import { SchemaClient } from '../../shared/clients/schemaClient'
98
import { getLogger, Logger } from '../../shared/logger/logger'
109
import { toArrayAsync } from '../../shared/utilities/collectionUtils'
10+
import { SchemaSummary } from '@aws-sdk/client-schemas'
1111

1212
export class Cache {
1313
public constructor(public readonly credentialsRegionDataList: credentialsRegionDataListMap[]) {}
@@ -26,7 +26,7 @@ export interface regionRegistryMap {
2626

2727
export interface registrySchemasMap {
2828
registryName: string
29-
schemaList: Schemas.SchemaSummary[]
29+
schemaList: SchemaSummary[]
3030
}
3131

3232
/**

packages/core/src/eventSchemas/vue/searchSchemas.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import * as nls from 'vscode-nls'
77
const localize = nls.loadMessageBundle()
8-
import { Schemas } from 'aws-sdk'
8+
import { SchemaSummary, SearchSchemaSummary } from '@aws-sdk/client-schemas'
99
import * as vscode from 'vscode'
1010
import { downloadSchemaItemCode } from '../commands/downloadSchemaItemCode'
1111
import { RegistryItemNode } from '../explorer/registryItemNode'
@@ -93,7 +93,7 @@ export class SearchSchemasWebview extends VueWebview {
9393
}
9494

9595
public async downloadCodeBindings(summary: SchemaVersionedSummary) {
96-
const schemaItem: Schemas.SchemaSummary = {
96+
const schemaItem: SchemaSummary = {
9797
SchemaName: getSchemaNameFromTitle(summary.Title),
9898
}
9999
const schemaItemNode = new SchemaItemNode(schemaItem, this.client, summary.RegistryName)
@@ -230,7 +230,7 @@ export async function getSearchResults(
230230
return results
231231
}
232232

233-
export function getSchemaVersionedSummary(searchSummary: Schemas.SearchSchemaSummary[], prefix: string) {
233+
export function getSchemaVersionedSummary(searchSummary: SearchSchemaSummary[], prefix: string) {
234234
const results = searchSummary.map((searchSchemaSummary) => ({
235235
RegistryName: searchSchemaSummary.RegistryName!,
236236
Title: prefix.concat(searchSchemaSummary.SchemaName!),

packages/core/src/test/eventSchemas/commands/viewSchemaItem.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import { Schemas } from 'aws-sdk'
7-
6+
import { DescribeSchemaResponse } from '@aws-sdk/client-schemas'
87
import assert from 'assert'
98
import * as sinon from 'sinon'
109
import * as vscode from 'vscode'
@@ -117,7 +116,7 @@ describe('viewSchemaItem', async function () {
117116
}
118117

119118
function generateSchemaItemNode(): SchemaItemNode {
120-
const schemaResponse: Schemas.DescribeSchemaResponse = {
119+
const schemaResponse: DescribeSchemaResponse = {
121120
Content: awsEventSchemaRaw,
122121
}
123122
const schemaClient = new DefaultSchemaClient('')

packages/core/src/test/eventSchemas/explorer/registryItemNode.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import assert from 'assert'
77
import * as os from 'os'
88
import * as sinon from 'sinon'
9-
import { Schemas } from 'aws-sdk'
9+
import { RegistrySummary, SchemaSummary } from '@aws-sdk/client-schemas'
1010
import { RegistryItemNode } from '../../../eventSchemas/explorer/registryItemNode'
1111
import { SchemaItemNode } from '../../../eventSchemas/explorer/schemaItemNode'
1212
import { SchemasNode } from '../../../eventSchemas/explorer/schemasNode'
@@ -21,7 +21,7 @@ import { asyncGenerator } from '../../../shared/utilities/collectionUtils'
2121
import { getIcon } from '../../../shared/icons'
2222
import { stub } from '../../utilities/stubber'
2323

24-
function createSchemaClient(data?: { schemas?: Schemas.SchemaSummary[]; registries?: Schemas.RegistrySummary[] }) {
24+
function createSchemaClient(data?: { schemas?: SchemaSummary[]; registries?: RegistrySummary[] }) {
2525
const client = stub(DefaultSchemaClient, { regionCode: 'code' })
2626
client.listSchemas.callsFake(() => asyncGenerator(data?.schemas ?? []))
2727
client.listRegistries.callsFake(() => asyncGenerator(data?.registries ?? []))
@@ -30,7 +30,7 @@ function createSchemaClient(data?: { schemas?: Schemas.SchemaSummary[]; registri
3030
}
3131

3232
describe('RegistryItemNode', function () {
33-
let fakeRegistry: Schemas.RegistrySummary
33+
let fakeRegistry: RegistrySummary
3434

3535
before(function () {
3636
fakeRegistry = {
@@ -58,17 +58,17 @@ describe('RegistryItemNode', function () {
5858
})
5959

6060
it('returns schemas that belong to Registry', async function () {
61-
const schema1Item: Schemas.SchemaSummary = {
61+
const schema1Item: SchemaSummary = {
6262
SchemaArn: 'arn:schema1',
6363
SchemaName: 'schema1Name',
6464
}
6565

66-
const schema2Item: Schemas.SchemaSummary = {
66+
const schema2Item: SchemaSummary = {
6767
SchemaArn: 'arn:schema1',
6868
SchemaName: 'schema2Name',
6969
}
7070

71-
const schema3Item: Schemas.SchemaSummary = {
71+
const schema3Item: SchemaSummary = {
7272
SchemaArn: 'arn:schema1',
7373
SchemaName: 'schema3Name',
7474
}

0 commit comments

Comments
 (0)