@@ -78,25 +78,27 @@ export class ClustersService {
7878 * create and wait to reach RUNNING state
7979 * or fail on reaching ERROR state
8080 */
81- async createAndWait ( {
82- request,
83- timeout,
84- cancellationToken,
85- onProgress = async ( newPollResponse ) => { } ,
86- } : {
87- request : model . CreateCluster ;
88- timeout ?: Time ;
89- cancellationToken ?: CancellationToken ;
90- onProgress ?: ( newPollResponse : model . ClusterInfo ) => Promise < void > ;
91- } ) : Promise < model . ClusterInfo > {
92- const response = await this . create ( request ) ;
81+ async createAndWait (
82+ createCluster : model . CreateCluster ,
83+ options ?: {
84+ timeout ?: Time ;
85+ cancellationToken ?: CancellationToken ;
86+ onProgress ?: ( newPollResponse : model . ClusterInfo ) => Promise < void > ;
87+ }
88+ ) : Promise < model . ClusterInfo > {
89+ options = options || { } ;
90+ options . onProgress =
91+ options . onProgress || ( async ( newPollResponse ) => { } ) ;
92+ let { cancellationToken, timeout, onProgress} = options ;
93+
94+ const createClusterResponse = await this . create ( createCluster ) ;
9395
9496 return await retry < model . ClusterInfo > ( {
95- timeout : timeout ,
97+ timeout,
9698 fn : async ( ) => {
9799 const pollResponse = await this . get (
98100 {
99- cluster_id : response . cluster_id ! ,
101+ cluster_id : createClusterResponse . cluster_id ! ,
100102 } ,
101103 cancellationToken
102104 ) ;
@@ -152,25 +154,27 @@ export class ClustersService {
152154 * delete and wait to reach TERMINATED state
153155 * or fail on reaching ERROR state
154156 */
155- async deleteAndWait ( {
156- request,
157- timeout,
158- cancellationToken,
159- onProgress = async ( newPollResponse ) => { } ,
160- } : {
161- request : model . DeleteCluster ;
162- timeout ?: Time ;
163- cancellationToken ?: CancellationToken ;
164- onProgress ?: ( newPollResponse : model . ClusterInfo ) => Promise < void > ;
165- } ) : Promise < model . ClusterInfo > {
166- const response = await this . delete ( request ) ;
157+ async deleteAndWait (
158+ deleteCluster : model . DeleteCluster ,
159+ options ?: {
160+ timeout ?: Time ;
161+ cancellationToken ?: CancellationToken ;
162+ onProgress ?: ( newPollResponse : model . ClusterInfo ) => Promise < void > ;
163+ }
164+ ) : Promise < model . ClusterInfo > {
165+ options = options || { } ;
166+ options . onProgress =
167+ options . onProgress || ( async ( newPollResponse ) => { } ) ;
168+ let { cancellationToken, timeout, onProgress} = options ;
169+
170+ await this . delete ( deleteCluster ) ;
167171
168172 return await retry < model . ClusterInfo > ( {
169- timeout : timeout ,
173+ timeout,
170174 fn : async ( ) => {
171175 const pollResponse = await this . get (
172176 {
173- cluster_id : request . cluster_id ! ,
177+ cluster_id : deleteCluster . cluster_id ! ,
174178 } ,
175179 cancellationToken
176180 ) ;
@@ -235,25 +239,27 @@ export class ClustersService {
235239 * edit and wait to reach RUNNING state
236240 * or fail on reaching ERROR state
237241 */
238- async editAndWait ( {
239- request,
240- timeout,
241- cancellationToken,
242- onProgress = async ( newPollResponse ) => { } ,
243- } : {
244- request : model . EditCluster ;
245- timeout ?: Time ;
246- cancellationToken ?: CancellationToken ;
247- onProgress ?: ( newPollResponse : model . ClusterInfo ) => Promise < void > ;
248- } ) : Promise < model . ClusterInfo > {
249- const response = await this . edit ( request ) ;
242+ async editAndWait (
243+ editCluster : model . EditCluster ,
244+ options ?: {
245+ timeout ?: Time ;
246+ cancellationToken ?: CancellationToken ;
247+ onProgress ?: ( newPollResponse : model . ClusterInfo ) => Promise < void > ;
248+ }
249+ ) : Promise < model . ClusterInfo > {
250+ options = options || { } ;
251+ options . onProgress =
252+ options . onProgress || ( async ( newPollResponse ) => { } ) ;
253+ let { cancellationToken, timeout, onProgress} = options ;
254+
255+ await this . edit ( editCluster ) ;
250256
251257 return await retry < model . ClusterInfo > ( {
252- timeout : timeout ,
258+ timeout,
253259 fn : async ( ) => {
254260 const pollResponse = await this . get (
255261 {
256- cluster_id : request . cluster_id ! ,
262+ cluster_id : editCluster . cluster_id ! ,
257263 } ,
258264 cancellationToken
259265 ) ;
@@ -328,25 +334,27 @@ export class ClustersService {
328334 * get and wait to reach RUNNING state
329335 * or fail on reaching ERROR state
330336 */
331- async getAndWait ( {
332- request,
333- timeout,
334- cancellationToken,
335- onProgress = async ( newPollResponse ) => { } ,
336- } : {
337- request : model . GetRequest ;
338- timeout ?: Time ;
339- cancellationToken ?: CancellationToken ;
340- onProgress ?: ( newPollResponse : model . ClusterInfo ) => Promise < void > ;
341- } ) : Promise < model . ClusterInfo > {
342- const response = await this . get ( request ) ;
337+ async getAndWait (
338+ getRequest : model . GetRequest ,
339+ options ?: {
340+ timeout ?: Time ;
341+ cancellationToken ?: CancellationToken ;
342+ onProgress ?: ( newPollResponse : model . ClusterInfo ) => Promise < void > ;
343+ }
344+ ) : Promise < model . ClusterInfo > {
345+ options = options || { } ;
346+ options . onProgress =
347+ options . onProgress || ( async ( newPollResponse ) => { } ) ;
348+ let { cancellationToken, timeout, onProgress} = options ;
349+
350+ const clusterInfo = await this . get ( getRequest ) ;
343351
344352 return await retry < model . ClusterInfo > ( {
345- timeout : timeout ,
353+ timeout,
346354 fn : async ( ) => {
347355 const pollResponse = await this . get (
348356 {
349- cluster_id : response . cluster_id ! ,
357+ cluster_id : clusterInfo . cluster_id ! ,
350358 } ,
351359 cancellationToken
352360 ) ;
@@ -506,25 +514,27 @@ export class ClustersService {
506514 * resize and wait to reach RUNNING state
507515 * or fail on reaching ERROR state
508516 */
509- async resizeAndWait ( {
510- request,
511- timeout,
512- cancellationToken,
513- onProgress = async ( newPollResponse ) => { } ,
514- } : {
515- request : model . ResizeCluster ;
516- timeout ?: Time ;
517- cancellationToken ?: CancellationToken ;
518- onProgress ?: ( newPollResponse : model . ClusterInfo ) => Promise < void > ;
519- } ) : Promise < model . ClusterInfo > {
520- const response = await this . resize ( request ) ;
517+ async resizeAndWait (
518+ resizeCluster : model . ResizeCluster ,
519+ options ?: {
520+ timeout ?: Time ;
521+ cancellationToken ?: CancellationToken ;
522+ onProgress ?: ( newPollResponse : model . ClusterInfo ) => Promise < void > ;
523+ }
524+ ) : Promise < model . ClusterInfo > {
525+ options = options || { } ;
526+ options . onProgress =
527+ options . onProgress || ( async ( newPollResponse ) => { } ) ;
528+ let { cancellationToken, timeout, onProgress} = options ;
529+
530+ await this . resize ( resizeCluster ) ;
521531
522532 return await retry < model . ClusterInfo > ( {
523- timeout : timeout ,
533+ timeout,
524534 fn : async ( ) => {
525535 const pollResponse = await this . get (
526536 {
527- cluster_id : request . cluster_id ! ,
537+ cluster_id : resizeCluster . cluster_id ! ,
528538 } ,
529539 cancellationToken
530540 ) ;
@@ -578,25 +588,27 @@ export class ClustersService {
578588 * restart and wait to reach RUNNING state
579589 * or fail on reaching ERROR state
580590 */
581- async restartAndWait ( {
582- request,
583- timeout,
584- cancellationToken,
585- onProgress = async ( newPollResponse ) => { } ,
586- } : {
587- request : model . RestartCluster ;
588- timeout ?: Time ;
589- cancellationToken ?: CancellationToken ;
590- onProgress ?: ( newPollResponse : model . ClusterInfo ) => Promise < void > ;
591- } ) : Promise < model . ClusterInfo > {
592- const response = await this . restart ( request ) ;
591+ async restartAndWait (
592+ restartCluster : model . RestartCluster ,
593+ options ?: {
594+ timeout ?: Time ;
595+ cancellationToken ?: CancellationToken ;
596+ onProgress ?: ( newPollResponse : model . ClusterInfo ) => Promise < void > ;
597+ }
598+ ) : Promise < model . ClusterInfo > {
599+ options = options || { } ;
600+ options . onProgress =
601+ options . onProgress || ( async ( newPollResponse ) => { } ) ;
602+ let { cancellationToken, timeout, onProgress} = options ;
603+
604+ await this . restart ( restartCluster ) ;
593605
594606 return await retry < model . ClusterInfo > ( {
595- timeout : timeout ,
607+ timeout,
596608 fn : async ( ) => {
597609 const pollResponse = await this . get (
598610 {
599- cluster_id : request . cluster_id ! ,
611+ cluster_id : restartCluster . cluster_id ! ,
600612 } ,
601613 cancellationToken
602614 ) ;
@@ -674,25 +686,27 @@ export class ClustersService {
674686 * start and wait to reach RUNNING state
675687 * or fail on reaching ERROR state
676688 */
677- async startAndWait ( {
678- request,
679- timeout,
680- cancellationToken,
681- onProgress = async ( newPollResponse ) => { } ,
682- } : {
683- request : model . StartCluster ;
684- timeout ?: Time ;
685- cancellationToken ?: CancellationToken ;
686- onProgress ?: ( newPollResponse : model . ClusterInfo ) => Promise < void > ;
687- } ) : Promise < model . ClusterInfo > {
688- const response = await this . start ( request ) ;
689+ async startAndWait (
690+ startCluster : model . StartCluster ,
691+ options ?: {
692+ timeout ?: Time ;
693+ cancellationToken ?: CancellationToken ;
694+ onProgress ?: ( newPollResponse : model . ClusterInfo ) => Promise < void > ;
695+ }
696+ ) : Promise < model . ClusterInfo > {
697+ options = options || { } ;
698+ options . onProgress =
699+ options . onProgress || ( async ( newPollResponse ) => { } ) ;
700+ let { cancellationToken, timeout, onProgress} = options ;
701+
702+ await this . start ( startCluster ) ;
689703
690704 return await retry < model . ClusterInfo > ( {
691- timeout : timeout ,
705+ timeout,
692706 fn : async ( ) => {
693707 const pollResponse = await this . get (
694708 {
695- cluster_id : request . cluster_id ! ,
709+ cluster_id : startCluster . cluster_id ! ,
696710 } ,
697711 cancellationToken
698712 ) ;
0 commit comments