Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1078] Add async delete support #1102

Merged
merged 2 commits into from
Sep 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -7,7 +7,6 @@
package com.microsoft.azure.management.graphrbac;

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 @@ -18,8 +17,7 @@
*/
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 @@ -7,7 +7,6 @@
package com.microsoft.azure.management.graphrbac;

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 @@ -18,8 +17,7 @@
*/
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 @@ -44,11 +44,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 @@ -40,11 +40,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 @@ -12,8 +12,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 @@ -57,13 +57,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