com.microsoft.azure.management.resources.implementation.ProvidersImpl Maven / Gradle / Ivy
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/
package com.microsoft.azure.management.resources.implementation;
import com.microsoft.azure.PagedList;
import com.microsoft.azure.management.resources.Provider;
import com.microsoft.azure.management.resources.Providers;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.ReadableWrappersImpl;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import rx.Observable;
import rx.functions.Func1;
/**
* The implementation for {@link Providers}.
*/
final class ProvidersImpl
extends ReadableWrappersImpl
implements Providers {
private final ProvidersInner client;
ProvidersImpl(final ProvidersInner client) {
this.client = client;
}
@Override
public PagedList list() {
return wrapList(client.list());
}
@Override
public Provider unregister(String resourceProviderNamespace) {
return this.unregisterAsync(resourceProviderNamespace).toBlocking().last();
}
@Override
public Observable unregisterAsync(String resourceProviderNamespace) {
return client.unregisterAsync(resourceProviderNamespace).map(new Func1() {
@Override
public Provider call(ProviderInner providerInner) {
return wrapModel(providerInner);
}
});
}
@Override
public ServiceFuture unregisterAsync(String resourceProviderNamespace, ServiceCallback callback) {
return ServiceFuture.fromBody(this.unregisterAsync(resourceProviderNamespace), callback);
}
@Override
public Provider register(String resourceProviderNamespace) {
return this.registerAsync(resourceProviderNamespace).toBlocking().last();
}
@Override
public Observable registerAsync(String resourceProviderNamespace) {
return client.registerAsync(resourceProviderNamespace).map(new Func1() {
@Override
public Provider call(ProviderInner providerInner) {
return wrapModel(providerInner);
}
});
}
@Override
public ServiceFuture registerAsync(String resourceProviderNamespace, ServiceCallback callback) {
return ServiceFuture.fromBody(this.registerAsync(resourceProviderNamespace), callback);
}
@Override
public Observable getByNameAsync(String name) {
return client.getAsync(name)
.map(new Func1() {
@Override
public Provider call(ProviderInner providerInner) {
return wrapModel(providerInner);
}
});
}
@Override
public Provider getByName(String resourceProviderNamespace) {
return wrapModel(client.get(resourceProviderNamespace));
}
@Override
protected ProviderImpl wrapModel(ProviderInner inner) {
if (inner == null) {
return null;
}
return new ProviderImpl(inner);
}
@Override
public Observable listAsync() {
return wrapPageAsync(this.client.listAsync());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy