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 @@ -18,13 +18,13 @@ public class AzureMetricsBaseData {
/**
* Gets or sets the Metric name.
*/
@JsonProperty(value = "metric")
@JsonProperty(value = "metric", required = true)
private String metric;

/**
* Gets or sets the Metric namespace.
*/
@JsonProperty(value = "namespace")
@JsonProperty(value = "namespace", required = true)
private String namespace;

/**
Expand All @@ -37,7 +37,7 @@ public class AzureMetricsBaseData {
* Gets or sets the list of time series data for the metric (one per unique
* dimension combination).
*/
@JsonProperty(value = "series")
@JsonProperty(value = "series", required = true)
private List<AzureTimeSeriesData> series;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class AzureMetricsData {
/**
* The baseData property.
*/
@JsonProperty(value = "baseData")
@JsonProperty(value = "baseData", required = true)
private AzureMetricsBaseData baseData;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ public class AzureMetricsDocument {
/**
* Gets or sets Time property (in ISO 8601 format).
*/
@JsonProperty(value = "time")
@JsonProperty(value = "time", required = true)
private String time;

/**
* The data property.
*/
@JsonProperty(value = "data")
@JsonProperty(value = "data", required = true)
private AzureMetricsData data;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@ public class AzureTimeSeriesData {
/**
* Gets or sets Min value.
*/
@JsonProperty(value = "min")
private Double min;
@JsonProperty(value = "min", required = true)
private double min;

/**
* Gets or sets Max value.
*/
@JsonProperty(value = "max")
private Double max;
@JsonProperty(value = "max", required = true)
private double max;

/**
* Gets or sets Sum value.
*/
@JsonProperty(value = "sum")
private Double sum;
@JsonProperty(value = "sum", required = true)
private double sum;

/**
* Gets or sets Count value.
*/
@JsonProperty(value = "count")
private Integer count;
@JsonProperty(value = "count", required = true)
private int count;

/**
* Get gets or sets dimension values.
Expand All @@ -70,7 +70,7 @@ public AzureTimeSeriesData withDimValues(List<String> dimValues) {
*
* @return the min value
*/
public Double min() {
public double min() {
return this.min;
}

Expand All @@ -80,7 +80,7 @@ public Double min() {
* @param min the min value to set
* @return the AzureTimeSeriesData object itself.
*/
public AzureTimeSeriesData withMin(Double min) {
public AzureTimeSeriesData withMin(double min) {
this.min = min;
return this;
}
Expand All @@ -90,7 +90,7 @@ public AzureTimeSeriesData withMin(Double min) {
*
* @return the max value
*/
public Double max() {
public double max() {
return this.max;
}

Expand All @@ -100,7 +100,7 @@ public Double max() {
* @param max the max value to set
* @return the AzureTimeSeriesData object itself.
*/
public AzureTimeSeriesData withMax(Double max) {
public AzureTimeSeriesData withMax(double max) {
this.max = max;
return this;
}
Expand All @@ -110,7 +110,7 @@ public AzureTimeSeriesData withMax(Double max) {
*
* @return the sum value
*/
public Double sum() {
public double sum() {
return this.sum;
}

Expand All @@ -120,7 +120,7 @@ public Double sum() {
* @param sum the sum value to set
* @return the AzureTimeSeriesData object itself.
*/
public AzureTimeSeriesData withSum(Double sum) {
public AzureTimeSeriesData withSum(double sum) {
this.sum = sum;
return this;
}
Expand All @@ -130,7 +130,7 @@ public AzureTimeSeriesData withSum(Double sum) {
*
* @return the count value
*/
public Integer count() {
public int count() {
return this.count;
}

Expand All @@ -140,7 +140,7 @@ public Integer count() {
* @param count the count value to set
* @return the AzureTimeSeriesData object itself.
*/
public AzureTimeSeriesData withCount(Integer count) {
public AzureTimeSeriesData withCount(int count) {
this.count = count;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public MetricsInner(Retrofit retrofit, AzureMetricsClientImpl client) {
interface MetricsService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.monitor.Metrics create" })
@POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProvider}/{resourceTypeName}/{resourceName}/metrics")
Observable<Response<ResponseBody>> create(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceProvider") String resourceProvider, @Path("resourceTypeName") String resourceTypeName, @Path("resourceName") String resourceName, @Header("Content-Type") String contentType, @Header("Content-Length") Integer contentLength, @Body AzureMetricsDocument body, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
Observable<Response<ResponseBody>> create(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceProvider") String resourceProvider, @Path("resourceTypeName") String resourceTypeName, @Path("resourceName") String resourceName, @Header("Content-Type") String contentType, @Header("Content-Length") int contentLength, @Body AzureMetricsDocument body, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

}

Expand All @@ -67,120 +67,16 @@ interface MetricsService {
* @param resourceProvider The ARM resource provider name
* @param resourceTypeName The ARM resource type name
* @param resourceName The ARM resource name
* @param body The Azure metrics document json payload
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws AzureMetricsResultInnerException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the AzureMetricsResultInner object if successful.
*/
public AzureMetricsResultInner create(String subscriptionId, String resourceGroupName, String resourceProvider, String resourceTypeName, String resourceName, AzureMetricsDocument body) {
return createWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceProvider, resourceTypeName, resourceName, body).toBlocking().single().body();
}

/**
* **Post the metric values for a resource**.
*
* @param subscriptionId The azure subscription id
* @param resourceGroupName The ARM resource group name
* @param resourceProvider The ARM resource provider name
* @param resourceTypeName The ARM resource type name
* @param resourceName The ARM resource name
* @param body The Azure metrics document json payload
* @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<AzureMetricsResultInner> createAsync(String subscriptionId, String resourceGroupName, String resourceProvider, String resourceTypeName, String resourceName, AzureMetricsDocument body, final ServiceCallback<AzureMetricsResultInner> serviceCallback) {
return ServiceFuture.fromResponse(createWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceProvider, resourceTypeName, resourceName, body), serviceCallback);
}

/**
* **Post the metric values for a resource**.
*
* @param subscriptionId The azure subscription id
* @param resourceGroupName The ARM resource group name
* @param resourceProvider The ARM resource provider name
* @param resourceTypeName The ARM resource type name
* @param resourceName The ARM resource name
* @param body The Azure metrics document json payload
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the AzureMetricsResultInner object
*/
public Observable<AzureMetricsResultInner> createAsync(String subscriptionId, String resourceGroupName, String resourceProvider, String resourceTypeName, String resourceName, AzureMetricsDocument body) {
return createWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceProvider, resourceTypeName, resourceName, body).map(new Func1<ServiceResponse<AzureMetricsResultInner>, AzureMetricsResultInner>() {
@Override
public AzureMetricsResultInner call(ServiceResponse<AzureMetricsResultInner> response) {
return response.body();
}
});
}

/**
* **Post the metric values for a resource**.
*
* @param subscriptionId The azure subscription id
* @param resourceGroupName The ARM resource group name
* @param resourceProvider The ARM resource provider name
* @param resourceTypeName The ARM resource type name
* @param resourceName The ARM resource name
* @param body The Azure metrics document json payload
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the AzureMetricsResultInner object
*/
public Observable<ServiceResponse<AzureMetricsResultInner>> createWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String resourceProvider, String resourceTypeName, String resourceName, AzureMetricsDocument body) {
if (subscriptionId == null) {
throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (resourceProvider == null) {
throw new IllegalArgumentException("Parameter resourceProvider is required and cannot be null.");
}
if (resourceTypeName == null) {
throw new IllegalArgumentException("Parameter resourceTypeName is required and cannot be null.");
}
if (resourceName == null) {
throw new IllegalArgumentException("Parameter resourceName is required and cannot be null.");
}
if (body == null) {
throw new IllegalArgumentException("Parameter body is required and cannot be null.");
}
Validator.validate(body);
final String contentType = null;
final Integer contentLength = null;
return service.create(subscriptionId, resourceGroupName, resourceProvider, resourceTypeName, resourceName, contentType, contentLength, body, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<AzureMetricsResultInner>>>() {
@Override
public Observable<ServiceResponse<AzureMetricsResultInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<AzureMetricsResultInner> clientResponse = createDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}

/**
* **Post the metric values for a resource**.
*
* @param subscriptionId The azure subscription id
* @param resourceGroupName The ARM resource group name
* @param resourceProvider The ARM resource provider name
* @param resourceTypeName The ARM resource type name
* @param resourceName The ARM resource name
* @param body The Azure metrics document json payload
* @param contentType Supports application/json and application/x-ndjson
* @param contentLength Content length of the payload
* @param body The Azure metrics document json payload
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws AzureMetricsResultInnerException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the AzureMetricsResultInner object if successful.
*/
public AzureMetricsResultInner create(String subscriptionId, String resourceGroupName, String resourceProvider, String resourceTypeName, String resourceName, AzureMetricsDocument body, String contentType, Integer contentLength) {
return createWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceProvider, resourceTypeName, resourceName, body, contentType, contentLength).toBlocking().single().body();
public AzureMetricsResultInner create(String subscriptionId, String resourceGroupName, String resourceProvider, String resourceTypeName, String resourceName, String contentType, int contentLength, AzureMetricsDocument body) {
return createWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceProvider, resourceTypeName, resourceName, contentType, contentLength, body).toBlocking().single().body();
}

/**
Expand All @@ -191,15 +87,15 @@ public AzureMetricsResultInner create(String subscriptionId, String resourceGrou
* @param resourceProvider The ARM resource provider name
* @param resourceTypeName The ARM resource type name
* @param resourceName The ARM resource name
* @param body The Azure metrics document json payload
* @param contentType Supports application/json and application/x-ndjson
* @param contentLength Content length of the payload
* @param body The Azure metrics document json payload
* @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<AzureMetricsResultInner> createAsync(String subscriptionId, String resourceGroupName, String resourceProvider, String resourceTypeName, String resourceName, AzureMetricsDocument body, String contentType, Integer contentLength, final ServiceCallback<AzureMetricsResultInner> serviceCallback) {
return ServiceFuture.fromResponse(createWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceProvider, resourceTypeName, resourceName, body, contentType, contentLength), serviceCallback);
public ServiceFuture<AzureMetricsResultInner> createAsync(String subscriptionId, String resourceGroupName, String resourceProvider, String resourceTypeName, String resourceName, String contentType, int contentLength, AzureMetricsDocument body, final ServiceCallback<AzureMetricsResultInner> serviceCallback) {
return ServiceFuture.fromResponse(createWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceProvider, resourceTypeName, resourceName, contentType, contentLength, body), serviceCallback);
}

/**
Expand All @@ -210,14 +106,14 @@ public ServiceFuture<AzureMetricsResultInner> createAsync(String subscriptionId,
* @param resourceProvider The ARM resource provider name
* @param resourceTypeName The ARM resource type name
* @param resourceName The ARM resource name
* @param body The Azure metrics document json payload
* @param contentType Supports application/json and application/x-ndjson
* @param contentLength Content length of the payload
* @param body The Azure metrics document json payload
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the AzureMetricsResultInner object
*/
public Observable<AzureMetricsResultInner> createAsync(String subscriptionId, String resourceGroupName, String resourceProvider, String resourceTypeName, String resourceName, AzureMetricsDocument body, String contentType, Integer contentLength) {
return createWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceProvider, resourceTypeName, resourceName, body, contentType, contentLength).map(new Func1<ServiceResponse<AzureMetricsResultInner>, AzureMetricsResultInner>() {
public Observable<AzureMetricsResultInner> createAsync(String subscriptionId, String resourceGroupName, String resourceProvider, String resourceTypeName, String resourceName, String contentType, int contentLength, AzureMetricsDocument body) {
return createWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceProvider, resourceTypeName, resourceName, contentType, contentLength, body).map(new Func1<ServiceResponse<AzureMetricsResultInner>, AzureMetricsResultInner>() {
@Override
public AzureMetricsResultInner call(ServiceResponse<AzureMetricsResultInner> response) {
return response.body();
Expand All @@ -233,13 +129,13 @@ public AzureMetricsResultInner call(ServiceResponse<AzureMetricsResultInner> res
* @param resourceProvider The ARM resource provider name
* @param resourceTypeName The ARM resource type name
* @param resourceName The ARM resource name
* @param body The Azure metrics document json payload
* @param contentType Supports application/json and application/x-ndjson
* @param contentLength Content length of the payload
* @param body The Azure metrics document json payload
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the AzureMetricsResultInner object
*/
public Observable<ServiceResponse<AzureMetricsResultInner>> createWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String resourceProvider, String resourceTypeName, String resourceName, AzureMetricsDocument body, String contentType, Integer contentLength) {
public Observable<ServiceResponse<AzureMetricsResultInner>> createWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String resourceProvider, String resourceTypeName, String resourceName, String contentType, int contentLength, AzureMetricsDocument body) {
if (subscriptionId == null) {
throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.");
}
Expand All @@ -255,6 +151,9 @@ public Observable<ServiceResponse<AzureMetricsResultInner>> createWithServiceRes
if (resourceName == null) {
throw new IllegalArgumentException("Parameter resourceName is required and cannot be null.");
}
if (contentType == null) {
throw new IllegalArgumentException("Parameter contentType is required and cannot be null.");
}
if (body == null) {
throw new IllegalArgumentException("Parameter body is required and cannot be null.");
}
Expand Down