Skip to content
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 @@ -9,9 +9,9 @@
package com.microsoft.azure.management.authorization.v2015_07_01;

import com.microsoft.azure.arm.model.HasInner;
import com.microsoft.azure.management.authorization.v2015_07_01.implementation.ClassicAdministratorInner;
import com.microsoft.azure.arm.resources.models.HasManager;
import com.microsoft.azure.management.authorization.v2015_07_01.implementation.AuthorizationManager;
import com.microsoft.azure.management.authorization.v2015_07_01.implementation.ClassicAdministratorInner;

/**
* Type representing ClassicAdministrator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,12 @@

package com.microsoft.azure.management.authorization.v2015_07_01;

import rx.Observable;
import com.microsoft.azure.arm.collection.SupportsListing;
import com.microsoft.azure.management.authorization.v2015_07_01.implementation.ClassicAdministratorsInner;
import com.microsoft.azure.arm.model.HasInner;

/**
* Type representing ClassicAdministrators.
*/
public interface ClassicAdministrators extends HasInner<ClassicAdministratorsInner> {
/**
* Gets service administrator, account administrator, and co-administrators for the subscription.
*
* @param apiVersion The API version to use for this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
Observable<ClassicAdministrator> listAsync(final String apiVersion);

public interface ClassicAdministrators extends SupportsListing<ClassicAdministrator>, HasInner<ClassicAdministratorsInner> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*
*/

package com.microsoft.azure.management.authorization.v2015_07_01.implementation;

import com.microsoft.azure.management.authorization.v2015_07_01.ClassicAdministrator;
import com.microsoft.azure.arm.model.implementation.WrapperImpl;
import rx.Observable;

class ClassicAdministratorImpl extends WrapperImpl<ClassicAdministratorInner> implements ClassicAdministrator {
private final AuthorizationManager manager;
ClassicAdministratorImpl(ClassicAdministratorInner inner, AuthorizationManager manager) {

ClassicAdministratorImpl(ClassicAdministratorInner inner, AuthorizationManager manager) {
super(inner);
this.manager = manager;
}
Expand All @@ -23,6 +26,8 @@ public AuthorizationManager manager() {
return this.manager;
}



@Override
public String emailAddress() {
return this.inner().emailAddress();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,53 @@
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* abc
* jkl
*/

package com.microsoft.azure.management.authorization.v2015_07_01.implementation;

import com.microsoft.azure.arm.model.implementation.WrapperImpl;
import com.microsoft.azure.management.authorization.v2015_07_01.ClassicAdministrators;
import rx.functions.Func1;
import rx.Observable;
import rx.functions.Func1;
import com.microsoft.azure.PagedList;
import com.microsoft.azure.Page;
import com.microsoft.azure.arm.utils.PagedListConverter;
import com.microsoft.azure.management.authorization.v2015_07_01.ClassicAdministrator;

class ClassicAdministratorsImpl extends WrapperImpl<ClassicAdministratorsInner> implements ClassicAdministrators {
private PagedListConverter<ClassicAdministratorInner, ClassicAdministrator> converter;
private final AuthorizationManager manager;

ClassicAdministratorsImpl(AuthorizationManager manager) {
super(manager.inner().classicAdministrators());
this.manager = manager;
this.converter = new PagedListConverter<ClassicAdministratorInner, ClassicAdministrator>() {
@Override
public Observable<ClassicAdministrator> typeConvertAsync(ClassicAdministratorInner inner) {
return Observable.just((ClassicAdministrator) wrapModel(inner));
}
};
}

public AuthorizationManager manager() {
return this.manager;
}

private ClassicAdministratorImpl wrapModel(ClassicAdministratorInner inner) {
return new ClassicAdministratorImpl(inner, manager());
}

@Override
public PagedList<ClassicAdministrator> list() {
ClassicAdministratorsInner client = this.inner();
return converter.convert(client.list());
}

@Override
public Observable<ClassicAdministrator> listAsync(final String apiVersion) {
public Observable<ClassicAdministrator> listAsync() {
ClassicAdministratorsInner client = this.inner();
return client.listAsync(apiVersion)
return client.listAsync()
.flatMapIterable(new Func1<Page<ClassicAdministratorInner>, Iterable<ClassicAdministratorInner>>() {
@Override
public Iterable<ClassicAdministratorInner> call(Page<ClassicAdministratorInner> page) {
Expand All @@ -41,7 +60,7 @@ public Iterable<ClassicAdministratorInner> call(Page<ClassicAdministratorInner>
.map(new Func1<ClassicAdministratorInner, ClassicAdministrator>() {
@Override
public ClassicAdministrator call(ClassicAdministratorInner inner) {
return new ClassicAdministratorImpl(inner, manager());
return wrapModel(inner);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,13 @@ interface ClassicAdministratorsService {
/**
* Gets service administrator, account administrator, and co-administrators for the subscription.
*
* @param apiVersion The API version to use for this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList&lt;ClassicAdministratorInner&gt; object if successful.
*/
public PagedList<ClassicAdministratorInner> list(final String apiVersion) {
ServiceResponse<Page<ClassicAdministratorInner>> response = listSinglePageAsync(apiVersion).toBlocking().single();
public PagedList<ClassicAdministratorInner> list() {
ServiceResponse<Page<ClassicAdministratorInner>> response = listSinglePageAsync().toBlocking().single();
return new PagedList<ClassicAdministratorInner>(response.body()) {
@Override
public Page<ClassicAdministratorInner> nextPage(String nextPageLink) {
Expand All @@ -88,14 +87,13 @@ public Page<ClassicAdministratorInner> nextPage(String nextPageLink) {
/**
* Gets service administrator, account administrator, and co-administrators for the subscription.
*
* @param apiVersion The API version to use for this operation.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<List<ClassicAdministratorInner>> listAsync(final String apiVersion, final ListOperationCallback<ClassicAdministratorInner> serviceCallback) {
public ServiceFuture<List<ClassicAdministratorInner>> listAsync(final ListOperationCallback<ClassicAdministratorInner> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listSinglePageAsync(apiVersion),
listSinglePageAsync(),
new Func1<String, Observable<ServiceResponse<Page<ClassicAdministratorInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ClassicAdministratorInner>>> call(String nextPageLink) {
Expand All @@ -108,12 +106,11 @@ public Observable<ServiceResponse<Page<ClassicAdministratorInner>>> call(String
/**
* Gets service administrator, account administrator, and co-administrators for the subscription.
*
* @param apiVersion The API version to use for this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;ClassicAdministratorInner&gt; object
*/
public Observable<Page<ClassicAdministratorInner>> listAsync(final String apiVersion) {
return listWithServiceResponseAsync(apiVersion)
public Observable<Page<ClassicAdministratorInner>> listAsync() {
return listWithServiceResponseAsync()
.map(new Func1<ServiceResponse<Page<ClassicAdministratorInner>>, Page<ClassicAdministratorInner>>() {
@Override
public Page<ClassicAdministratorInner> call(ServiceResponse<Page<ClassicAdministratorInner>> response) {
Expand All @@ -125,12 +122,11 @@ public Page<ClassicAdministratorInner> call(ServiceResponse<Page<ClassicAdminist
/**
* Gets service administrator, account administrator, and co-administrators for the subscription.
*
* @param apiVersion The API version to use for this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;ClassicAdministratorInner&gt; object
*/
public Observable<ServiceResponse<Page<ClassicAdministratorInner>>> listWithServiceResponseAsync(final String apiVersion) {
return listSinglePageAsync(apiVersion)
public Observable<ServiceResponse<Page<ClassicAdministratorInner>>> listWithServiceResponseAsync() {
return listSinglePageAsync()
.concatMap(new Func1<ServiceResponse<Page<ClassicAdministratorInner>>, Observable<ServiceResponse<Page<ClassicAdministratorInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ClassicAdministratorInner>>> call(ServiceResponse<Page<ClassicAdministratorInner>> page) {
Expand All @@ -146,18 +142,17 @@ public Observable<ServiceResponse<Page<ClassicAdministratorInner>>> call(Service
/**
* Gets service administrator, account administrator, and co-administrators for the subscription.
*
ServiceResponse<PageImpl<ClassicAdministratorInner>> * @param apiVersion The API version to use for this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList&lt;ClassicAdministratorInner&gt; object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<ClassicAdministratorInner>>> listSinglePageAsync(final String apiVersion) {
public Observable<ServiceResponse<Page<ClassicAdministratorInner>>> listSinglePageAsync() {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (apiVersion == null) {
throw new IllegalArgumentException("Parameter apiVersion is required and cannot be null.");
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent())
return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<ClassicAdministratorInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ClassicAdministratorInner>>> call(Response<ResponseBody> response) {
Expand Down