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

Change criteria for adding 'Inner' in Network #959

Merged
merged 5 commits into from
Jul 20, 2016
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Regenerate storage
jianghaolu committed Jul 20, 2016
commit 3d50edbeefd3ef41bd329d7061f2aef001321441
Original file line number Diff line number Diff line change
@@ -7,11 +7,12 @@
package com.microsoft.azure.management.storage;

import com.microsoft.azure.management.resources.fluentcore.model.Wrapper;
import com.microsoft.azure.management.storage.implementation.UsageInner;

/**
* An immutable client-side representation of an Azure storage resource usage info object.
*/
public interface StorageUsage extends Wrapper<Usage> {
public interface StorageUsage extends Wrapper<UsageInner> {
/**
* @return the unit of measurement. Possible values include: 'Count',
* 'Bytes', 'Seconds', 'Percent', 'CountsPerSecond', 'BytesPerSecond'.
Original file line number Diff line number Diff line change
@@ -2,15 +2,14 @@

import com.microsoft.azure.management.resources.fluentcore.model.implementation.WrapperImpl;
import com.microsoft.azure.management.storage.StorageUsage;
import com.microsoft.azure.management.storage.Usage;
import com.microsoft.azure.management.storage.UsageName;
import com.microsoft.azure.management.storage.UsageUnit;

/**
* The implementation of {@link Usage}.
* The implementation of {@link UsageInner}.
*/
class UsageImpl extends WrapperImpl<Usage> implements StorageUsage {
UsageImpl(Usage innerObject) {
class UsageImpl extends WrapperImpl<UsageInner> implements StorageUsage {
UsageImpl(UsageInner innerObject) {
super(innerObject);
}

Original file line number Diff line number Diff line change
@@ -6,14 +6,16 @@
* Code generated by Microsoft (R) AutoRest Code Generator.
*/

package com.microsoft.azure.management.storage;
package com.microsoft.azure.management.storage.implementation;

import com.microsoft.azure.management.storage.UsageUnit;
import com.microsoft.azure.management.storage.UsageName;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Describes Storage Resource Usage.
*/
public class Usage {
public class UsageInner {
/**
* Gets the unit of measurement. Possible values include: 'Count',
* 'Bytes', 'Seconds', 'Percent', 'CountsPerSecond', 'BytesPerSecond'.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@
import com.microsoft.azure.management.resources.fluentcore.utils.PagedListConverter;
import com.microsoft.azure.management.resources.implementation.PageImpl;
import com.microsoft.azure.management.storage.StorageUsage;
import com.microsoft.azure.management.storage.Usage;
import com.microsoft.azure.management.storage.Usages;
import com.microsoft.rest.RestException;

@@ -26,23 +25,23 @@ class UsagesImpl

@Override
public PagedList<StorageUsage> list() throws CloudException, IOException {
PagedListConverter<Usage, StorageUsage> converter =
new PagedListConverter<Usage, StorageUsage>() {
PagedListConverter<UsageInner, StorageUsage> converter =
new PagedListConverter<UsageInner, StorageUsage>() {
@Override
public StorageUsage typeConvert(Usage usageInner) {
public StorageUsage typeConvert(UsageInner usageInner) {
return new UsageImpl(usageInner);
}
};
return converter.convert(toPagedList(client.usages().list().getBody().value()));
return converter.convert(toPagedList(client.usages().list().getBody()));
}

private PagedList<Usage> toPagedList(List<Usage> list) {
PageImpl<Usage> page = new PageImpl<>();
private PagedList<UsageInner> toPagedList(List<UsageInner> list) {
PageImpl<UsageInner> page = new PageImpl<>();
page.setItems(list);
page.setNextPageLink(null);
return new PagedList<Usage>(page) {
return new PagedList<UsageInner>(page) {
@Override
public Page<Usage> nextPage(String nextPageLink) throws RestException, IOException {
public Page<UsageInner> nextPage(String nextPageLink) throws RestException, IOException {
return null;
}
};
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.ServiceResponseCallback;
import java.io.IOException;
import java.util.List;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.GET;
@@ -64,17 +65,19 @@ interface UsagesService {
* @throws CloudException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @throws IllegalArgumentException exception thrown from invalid parameters
* @return the UsageListResultInner object wrapped in {@link ServiceResponse} if successful.
* @return the List&lt;UsageInner&gt; object wrapped in {@link ServiceResponse} if successful.
*/
public ServiceResponse<UsageListResultInner> list() throws CloudException, IOException, IllegalArgumentException {
public ServiceResponse<List<UsageInner>> list() throws CloudException, IOException, IllegalArgumentException {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Call<ResponseBody> call = service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent());
return listDelegate(call.execute());
ServiceResponse<PageImpl<UsageInner>> response = listDelegate(call.execute());
List<UsageInner> result = response.getBody().getItems();
return new ServiceResponse<>(result, response.getResponse());
}

/**
@@ -84,7 +87,7 @@ public ServiceResponse<UsageListResultInner> list() throws CloudException, IOExc
* @throws IllegalArgumentException thrown if callback is null
* @return the {@link Call} object
*/
public ServiceCall listAsync(final ServiceCallback<UsageListResultInner> serviceCallback) throws IllegalArgumentException {
public ServiceCall listAsync(final ServiceCallback<List<UsageInner>> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
@@ -98,11 +101,12 @@ public ServiceCall listAsync(final ServiceCallback<UsageListResultInner> service
}
Call<ResponseBody> call = service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent());
final ServiceCall serviceCall = new ServiceCall(call);
call.enqueue(new ServiceResponseCallback<UsageListResultInner>(serviceCallback) {
call.enqueue(new ServiceResponseCallback<List<UsageInner>>(serviceCallback) {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
try {
serviceCallback.success(listDelegate(response));
ServiceResponse<PageImpl<UsageInner>> result = listDelegate(response);
serviceCallback.success(new ServiceResponse<>(result.getBody().getItems(), result.getResponse()));
} catch (CloudException | IOException exception) {
serviceCallback.failure(exception);
}
@@ -111,9 +115,9 @@ public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response)
return serviceCall;
}

private ServiceResponse<UsageListResultInner> listDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return new AzureServiceResponseBuilder<UsageListResultInner, CloudException>(this.client.mapperAdapter())
.register(200, new TypeToken<UsageListResultInner>() { }.getType())
private ServiceResponse<PageImpl<UsageInner>> listDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return new AzureServiceResponseBuilder<PageImpl<UsageInner>, CloudException>(this.client.mapperAdapter())
.register(200, new TypeToken<PageImpl<UsageInner>>() { }.getType())
.registerError(CloudException.class)
.build(response);
}