Skip to content

Commit

Permalink
Compute: rename get/delete methods to getXxx/deleteXxx
Browse files Browse the repository at this point in the history
  • Loading branch information
mziccard committed Apr 28, 2016
1 parent 88fea35 commit 3ae1285
Show file tree
Hide file tree
Showing 16 changed files with 197 additions and 195 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public boolean exists() {
* @throws ComputeException upon failure
*/
public Address reload(Compute.AddressOption... options) {
return compute.get(addressId(), options);
return compute.getAddress(addressId(), options);
}

/**
Expand All @@ -145,7 +145,7 @@ public Address reload(Compute.AddressOption... options) {
* @throws ComputeException upon failure
*/
public Operation delete(Compute.OperationOption... options) {
return compute.delete(addressId(), options);
return compute.deleteAddress(addressId(), options);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2289,7 +2289,7 @@ public static InstanceAggregatedListOption pageToken(String pageToken) {
*
* @throws ComputeException upon failure
*/
Operation get(OperationId operationId, OperationOption... options);
Operation getOperation(OperationId operationId, OperationOption... options);

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

/**
* Returns the requested address or {@code null} if not found.
*
* @throws ComputeException upon failure
*/
Address get(AddressId addressId, AddressOption... options);
Address getAddress(AddressId addressId, AddressOption... options);

/**
* Creates a new address.
Expand Down Expand Up @@ -2366,7 +2366,7 @@ public static InstanceAggregatedListOption pageToken(String pageToken) {
* found
* @throws ComputeException upon failure
*/
Operation delete(AddressId addressId, OperationOption... options);
Operation deleteAddress(AddressId addressId, OperationOption... options);

/**
* Creates a new snapshot.
Expand Down Expand Up @@ -2429,7 +2429,7 @@ public static InstanceAggregatedListOption pageToken(String pageToken) {
*
* @throws ComputeException upon failure
*/
Image get(ImageId imageId, ImageOption... options);
Image getImage(ImageId imageId, ImageOption... options);

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

/**
* Deprecates the requested image.
Expand All @@ -2474,7 +2474,7 @@ Operation deprecate(ImageId image, DeprecationStatus<ImageId> deprecationStatus,
*
* @throws ComputeException upon failure
*/
Disk get(DiskId diskId, DiskOption... options);
Disk getDisk(DiskId diskId, DiskOption... options);

/**
* Creates a new disk.
Expand Down Expand Up @@ -2505,7 +2505,7 @@ Operation deprecate(ImageId image, DeprecationStatus<ImageId> deprecationStatus,
* found
* @throws ComputeException upon failure
*/
Operation delete(DiskId disk, OperationOption... options);
Operation deleteDisk(DiskId disk, OperationOption... options);

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

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

/**
* Creates a new network.
Expand Down Expand Up @@ -2608,7 +2608,7 @@ Operation deprecate(ImageId image, DeprecationStatus<ImageId> deprecationStatus,
*
* @throws ComputeException upon failure
*/
Instance get(InstanceId instance, InstanceOption... options);
Instance getInstance(InstanceId instance, InstanceOption... options);

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

/**
* Adds an access configuration to an instance's network interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ public com.google.api.services.compute.model.License call() {
}

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

@Override
public boolean delete(final OperationId operation) {
public boolean deleteOperation(final OperationId operation) {
try {
return runWithRetries(new Callable<Boolean>() {
@Override
Expand All @@ -916,7 +916,7 @@ public Boolean call() {
}

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

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

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

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

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

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

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

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

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

@Override
public Operation delete(final InstanceId instance, OperationOption... options) {
public Operation deleteInstance(final InstanceId instance, OperationOption... options) {
final Map<ComputeRpc.Option, ?> optionsMap = optionMap(options);
try {
com.google.api.services.compute.model.Operation answer =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public boolean exists() {
* @throws ComputeException upon failure
*/
public Disk reload(DiskOption... options) {
return compute.get(diskId(), options);
return compute.getDisk(diskId(), options);
}

/**
Expand All @@ -160,7 +160,7 @@ public Disk reload(DiskOption... options) {
* @throws ComputeException upon failure
*/
public Operation delete(OperationOption... options) {
return compute.delete(diskId(), options);
return compute.deleteDisk(diskId(), options);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public boolean exists() {
* @throws ComputeException upon failure
*/
public Image reload(ImageOption... options) {
return compute.get(imageId(), options);
return compute.getImage(imageId(), options);
}

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

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public boolean exists() {
* @throws ComputeException upon failure
*/
public Instance reload(InstanceOption... options) {
return compute.get(instanceId(), options);
return compute.getInstance(instanceId(), options);
}

/**
Expand All @@ -213,7 +213,7 @@ public Instance reload(InstanceOption... options) {
* @throws ComputeException upon failure
*/
public Operation delete(OperationOption... options) {
return compute.delete(instanceId(), options);
return compute.deleteInstance(instanceId(), options);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,8 @@ public boolean exists() throws ComputeException {
* @throws ComputeException upon failure
*/
public boolean isDone() throws ComputeException {
Operation operation =
compute.get(operationId, Compute.OperationOption.fields(Compute.OperationField.STATUS));
Operation operation = compute.getOperation(operationId,
Compute.OperationOption.fields(Compute.OperationField.STATUS));
return operation == null || operation.status() == Status.DONE;
}

Expand All @@ -666,7 +666,7 @@ public boolean isDone() throws ComputeException {
* @throws ComputeException upon failure
*/
public Operation reload(Compute.OperationOption... options) throws ComputeException {
return compute.get(operationId, options);
return compute.getOperation(operationId, options);
}

/**
Expand All @@ -677,7 +677,7 @@ public Operation reload(Compute.OperationOption... options) throws ComputeExcept
* @throws ComputeException upon failure
*/
public boolean delete() throws ComputeException {
return compute.delete(operationId);
return compute.deleteOperation(operationId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public boolean exists() {
* @throws ComputeException upon failure
*/
public Subnetwork reload(SubnetworkOption... options) {
return compute.get(subnetworkId(), options);
return compute.getSubnetwork(subnetworkId(), options);
}

/**
Expand All @@ -146,7 +146,7 @@ public Subnetwork reload(SubnetworkOption... options) {
* @throws ComputeException upon failure
*/
public Operation delete(OperationOption... options) {
return compute.delete(subnetworkId(), options);
return compute.deleteSubnetwork(subnetworkId(), options);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void testDeleteOperation() {
Operation operation = new Operation.Builder(serviceMockReturnsOptions)
.operationId(GlobalOperationId.of("project", "op"))
.build();
expect(compute.delete(REGION_ADDRESS_ID)).andReturn(operation);
expect(compute.deleteAddress(REGION_ADDRESS_ID)).andReturn(operation);
replay(compute);
initializeAddress();
assertSame(operation, address.delete());
Expand All @@ -213,7 +213,7 @@ public void testDeleteOperation() {
public void testDeleteNull() {
initializeExpectedAddress(3);
expect(compute.options()).andReturn(mockOptions);
expect(compute.delete(REGION_ADDRESS_ID)).andReturn(null);
expect(compute.deleteAddress(REGION_ADDRESS_ID)).andReturn(null);
replay(compute);
initializeAddress();
assertNull(address.delete());
Expand All @@ -224,7 +224,7 @@ public void testExists_True() throws Exception {
initializeExpectedAddress(3);
Compute.AddressOption[] expectedOptions = {Compute.AddressOption.fields()};
expect(compute.options()).andReturn(mockOptions);
expect(compute.get(REGION_ADDRESS_ID, expectedOptions)).andReturn(regionForwardingAddress);
expect(compute.getAddress(REGION_ADDRESS_ID, expectedOptions)).andReturn(regionForwardingAddress);
replay(compute);
initializeAddress();
assertTrue(address.exists());
Expand All @@ -236,7 +236,7 @@ public void testExists_False() throws Exception {
initializeExpectedAddress(3);
Compute.AddressOption[] expectedOptions = {Compute.AddressOption.fields()};
expect(compute.options()).andReturn(mockOptions);
expect(compute.get(REGION_ADDRESS_ID, expectedOptions)).andReturn(null);
expect(compute.getAddress(REGION_ADDRESS_ID, expectedOptions)).andReturn(null);
replay(compute);
initializeAddress();
assertFalse(address.exists());
Expand All @@ -247,7 +247,7 @@ public void testExists_False() throws Exception {
public void testReload() throws Exception {
initializeExpectedAddress(5);
expect(compute.options()).andReturn(mockOptions);
expect(compute.get(REGION_ADDRESS_ID)).andReturn(regionForwardingAddress);
expect(compute.getAddress(REGION_ADDRESS_ID)).andReturn(regionForwardingAddress);
replay(compute);
initializeAddress();
Address updatedAddress = address.reload();
Expand All @@ -259,7 +259,7 @@ public void testReload() throws Exception {
public void testReloadNull() throws Exception {
initializeExpectedAddress(3);
expect(compute.options()).andReturn(mockOptions);
expect(compute.get(REGION_ADDRESS_ID)).andReturn(null);
expect(compute.getAddress(REGION_ADDRESS_ID)).andReturn(null);
replay(compute);
initializeAddress();
assertNull(address.reload());
Expand All @@ -270,7 +270,7 @@ public void testReloadNull() throws Exception {
public void testReloadWithOptions() throws Exception {
initializeExpectedAddress(5);
expect(compute.options()).andReturn(mockOptions);
expect(compute.get(REGION_ADDRESS_ID, Compute.AddressOption.fields()))
expect(compute.getAddress(REGION_ADDRESS_ID, Compute.AddressOption.fields()))
.andReturn(regionForwardingAddress);
replay(compute);
initializeAddress();
Expand Down
Loading

0 comments on commit 3ae1285

Please sign in to comment.