OLD | NEW |
| (Empty) |
1 library googleapis_beta.replicapool.v1beta1; | |
2 | |
3 import "dart:core" as core; | |
4 import "dart:collection" as collection; | |
5 import "dart:async" as async; | |
6 import "dart:convert" as convert; | |
7 | |
8 import "package:crypto/crypto.dart" as crypto; | |
9 import 'package:http/http.dart' as http; | |
10 import '../src/common_internal.dart' as common_internal; | |
11 import '../common/common.dart' as common; | |
12 | |
13 export '../common/common.dart' show ApiRequestError; | |
14 export '../common/common.dart' show DetailedApiRequestError; | |
15 | |
16 /** | |
17 * The Replica Pool API allows users to declaratively provision and manage | |
18 * groups of Google Compute Engine instances based on a common template. | |
19 */ | |
20 class ReplicapoolApi { | |
21 /** View and manage your data across Google Cloud Platform services */ | |
22 static const CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platf
orm"; | |
23 | |
24 /** | |
25 * View and manage your Google Cloud Platform management resources and | |
26 * deployment status information | |
27 */ | |
28 static const NdevCloudmanScope = "https://www.googleapis.com/auth/ndev.cloudma
n"; | |
29 | |
30 /** | |
31 * View your Google Cloud Platform management resources and deployment status | |
32 * information | |
33 */ | |
34 static const NdevCloudmanReadonlyScope = "https://www.googleapis.com/auth/ndev
.cloudman.readonly"; | |
35 | |
36 /** View and manage replica pools */ | |
37 static const ReplicapoolScope = "https://www.googleapis.com/auth/replicapool"; | |
38 | |
39 /** View replica pools */ | |
40 static const ReplicapoolReadonlyScope = "https://www.googleapis.com/auth/repli
capool.readonly"; | |
41 | |
42 | |
43 final common_internal.ApiRequester _requester; | |
44 | |
45 PoolsResourceApi get pools => new PoolsResourceApi(_requester); | |
46 ReplicasResourceApi get replicas => new ReplicasResourceApi(_requester); | |
47 | |
48 ReplicapoolApi(http.Client client) : | |
49 _requester = new common_internal.ApiRequester(client, "https://www.googlea
pis.com/", "replicapool/v1beta1/projects/"); | |
50 } | |
51 | |
52 | |
53 /** Not documented yet. */ | |
54 class PoolsResourceApi { | |
55 final common_internal.ApiRequester _requester; | |
56 | |
57 PoolsResourceApi(common_internal.ApiRequester client) : | |
58 _requester = client; | |
59 | |
60 /** | |
61 * Deletes a replica pool. | |
62 * | |
63 * [request] - The metadata request object. | |
64 * | |
65 * Request parameters: | |
66 * | |
67 * [projectName] - The project ID for this replica pool. | |
68 * | |
69 * [zone] - The zone for this replica pool. | |
70 * | |
71 * [poolName] - The name of the replica pool for this request. | |
72 * | |
73 * Completes with a [common.ApiRequestError] if the API endpoint returned an | |
74 * error. | |
75 * | |
76 * If the used [http.Client] completes with an error when making a REST call, | |
77 * this method will complete with the same error. | |
78 */ | |
79 async.Future delete(PoolsDeleteRequest request, core.String projectName, core.
String zone, core.String poolName) { | |
80 var _url = null; | |
81 var _queryParams = new core.Map(); | |
82 var _uploadMedia = null; | |
83 var _uploadOptions = null; | |
84 var _downloadOptions = common.DownloadOptions.Metadata; | |
85 var _body = null; | |
86 | |
87 if (request != null) { | |
88 _body = convert.JSON.encode((request).toJson()); | |
89 } | |
90 if (projectName == null) { | |
91 throw new core.ArgumentError("Parameter projectName is required."); | |
92 } | |
93 if (zone == null) { | |
94 throw new core.ArgumentError("Parameter zone is required."); | |
95 } | |
96 if (poolName == null) { | |
97 throw new core.ArgumentError("Parameter poolName is required."); | |
98 } | |
99 | |
100 _downloadOptions = null; | |
101 | |
102 _url = common_internal.Escaper.ecapeVariable('$projectName') + '/zones/' + c
ommon_internal.Escaper.ecapeVariable('$zone') + '/pools/' + common_internal.Esca
per.ecapeVariable('$poolName'); | |
103 | |
104 var _response = _requester.request(_url, | |
105 "POST", | |
106 body: _body, | |
107 queryParams: _queryParams, | |
108 uploadOptions: _uploadOptions, | |
109 uploadMedia: _uploadMedia, | |
110 downloadOptions: _downloadOptions); | |
111 return _response.then((data) => null); | |
112 } | |
113 | |
114 /** | |
115 * Gets information about a single replica pool. | |
116 * | |
117 * Request parameters: | |
118 * | |
119 * [projectName] - The project ID for this replica pool. | |
120 * | |
121 * [zone] - The zone for this replica pool. | |
122 * | |
123 * [poolName] - The name of the replica pool for this request. | |
124 * | |
125 * Completes with a [Pool]. | |
126 * | |
127 * Completes with a [common.ApiRequestError] if the API endpoint returned an | |
128 * error. | |
129 * | |
130 * If the used [http.Client] completes with an error when making a REST call, | |
131 * this method will complete with the same error. | |
132 */ | |
133 async.Future<Pool> get(core.String projectName, core.String zone, core.String
poolName) { | |
134 var _url = null; | |
135 var _queryParams = new core.Map(); | |
136 var _uploadMedia = null; | |
137 var _uploadOptions = null; | |
138 var _downloadOptions = common.DownloadOptions.Metadata; | |
139 var _body = null; | |
140 | |
141 if (projectName == null) { | |
142 throw new core.ArgumentError("Parameter projectName is required."); | |
143 } | |
144 if (zone == null) { | |
145 throw new core.ArgumentError("Parameter zone is required."); | |
146 } | |
147 if (poolName == null) { | |
148 throw new core.ArgumentError("Parameter poolName is required."); | |
149 } | |
150 | |
151 | |
152 _url = common_internal.Escaper.ecapeVariable('$projectName') + '/zones/' + c
ommon_internal.Escaper.ecapeVariable('$zone') + '/pools/' + common_internal.Esca
per.ecapeVariable('$poolName'); | |
153 | |
154 var _response = _requester.request(_url, | |
155 "GET", | |
156 body: _body, | |
157 queryParams: _queryParams, | |
158 uploadOptions: _uploadOptions, | |
159 uploadMedia: _uploadMedia, | |
160 downloadOptions: _downloadOptions); | |
161 return _response.then((data) => new Pool.fromJson(data)); | |
162 } | |
163 | |
164 /** | |
165 * Inserts a new replica pool. | |
166 * | |
167 * [request] - The metadata request object. | |
168 * | |
169 * Request parameters: | |
170 * | |
171 * [projectName] - The project ID for this replica pool. | |
172 * | |
173 * [zone] - The zone for this replica pool. | |
174 * | |
175 * Completes with a [Pool]. | |
176 * | |
177 * Completes with a [common.ApiRequestError] if the API endpoint returned an | |
178 * error. | |
179 * | |
180 * If the used [http.Client] completes with an error when making a REST call, | |
181 * this method will complete with the same error. | |
182 */ | |
183 async.Future<Pool> insert(Pool request, core.String projectName, core.String z
one) { | |
184 var _url = null; | |
185 var _queryParams = new core.Map(); | |
186 var _uploadMedia = null; | |
187 var _uploadOptions = null; | |
188 var _downloadOptions = common.DownloadOptions.Metadata; | |
189 var _body = null; | |
190 | |
191 if (request != null) { | |
192 _body = convert.JSON.encode((request).toJson()); | |
193 } | |
194 if (projectName == null) { | |
195 throw new core.ArgumentError("Parameter projectName is required."); | |
196 } | |
197 if (zone == null) { | |
198 throw new core.ArgumentError("Parameter zone is required."); | |
199 } | |
200 | |
201 | |
202 _url = common_internal.Escaper.ecapeVariable('$projectName') + '/zones/' + c
ommon_internal.Escaper.ecapeVariable('$zone') + '/pools'; | |
203 | |
204 var _response = _requester.request(_url, | |
205 "POST", | |
206 body: _body, | |
207 queryParams: _queryParams, | |
208 uploadOptions: _uploadOptions, | |
209 uploadMedia: _uploadMedia, | |
210 downloadOptions: _downloadOptions); | |
211 return _response.then((data) => new Pool.fromJson(data)); | |
212 } | |
213 | |
214 /** | |
215 * List all replica pools. | |
216 * | |
217 * Request parameters: | |
218 * | |
219 * [projectName] - The project ID for this request. | |
220 * | |
221 * [zone] - The zone for this replica pool. | |
222 * | |
223 * [maxResults] - Maximum count of results to be returned. Acceptable values | |
224 * are 0 to 100, inclusive. (Default: 50) | |
225 * Value must be between "0" and "1000". | |
226 * | |
227 * [pageToken] - Set this to the nextPageToken value returned by a previous | |
228 * list request to obtain the next page of results from the previous list | |
229 * request. | |
230 * | |
231 * Completes with a [PoolsListResponse]. | |
232 * | |
233 * Completes with a [common.ApiRequestError] if the API endpoint returned an | |
234 * error. | |
235 * | |
236 * If the used [http.Client] completes with an error when making a REST call, | |
237 * this method will complete with the same error. | |
238 */ | |
239 async.Future<PoolsListResponse> list(core.String projectName, core.String zone
, {core.int maxResults, core.String pageToken}) { | |
240 var _url = null; | |
241 var _queryParams = new core.Map(); | |
242 var _uploadMedia = null; | |
243 var _uploadOptions = null; | |
244 var _downloadOptions = common.DownloadOptions.Metadata; | |
245 var _body = null; | |
246 | |
247 if (projectName == null) { | |
248 throw new core.ArgumentError("Parameter projectName is required."); | |
249 } | |
250 if (zone == null) { | |
251 throw new core.ArgumentError("Parameter zone is required."); | |
252 } | |
253 if (maxResults != null) { | |
254 _queryParams["maxResults"] = ["${maxResults}"]; | |
255 } | |
256 if (pageToken != null) { | |
257 _queryParams["pageToken"] = [pageToken]; | |
258 } | |
259 | |
260 | |
261 _url = common_internal.Escaper.ecapeVariable('$projectName') + '/zones/' + c
ommon_internal.Escaper.ecapeVariable('$zone') + '/pools'; | |
262 | |
263 var _response = _requester.request(_url, | |
264 "GET", | |
265 body: _body, | |
266 queryParams: _queryParams, | |
267 uploadOptions: _uploadOptions, | |
268 uploadMedia: _uploadMedia, | |
269 downloadOptions: _downloadOptions); | |
270 return _response.then((data) => new PoolsListResponse.fromJson(data)); | |
271 } | |
272 | |
273 /** | |
274 * Resize a pool. This is an asynchronous operation, and multiple overlapping | |
275 * resize requests can be made. Replica Pools will use the information from | |
276 * the last resize request. | |
277 * | |
278 * Request parameters: | |
279 * | |
280 * [projectName] - The project ID for this replica pool. | |
281 * | |
282 * [zone] - The zone for this replica pool. | |
283 * | |
284 * [poolName] - The name of the replica pool for this request. | |
285 * | |
286 * [numReplicas] - The desired number of replicas to resize to. If this number | |
287 * is larger than the existing number of replicas, new replicas will be added. | |
288 * If the number is smaller, then existing replicas will be deleted. | |
289 * | |
290 * Completes with a [Pool]. | |
291 * | |
292 * Completes with a [common.ApiRequestError] if the API endpoint returned an | |
293 * error. | |
294 * | |
295 * If the used [http.Client] completes with an error when making a REST call, | |
296 * this method will complete with the same error. | |
297 */ | |
298 async.Future<Pool> resize(core.String projectName, core.String zone, core.Stri
ng poolName, {core.int numReplicas}) { | |
299 var _url = null; | |
300 var _queryParams = new core.Map(); | |
301 var _uploadMedia = null; | |
302 var _uploadOptions = null; | |
303 var _downloadOptions = common.DownloadOptions.Metadata; | |
304 var _body = null; | |
305 | |
306 if (projectName == null) { | |
307 throw new core.ArgumentError("Parameter projectName is required."); | |
308 } | |
309 if (zone == null) { | |
310 throw new core.ArgumentError("Parameter zone is required."); | |
311 } | |
312 if (poolName == null) { | |
313 throw new core.ArgumentError("Parameter poolName is required."); | |
314 } | |
315 if (numReplicas != null) { | |
316 _queryParams["numReplicas"] = ["${numReplicas}"]; | |
317 } | |
318 | |
319 | |
320 _url = common_internal.Escaper.ecapeVariable('$projectName') + '/zones/' + c
ommon_internal.Escaper.ecapeVariable('$zone') + '/pools/' + common_internal.Esca
per.ecapeVariable('$poolName') + '/resize'; | |
321 | |
322 var _response = _requester.request(_url, | |
323 "POST", | |
324 body: _body, | |
325 queryParams: _queryParams, | |
326 uploadOptions: _uploadOptions, | |
327 uploadMedia: _uploadMedia, | |
328 downloadOptions: _downloadOptions); | |
329 return _response.then((data) => new Pool.fromJson(data)); | |
330 } | |
331 | |
332 /** | |
333 * Update the template used by the pool. | |
334 * | |
335 * [request] - The metadata request object. | |
336 * | |
337 * Request parameters: | |
338 * | |
339 * [projectName] - The project ID for this replica pool. | |
340 * | |
341 * [zone] - The zone for this replica pool. | |
342 * | |
343 * [poolName] - The name of the replica pool for this request. | |
344 * | |
345 * Completes with a [common.ApiRequestError] if the API endpoint returned an | |
346 * error. | |
347 * | |
348 * If the used [http.Client] completes with an error when making a REST call, | |
349 * this method will complete with the same error. | |
350 */ | |
351 async.Future updatetemplate(Template request, core.String projectName, core.St
ring zone, core.String poolName) { | |
352 var _url = null; | |
353 var _queryParams = new core.Map(); | |
354 var _uploadMedia = null; | |
355 var _uploadOptions = null; | |
356 var _downloadOptions = common.DownloadOptions.Metadata; | |
357 var _body = null; | |
358 | |
359 if (request != null) { | |
360 _body = convert.JSON.encode((request).toJson()); | |
361 } | |
362 if (projectName == null) { | |
363 throw new core.ArgumentError("Parameter projectName is required."); | |
364 } | |
365 if (zone == null) { | |
366 throw new core.ArgumentError("Parameter zone is required."); | |
367 } | |
368 if (poolName == null) { | |
369 throw new core.ArgumentError("Parameter poolName is required."); | |
370 } | |
371 | |
372 _downloadOptions = null; | |
373 | |
374 _url = common_internal.Escaper.ecapeVariable('$projectName') + '/zones/' + c
ommon_internal.Escaper.ecapeVariable('$zone') + '/pools/' + common_internal.Esca
per.ecapeVariable('$poolName') + '/updateTemplate'; | |
375 | |
376 var _response = _requester.request(_url, | |
377 "POST", | |
378 body: _body, | |
379 queryParams: _queryParams, | |
380 uploadOptions: _uploadOptions, | |
381 uploadMedia: _uploadMedia, | |
382 downloadOptions: _downloadOptions); | |
383 return _response.then((data) => null); | |
384 } | |
385 | |
386 } | |
387 | |
388 | |
389 /** Not documented yet. */ | |
390 class ReplicasResourceApi { | |
391 final common_internal.ApiRequester _requester; | |
392 | |
393 ReplicasResourceApi(common_internal.ApiRequester client) : | |
394 _requester = client; | |
395 | |
396 /** | |
397 * Deletes a replica from the pool. | |
398 * | |
399 * [request] - The metadata request object. | |
400 * | |
401 * Request parameters: | |
402 * | |
403 * [projectName] - The project ID for this request. | |
404 * | |
405 * [zone] - The zone where the replica lives. | |
406 * | |
407 * [poolName] - The replica pool name for this request. | |
408 * | |
409 * [replicaName] - The name of the replica for this request. | |
410 * | |
411 * Completes with a [Replica]. | |
412 * | |
413 * Completes with a [common.ApiRequestError] if the API endpoint returned an | |
414 * error. | |
415 * | |
416 * If the used [http.Client] completes with an error when making a REST call, | |
417 * this method will complete with the same error. | |
418 */ | |
419 async.Future<Replica> delete(ReplicasDeleteRequest request, core.String projec
tName, core.String zone, core.String poolName, core.String replicaName) { | |
420 var _url = null; | |
421 var _queryParams = new core.Map(); | |
422 var _uploadMedia = null; | |
423 var _uploadOptions = null; | |
424 var _downloadOptions = common.DownloadOptions.Metadata; | |
425 var _body = null; | |
426 | |
427 if (request != null) { | |
428 _body = convert.JSON.encode((request).toJson()); | |
429 } | |
430 if (projectName == null) { | |
431 throw new core.ArgumentError("Parameter projectName is required."); | |
432 } | |
433 if (zone == null) { | |
434 throw new core.ArgumentError("Parameter zone is required."); | |
435 } | |
436 if (poolName == null) { | |
437 throw new core.ArgumentError("Parameter poolName is required."); | |
438 } | |
439 if (replicaName == null) { | |
440 throw new core.ArgumentError("Parameter replicaName is required."); | |
441 } | |
442 | |
443 | |
444 _url = common_internal.Escaper.ecapeVariable('$projectName') + '/zones/' + c
ommon_internal.Escaper.ecapeVariable('$zone') + '/pools/' + common_internal.Esca
per.ecapeVariable('$poolName') + '/replicas/' + common_internal.Escaper.ecapeVar
iable('$replicaName'); | |
445 | |
446 var _response = _requester.request(_url, | |
447 "POST", | |
448 body: _body, | |
449 queryParams: _queryParams, | |
450 uploadOptions: _uploadOptions, | |
451 uploadMedia: _uploadMedia, | |
452 downloadOptions: _downloadOptions); | |
453 return _response.then((data) => new Replica.fromJson(data)); | |
454 } | |
455 | |
456 /** | |
457 * Gets information about a specific replica. | |
458 * | |
459 * Request parameters: | |
460 * | |
461 * [projectName] - The project ID for this request. | |
462 * | |
463 * [zone] - The zone where the replica lives. | |
464 * | |
465 * [poolName] - The replica pool name for this request. | |
466 * | |
467 * [replicaName] - The name of the replica for this request. | |
468 * | |
469 * Completes with a [Replica]. | |
470 * | |
471 * Completes with a [common.ApiRequestError] if the API endpoint returned an | |
472 * error. | |
473 * | |
474 * If the used [http.Client] completes with an error when making a REST call, | |
475 * this method will complete with the same error. | |
476 */ | |
477 async.Future<Replica> get(core.String projectName, core.String zone, core.Stri
ng poolName, core.String replicaName) { | |
478 var _url = null; | |
479 var _queryParams = new core.Map(); | |
480 var _uploadMedia = null; | |
481 var _uploadOptions = null; | |
482 var _downloadOptions = common.DownloadOptions.Metadata; | |
483 var _body = null; | |
484 | |
485 if (projectName == null) { | |
486 throw new core.ArgumentError("Parameter projectName is required."); | |
487 } | |
488 if (zone == null) { | |
489 throw new core.ArgumentError("Parameter zone is required."); | |
490 } | |
491 if (poolName == null) { | |
492 throw new core.ArgumentError("Parameter poolName is required."); | |
493 } | |
494 if (replicaName == null) { | |
495 throw new core.ArgumentError("Parameter replicaName is required."); | |
496 } | |
497 | |
498 | |
499 _url = common_internal.Escaper.ecapeVariable('$projectName') + '/zones/' + c
ommon_internal.Escaper.ecapeVariable('$zone') + '/pools/' + common_internal.Esca
per.ecapeVariable('$poolName') + '/replicas/' + common_internal.Escaper.ecapeVar
iable('$replicaName'); | |
500 | |
501 var _response = _requester.request(_url, | |
502 "GET", | |
503 body: _body, | |
504 queryParams: _queryParams, | |
505 uploadOptions: _uploadOptions, | |
506 uploadMedia: _uploadMedia, | |
507 downloadOptions: _downloadOptions); | |
508 return _response.then((data) => new Replica.fromJson(data)); | |
509 } | |
510 | |
511 /** | |
512 * Lists all replicas in a pool. | |
513 * | |
514 * Request parameters: | |
515 * | |
516 * [projectName] - The project ID for this request. | |
517 * | |
518 * [zone] - The zone where the replica pool lives. | |
519 * | |
520 * [poolName] - The replica pool name for this request. | |
521 * | |
522 * [maxResults] - Maximum count of results to be returned. Acceptable values | |
523 * are 0 to 100, inclusive. (Default: 50) | |
524 * Value must be between "0" and "1000". | |
525 * | |
526 * [pageToken] - Set this to the nextPageToken value returned by a previous | |
527 * list request to obtain the next page of results from the previous list | |
528 * request. | |
529 * | |
530 * Completes with a [ReplicasListResponse]. | |
531 * | |
532 * Completes with a [common.ApiRequestError] if the API endpoint returned an | |
533 * error. | |
534 * | |
535 * If the used [http.Client] completes with an error when making a REST call, | |
536 * this method will complete with the same error. | |
537 */ | |
538 async.Future<ReplicasListResponse> list(core.String projectName, core.String z
one, core.String poolName, {core.int maxResults, core.String pageToken}) { | |
539 var _url = null; | |
540 var _queryParams = new core.Map(); | |
541 var _uploadMedia = null; | |
542 var _uploadOptions = null; | |
543 var _downloadOptions = common.DownloadOptions.Metadata; | |
544 var _body = null; | |
545 | |
546 if (projectName == null) { | |
547 throw new core.ArgumentError("Parameter projectName is required."); | |
548 } | |
549 if (zone == null) { | |
550 throw new core.ArgumentError("Parameter zone is required."); | |
551 } | |
552 if (poolName == null) { | |
553 throw new core.ArgumentError("Parameter poolName is required."); | |
554 } | |
555 if (maxResults != null) { | |
556 _queryParams["maxResults"] = ["${maxResults}"]; | |
557 } | |
558 if (pageToken != null) { | |
559 _queryParams["pageToken"] = [pageToken]; | |
560 } | |
561 | |
562 | |
563 _url = common_internal.Escaper.ecapeVariable('$projectName') + '/zones/' + c
ommon_internal.Escaper.ecapeVariable('$zone') + '/pools/' + common_internal.Esca
per.ecapeVariable('$poolName') + '/replicas'; | |
564 | |
565 var _response = _requester.request(_url, | |
566 "GET", | |
567 body: _body, | |
568 queryParams: _queryParams, | |
569 uploadOptions: _uploadOptions, | |
570 uploadMedia: _uploadMedia, | |
571 downloadOptions: _downloadOptions); | |
572 return _response.then((data) => new ReplicasListResponse.fromJson(data)); | |
573 } | |
574 | |
575 /** | |
576 * Restarts a replica in a pool. | |
577 * | |
578 * Request parameters: | |
579 * | |
580 * [projectName] - The project ID for this request. | |
581 * | |
582 * [zone] - The zone where the replica lives. | |
583 * | |
584 * [poolName] - The replica pool name for this request. | |
585 * | |
586 * [replicaName] - The name of the replica for this request. | |
587 * | |
588 * Completes with a [Replica]. | |
589 * | |
590 * Completes with a [common.ApiRequestError] if the API endpoint returned an | |
591 * error. | |
592 * | |
593 * If the used [http.Client] completes with an error when making a REST call, | |
594 * this method will complete with the same error. | |
595 */ | |
596 async.Future<Replica> restart(core.String projectName, core.String zone, core.
String poolName, core.String replicaName) { | |
597 var _url = null; | |
598 var _queryParams = new core.Map(); | |
599 var _uploadMedia = null; | |
600 var _uploadOptions = null; | |
601 var _downloadOptions = common.DownloadOptions.Metadata; | |
602 var _body = null; | |
603 | |
604 if (projectName == null) { | |
605 throw new core.ArgumentError("Parameter projectName is required."); | |
606 } | |
607 if (zone == null) { | |
608 throw new core.ArgumentError("Parameter zone is required."); | |
609 } | |
610 if (poolName == null) { | |
611 throw new core.ArgumentError("Parameter poolName is required."); | |
612 } | |
613 if (replicaName == null) { | |
614 throw new core.ArgumentError("Parameter replicaName is required."); | |
615 } | |
616 | |
617 | |
618 _url = common_internal.Escaper.ecapeVariable('$projectName') + '/zones/' + c
ommon_internal.Escaper.ecapeVariable('$zone') + '/pools/' + common_internal.Esca
per.ecapeVariable('$poolName') + '/replicas/' + common_internal.Escaper.ecapeVar
iable('$replicaName') + '/restart'; | |
619 | |
620 var _response = _requester.request(_url, | |
621 "POST", | |
622 body: _body, | |
623 queryParams: _queryParams, | |
624 uploadOptions: _uploadOptions, | |
625 uploadMedia: _uploadMedia, | |
626 downloadOptions: _downloadOptions); | |
627 return _response.then((data) => new Replica.fromJson(data)); | |
628 } | |
629 | |
630 } | |
631 | |
632 | |
633 | |
634 /** | |
635 * A Compute Engine network accessConfig. Identical to the accessConfig on | |
636 * corresponding Compute Engine resource. | |
637 */ | |
638 class AccessConfig { | |
639 /** Name of this access configuration. */ | |
640 core.String name; | |
641 | |
642 /** An external IP address associated with this instance. */ | |
643 core.String natIp; | |
644 | |
645 /** | |
646 * Type of this access configuration file. Currently only ONE_TO_ONE_NAT is | |
647 * supported. | |
648 */ | |
649 core.String type; | |
650 | |
651 | |
652 AccessConfig(); | |
653 | |
654 AccessConfig.fromJson(core.Map _json) { | |
655 if (_json.containsKey("name")) { | |
656 name = _json["name"]; | |
657 } | |
658 if (_json.containsKey("natIp")) { | |
659 natIp = _json["natIp"]; | |
660 } | |
661 if (_json.containsKey("type")) { | |
662 type = _json["type"]; | |
663 } | |
664 } | |
665 | |
666 core.Map toJson() { | |
667 var _json = new core.Map(); | |
668 if (name != null) { | |
669 _json["name"] = name; | |
670 } | |
671 if (natIp != null) { | |
672 _json["natIp"] = natIp; | |
673 } | |
674 if (type != null) { | |
675 _json["type"] = type; | |
676 } | |
677 return _json; | |
678 } | |
679 } | |
680 | |
681 | |
682 /** An action that gets executed during initialization of the replicas. */ | |
683 class Action { | |
684 /** | |
685 * A list of commands to run, one per line. If any command fails, the whole | |
686 * action is considered a failure and no further actions are run. This also | |
687 * marks the virtual machine or replica as a failure. | |
688 */ | |
689 core.List<core.String> commands; | |
690 | |
691 /** | |
692 * A list of environment variables to use for the commands in this action. | |
693 */ | |
694 core.List<EnvVariable> envVariables; | |
695 | |
696 /** | |
697 * If an action's commands on a particular replica do not finish in the | |
698 * specified timeoutMilliSeconds, the replica is considered to be in a FAILING | |
699 * state. No efforts are made to stop any processes that were spawned or | |
700 * created as the result of running the action's commands. The default is the | |
701 * max allowed value, 1 hour (i.e. 3600000 milliseconds). | |
702 */ | |
703 core.int timeoutMilliSeconds; | |
704 | |
705 | |
706 Action(); | |
707 | |
708 Action.fromJson(core.Map _json) { | |
709 if (_json.containsKey("commands")) { | |
710 commands = _json["commands"]; | |
711 } | |
712 if (_json.containsKey("envVariables")) { | |
713 envVariables = _json["envVariables"].map((value) => new EnvVariable.fromJs
on(value)).toList(); | |
714 } | |
715 if (_json.containsKey("timeoutMilliSeconds")) { | |
716 timeoutMilliSeconds = _json["timeoutMilliSeconds"]; | |
717 } | |
718 } | |
719 | |
720 core.Map toJson() { | |
721 var _json = new core.Map(); | |
722 if (commands != null) { | |
723 _json["commands"] = commands; | |
724 } | |
725 if (envVariables != null) { | |
726 _json["envVariables"] = envVariables.map((value) => (value).toJson()).toLi
st(); | |
727 } | |
728 if (timeoutMilliSeconds != null) { | |
729 _json["timeoutMilliSeconds"] = timeoutMilliSeconds; | |
730 } | |
731 return _json; | |
732 } | |
733 } | |
734 | |
735 | |
736 /** Specifies how to attach a disk to a Replica. */ | |
737 class DiskAttachment { | |
738 /** The device name of this disk. */ | |
739 core.String deviceName; | |
740 | |
741 /** | |
742 * A zero-based index to assign to this disk, where 0 is reserved for the boot | |
743 * disk. If not specified, this is assigned by the server. | |
744 */ | |
745 core.int index; | |
746 | |
747 | |
748 DiskAttachment(); | |
749 | |
750 DiskAttachment.fromJson(core.Map _json) { | |
751 if (_json.containsKey("deviceName")) { | |
752 deviceName = _json["deviceName"]; | |
753 } | |
754 if (_json.containsKey("index")) { | |
755 index = _json["index"]; | |
756 } | |
757 } | |
758 | |
759 core.Map toJson() { | |
760 var _json = new core.Map(); | |
761 if (deviceName != null) { | |
762 _json["deviceName"] = deviceName; | |
763 } | |
764 if (index != null) { | |
765 _json["index"] = index; | |
766 } | |
767 return _json; | |
768 } | |
769 } | |
770 | |
771 | |
772 /** An environment variable to set for an action. */ | |
773 class EnvVariable { | |
774 /** Deprecated, do not use. */ | |
775 core.bool hidden; | |
776 | |
777 /** The name of the environment variable. */ | |
778 core.String name; | |
779 | |
780 /** The value of the variable. */ | |
781 core.String value; | |
782 | |
783 | |
784 EnvVariable(); | |
785 | |
786 EnvVariable.fromJson(core.Map _json) { | |
787 if (_json.containsKey("hidden")) { | |
788 hidden = _json["hidden"]; | |
789 } | |
790 if (_json.containsKey("name")) { | |
791 name = _json["name"]; | |
792 } | |
793 if (_json.containsKey("value")) { | |
794 value = _json["value"]; | |
795 } | |
796 } | |
797 | |
798 core.Map toJson() { | |
799 var _json = new core.Map(); | |
800 if (hidden != null) { | |
801 _json["hidden"] = hidden; | |
802 } | |
803 if (name != null) { | |
804 _json["name"] = name; | |
805 } | |
806 if (value != null) { | |
807 _json["value"] = value; | |
808 } | |
809 return _json; | |
810 } | |
811 } | |
812 | |
813 | |
814 /** | |
815 * A pre-existing persistent disk that will be attached to every Replica in the | |
816 * Pool in READ_ONLY mode. | |
817 */ | |
818 class ExistingDisk { | |
819 /** How the disk will be attached to the Replica. */ | |
820 DiskAttachment attachment; | |
821 | |
822 /** | |
823 * The name of the Persistent Disk resource. The Persistent Disk resource must | |
824 * be in the same zone as the Pool. | |
825 */ | |
826 core.String source; | |
827 | |
828 | |
829 ExistingDisk(); | |
830 | |
831 ExistingDisk.fromJson(core.Map _json) { | |
832 if (_json.containsKey("attachment")) { | |
833 attachment = new DiskAttachment.fromJson(_json["attachment"]); | |
834 } | |
835 if (_json.containsKey("source")) { | |
836 source = _json["source"]; | |
837 } | |
838 } | |
839 | |
840 core.Map toJson() { | |
841 var _json = new core.Map(); | |
842 if (attachment != null) { | |
843 _json["attachment"] = (attachment).toJson(); | |
844 } | |
845 if (source != null) { | |
846 _json["source"] = source; | |
847 } | |
848 return _json; | |
849 } | |
850 } | |
851 | |
852 | |
853 /** Not documented yet. */ | |
854 class HealthCheck { | |
855 /** | |
856 * How often (in seconds) to make HTTP requests for this healthcheck. The | |
857 * default value is 5 seconds. | |
858 */ | |
859 core.int checkIntervalSec; | |
860 | |
861 /** The description for this health check. */ | |
862 core.String description; | |
863 | |
864 /** | |
865 * The number of consecutive health check requests that need to succeed before | |
866 * the replica is considered healthy again. The default value is 2. | |
867 */ | |
868 core.int healthyThreshold; | |
869 | |
870 /** | |
871 * The value of the host header in the HTTP health check request. If left | |
872 * empty (default value), the localhost IP 127.0.0.1 will be used. | |
873 */ | |
874 core.String host; | |
875 | |
876 /** The name of this health check. */ | |
877 core.String name; | |
878 | |
879 /** | |
880 * The localhost request path to send this health check, in the format | |
881 * /path/to/use. For example, /healthcheck. | |
882 */ | |
883 core.String path; | |
884 | |
885 /** The TCP port for the health check requests. */ | |
886 core.int port; | |
887 | |
888 /** | |
889 * How long (in seconds) to wait before a timeout failure for this | |
890 * healthcheck. The default value is 5 seconds. | |
891 */ | |
892 core.int timeoutSec; | |
893 | |
894 /** | |
895 * The number of consecutive health check requests that need to fail in order | |
896 * to consider the replica unhealthy. The default value is 2. | |
897 */ | |
898 core.int unhealthyThreshold; | |
899 | |
900 | |
901 HealthCheck(); | |
902 | |
903 HealthCheck.fromJson(core.Map _json) { | |
904 if (_json.containsKey("checkIntervalSec")) { | |
905 checkIntervalSec = _json["checkIntervalSec"]; | |
906 } | |
907 if (_json.containsKey("description")) { | |
908 description = _json["description"]; | |
909 } | |
910 if (_json.containsKey("healthyThreshold")) { | |
911 healthyThreshold = _json["healthyThreshold"]; | |
912 } | |
913 if (_json.containsKey("host")) { | |
914 host = _json["host"]; | |
915 } | |
916 if (_json.containsKey("name")) { | |
917 name = _json["name"]; | |
918 } | |
919 if (_json.containsKey("path")) { | |
920 path = _json["path"]; | |
921 } | |
922 if (_json.containsKey("port")) { | |
923 port = _json["port"]; | |
924 } | |
925 if (_json.containsKey("timeoutSec")) { | |
926 timeoutSec = _json["timeoutSec"]; | |
927 } | |
928 if (_json.containsKey("unhealthyThreshold")) { | |
929 unhealthyThreshold = _json["unhealthyThreshold"]; | |
930 } | |
931 } | |
932 | |
933 core.Map toJson() { | |
934 var _json = new core.Map(); | |
935 if (checkIntervalSec != null) { | |
936 _json["checkIntervalSec"] = checkIntervalSec; | |
937 } | |
938 if (description != null) { | |
939 _json["description"] = description; | |
940 } | |
941 if (healthyThreshold != null) { | |
942 _json["healthyThreshold"] = healthyThreshold; | |
943 } | |
944 if (host != null) { | |
945 _json["host"] = host; | |
946 } | |
947 if (name != null) { | |
948 _json["name"] = name; | |
949 } | |
950 if (path != null) { | |
951 _json["path"] = path; | |
952 } | |
953 if (port != null) { | |
954 _json["port"] = port; | |
955 } | |
956 if (timeoutSec != null) { | |
957 _json["timeoutSec"] = timeoutSec; | |
958 } | |
959 if (unhealthyThreshold != null) { | |
960 _json["unhealthyThreshold"] = unhealthyThreshold; | |
961 } | |
962 return _json; | |
963 } | |
964 } | |
965 | |
966 | |
967 /** A label to apply to this replica pool. */ | |
968 class Label { | |
969 /** The key for this label. */ | |
970 core.String key; | |
971 | |
972 /** The value of this label. */ | |
973 core.String value; | |
974 | |
975 | |
976 Label(); | |
977 | |
978 Label.fromJson(core.Map _json) { | |
979 if (_json.containsKey("key")) { | |
980 key = _json["key"]; | |
981 } | |
982 if (_json.containsKey("value")) { | |
983 value = _json["value"]; | |
984 } | |
985 } | |
986 | |
987 core.Map toJson() { | |
988 var _json = new core.Map(); | |
989 if (key != null) { | |
990 _json["key"] = key; | |
991 } | |
992 if (value != null) { | |
993 _json["value"] = value; | |
994 } | |
995 return _json; | |
996 } | |
997 } | |
998 | |
999 | |
1000 /** | |
1001 * A Compute Engine metadata entry. Identical to the metadata on the | |
1002 * corresponding Compute Engine resource. | |
1003 */ | |
1004 class Metadata { | |
1005 /** | |
1006 * The fingerprint of the metadata. Required for updating the metadata entries | |
1007 * for this instance. | |
1008 */ | |
1009 core.String fingerPrint; | |
1010 | |
1011 /** A list of metadata items. */ | |
1012 core.List<MetadataItem> items; | |
1013 | |
1014 | |
1015 Metadata(); | |
1016 | |
1017 Metadata.fromJson(core.Map _json) { | |
1018 if (_json.containsKey("fingerPrint")) { | |
1019 fingerPrint = _json["fingerPrint"]; | |
1020 } | |
1021 if (_json.containsKey("items")) { | |
1022 items = _json["items"].map((value) => new MetadataItem.fromJson(value)).to
List(); | |
1023 } | |
1024 } | |
1025 | |
1026 core.Map toJson() { | |
1027 var _json = new core.Map(); | |
1028 if (fingerPrint != null) { | |
1029 _json["fingerPrint"] = fingerPrint; | |
1030 } | |
1031 if (items != null) { | |
1032 _json["items"] = items.map((value) => (value).toJson()).toList(); | |
1033 } | |
1034 return _json; | |
1035 } | |
1036 } | |
1037 | |
1038 | |
1039 /** | |
1040 * A Compute Engine metadata item, defined as a key:value pair. Identical to the | |
1041 * metadata on the corresponding Compute Engine resource. | |
1042 */ | |
1043 class MetadataItem { | |
1044 /** A metadata key. */ | |
1045 core.String key; | |
1046 | |
1047 /** A metadata value. */ | |
1048 core.String value; | |
1049 | |
1050 | |
1051 MetadataItem(); | |
1052 | |
1053 MetadataItem.fromJson(core.Map _json) { | |
1054 if (_json.containsKey("key")) { | |
1055 key = _json["key"]; | |
1056 } | |
1057 if (_json.containsKey("value")) { | |
1058 value = _json["value"]; | |
1059 } | |
1060 } | |
1061 | |
1062 core.Map toJson() { | |
1063 var _json = new core.Map(); | |
1064 if (key != null) { | |
1065 _json["key"] = key; | |
1066 } | |
1067 if (value != null) { | |
1068 _json["value"] = value; | |
1069 } | |
1070 return _json; | |
1071 } | |
1072 } | |
1073 | |
1074 | |
1075 /** | |
1076 * A Compute Engine NetworkInterface resource. Identical to the NetworkInterface | |
1077 * on the corresponding Compute Engine resource. | |
1078 */ | |
1079 class NetworkInterface { | |
1080 /** | |
1081 * An array of configurations for this interface. This specifies how this | |
1082 * interface is configured to interact with other network services. | |
1083 */ | |
1084 core.List<AccessConfig> accessConfigs; | |
1085 | |
1086 /** Name the Network resource to which this interface applies. */ | |
1087 core.String network; | |
1088 | |
1089 /** | |
1090 * An optional IPV4 internal network address to assign to the instance for | |
1091 * this network interface. | |
1092 */ | |
1093 core.String networkIp; | |
1094 | |
1095 | |
1096 NetworkInterface(); | |
1097 | |
1098 NetworkInterface.fromJson(core.Map _json) { | |
1099 if (_json.containsKey("accessConfigs")) { | |
1100 accessConfigs = _json["accessConfigs"].map((value) => new AccessConfig.fro
mJson(value)).toList(); | |
1101 } | |
1102 if (_json.containsKey("network")) { | |
1103 network = _json["network"]; | |
1104 } | |
1105 if (_json.containsKey("networkIp")) { | |
1106 networkIp = _json["networkIp"]; | |
1107 } | |
1108 } | |
1109 | |
1110 core.Map toJson() { | |
1111 var _json = new core.Map(); | |
1112 if (accessConfigs != null) { | |
1113 _json["accessConfigs"] = accessConfigs.map((value) => (value).toJson()).to
List(); | |
1114 } | |
1115 if (network != null) { | |
1116 _json["network"] = network; | |
1117 } | |
1118 if (networkIp != null) { | |
1119 _json["networkIp"] = networkIp; | |
1120 } | |
1121 return _json; | |
1122 } | |
1123 } | |
1124 | |
1125 | |
1126 /** | |
1127 * A Persistent Disk resource that will be created and attached to each Replica | |
1128 * in the Pool. Each Replica will have a unique persistent disk that is created | |
1129 * and attached to that Replica in READ_WRITE mode. | |
1130 */ | |
1131 class NewDisk { | |
1132 /** How the disk will be attached to the Replica. */ | |
1133 DiskAttachment attachment; | |
1134 | |
1135 /** | |
1136 * If true, then this disk will be deleted when the instance is deleted. The | |
1137 * default value is true. | |
1138 */ | |
1139 core.bool autoDelete; | |
1140 | |
1141 /** If true, indicates that this is the root persistent disk. */ | |
1142 core.bool boot; | |
1143 | |
1144 /** | |
1145 * Create the new disk using these parameters. The name of the disk will be | |
1146 * <instance_name>-<four_random_charactersgt;. | |
1147 */ | |
1148 NewDiskInitializeParams initializeParams; | |
1149 | |
1150 | |
1151 NewDisk(); | |
1152 | |
1153 NewDisk.fromJson(core.Map _json) { | |
1154 if (_json.containsKey("attachment")) { | |
1155 attachment = new DiskAttachment.fromJson(_json["attachment"]); | |
1156 } | |
1157 if (_json.containsKey("autoDelete")) { | |
1158 autoDelete = _json["autoDelete"]; | |
1159 } | |
1160 if (_json.containsKey("boot")) { | |
1161 boot = _json["boot"]; | |
1162 } | |
1163 if (_json.containsKey("initializeParams")) { | |
1164 initializeParams = new NewDiskInitializeParams.fromJson(_json["initializeP
arams"]); | |
1165 } | |
1166 } | |
1167 | |
1168 core.Map toJson() { | |
1169 var _json = new core.Map(); | |
1170 if (attachment != null) { | |
1171 _json["attachment"] = (attachment).toJson(); | |
1172 } | |
1173 if (autoDelete != null) { | |
1174 _json["autoDelete"] = autoDelete; | |
1175 } | |
1176 if (boot != null) { | |
1177 _json["boot"] = boot; | |
1178 } | |
1179 if (initializeParams != null) { | |
1180 _json["initializeParams"] = (initializeParams).toJson(); | |
1181 } | |
1182 return _json; | |
1183 } | |
1184 } | |
1185 | |
1186 | |
1187 /** Initialization parameters for creating a new disk. */ | |
1188 class NewDiskInitializeParams { | |
1189 /** The size of the created disk in gigabytes. */ | |
1190 core.String diskSizeGb; | |
1191 | |
1192 /** | |
1193 * Name of the disk type resource describing which disk type to use to create | |
1194 * the disk. For example 'pd-ssd' or 'pd-standard'. Default is 'pd-standard' | |
1195 */ | |
1196 core.String diskType; | |
1197 | |
1198 /** | |
1199 * The name or fully-qualified URL of a source image to use to create this | |
1200 * disk. If you provide a name of the source image, Replica Pool will look for | |
1201 * an image with that name in your project. If you are specifying an image | |
1202 * provided by Compute Engine, you will need to provide the full URL with the | |
1203 * correct project, such as: | |
1204 * http://www.googleapis.com/compute/v1/projects/debian-cloud/ | |
1205 * global/images/debian-wheezy-7-vYYYYMMDD | |
1206 */ | |
1207 core.String sourceImage; | |
1208 | |
1209 | |
1210 NewDiskInitializeParams(); | |
1211 | |
1212 NewDiskInitializeParams.fromJson(core.Map _json) { | |
1213 if (_json.containsKey("diskSizeGb")) { | |
1214 diskSizeGb = _json["diskSizeGb"]; | |
1215 } | |
1216 if (_json.containsKey("diskType")) { | |
1217 diskType = _json["diskType"]; | |
1218 } | |
1219 if (_json.containsKey("sourceImage")) { | |
1220 sourceImage = _json["sourceImage"]; | |
1221 } | |
1222 } | |
1223 | |
1224 core.Map toJson() { | |
1225 var _json = new core.Map(); | |
1226 if (diskSizeGb != null) { | |
1227 _json["diskSizeGb"] = diskSizeGb; | |
1228 } | |
1229 if (diskType != null) { | |
1230 _json["diskType"] = diskType; | |
1231 } | |
1232 if (sourceImage != null) { | |
1233 _json["sourceImage"] = sourceImage; | |
1234 } | |
1235 return _json; | |
1236 } | |
1237 } | |
1238 | |
1239 | |
1240 /** Not documented yet. */ | |
1241 class Pool { | |
1242 /** | |
1243 * Whether replicas in this pool should be restarted if they experience a | |
1244 * failure. The default value is true. | |
1245 */ | |
1246 core.bool autoRestart; | |
1247 | |
1248 /** | |
1249 * The base instance name to use for the replicas in this pool. This must | |
1250 * match the regex [a-z]([-a-z0-9]*[a-z0-9])?. If specified, the instances in | |
1251 * this replica pool will be named in the format <base-instance-name>-<ID>. | |
1252 * The <ID> postfix will be a four character alphanumeric identifier generated | |
1253 * by the service. | |
1254 * | |
1255 * If this is not specified by the user, a random base instance name is | |
1256 * generated by the service. | |
1257 */ | |
1258 core.String baseInstanceName; | |
1259 | |
1260 /** [Output Only] The current number of replicas in the pool. */ | |
1261 core.int currentNumReplicas; | |
1262 | |
1263 /** An optional description of the replica pool. */ | |
1264 core.String description; | |
1265 | |
1266 /** Deprecated. Please use template[].healthChecks instead. */ | |
1267 core.List<HealthCheck> healthChecks; | |
1268 | |
1269 /** | |
1270 * The initial number of replicas this pool should have. You must provide a | |
1271 * value greater than or equal to 0. | |
1272 */ | |
1273 core.int initialNumReplicas; | |
1274 | |
1275 /** | |
1276 * A list of labels to attach to this replica pool and all created virtual | |
1277 * machines in this replica pool. | |
1278 */ | |
1279 core.List<Label> labels; | |
1280 | |
1281 /** | |
1282 * The name of the replica pool. Must follow the regex | |
1283 * [a-z]([-a-z0-9]*[a-z0-9])? and be 1-28 characters long. | |
1284 */ | |
1285 core.String name; | |
1286 | |
1287 /** Deprecated! Use initial_num_replicas instead. */ | |
1288 core.int numReplicas; | |
1289 | |
1290 /** | |
1291 * The list of resource views that should be updated with all the replicas | |
1292 * that are managed by this pool. | |
1293 */ | |
1294 core.List<core.String> resourceViews; | |
1295 | |
1296 /** [Output Only] A self-link to the replica pool. */ | |
1297 core.String selfLink; | |
1298 | |
1299 /** Deprecated, please use target_pools instead. */ | |
1300 core.String targetPool; | |
1301 | |
1302 /** | |
1303 * A list of target pools to update with the replicas that are managed by this | |
1304 * pool. If specified, the replicas in this replica pool will be added to the | |
1305 * specified target pools for load balancing purposes. The replica pool must | |
1306 * live in the same region as the specified target pools. These values must be | |
1307 * the target pool resource names, and not fully qualified URLs. | |
1308 */ | |
1309 core.List<core.String> targetPools; | |
1310 | |
1311 /** | |
1312 * The template to use when creating replicas in this pool. This template is | |
1313 * used during initial instance creation of the pool, when growing the pool in | |
1314 * size, or when a replica restarts. | |
1315 */ | |
1316 Template template; | |
1317 | |
1318 /** Deprecated! Do not set. */ | |
1319 core.String type; | |
1320 | |
1321 | |
1322 Pool(); | |
1323 | |
1324 Pool.fromJson(core.Map _json) { | |
1325 if (_json.containsKey("autoRestart")) { | |
1326 autoRestart = _json["autoRestart"]; | |
1327 } | |
1328 if (_json.containsKey("baseInstanceName")) { | |
1329 baseInstanceName = _json["baseInstanceName"]; | |
1330 } | |
1331 if (_json.containsKey("currentNumReplicas")) { | |
1332 currentNumReplicas = _json["currentNumReplicas"]; | |
1333 } | |
1334 if (_json.containsKey("description")) { | |
1335 description = _json["description"]; | |
1336 } | |
1337 if (_json.containsKey("healthChecks")) { | |
1338 healthChecks = _json["healthChecks"].map((value) => new HealthCheck.fromJs
on(value)).toList(); | |
1339 } | |
1340 if (_json.containsKey("initialNumReplicas")) { | |
1341 initialNumReplicas = _json["initialNumReplicas"]; | |
1342 } | |
1343 if (_json.containsKey("labels")) { | |
1344 labels = _json["labels"].map((value) => new Label.fromJson(value)).toList(
); | |
1345 } | |
1346 if (_json.containsKey("name")) { | |
1347 name = _json["name"]; | |
1348 } | |
1349 if (_json.containsKey("numReplicas")) { | |
1350 numReplicas = _json["numReplicas"]; | |
1351 } | |
1352 if (_json.containsKey("resourceViews")) { | |
1353 resourceViews = _json["resourceViews"]; | |
1354 } | |
1355 if (_json.containsKey("selfLink")) { | |
1356 selfLink = _json["selfLink"]; | |
1357 } | |
1358 if (_json.containsKey("targetPool")) { | |
1359 targetPool = _json["targetPool"]; | |
1360 } | |
1361 if (_json.containsKey("targetPools")) { | |
1362 targetPools = _json["targetPools"]; | |
1363 } | |
1364 if (_json.containsKey("template")) { | |
1365 template = new Template.fromJson(_json["template"]); | |
1366 } | |
1367 if (_json.containsKey("type")) { | |
1368 type = _json["type"]; | |
1369 } | |
1370 } | |
1371 | |
1372 core.Map toJson() { | |
1373 var _json = new core.Map(); | |
1374 if (autoRestart != null) { | |
1375 _json["autoRestart"] = autoRestart; | |
1376 } | |
1377 if (baseInstanceName != null) { | |
1378 _json["baseInstanceName"] = baseInstanceName; | |
1379 } | |
1380 if (currentNumReplicas != null) { | |
1381 _json["currentNumReplicas"] = currentNumReplicas; | |
1382 } | |
1383 if (description != null) { | |
1384 _json["description"] = description; | |
1385 } | |
1386 if (healthChecks != null) { | |
1387 _json["healthChecks"] = healthChecks.map((value) => (value).toJson()).toLi
st(); | |
1388 } | |
1389 if (initialNumReplicas != null) { | |
1390 _json["initialNumReplicas"] = initialNumReplicas; | |
1391 } | |
1392 if (labels != null) { | |
1393 _json["labels"] = labels.map((value) => (value).toJson()).toList(); | |
1394 } | |
1395 if (name != null) { | |
1396 _json["name"] = name; | |
1397 } | |
1398 if (numReplicas != null) { | |
1399 _json["numReplicas"] = numReplicas; | |
1400 } | |
1401 if (resourceViews != null) { | |
1402 _json["resourceViews"] = resourceViews; | |
1403 } | |
1404 if (selfLink != null) { | |
1405 _json["selfLink"] = selfLink; | |
1406 } | |
1407 if (targetPool != null) { | |
1408 _json["targetPool"] = targetPool; | |
1409 } | |
1410 if (targetPools != null) { | |
1411 _json["targetPools"] = targetPools; | |
1412 } | |
1413 if (template != null) { | |
1414 _json["template"] = (template).toJson(); | |
1415 } | |
1416 if (type != null) { | |
1417 _json["type"] = type; | |
1418 } | |
1419 return _json; | |
1420 } | |
1421 } | |
1422 | |
1423 | |
1424 /** Not documented yet. */ | |
1425 class PoolsDeleteRequest { | |
1426 /** | |
1427 * If there are instances you would like to keep, you can specify them here. | |
1428 * These instances won't be deleted, but the associated replica objects will | |
1429 * be removed. | |
1430 */ | |
1431 core.List<core.String> abandonInstances; | |
1432 | |
1433 | |
1434 PoolsDeleteRequest(); | |
1435 | |
1436 PoolsDeleteRequest.fromJson(core.Map _json) { | |
1437 if (_json.containsKey("abandonInstances")) { | |
1438 abandonInstances = _json["abandonInstances"]; | |
1439 } | |
1440 } | |
1441 | |
1442 core.Map toJson() { | |
1443 var _json = new core.Map(); | |
1444 if (abandonInstances != null) { | |
1445 _json["abandonInstances"] = abandonInstances; | |
1446 } | |
1447 return _json; | |
1448 } | |
1449 } | |
1450 | |
1451 | |
1452 /** Not documented yet. */ | |
1453 class PoolsListResponse { | |
1454 /** Not documented yet. */ | |
1455 core.String nextPageToken; | |
1456 | |
1457 /** Not documented yet. */ | |
1458 core.List<Pool> resources; | |
1459 | |
1460 | |
1461 PoolsListResponse(); | |
1462 | |
1463 PoolsListResponse.fromJson(core.Map _json) { | |
1464 if (_json.containsKey("nextPageToken")) { | |
1465 nextPageToken = _json["nextPageToken"]; | |
1466 } | |
1467 if (_json.containsKey("resources")) { | |
1468 resources = _json["resources"].map((value) => new Pool.fromJson(value)).to
List(); | |
1469 } | |
1470 } | |
1471 | |
1472 core.Map toJson() { | |
1473 var _json = new core.Map(); | |
1474 if (nextPageToken != null) { | |
1475 _json["nextPageToken"] = nextPageToken; | |
1476 } | |
1477 if (resources != null) { | |
1478 _json["resources"] = resources.map((value) => (value).toJson()).toList(); | |
1479 } | |
1480 return _json; | |
1481 } | |
1482 } | |
1483 | |
1484 | |
1485 /** | |
1486 * An individual Replica within a Pool. Replicas are automatically created by | |
1487 * the replica pool, using the template provided by the user. You cannot | |
1488 * directly create replicas. | |
1489 */ | |
1490 class Replica { | |
1491 /** [Output Only] The name of the Replica object. */ | |
1492 core.String name; | |
1493 | |
1494 /** [Output Only] The self-link of the Replica. */ | |
1495 core.String selfLink; | |
1496 | |
1497 /** [Output Only] Last known status of the Replica. */ | |
1498 ReplicaStatus status; | |
1499 | |
1500 | |
1501 Replica(); | |
1502 | |
1503 Replica.fromJson(core.Map _json) { | |
1504 if (_json.containsKey("name")) { | |
1505 name = _json["name"]; | |
1506 } | |
1507 if (_json.containsKey("selfLink")) { | |
1508 selfLink = _json["selfLink"]; | |
1509 } | |
1510 if (_json.containsKey("status")) { | |
1511 status = new ReplicaStatus.fromJson(_json["status"]); | |
1512 } | |
1513 } | |
1514 | |
1515 core.Map toJson() { | |
1516 var _json = new core.Map(); | |
1517 if (name != null) { | |
1518 _json["name"] = name; | |
1519 } | |
1520 if (selfLink != null) { | |
1521 _json["selfLink"] = selfLink; | |
1522 } | |
1523 if (status != null) { | |
1524 _json["status"] = (status).toJson(); | |
1525 } | |
1526 return _json; | |
1527 } | |
1528 } | |
1529 | |
1530 | |
1531 /** The current status of a Replica. */ | |
1532 class ReplicaStatus { | |
1533 /** | |
1534 * [Output Only] Human-readable details about the current state of the replica | |
1535 */ | |
1536 core.String details; | |
1537 | |
1538 /** [Output Only] The state of the Replica. */ | |
1539 core.String state; | |
1540 | |
1541 /** [Output Only] The template used to build the replica. */ | |
1542 core.String templateVersion; | |
1543 | |
1544 /** | |
1545 * [Output Only] Link to the virtual machine that this Replica represents. | |
1546 */ | |
1547 core.String vmLink; | |
1548 | |
1549 /** | |
1550 * [Output Only] The time that this Replica got to the RUNNING state, in RFC | |
1551 * 3339 format. If the start time is unknown, UNKNOWN is returned. | |
1552 */ | |
1553 core.String vmStartTime; | |
1554 | |
1555 | |
1556 ReplicaStatus(); | |
1557 | |
1558 ReplicaStatus.fromJson(core.Map _json) { | |
1559 if (_json.containsKey("details")) { | |
1560 details = _json["details"]; | |
1561 } | |
1562 if (_json.containsKey("state")) { | |
1563 state = _json["state"]; | |
1564 } | |
1565 if (_json.containsKey("templateVersion")) { | |
1566 templateVersion = _json["templateVersion"]; | |
1567 } | |
1568 if (_json.containsKey("vmLink")) { | |
1569 vmLink = _json["vmLink"]; | |
1570 } | |
1571 if (_json.containsKey("vmStartTime")) { | |
1572 vmStartTime = _json["vmStartTime"]; | |
1573 } | |
1574 } | |
1575 | |
1576 core.Map toJson() { | |
1577 var _json = new core.Map(); | |
1578 if (details != null) { | |
1579 _json["details"] = details; | |
1580 } | |
1581 if (state != null) { | |
1582 _json["state"] = state; | |
1583 } | |
1584 if (templateVersion != null) { | |
1585 _json["templateVersion"] = templateVersion; | |
1586 } | |
1587 if (vmLink != null) { | |
1588 _json["vmLink"] = vmLink; | |
1589 } | |
1590 if (vmStartTime != null) { | |
1591 _json["vmStartTime"] = vmStartTime; | |
1592 } | |
1593 return _json; | |
1594 } | |
1595 } | |
1596 | |
1597 | |
1598 /** Not documented yet. */ | |
1599 class ReplicasDeleteRequest { | |
1600 /** | |
1601 * Whether the instance resource represented by this replica should be deleted | |
1602 * or abandoned. If abandoned, the replica will be deleted but the virtual | |
1603 * machine instance will remain. By default, this is set to false and the | |
1604 * instance will be deleted along with the replica. | |
1605 */ | |
1606 core.bool abandonInstance; | |
1607 | |
1608 | |
1609 ReplicasDeleteRequest(); | |
1610 | |
1611 ReplicasDeleteRequest.fromJson(core.Map _json) { | |
1612 if (_json.containsKey("abandonInstance")) { | |
1613 abandonInstance = _json["abandonInstance"]; | |
1614 } | |
1615 } | |
1616 | |
1617 core.Map toJson() { | |
1618 var _json = new core.Map(); | |
1619 if (abandonInstance != null) { | |
1620 _json["abandonInstance"] = abandonInstance; | |
1621 } | |
1622 return _json; | |
1623 } | |
1624 } | |
1625 | |
1626 | |
1627 /** Not documented yet. */ | |
1628 class ReplicasListResponse { | |
1629 /** Not documented yet. */ | |
1630 core.String nextPageToken; | |
1631 | |
1632 /** Not documented yet. */ | |
1633 core.List<Replica> resources; | |
1634 | |
1635 | |
1636 ReplicasListResponse(); | |
1637 | |
1638 ReplicasListResponse.fromJson(core.Map _json) { | |
1639 if (_json.containsKey("nextPageToken")) { | |
1640 nextPageToken = _json["nextPageToken"]; | |
1641 } | |
1642 if (_json.containsKey("resources")) { | |
1643 resources = _json["resources"].map((value) => new Replica.fromJson(value))
.toList(); | |
1644 } | |
1645 } | |
1646 | |
1647 core.Map toJson() { | |
1648 var _json = new core.Map(); | |
1649 if (nextPageToken != null) { | |
1650 _json["nextPageToken"] = nextPageToken; | |
1651 } | |
1652 if (resources != null) { | |
1653 _json["resources"] = resources.map((value) => (value).toJson()).toList(); | |
1654 } | |
1655 return _json; | |
1656 } | |
1657 } | |
1658 | |
1659 | |
1660 /** | |
1661 * A Compute Engine service account, identical to the Compute Engine resource. | |
1662 */ | |
1663 class ServiceAccount { | |
1664 /** | |
1665 * The service account email address, for example: | |
1666 * 123845678986@project.gserviceaccount.com | |
1667 */ | |
1668 core.String email; | |
1669 | |
1670 /** | |
1671 * The list of OAuth2 scopes to obtain for the service account, for example: | |
1672 * https://www.googleapis.com/auth/devstorage.full_control | |
1673 */ | |
1674 core.List<core.String> scopes; | |
1675 | |
1676 | |
1677 ServiceAccount(); | |
1678 | |
1679 ServiceAccount.fromJson(core.Map _json) { | |
1680 if (_json.containsKey("email")) { | |
1681 email = _json["email"]; | |
1682 } | |
1683 if (_json.containsKey("scopes")) { | |
1684 scopes = _json["scopes"]; | |
1685 } | |
1686 } | |
1687 | |
1688 core.Map toJson() { | |
1689 var _json = new core.Map(); | |
1690 if (email != null) { | |
1691 _json["email"] = email; | |
1692 } | |
1693 if (scopes != null) { | |
1694 _json["scopes"] = scopes; | |
1695 } | |
1696 return _json; | |
1697 } | |
1698 } | |
1699 | |
1700 | |
1701 /** | |
1702 * A Compute Engine Instance tag, identical to the tags on the corresponding | |
1703 * Compute Engine Instance resource. | |
1704 */ | |
1705 class Tag { | |
1706 /** The fingerprint of the tag. Required for updating the list of tags. */ | |
1707 core.String fingerPrint; | |
1708 | |
1709 /** Items contained in this tag. */ | |
1710 core.List<core.String> items; | |
1711 | |
1712 | |
1713 Tag(); | |
1714 | |
1715 Tag.fromJson(core.Map _json) { | |
1716 if (_json.containsKey("fingerPrint")) { | |
1717 fingerPrint = _json["fingerPrint"]; | |
1718 } | |
1719 if (_json.containsKey("items")) { | |
1720 items = _json["items"]; | |
1721 } | |
1722 } | |
1723 | |
1724 core.Map toJson() { | |
1725 var _json = new core.Map(); | |
1726 if (fingerPrint != null) { | |
1727 _json["fingerPrint"] = fingerPrint; | |
1728 } | |
1729 if (items != null) { | |
1730 _json["items"] = items; | |
1731 } | |
1732 return _json; | |
1733 } | |
1734 } | |
1735 | |
1736 | |
1737 /** The template used for creating replicas in the pool. */ | |
1738 class Template { | |
1739 /** | |
1740 * An action to run during initialization of your replicas. An action is run | |
1741 * as shell commands which are executed one after the other in the same bash | |
1742 * shell, so any state established by one command is inherited by later | |
1743 * commands. | |
1744 */ | |
1745 Action action; | |
1746 | |
1747 /** | |
1748 * A list of HTTP Health Checks to configure for this replica pool and all | |
1749 * virtual machines in this replica pool. | |
1750 */ | |
1751 core.List<HealthCheck> healthChecks; | |
1752 | |
1753 /** | |
1754 * A free-form string describing the version of this template. You can provide | |
1755 * any versioning string you would like. For example, version1 or template-v1. | |
1756 */ | |
1757 core.String version; | |
1758 | |
1759 /** | |
1760 * The virtual machine parameters to use for creating replicas. You can define | |
1761 * settings such as the machine type and the image of replicas in this pool. | |
1762 * This is required if replica type is SMART_VM. | |
1763 */ | |
1764 VmParams vmParams; | |
1765 | |
1766 | |
1767 Template(); | |
1768 | |
1769 Template.fromJson(core.Map _json) { | |
1770 if (_json.containsKey("action")) { | |
1771 action = new Action.fromJson(_json["action"]); | |
1772 } | |
1773 if (_json.containsKey("healthChecks")) { | |
1774 healthChecks = _json["healthChecks"].map((value) => new HealthCheck.fromJs
on(value)).toList(); | |
1775 } | |
1776 if (_json.containsKey("version")) { | |
1777 version = _json["version"]; | |
1778 } | |
1779 if (_json.containsKey("vmParams")) { | |
1780 vmParams = new VmParams.fromJson(_json["vmParams"]); | |
1781 } | |
1782 } | |
1783 | |
1784 core.Map toJson() { | |
1785 var _json = new core.Map(); | |
1786 if (action != null) { | |
1787 _json["action"] = (action).toJson(); | |
1788 } | |
1789 if (healthChecks != null) { | |
1790 _json["healthChecks"] = healthChecks.map((value) => (value).toJson()).toLi
st(); | |
1791 } | |
1792 if (version != null) { | |
1793 _json["version"] = version; | |
1794 } | |
1795 if (vmParams != null) { | |
1796 _json["vmParams"] = (vmParams).toJson(); | |
1797 } | |
1798 return _json; | |
1799 } | |
1800 } | |
1801 | |
1802 | |
1803 /** | |
1804 * Parameters for creating a Compute Engine Instance resource. Most fields are | |
1805 * identical to the corresponding Compute Engine resource. | |
1806 */ | |
1807 class VmParams { | |
1808 /** Deprecated. Please use baseInstanceName instead. */ | |
1809 core.String baseInstanceName; | |
1810 | |
1811 /** | |
1812 * Enables IP Forwarding, which allows this instance to receive packets | |
1813 * destined for a different IP address, and send packets with a different | |
1814 * source IP. See IP Forwarding for more information. | |
1815 */ | |
1816 core.bool canIpForward; | |
1817 | |
1818 /** An optional textual description of the instance. */ | |
1819 core.String description; | |
1820 | |
1821 /** | |
1822 * A list of existing Persistent Disk resources to attach to each replica in | |
1823 * the pool. Each disk will be attached in read-only mode to every replica. | |
1824 */ | |
1825 core.List<ExistingDisk> disksToAttach; | |
1826 | |
1827 /** | |
1828 * A list of Disk resources to create and attach to each Replica in the Pool. | |
1829 * Currently, you can only define one disk and it must be a root persistent | |
1830 * disk. Note that Replica Pool will create a root persistent disk for each | |
1831 * replica. | |
1832 */ | |
1833 core.List<NewDisk> disksToCreate; | |
1834 | |
1835 /** | |
1836 * The machine type for this instance. The resource name (e.g. n1-standard-1). | |
1837 */ | |
1838 core.String machineType; | |
1839 | |
1840 /** The metadata key/value pairs assigned to this instance. */ | |
1841 Metadata metadata; | |
1842 | |
1843 /** | |
1844 * A list of network interfaces for the instance. Currently only one interface | |
1845 * is supported by Google Compute Engine, ONE_TO_ONE_NAT. | |
1846 */ | |
1847 core.List<NetworkInterface> networkInterfaces; | |
1848 | |
1849 /** Not documented yet. */ | |
1850 core.String onHostMaintenance; | |
1851 | |
1852 /** A list of Service Accounts to enable for this instance. */ | |
1853 core.List<ServiceAccount> serviceAccounts; | |
1854 | |
1855 /** | |
1856 * A list of tags to apply to the Google Compute Engine instance to identify | |
1857 * resources. | |
1858 */ | |
1859 Tag tags; | |
1860 | |
1861 | |
1862 VmParams(); | |
1863 | |
1864 VmParams.fromJson(core.Map _json) { | |
1865 if (_json.containsKey("baseInstanceName")) { | |
1866 baseInstanceName = _json["baseInstanceName"]; | |
1867 } | |
1868 if (_json.containsKey("canIpForward")) { | |
1869 canIpForward = _json["canIpForward"]; | |
1870 } | |
1871 if (_json.containsKey("description")) { | |
1872 description = _json["description"]; | |
1873 } | |
1874 if (_json.containsKey("disksToAttach")) { | |
1875 disksToAttach = _json["disksToAttach"].map((value) => new ExistingDisk.fro
mJson(value)).toList(); | |
1876 } | |
1877 if (_json.containsKey("disksToCreate")) { | |
1878 disksToCreate = _json["disksToCreate"].map((value) => new NewDisk.fromJson
(value)).toList(); | |
1879 } | |
1880 if (_json.containsKey("machineType")) { | |
1881 machineType = _json["machineType"]; | |
1882 } | |
1883 if (_json.containsKey("metadata")) { | |
1884 metadata = new Metadata.fromJson(_json["metadata"]); | |
1885 } | |
1886 if (_json.containsKey("networkInterfaces")) { | |
1887 networkInterfaces = _json["networkInterfaces"].map((value) => new NetworkI
nterface.fromJson(value)).toList(); | |
1888 } | |
1889 if (_json.containsKey("onHostMaintenance")) { | |
1890 onHostMaintenance = _json["onHostMaintenance"]; | |
1891 } | |
1892 if (_json.containsKey("serviceAccounts")) { | |
1893 serviceAccounts = _json["serviceAccounts"].map((value) => new ServiceAccou
nt.fromJson(value)).toList(); | |
1894 } | |
1895 if (_json.containsKey("tags")) { | |
1896 tags = new Tag.fromJson(_json["tags"]); | |
1897 } | |
1898 } | |
1899 | |
1900 core.Map toJson() { | |
1901 var _json = new core.Map(); | |
1902 if (baseInstanceName != null) { | |
1903 _json["baseInstanceName"] = baseInstanceName; | |
1904 } | |
1905 if (canIpForward != null) { | |
1906 _json["canIpForward"] = canIpForward; | |
1907 } | |
1908 if (description != null) { | |
1909 _json["description"] = description; | |
1910 } | |
1911 if (disksToAttach != null) { | |
1912 _json["disksToAttach"] = disksToAttach.map((value) => (value).toJson()).to
List(); | |
1913 } | |
1914 if (disksToCreate != null) { | |
1915 _json["disksToCreate"] = disksToCreate.map((value) => (value).toJson()).to
List(); | |
1916 } | |
1917 if (machineType != null) { | |
1918 _json["machineType"] = machineType; | |
1919 } | |
1920 if (metadata != null) { | |
1921 _json["metadata"] = (metadata).toJson(); | |
1922 } | |
1923 if (networkInterfaces != null) { | |
1924 _json["networkInterfaces"] = networkInterfaces.map((value) => (value).toJs
on()).toList(); | |
1925 } | |
1926 if (onHostMaintenance != null) { | |
1927 _json["onHostMaintenance"] = onHostMaintenance; | |
1928 } | |
1929 if (serviceAccounts != null) { | |
1930 _json["serviceAccounts"] = serviceAccounts.map((value) => (value).toJson()
).toList(); | |
1931 } | |
1932 if (tags != null) { | |
1933 _json["tags"] = (tags).toJson(); | |
1934 } | |
1935 return _json; | |
1936 } | |
1937 } | |
1938 | |
1939 | |
OLD | NEW |