@@ -17,13 +17,12 @@ import {
17
17
import APIS , { ActionType } from './apis' ;
18
18
import { pascalCaseProps , randomId } from '../../utils/index' ;
19
19
import { CapiCredentials , RegionType } from '../interface' ;
20
- import { Account , Cam } from '../../' ;
20
+ import { Cam } from '../../' ;
21
21
22
22
export default class Asw {
23
23
credentials : CapiCredentials ;
24
24
capi : Capi ;
25
25
region : RegionType ;
26
- account : Account ;
27
26
cam : Cam ;
28
27
29
28
constructor ( credentials : CapiCredentials , region : RegionType = 'ap-guangzhou' ) {
@@ -38,8 +37,6 @@ export default class Asw {
38
37
Token : this . credentials . Token ,
39
38
} ) ;
40
39
41
- this . account = new Account ( credentials ) ;
42
-
43
40
this . cam = new Cam ( credentials ) ;
44
41
}
45
42
@@ -70,8 +67,7 @@ export default class Asw {
70
67
const {
71
68
definition,
72
69
name,
73
- role,
74
- uin,
70
+ roleArn,
75
71
type = 'STANDARD' ,
76
72
chineseName = 'serverless' ,
77
73
description = 'Created By Serverless' ,
@@ -82,22 +78,14 @@ export default class Asw {
82
78
const reqParams : CreateApiOptions = {
83
79
Definition : definition ,
84
80
FlowServiceName : name ,
85
- IsNewRole : ! ! role ,
81
+ IsNewRole : false ,
86
82
Type : type ,
87
83
FlowServiceChineseName : chineseName ,
88
84
Description : description ,
89
85
EnableCLS : enableCls ,
86
+ RoleResource : roleArn ,
90
87
} ;
91
88
92
- let roleName = role ;
93
-
94
- if ( ! roleName ) {
95
- // 如果上层传入 appId 直接使用上层 appId,如果没有尝试通过 accountInfo 中来获取
96
- const { appId } = options ;
97
- roleName = await this . createRole ( name , appId ! ) ;
98
- }
99
- reqParams . RoleResource = `qcs::cam::uin/${ uin } :roleName/${ roleName } ` ;
100
-
101
89
if ( input ) {
102
90
reqParams . Input = input ;
103
91
}
@@ -109,8 +97,7 @@ export default class Asw {
109
97
return {
110
98
requestId : RequestId ,
111
99
resourceId : FlowServiceResource ,
112
- isNewRole : reqParams . IsNewRole ,
113
- roleName,
100
+ roleArn,
114
101
} ;
115
102
}
116
103
@@ -124,8 +111,7 @@ export default class Asw {
124
111
resourceId,
125
112
definition,
126
113
name,
127
- role,
128
- uin,
114
+ roleArn,
129
115
type = 'STANDARD' ,
130
116
chineseName = 'serverless' ,
131
117
description = 'Created By Serverless' ,
@@ -136,23 +122,14 @@ export default class Asw {
136
122
FlowServiceResource : resourceId ,
137
123
Definition : definition ,
138
124
FlowServiceName : name ,
139
- IsNewRole : ! role ,
125
+ IsNewRole : false ,
140
126
Type : type ,
141
127
FlowServiceChineseName : chineseName ,
142
128
Description : description ,
143
129
EnableCLS : enableCls ,
130
+ RoleResource : roleArn ,
144
131
} ;
145
132
146
- let roleName = role ;
147
-
148
- if ( ! roleName ) {
149
- // 如果上层传入 appId 直接使用上层 appId,如果没有尝试通过 accountInfo 中来获取
150
- const { appId } = options ;
151
- roleName = await this . createRole ( name , appId ! ) ;
152
- }
153
-
154
- reqParams . RoleResource = `qcs::cam::uin/${ uin } :roleName/${ roleName } ` ;
155
-
156
133
const { RequestId, FlowServiceResource } = await this . request ( {
157
134
...reqParams ,
158
135
Action : 'ModifyFlowService' ,
@@ -161,8 +138,7 @@ export default class Asw {
161
138
return {
162
139
requestId : RequestId ,
163
140
resourceId : FlowServiceResource ,
164
- isNewRole : reqParams . IsNewRole ,
165
- roleName,
141
+ roleArn,
166
142
} ;
167
143
}
168
144
0 commit comments