Skip to content

Commit 7f75485

Browse files
committed
Compute: rename get/delete methods to getXxx/deleteXxx (#968)
1 parent 88fea35 commit 7f75485

File tree

16 files changed

+197
-195
lines changed

16 files changed

+197
-195
lines changed

gcloud-java-compute/src/main/java/com/google/gcloud/compute/Address.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public boolean exists() {
134134
* @throws ComputeException upon failure
135135
*/
136136
public Address reload(Compute.AddressOption... options) {
137-
return compute.get(addressId(), options);
137+
return compute.getAddress(addressId(), options);
138138
}
139139

140140
/**
@@ -145,7 +145,7 @@ public Address reload(Compute.AddressOption... options) {
145145
* @throws ComputeException upon failure
146146
*/
147147
public Operation delete(Compute.OperationOption... options) {
148-
return compute.delete(addressId(), options);
148+
return compute.deleteAddress(addressId(), options);
149149
}
150150

151151
/**

gcloud-java-compute/src/main/java/com/google/gcloud/compute/Compute.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2289,7 +2289,7 @@ public static InstanceAggregatedListOption pageToken(String pageToken) {
22892289
*
22902290
* @throws ComputeException upon failure
22912291
*/
2292-
Operation get(OperationId operationId, OperationOption... options);
2292+
Operation getOperation(OperationId operationId, OperationOption... options);
22932293

22942294
/**
22952295
* Lists the global operations.
@@ -2321,14 +2321,14 @@ public static InstanceAggregatedListOption pageToken(String pageToken) {
23212321
* @return {@code true} if operation was deleted, {@code false} if it was not found
23222322
* @throws ComputeException upon failure
23232323
*/
2324-
boolean delete(OperationId operation);
2324+
boolean deleteOperation(OperationId operation);
23252325

23262326
/**
23272327
* Returns the requested address or {@code null} if not found.
23282328
*
23292329
* @throws ComputeException upon failure
23302330
*/
2331-
Address get(AddressId addressId, AddressOption... options);
2331+
Address getAddress(AddressId addressId, AddressOption... options);
23322332

23332333
/**
23342334
* Creates a new address.
@@ -2366,7 +2366,7 @@ public static InstanceAggregatedListOption pageToken(String pageToken) {
23662366
* found
23672367
* @throws ComputeException upon failure
23682368
*/
2369-
Operation delete(AddressId addressId, OperationOption... options);
2369+
Operation deleteAddress(AddressId addressId, OperationOption... options);
23702370

23712371
/**
23722372
* Creates a new snapshot.
@@ -2429,7 +2429,7 @@ public static InstanceAggregatedListOption pageToken(String pageToken) {
24292429
*
24302430
* @throws ComputeException upon failure
24312431
*/
2432-
Image get(ImageId imageId, ImageOption... options);
2432+
Image getImage(ImageId imageId, ImageOption... options);
24332433

24342434
/**
24352435
* Lists images in the provided project that are available to the current user. This method can be
@@ -2457,7 +2457,7 @@ public static InstanceAggregatedListOption pageToken(String pageToken) {
24572457
* image was not found
24582458
* @throws ComputeException upon failure or if {@code image} is a publicly-available image
24592459
*/
2460-
Operation delete(ImageId image, OperationOption... options);
2460+
Operation deleteImage(ImageId image, OperationOption... options);
24612461

24622462
/**
24632463
* Deprecates the requested image.
@@ -2474,7 +2474,7 @@ Operation deprecate(ImageId image, DeprecationStatus<ImageId> deprecationStatus,
24742474
*
24752475
* @throws ComputeException upon failure
24762476
*/
2477-
Disk get(DiskId diskId, DiskOption... options);
2477+
Disk getDisk(DiskId diskId, DiskOption... options);
24782478

24792479
/**
24802480
* Creates a new disk.
@@ -2505,7 +2505,7 @@ Operation deprecate(ImageId image, DeprecationStatus<ImageId> deprecationStatus,
25052505
* found
25062506
* @throws ComputeException upon failure
25072507
*/
2508-
Operation delete(DiskId disk, OperationOption... options);
2508+
Operation deleteDisk(DiskId disk, OperationOption... options);
25092509

25102510
/**
25112511
* Resizes the disk to the requested size. The new size must be larger than the previous one.
@@ -2529,7 +2529,7 @@ Operation deprecate(ImageId image, DeprecationStatus<ImageId> deprecationStatus,
25292529
*
25302530
* @throws ComputeException upon failure
25312531
*/
2532-
Subnetwork get(SubnetworkId subnetworkId, SubnetworkOption... options);
2532+
Subnetwork getSubnetwork(SubnetworkId subnetworkId, SubnetworkOption... options);
25332533

25342534
/**
25352535
* Lists subnetworks for the provided region.
@@ -2553,7 +2553,7 @@ Operation deprecate(ImageId image, DeprecationStatus<ImageId> deprecationStatus,
25532553
* subnetwork was not found
25542554
* @throws ComputeException upon failure
25552555
*/
2556-
Operation delete(SubnetworkId subnetwork, OperationOption... options);
2556+
Operation deleteSubnetwork(SubnetworkId subnetwork, OperationOption... options);
25572557

25582558
/**
25592559
* Creates a new network.
@@ -2608,7 +2608,7 @@ Operation deprecate(ImageId image, DeprecationStatus<ImageId> deprecationStatus,
26082608
*
26092609
* @throws ComputeException upon failure
26102610
*/
2611-
Instance get(InstanceId instance, InstanceOption... options);
2611+
Instance getInstance(InstanceId instance, InstanceOption... options);
26122612

26132613
/**
26142614
* Lists instances for the provided zone.
@@ -2631,7 +2631,7 @@ Operation deprecate(ImageId image, DeprecationStatus<ImageId> deprecationStatus,
26312631
* instance was not found
26322632
* @throws ComputeException upon failure
26332633
*/
2634-
Operation delete(InstanceId instance, OperationOption... options);
2634+
Operation deleteInstance(InstanceId instance, OperationOption... options);
26352635

26362636
/**
26372637
* Adds an access configuration to an instance's network interface.

gcloud-java-compute/src/main/java/com/google/gcloud/compute/ComputeImpl.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ public com.google.api.services.compute.model.License call() {
765765
}
766766

767767
@Override
768-
public Operation get(final OperationId operationId, OperationOption... options) {
768+
public Operation getOperation(final OperationId operationId, OperationOption... options) {
769769
final Map<ComputeRpc.Option, ?> optionsMap = optionMap(options);
770770
try {
771771
com.google.api.services.compute.model.Operation answer =
@@ -889,7 +889,7 @@ Iterable<com.google.api.services.compute.model.Operation>> call() {
889889
}
890890

891891
@Override
892-
public boolean delete(final OperationId operation) {
892+
public boolean deleteOperation(final OperationId operation) {
893893
try {
894894
return runWithRetries(new Callable<Boolean>() {
895895
@Override
@@ -916,7 +916,7 @@ public Boolean call() {
916916
}
917917

918918
@Override
919-
public Address get(final AddressId addressId, AddressOption... options) {
919+
public Address getAddress(final AddressId addressId, AddressOption... options) {
920920
final Map<ComputeRpc.Option, ?> optionsMap = optionMap(options);
921921
try {
922922
com.google.api.services.compute.model.Address answer =
@@ -1069,7 +1069,7 @@ public Address apply(com.google.api.services.compute.model.Address address) {
10691069
}
10701070

10711071
@Override
1072-
public Operation delete(final AddressId addressId, OperationOption... options) {
1072+
public Operation deleteAddress(final AddressId addressId, OperationOption... options) {
10731073
final Map<ComputeRpc.Option, ?> optionsMap = optionMap(options);
10741074
try {
10751075
com.google.api.services.compute.model.Operation answer =
@@ -1206,7 +1206,7 @@ public com.google.api.services.compute.model.Operation call() {
12061206
}
12071207

12081208
@Override
1209-
public Image get(ImageId imageId, ImageOption... options) {
1209+
public Image getImage(ImageId imageId, ImageOption... options) {
12101210
final ImageId completeImageId = imageId.setProjectId(options().projectId());
12111211
final Map<ComputeRpc.Option, ?> optionsMap = optionMap(options);
12121212
try {
@@ -1264,7 +1264,7 @@ public Image apply(com.google.api.services.compute.model.Image image) {
12641264
}
12651265

12661266
@Override
1267-
public Operation delete(ImageId image, OperationOption... options) {
1267+
public Operation deleteImage(ImageId image, OperationOption... options) {
12681268
final ImageId completeId = image.setProjectId(options().projectId());
12691269
final Map<ComputeRpc.Option, ?> optionsMap = optionMap(options);
12701270
try {
@@ -1302,7 +1302,7 @@ public com.google.api.services.compute.model.Operation call() {
13021302
}
13031303

13041304
@Override
1305-
public Disk get(final DiskId diskId, DiskOption... options) {
1305+
public Disk getDisk(final DiskId diskId, DiskOption... options) {
13061306
final Map<ComputeRpc.Option, ?> optionsMap = optionMap(options);
13071307
try {
13081308
com.google.api.services.compute.model.Disk answer =
@@ -1403,7 +1403,7 @@ Iterable<com.google.api.services.compute.model.Disk>> call() {
14031403
}
14041404

14051405
@Override
1406-
public Operation delete(final DiskId disk, OperationOption... options) {
1406+
public Operation deleteDisk(final DiskId disk, OperationOption... options) {
14071407
final Map<ComputeRpc.Option, ?> optionsMap = optionMap(options);
14081408
try {
14091409
com.google.api.services.compute.model.Operation answer =
@@ -1455,7 +1455,7 @@ public com.google.api.services.compute.model.Operation call() {
14551455
}
14561456

14571457
@Override
1458-
public Subnetwork get(final SubnetworkId subnetworkId, SubnetworkOption... options) {
1458+
public Subnetwork getSubnetwork(final SubnetworkId subnetworkId, SubnetworkOption... options) {
14591459
final Map<ComputeRpc.Option, ?> optionsMap = optionMap(options);
14601460
try {
14611461
com.google.api.services.compute.model.Subnetwork answer =
@@ -1539,7 +1539,7 @@ Iterable<com.google.api.services.compute.model.Subnetwork>> call() {
15391539
}
15401540

15411541
@Override
1542-
public Operation delete(final SubnetworkId subnetwork, OperationOption... options) {
1542+
public Operation deleteSubnetwork(final SubnetworkId subnetwork, OperationOption... options) {
15431543
final Map<ComputeRpc.Option, ?> optionsMap = optionMap(options);
15441544
try {
15451545
com.google.api.services.compute.model.Operation answer =
@@ -1667,7 +1667,7 @@ public com.google.api.services.compute.model.Operation call() {
16671667
}
16681668

16691669
@Override
1670-
public Instance get(final InstanceId instance, InstanceOption... options) {
1670+
public Instance getInstance(final InstanceId instance, InstanceOption... options) {
16711671
final Map<ComputeRpc.Option, ?> optionsMap = optionMap(options);
16721672
try {
16731673
com.google.api.services.compute.model.Instance answer =
@@ -1750,7 +1750,7 @@ Iterable<com.google.api.services.compute.model.Instance>> call() {
17501750
}
17511751

17521752
@Override
1753-
public Operation delete(final InstanceId instance, OperationOption... options) {
1753+
public Operation deleteInstance(final InstanceId instance, OperationOption... options) {
17541754
final Map<ComputeRpc.Option, ?> optionsMap = optionMap(options);
17551755
try {
17561756
com.google.api.services.compute.model.Operation answer =

gcloud-java-compute/src/main/java/com/google/gcloud/compute/Disk.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public boolean exists() {
149149
* @throws ComputeException upon failure
150150
*/
151151
public Disk reload(DiskOption... options) {
152-
return compute.get(diskId(), options);
152+
return compute.getDisk(diskId(), options);
153153
}
154154

155155
/**
@@ -160,7 +160,7 @@ public Disk reload(DiskOption... options) {
160160
* @throws ComputeException upon failure
161161
*/
162162
public Operation delete(OperationOption... options) {
163-
return compute.delete(diskId(), options);
163+
return compute.deleteDisk(diskId(), options);
164164
}
165165

166166
/**

gcloud-java-compute/src/main/java/com/google/gcloud/compute/Image.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public boolean exists() {
148148
* @throws ComputeException upon failure
149149
*/
150150
public Image reload(ImageOption... options) {
151-
return compute.get(imageId(), options);
151+
return compute.getImage(imageId(), options);
152152
}
153153

154154
/**
@@ -159,7 +159,7 @@ public Image reload(ImageOption... options) {
159159
* @throws ComputeException upon failure or if this image is a publicly-available image
160160
*/
161161
public Operation delete(OperationOption... options) {
162-
return compute.delete(imageId(), options);
162+
return compute.deleteImage(imageId(), options);
163163
}
164164

165165
/**

gcloud-java-compute/src/main/java/com/google/gcloud/compute/Instance.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public boolean exists() {
202202
* @throws ComputeException upon failure
203203
*/
204204
public Instance reload(InstanceOption... options) {
205-
return compute.get(instanceId(), options);
205+
return compute.getInstance(instanceId(), options);
206206
}
207207

208208
/**
@@ -213,7 +213,7 @@ public Instance reload(InstanceOption... options) {
213213
* @throws ComputeException upon failure
214214
*/
215215
public Operation delete(OperationOption... options) {
216-
return compute.delete(instanceId(), options);
216+
return compute.deleteInstance(instanceId(), options);
217217
}
218218

219219
/**

gcloud-java-compute/src/main/java/com/google/gcloud/compute/Operation.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,8 @@ public boolean exists() throws ComputeException {
652652
* @throws ComputeException upon failure
653653
*/
654654
public boolean isDone() throws ComputeException {
655-
Operation operation =
656-
compute.get(operationId, Compute.OperationOption.fields(Compute.OperationField.STATUS));
655+
Operation operation = compute.getOperation(operationId,
656+
Compute.OperationOption.fields(Compute.OperationField.STATUS));
657657
return operation == null || operation.status() == Status.DONE;
658658
}
659659

@@ -666,7 +666,7 @@ public boolean isDone() throws ComputeException {
666666
* @throws ComputeException upon failure
667667
*/
668668
public Operation reload(Compute.OperationOption... options) throws ComputeException {
669-
return compute.get(operationId, options);
669+
return compute.getOperation(operationId, options);
670670
}
671671

672672
/**
@@ -677,7 +677,7 @@ public Operation reload(Compute.OperationOption... options) throws ComputeExcept
677677
* @throws ComputeException upon failure
678678
*/
679679
public boolean delete() throws ComputeException {
680-
return compute.delete(operationId);
680+
return compute.deleteOperation(operationId);
681681
}
682682

683683
@Override

gcloud-java-compute/src/main/java/com/google/gcloud/compute/Subnetwork.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public boolean exists() {
135135
* @throws ComputeException upon failure
136136
*/
137137
public Subnetwork reload(SubnetworkOption... options) {
138-
return compute.get(subnetworkId(), options);
138+
return compute.getSubnetwork(subnetworkId(), options);
139139
}
140140

141141
/**
@@ -146,7 +146,7 @@ public Subnetwork reload(SubnetworkOption... options) {
146146
* @throws ComputeException upon failure
147147
*/
148148
public Operation delete(OperationOption... options) {
149-
return compute.delete(subnetworkId(), options);
149+
return compute.deleteSubnetwork(subnetworkId(), options);
150150
}
151151

152152
/**

gcloud-java-compute/src/test/java/com/google/gcloud/compute/AddressTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public void testDeleteOperation() {
203203
Operation operation = new Operation.Builder(serviceMockReturnsOptions)
204204
.operationId(GlobalOperationId.of("project", "op"))
205205
.build();
206-
expect(compute.delete(REGION_ADDRESS_ID)).andReturn(operation);
206+
expect(compute.deleteAddress(REGION_ADDRESS_ID)).andReturn(operation);
207207
replay(compute);
208208
initializeAddress();
209209
assertSame(operation, address.delete());
@@ -213,7 +213,7 @@ public void testDeleteOperation() {
213213
public void testDeleteNull() {
214214
initializeExpectedAddress(3);
215215
expect(compute.options()).andReturn(mockOptions);
216-
expect(compute.delete(REGION_ADDRESS_ID)).andReturn(null);
216+
expect(compute.deleteAddress(REGION_ADDRESS_ID)).andReturn(null);
217217
replay(compute);
218218
initializeAddress();
219219
assertNull(address.delete());
@@ -224,7 +224,7 @@ public void testExists_True() throws Exception {
224224
initializeExpectedAddress(3);
225225
Compute.AddressOption[] expectedOptions = {Compute.AddressOption.fields()};
226226
expect(compute.options()).andReturn(mockOptions);
227-
expect(compute.get(REGION_ADDRESS_ID, expectedOptions)).andReturn(regionForwardingAddress);
227+
expect(compute.getAddress(REGION_ADDRESS_ID, expectedOptions)).andReturn(regionForwardingAddress);
228228
replay(compute);
229229
initializeAddress();
230230
assertTrue(address.exists());
@@ -236,7 +236,7 @@ public void testExists_False() throws Exception {
236236
initializeExpectedAddress(3);
237237
Compute.AddressOption[] expectedOptions = {Compute.AddressOption.fields()};
238238
expect(compute.options()).andReturn(mockOptions);
239-
expect(compute.get(REGION_ADDRESS_ID, expectedOptions)).andReturn(null);
239+
expect(compute.getAddress(REGION_ADDRESS_ID, expectedOptions)).andReturn(null);
240240
replay(compute);
241241
initializeAddress();
242242
assertFalse(address.exists());
@@ -247,7 +247,7 @@ public void testExists_False() throws Exception {
247247
public void testReload() throws Exception {
248248
initializeExpectedAddress(5);
249249
expect(compute.options()).andReturn(mockOptions);
250-
expect(compute.get(REGION_ADDRESS_ID)).andReturn(regionForwardingAddress);
250+
expect(compute.getAddress(REGION_ADDRESS_ID)).andReturn(regionForwardingAddress);
251251
replay(compute);
252252
initializeAddress();
253253
Address updatedAddress = address.reload();
@@ -259,7 +259,7 @@ public void testReload() throws Exception {
259259
public void testReloadNull() throws Exception {
260260
initializeExpectedAddress(3);
261261
expect(compute.options()).andReturn(mockOptions);
262-
expect(compute.get(REGION_ADDRESS_ID)).andReturn(null);
262+
expect(compute.getAddress(REGION_ADDRESS_ID)).andReturn(null);
263263
replay(compute);
264264
initializeAddress();
265265
assertNull(address.reload());
@@ -270,7 +270,7 @@ public void testReloadNull() throws Exception {
270270
public void testReloadWithOptions() throws Exception {
271271
initializeExpectedAddress(5);
272272
expect(compute.options()).andReturn(mockOptions);
273-
expect(compute.get(REGION_ADDRESS_ID, Compute.AddressOption.fields()))
273+
expect(compute.getAddress(REGION_ADDRESS_ID, Compute.AddressOption.fields()))
274274
.andReturn(regionForwardingAddress);
275275
replay(compute);
276276
initializeAddress();

0 commit comments

Comments
 (0)