Skip to content

Commit

Permalink
Merge pull request #1102 from jianghaolu/delete
Browse files Browse the repository at this point in the history
per Anu's review, ok to merge -- comments could be addressed separately and are not blocking
  • Loading branch information
Martin Sawicki authored Sep 26, 2016
2 parents 56bba66 + 6fea931 commit 09ded68
Show file tree
Hide file tree
Showing 23 changed files with 180 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.batch.BatchAccount;
import com.microsoft.azure.management.batch.BatchAccounts;
import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl;
import com.microsoft.azure.management.storage.implementation.StorageManager;
import rx.Observable;

/**
* Implementation for BatchAccounts and its parent interfaces.
Expand All @@ -27,13 +27,8 @@ protected BatchAccountsImpl(BatchAccountsInner innerCollection, BatchManager man
}

@Override
public void delete(String id) {
delete(ResourceUtils.groupFromResourceId(id), ResourceUtils.nameFromResourceId(id));
}

@Override
public void delete(String groupName, String name) {
this.innerCollection.delete(groupName, name);
public Observable<Void> deleteAsync(String groupName, String name) {
return this.innerCollection.deleteAsync(groupName, name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.compute.AvailabilitySet;
import com.microsoft.azure.management.compute.AvailabilitySets;
import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl;
import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.GroupPagedList;
import rx.Observable;

import java.util.List;

Expand Down Expand Up @@ -61,13 +61,8 @@ public AvailabilitySetImpl define(String name) {
}

@Override
public void delete(String id) {
delete(ResourceUtils.groupFromResourceId(id), ResourceUtils.nameFromResourceId(id));
}

@Override
public void delete(String groupName, String name) {
this.innerCollection.delete(groupName, name);
public Observable<Void> deleteAsync(String groupName, String name) {
return this.innerCollection.deleteAsync(groupName, name);
}

/**************************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
import com.microsoft.azure.management.compute.VirtualMachineScaleSetVMProfile;
import com.microsoft.azure.management.compute.VirtualMachineScaleSets;
import com.microsoft.azure.management.network.implementation.NetworkManager;
import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl;
import com.microsoft.azure.management.storage.implementation.StorageManager;
import rx.Observable;

import java.util.ArrayList;

/**
Expand Down Expand Up @@ -55,13 +56,8 @@ public PagedList<VirtualMachineScaleSet> list() {
}

@Override
public void delete(String id) {
this.delete(ResourceUtils.groupFromResourceId(id), ResourceUtils.nameFromResourceId(id));
}

@Override
public void delete(String groupName, String name) {
this.innerCollection.delete(groupName, name);
public Observable<Void> deleteAsync(String groupName, String name) {
return this.innerCollection.deleteAsync(groupName, name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import com.microsoft.azure.management.compute.VirtualMachineSizes;
import com.microsoft.azure.management.compute.VirtualMachines;
import com.microsoft.azure.management.network.implementation.NetworkManager;
import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl;
import com.microsoft.azure.management.storage.implementation.StorageManager;
import rx.Observable;
import rx.exceptions.Exceptions;

import java.util.ArrayList;
Expand Down Expand Up @@ -74,13 +74,8 @@ public VirtualMachine getByGroup(String groupName, String name) {
}

@Override
public void delete(String id) {
delete(ResourceUtils.groupFromResourceId(id), ResourceUtils.nameFromResourceId(id));
}

@Override
public void delete(String groupName, String name) {
this.innerCollection.delete(groupName, name);
public Observable<Void> deleteAsync(String groupName, String name) {
return this.innerCollection.deleteAsync(groupName, name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating;
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeleting;
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing;
import com.microsoft.rest.ServiceCall;
import com.microsoft.rest.ServiceCallback;
Expand All @@ -20,8 +19,7 @@
@LangDefinition(ContainerName = "~/")
public interface ServicePrincipals extends
SupportsCreating<ServicePrincipal.DefinitionStages.Blank>,
SupportsListing<ServicePrincipal>,
SupportsDeleting {
SupportsListing<ServicePrincipal> {
/**
* Gets the information about a service principal.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCreating;
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeleting;
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing;
import com.microsoft.rest.ServiceCall;
import com.microsoft.rest.ServiceCallback;
Expand All @@ -20,8 +19,7 @@
@LangDefinition(ContainerName = "~/")
public interface Users extends
SupportsCreating<User.DefinitionStages.Blank>,
SupportsListing<User>,
SupportsDeleting {
SupportsListing<User> {
/**
* Gets the information about a user.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ public PagedList<ServicePrincipal> list() {
return wrapList(this.innerCollection.list());
}

@Override
public void delete(String id) {
innerCollection.delete(id);
}

@Override
public ServicePrincipalImpl define(String appId) {
return wrapModel(appId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ public PagedList<User> list() {
return wrapList(this.innerCollection.list());
}

@Override
public void delete(String id) {
innerCollection.delete(id);
}

@Override
public UserImpl define(String name) {
return wrapModel(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import com.microsoft.azure.management.keyvault.Vault;
import com.microsoft.azure.management.keyvault.VaultProperties;
import com.microsoft.azure.management.keyvault.Vaults;
import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl;
import rx.Observable;

import java.util.UUID;

Expand Down Expand Up @@ -59,13 +59,8 @@ public Vault getByGroup(String groupName, String name) {
}

@Override
public void delete(String id) {
delete(ResourceUtils.groupFromResourceId(id), ResourceUtils.nameFromResourceId(id));
}

@Override
public void delete(String groupName, String name) {
this.innerCollection.delete(groupName, name);
public Observable<Void> deleteAsync(String groupName, String name) {
return this.innerCollection.deleteAsync(groupName, name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.network.LoadBalancer;
import com.microsoft.azure.management.network.LoadBalancers;
import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl;
import rx.Observable;

/**
* Implementation for {@link LoadBalancers}.
Expand Down Expand Up @@ -47,13 +47,8 @@ public LoadBalancerImpl getByGroup(String groupName, String name) {
}

@Override
public void delete(String id) {
delete(ResourceUtils.groupFromResourceId(id), ResourceUtils.nameFromResourceId(id));
}

@Override
public void delete(String groupName, String name) {
this.innerCollection.delete(groupName, name);
public Observable<Void> deleteAsync(String groupName, String name) {
return this.innerCollection.deleteAsync(groupName, name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import com.microsoft.azure.management.network.NetworkInterface;
import com.microsoft.azure.management.network.NetworkInterfaceDnsSettings;
import com.microsoft.azure.management.network.NetworkInterfaces;
import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl;
import rx.Observable;

import java.util.ArrayList;

Expand Down Expand Up @@ -45,13 +45,8 @@ public NetworkInterface getByGroup(String groupName, String name) {
}

@Override
public void delete(String id) {
this.delete(ResourceUtils.groupFromResourceId(id), ResourceUtils.nameFromResourceId(id));
}

@Override
public void delete(String groupName, String name) {
this.innerCollection.delete(groupName, name);
public Observable<Void> deleteAsync(String groupName, String name) {
return this.innerCollection.deleteAsync(groupName, name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.network.NetworkSecurityGroup;
import com.microsoft.azure.management.network.NetworkSecurityGroups;
import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl;
import rx.Observable;

import java.util.ArrayList;

Expand Down Expand Up @@ -49,13 +49,8 @@ public NetworkSecurityGroupImpl getByGroup(String groupName, String name) {
}

@Override
public void delete(String id) {
delete(ResourceUtils.groupFromResourceId(id), ResourceUtils.nameFromResourceId(id));
}

@Override
public void delete(String groupName, String name) {
this.innerCollection.delete(groupName, name);
public Observable<Void> deleteAsync(String groupName, String name) {
return this.innerCollection.deleteAsync(groupName, name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import com.microsoft.azure.management.network.DhcpOptions;
import com.microsoft.azure.management.network.Network;
import com.microsoft.azure.management.network.Networks;
import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl;
import rx.Observable;

import java.util.ArrayList;

Expand Down Expand Up @@ -51,13 +51,8 @@ public NetworkImpl getByGroup(String groupName, String name) {
}

@Override
public void delete(String id) {
delete(ResourceUtils.groupFromResourceId(id), ResourceUtils.nameFromResourceId(id));
}

@Override
public void delete(String groupName, String name) {
this.innerCollection.delete(groupName, name);
public Observable<Void> deleteAsync(String groupName, String name) {
return this.innerCollection.deleteAsync(groupName, name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
package com.microsoft.azure.management.network.implementation;

import com.microsoft.azure.PagedList;
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.network.PublicIPAddressDnsSettings;
import com.microsoft.azure.management.network.PublicIpAddress;
import com.microsoft.azure.management.network.PublicIpAddresses;
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl;
import rx.Observable;

/**
* Implementation for {@link PublicIpAddresses}.
Expand Down Expand Up @@ -48,13 +48,8 @@ public PublicIpAddressImpl getByGroup(String groupName, String name) {
}

@Override
public void delete(String id) {
delete(ResourceUtils.groupFromResourceId(id), ResourceUtils.nameFromResourceId(id));
}

@Override
public void delete(String groupName, String name) {
this.innerCollection.delete(groupName, name);
public Observable<Void> deleteAsync(String groupName, String name) {
return this.innerCollection.deleteAsync(groupName, name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.redis.RedisCache;
import com.microsoft.azure.management.redis.RedisCaches;
import com.microsoft.azure.management.resources.fluentcore.arm.ResourceUtils;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.GroupableResourcesImpl;
import rx.Observable;

/**
* The implementation of RedisCaches and its parent interfaces.
Expand Down Expand Up @@ -52,13 +52,8 @@ public RedisCache getByGroup(String groupName, String name) {
}

@Override
public void delete(String id) {
delete(ResourceUtils.groupFromResourceId(id), ResourceUtils.nameFromResourceId(id));
}

@Override
public void delete(String groupName, String name) {
this.innerCollection.delete(groupName, name);
public Observable<Void> deleteAsync(String groupName, String name) {
return this.innerCollection.deleteAsync(groupName, name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.apigeneration.LangDefinition.MethodConversion;
import com.microsoft.rest.ServiceCall;
import com.microsoft.rest.ServiceCallback;
import rx.Observable;

/**
* Provides access to deleting a resource from Azure, identifying it by its name and its resource group.
Expand All @@ -23,4 +26,23 @@ public interface SupportsDeletingByGroup {
* @param name The name of the resource
*/
void delete(String groupName, String name);

/**
* Asynchronously delete a resource from Azure, identifying it by its name and its resource group.
*
* @param groupName The group the resource is part of
* @param name The name of the resource
* @param callback the callback to call on success or failure
* @return a handle to cancel the request
*/
ServiceCall<Void> deleteAsync(String groupName, String name, ServiceCallback<Void> callback);

/**
* Asynchronously delete a resource from Azure, identifying it by its name and its resource group.
*
* @param groupName The group the resource is part of
* @param name The name of the resource
* @return an observable to the request
*/
Observable<Void> deleteAsync(String groupName, String name);
}
Loading

0 comments on commit 09ded68

Please sign in to comment.