|
16 | 16 |
|
17 | 17 | package com.google.gcloud.compute.spi;
|
18 | 18 |
|
| 19 | +import com.google.api.services.compute.model.AccessConfig; |
19 | 20 | import com.google.api.services.compute.model.Address;
|
| 21 | +import com.google.api.services.compute.model.AttachedDisk; |
20 | 22 | import com.google.api.services.compute.model.DeprecationStatus;
|
21 | 23 | import com.google.api.services.compute.model.Disk;
|
22 | 24 | import com.google.api.services.compute.model.DiskType;
|
23 | 25 | import com.google.api.services.compute.model.Image;
|
| 26 | +import com.google.api.services.compute.model.Instance; |
24 | 27 | import com.google.api.services.compute.model.License;
|
25 | 28 | import com.google.api.services.compute.model.MachineType;
|
| 29 | +import com.google.api.services.compute.model.Metadata; |
26 | 30 | import com.google.api.services.compute.model.Network;
|
27 | 31 | import com.google.api.services.compute.model.Operation;
|
28 | 32 | import com.google.api.services.compute.model.Region;
|
| 33 | +import com.google.api.services.compute.model.Scheduling; |
29 | 34 | import com.google.api.services.compute.model.Snapshot;
|
30 | 35 | import com.google.api.services.compute.model.Subnetwork;
|
| 36 | +import com.google.api.services.compute.model.Tags; |
31 | 37 | import com.google.api.services.compute.model.Zone;
|
32 | 38 | import com.google.gcloud.compute.ComputeException;
|
33 | 39 |
|
@@ -496,4 +502,171 @@ Operation deprecateImage(String project, String image, DeprecationStatus depreca
|
496 | 502 | * @throws ComputeException upon failure
|
497 | 503 | */
|
498 | 504 | Operation deleteNetwork(String network, Map<Option, ?> options);
|
| 505 | + |
| 506 | + /** |
| 507 | + * Creates a new instance. |
| 508 | + * |
| 509 | + * @return a zone operation for instance's creation |
| 510 | + * @throws ComputeException upon failure or if the zone does not exist |
| 511 | + */ |
| 512 | + Operation createInstance(String zone, Instance instance, Map<Option, ?> options); |
| 513 | + |
| 514 | + /** |
| 515 | + * Returns the requested instance or {@code null} if not found. |
| 516 | + * |
| 517 | + * @throws ComputeException upon failure or if the zone does not exist |
| 518 | + */ |
| 519 | + Instance getInstance(String zone, String instance, Map<Option, ?> options); |
| 520 | + |
| 521 | + /** |
| 522 | + * Lists instances for the provided zone. |
| 523 | + * |
| 524 | + * @throws ComputeException upon failure or if the zone does not exist |
| 525 | + */ |
| 526 | + Tuple<String, Iterable<Instance>> listInstances(String zone, Map<Option, ?> options); |
| 527 | + |
| 528 | + /** |
| 529 | + * Lists instances. |
| 530 | + * |
| 531 | + * @throws ComputeException upon failure |
| 532 | + */ |
| 533 | + Tuple<String, Iterable<Instance>> listInstances(Map<Option, ?> options); |
| 534 | + |
| 535 | + /** |
| 536 | + * Deletes the requested instance. |
| 537 | + * |
| 538 | + * @return a zone operation if the delete request was issued correctly, {@code null} if the |
| 539 | + * instance was not found |
| 540 | + * @throws ComputeException upon failure or if the zone does not exist |
| 541 | + */ |
| 542 | + Operation deleteInstance(String zone, String instance, Map<Option, ?> options); |
| 543 | + |
| 544 | + /** |
| 545 | + * Adds an access configuration to an instance's network interface. |
| 546 | + * |
| 547 | + * @return a zone operation if the add request was issued correctly, {@code null} if the instance |
| 548 | + * was not found |
| 549 | + * @throws ComputeException upon failure |
| 550 | + */ |
| 551 | + Operation addAccessConfig(String zone, String instance, String networkInterface, |
| 552 | + AccessConfig accessConfig, Map<Option, ?> options); |
| 553 | + |
| 554 | + /** |
| 555 | + * Attaches a disk to an instance. |
| 556 | + * |
| 557 | + * @return a zone operation if the attach request was issued correctly, {@code null} if the |
| 558 | + * instance was not found |
| 559 | + * @throws ComputeException upon failure |
| 560 | + */ |
| 561 | + Operation attachDisk(String zone, String instance, AttachedDisk attachedDisk, |
| 562 | + Map<Option, ?> options); |
| 563 | + |
| 564 | + /** |
| 565 | + * Deletes an access configuration from an instance's network interface. |
| 566 | + * |
| 567 | + * @return a zone operation if the delete request was issued correctly, {@code null} if the |
| 568 | + * instance was not found |
| 569 | + * @throws ComputeException upon failure |
| 570 | + */ |
| 571 | + Operation deleteAccessConfig(String zone, String instance, String networkInterface, |
| 572 | + String accessConfig, Map<Option, ?> options); |
| 573 | + |
| 574 | + /** |
| 575 | + * Detaches a disk from an instance. |
| 576 | + * |
| 577 | + * @return a zone operation if the detach request was issued correctly, {@code null} if the |
| 578 | + * instance was not found |
| 579 | + * @throws ComputeException upon failure |
| 580 | + */ |
| 581 | + Operation detachDisk(String zone, String instance, String deviceName, Map<Option, ?> options); |
| 582 | + |
| 583 | + /** |
| 584 | + * Returns the serial port output for the provided instance and port number. {@code port} must be |
| 585 | + * between 1 and 4 (inclusive). If {@code port} is {@code null} output for the default port (1) is |
| 586 | + * returned. |
| 587 | + * |
| 588 | + * @return the serial port output or {@code null} if the instance was not found |
| 589 | + * @throws ComputeException upon failure |
| 590 | + */ |
| 591 | + String getSerialPortOutput(String zone, String instance, Integer port, Map<Option, ?> options); |
| 592 | + |
| 593 | + /** |
| 594 | + * Resets the provided instance. |
| 595 | + * |
| 596 | + * @return a zone operation if the reset request was issued correctly, {@code null} if the |
| 597 | + * instance was not found |
| 598 | + * @throws ComputeException upon failure |
| 599 | + */ |
| 600 | + Operation reset(String zone, String instance, Map<Option, ?> options); |
| 601 | + |
| 602 | + /** |
| 603 | + * Sets the auto-delete flag for a disk attached to the provided instance. |
| 604 | + * |
| 605 | + * @return a zone operation if the flag setting request was issued correctly, {@code null} if the |
| 606 | + * instance was not found |
| 607 | + * @throws ComputeException upon failure |
| 608 | + */ |
| 609 | + Operation setDiskAutoDelete(String zone, String instance, String deviceName, boolean autoDelete, |
| 610 | + Map<Option, ?> options); |
| 611 | + |
| 612 | + /** |
| 613 | + * Sets the machine type for the provided instance. Instance must be in {@code TERMINATED} state |
| 614 | + * to be able to set its machine type. |
| 615 | + * |
| 616 | + * @param zone name of the zone in which the instance resides |
| 617 | + * @param instance name of the instance |
| 618 | + * @param machineTypeUrl full or partial URL of the machine type resource. For example |
| 619 | + * {@code zones/us-central1-f/machineTypes/n1-standard-1}. |
| 620 | + * @return a zone operation if the set request was issued correctly, {@code null} if the instance |
| 621 | + * was not found |
| 622 | + * @throws ComputeException upon failure |
| 623 | + */ |
| 624 | + Operation setMachineType(String zone, String instance, String machineTypeUrl, |
| 625 | + Map<Option, ?> options); |
| 626 | + |
| 627 | + /** |
| 628 | + * Sets the metadata for the provided instance. |
| 629 | + * |
| 630 | + * @return a zone operation if the set request was issued correctly, {@code null} if the instance |
| 631 | + * was not found |
| 632 | + * @throws ComputeException upon failure |
| 633 | + */ |
| 634 | + Operation setMetadata(String zone, String instance, Metadata metadata, Map<Option, ?> options); |
| 635 | + |
| 636 | + /** |
| 637 | + * Sets the scheduling options for the provided instance. |
| 638 | + * |
| 639 | + * @return a zone operation if the set request was issued correctly, {@code null} if the instance |
| 640 | + * was not found |
| 641 | + * @throws ComputeException upon failure |
| 642 | + */ |
| 643 | + Operation setScheduling(String zone, String instance, Scheduling scheduling, |
| 644 | + Map<Option, ?> options); |
| 645 | + |
| 646 | + /** |
| 647 | + * Sets the tags for the provided instance. |
| 648 | + * |
| 649 | + * @return a zone operation if the set request was issued correctly, {@code null} if the instance |
| 650 | + * was not found |
| 651 | + * @throws ComputeException upon failure |
| 652 | + */ |
| 653 | + Operation setTags(String zone, String instance, Tags tags, Map<Option, ?> options); |
| 654 | + |
| 655 | + /** |
| 656 | + * Starts the provided instance. |
| 657 | + * |
| 658 | + * @return a zone operation if the start request was issued correctly, {@code null} if the |
| 659 | + * instance was not found |
| 660 | + * @throws ComputeException upon failure |
| 661 | + */ |
| 662 | + Operation start(String zone, String instance, Map<Option, ?> options); |
| 663 | + |
| 664 | + /** |
| 665 | + * Stops the provided instance. |
| 666 | + * |
| 667 | + * @return a zone operation if the stop request was issued correctly, {@code null} if the instance |
| 668 | + * was not found |
| 669 | + * @throws ComputeException upon failure |
| 670 | + */ |
| 671 | + Operation stop(String zone, String instance, Map<Option, ?> options); |
499 | 672 | }
|
0 commit comments