Skip to content

Commit ca90252

Browse files
committed
feat: 修改sts & command
1 parent 3b1fe4f commit ca90252

10 files changed

Lines changed: 121 additions & 51 deletions

File tree

packages/sdk-core/src/client/Client.ts

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,11 @@ export class Client {
102102

103103
async send<
104104
TInput extends CommandInput,
105-
TOutput,
106-
TName extends keyof CommandOutputMap | never = never
105+
TCommandName extends keyof CommandOutputMap
107106
>(
108-
command: Command<TInput, TOutput, TName>,
107+
command: Command<TInput, CommandOutputMap[TCommandName], TCommandName>,
109108
options?: SendOptions
110-
): Promise<
111-
TName extends keyof CommandOutputMap ? CommandOutputMap[TName] : TOutput
112-
> {
109+
): Promise<CommandOutputMap[TCommandName]> {
113110
const stack = this.middlewareStack.merge(command.middlewareStack);
114111
const context: MiddlewareContext = {
115112
clientName: this.constructor.name,
@@ -181,17 +178,6 @@ export class Client {
181178
return result as any;
182179
}
183180

184-
async sendWithRawResponse<
185-
TInput extends CommandInput,
186-
TOutput,
187-
TName extends keyof CommandOutputMap | never = never
188-
>(
189-
command: Command<TInput, TOutput, TName>,
190-
options?: SendOptions
191-
): Promise<any> {
192-
return this.send(command, { ...options, skipResponseCasting: true });
193-
}
194-
195181
destroy(): void {
196182
// 清理 requestHandler 资源
197183
this.requestHandler.destroy?.();
@@ -203,9 +189,10 @@ export class Client {
203189
*/
204190
debugMiddlewareStack<
205191
TInput extends CommandInput,
206-
TOutput,
207-
TName extends keyof CommandOutputMap | never = never
208-
>(command: Command<TInput, TOutput, TName>): string {
192+
TCommandName extends keyof CommandOutputMap
193+
>(
194+
command: Command<TInput, CommandOutputMap[TCommandName], TCommandName>
195+
): string {
209196
const mergedStack = this.middlewareStack.merge(command.middlewareStack);
210197
return mergedStack.toString();
211198
}

packages/sdk-core/src/client/stsClient/api.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@ import {
2222

2323
import { AssumeRoleRequest } from "./types/index";
2424
import { AssumeRoleResponse } from "./types/index";
25-
import { AssumeRoleRequestCast } from "./meta/index";
26-
import { AssumeRoleResponseCast } from "./meta/index";
2725

2826
// ============================================================================
2927
// Output Type Definitions
3028
// ============================================================================
3129
export type AssumeRoleCommandOutput = CommandOutput<AssumeRoleResponse>;
3230

31+
declare module "../../types/types" {
32+
interface CommandOutputMap {
33+
AssumeRoleCommand: AssumeRoleCommandOutput;
34+
}
35+
}
3336
/**
3437
* STSClient Service Client
3538
*/
@@ -58,9 +61,6 @@ export class AssumeRoleCommand extends Command<
5861
this.requestConfig = buildRequestConfigFromMetaPath(
5962
AssumeRoleCommand.metaPath
6063
);
61-
62-
this.requestMap = AssumeRoleRequestCast;
63-
this.responseMap = AssumeRoleResponseCast;
6464
}
6565
}
6666

packages/sdk-core/src/client/stsClient/meta/assume-role-meta.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

packages/sdk-core/src/client/stsClient/meta/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/sdk-core/src/client/stsClient/types/assume-role-response.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,31 @@
55
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
66
*
77
* OpenAPI spec version: common-version
8-
*
8+
*
99
*
1010
* NOTE: This class is auto generated by the swagger code generator program.
1111
* https://github.com/swagger-api/swagger-codegen.git
1212
* Do not edit the class manually.
1313
*/
1414

15-
/**
16-
*
15+
import { AssumedRoleUserForAssumeRoleOutput } from "./assumed-role-user-for-assume-role-output";
16+
import { CredentialsForAssumeRoleOutput } from "./credentials-for-assume-role-output";
17+
/**
18+
*
1719
*
1820
* @export
1921
* @interface AssumeRoleResponse
2022
*/
2123
export interface AssumeRoleResponse {
24+
/**
25+
* @type {AssumedRoleUserForAssumeRoleOutput}
26+
* @memberof AssumeRoleResponse
27+
*/
28+
AssumedRoleUser?: AssumedRoleUserForAssumeRoleOutput;
29+
30+
/**
31+
* @type {CredentialsForAssumeRoleOutput}
32+
* @memberof AssumeRoleResponse
33+
*/
34+
Credentials?: CredentialsForAssumeRoleOutput;
2235
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
* sts
5+
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
6+
*
7+
* OpenAPI spec version: common-version
8+
*
9+
*
10+
* NOTE: This class is auto generated by the swagger code generator program.
11+
* https://github.com/swagger-api/swagger-codegen.git
12+
* Do not edit the class manually.
13+
*/
14+
15+
/**
16+
*
17+
*
18+
* @export
19+
* @interface AssumedRoleUserForAssumeRoleOutput
20+
*/
21+
export interface AssumedRoleUserForAssumeRoleOutput {
22+
23+
/**
24+
* @type {string}
25+
* @memberof AssumedRoleUserForAssumeRoleOutput
26+
*/
27+
AssumedRoleId?: string;
28+
29+
/**
30+
* @type {string}
31+
* @memberof AssumedRoleUserForAssumeRoleOutput
32+
*/
33+
Trn?: string;
34+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
* sts
5+
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
6+
*
7+
* OpenAPI spec version: common-version
8+
*
9+
*
10+
* NOTE: This class is auto generated by the swagger code generator program.
11+
* https://github.com/swagger-api/swagger-codegen.git
12+
* Do not edit the class manually.
13+
*/
14+
15+
/**
16+
*
17+
*
18+
* @export
19+
* @interface CredentialsForAssumeRoleOutput
20+
*/
21+
export interface CredentialsForAssumeRoleOutput {
22+
23+
/**
24+
* @type {string}
25+
* @memberof CredentialsForAssumeRoleOutput
26+
*/
27+
AccessKeyId?: string;
28+
29+
/**
30+
* @type {string}
31+
* @memberof CredentialsForAssumeRoleOutput
32+
*/
33+
CurrentTime?: string;
34+
35+
/**
36+
* @type {string}
37+
* @memberof CredentialsForAssumeRoleOutput
38+
*/
39+
ExpiredTime?: string;
40+
41+
/**
42+
* @type {string}
43+
* @memberof CredentialsForAssumeRoleOutput
44+
*/
45+
SecretAccessKey?: string;
46+
47+
/**
48+
* @type {string}
49+
* @memberof CredentialsForAssumeRoleOutput
50+
*/
51+
SessionToken?: string;
52+
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
export * from './assume-role-request';
2-
export * from './assume-role-response';
3-
export * from './tag-for-assume-role-input';
1+
export * from "./assume-role-request";
2+
export * from "./assume-role-response";
3+
export * from "./assumed-role-user-for-assume-role-output";
4+
export * from "./credentials-for-assume-role-output";
5+
export * from "./tag-for-assume-role-input";

packages/sdk-core/src/command/Command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class Command<
2222
requestMap?: Record<string, any>;
2323
responseMap?: Record<string, any>;
2424

25-
private __type?: {
25+
protected __type?: {
2626
output: TOutput;
2727
commandName: TCommandName;
2828
};

packages/sdk-core/src/types/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export interface SendOptions {
128128
/**
129129
* AbortController 的 signal,用于取消请求
130130
*/
131-
abortSignal?: AbortSignal;
131+
abortSignal?: any;
132132
/**
133133
* Request-level timeout in milliseconds
134134
* Overrides client-level httpOptions.timeout

0 commit comments

Comments
 (0)