package com.microsoft.azure.arm.resources.collection.implementation;
import com.microsoft.azure.arm.resources.ResourceId;
import com.microsoft.azure.arm.resources.collection.SupportsGettingById;
import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import rx.Observable;
public abstract class SupportsGettingByResourceGroupImpl<T>
extends SupportsGettingByIdImpl<T>
implements
SupportsGettingByResourceGroup<T>,
SupportsGettingById<T> {
@Override
public T getByResourceGroup(String resourceGroupName, String name) {
return this.getByResourceGroupAsync(resourceGroupName, name).toBlocking().last();
}
@Override
public ServiceFuture<T> getByResourceGroupAsync(String resourceGroupName, String name, ServiceCallback<T> callback) {
return ServiceFuture.fromBody(getByResourceGroupAsync(resourceGroupName, name), callback);
}
@Override
public Observable<T> getByIdAsync(String id) {
ResourceId resourceId = ResourceId.fromString(id);
if (resourceId == null) {
return null;
}
return this.getByResourceGroupAsync(resourceId.resourceGroupName(), resourceId.name());
}
}