Skip to content

Commit

Permalink
Update Compute examples, snippets and READMEs to use renamed getters/…
Browse files Browse the repository at this point in the history
…setters/builders
  • Loading branch information
mziccard committed Oct 19, 2016
1 parent 728002e commit 7fa9a17
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 125 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ if (disk != null) {
String snapshotName = "disk-name-snapshot";
Operation operation = disk.createSnapshot(snapshotName);
operation = operation.waitFor();
if (operation.errors() == null) {
if (operation.getErrors() == null) {
// use snapshot
Snapshot snapshot = compute.getSnapshot(snapshotName);
}
Expand Down Expand Up @@ -252,7 +252,7 @@ MachineTypeId machineTypeId = MachineTypeId.of("us-central1-a", "n1-standard-1")
Operation operation =
compute.create(InstanceInfo.of(instanceId, machineTypeId, attachedDisk, networkInterface));
operation = operation.waitFor();
if (operation.errors() == null) {
if (operation.getErrors() == null) {
// use instance
Instance instance = compute.getInstance(instanceId);
}
Expand Down
12 changes: 6 additions & 6 deletions google-cloud-compute/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ operation = operation.waitFor();
if (operation.errors() == null) {
System.out.println("Address " + addressId + " was successfully created");
} else {
// inspect operation.errors()
// inspect operation.getErrors()
throw new RuntimeException("Address creation failed");
}
```
Expand Down Expand Up @@ -150,7 +150,7 @@ DiskInfo disk = DiskInfo.of(diskId, diskConfiguration);
Operation operation = compute.create(disk);
// Wait for operation to complete
operation = operation.waitFor();
if (operation.errors() == null) {
if (operation.getErrors() == null) {
System.out.println("Disk " + diskId + " was successfully created");
} else {
// inspect operation.errors()
Expand Down Expand Up @@ -185,18 +185,18 @@ Address externalIp = compute.getAddress(addressId);
InstanceId instanceId = InstanceId.of("us-central1-a", "test-instance");
NetworkId networkId = NetworkId.of("default");
PersistentDiskConfiguration attachConfiguration =
PersistentDiskConfiguration.builder(diskId).boot(true).build();
PersistentDiskConfiguration.newBuilder(diskId).setBoot(true).build();
AttachedDisk attachedDisk = AttachedDisk.of("dev0", attachConfiguration);
NetworkInterface networkInterface = NetworkInterface.builder(networkId)
.accessConfigurations(AccessConfig.of(externalIp.address()))
NetworkInterface networkInterface = NetworkInterface.newBuilder(networkId)
.setAccessConfigurations(AccessConfig.of(externalIp.getAddress()))
.build();
MachineTypeId machineTypeId = MachineTypeId.of("us-central1-a", "n1-standard-1");
InstanceInfo instance =
InstanceInfo.of(instanceId, machineTypeId, attachedDisk, networkInterface);
Operation operation = compute.create(instance);
// Wait for operation to complete
operation = operation.waitFor();
if (operation.errors() == null) {
if (operation.getErrors() == null) {
System.out.println("Instance " + instanceId + " was successfully created");
} else {
// inspect operation.errors()
Expand Down
Loading

0 comments on commit 7fa9a17

Please sign in to comment.