@@ -17,13 +17,12 @@ import {
1717import APIS , { ActionType } from './apis' ;
1818import { pascalCaseProps , randomId } from '../../utils/index' ;
1919import { CapiCredentials , RegionType } from '../interface' ;
20- import { Account , Cam } from '../../' ;
20+ import { Cam } from '../../' ;
2121
2222export default class Asw {
2323 credentials : CapiCredentials ;
2424 capi : Capi ;
2525 region : RegionType ;
26- account : Account ;
2726 cam : Cam ;
2827
2928 constructor ( credentials : CapiCredentials , region : RegionType = 'ap-guangzhou' ) {
@@ -38,8 +37,6 @@ export default class Asw {
3837 Token : this . credentials . Token ,
3938 } ) ;
4039
41- this . account = new Account ( credentials ) ;
42-
4340 this . cam = new Cam ( credentials ) ;
4441 }
4542
@@ -70,8 +67,7 @@ export default class Asw {
7067 const {
7168 definition,
7269 name,
73- role,
74- uin,
70+ roleArn,
7571 type = 'STANDARD' ,
7672 chineseName = 'serverless' ,
7773 description = 'Created By Serverless' ,
@@ -82,22 +78,14 @@ export default class Asw {
8278 const reqParams : CreateApiOptions = {
8379 Definition : definition ,
8480 FlowServiceName : name ,
85- IsNewRole : ! ! role ,
81+ IsNewRole : false ,
8682 Type : type ,
8783 FlowServiceChineseName : chineseName ,
8884 Description : description ,
8985 EnableCLS : enableCls ,
86+ RoleResource : roleArn ,
9087 } ;
9188
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-
10189 if ( input ) {
10290 reqParams . Input = input ;
10391 }
@@ -109,8 +97,7 @@ export default class Asw {
10997 return {
11098 requestId : RequestId ,
11199 resourceId : FlowServiceResource ,
112- isNewRole : reqParams . IsNewRole ,
113- roleName,
100+ roleArn,
114101 } ;
115102 }
116103
@@ -124,8 +111,7 @@ export default class Asw {
124111 resourceId,
125112 definition,
126113 name,
127- role,
128- uin,
114+ roleArn,
129115 type = 'STANDARD' ,
130116 chineseName = 'serverless' ,
131117 description = 'Created By Serverless' ,
@@ -136,23 +122,14 @@ export default class Asw {
136122 FlowServiceResource : resourceId ,
137123 Definition : definition ,
138124 FlowServiceName : name ,
139- IsNewRole : ! role ,
125+ IsNewRole : false ,
140126 Type : type ,
141127 FlowServiceChineseName : chineseName ,
142128 Description : description ,
143129 EnableCLS : enableCls ,
130+ RoleResource : roleArn ,
144131 } ;
145132
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-
156133 const { RequestId, FlowServiceResource } = await this . request ( {
157134 ...reqParams ,
158135 Action : 'ModifyFlowService' ,
@@ -161,8 +138,7 @@ export default class Asw {
161138 return {
162139 requestId : RequestId ,
163140 resourceId : FlowServiceResource ,
164- isNewRole : reqParams . IsNewRole ,
165- roleName,
141+ roleArn,
166142 } ;
167143 }
168144
0 commit comments