diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/Capability.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/Capability.java new file mode 100644 index 00000000000..1775169c1fb --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/Capability.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB capability object. + */ +public class Capability { + /** + * Name of the Cosmos DB capability. For example, "name": + * "EnableCassandra". Current values also include "EnableTable" and + * "EnableGremlin". + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the Capability object itself. + */ + public Capability withName(String name) { + this.name = name; + return this; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/ConsistencyPolicy.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/ConsistencyPolicy.java index c6486fb360f..a4989605e3e 100755 --- a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/ConsistencyPolicy.java +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/ConsistencyPolicy.java @@ -11,13 +11,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The consistency policy for the DocumentDB database account. + * The consistency policy for the Cosmos DB database account. */ public class ConsistencyPolicy { /** - * The default consistency level and configuration settings of the - * DocumentDB account. Possible values include: 'Eventual', 'Session', - * 'BoundedStaleness', 'Strong'. + * The default consistency level and configuration settings of the Cosmos + * DB account. Possible values include: 'Eventual', 'Session', + * 'BoundedStaleness', 'Strong', 'ConsistentPrefix'. */ @JsonProperty(value = "defaultConsistencyLevel", required = true) private DefaultConsistencyLevel defaultConsistencyLevel; @@ -34,8 +34,8 @@ public class ConsistencyPolicy { /** * When used with the Bounded Staleness consistency level, this value * represents the time amount of staleness (in seconds) tolerated. Accepted - * range for this value is 1 - 100. Required when defaultConsistencyPolicy - * is set to 'BoundedStaleness'. + * range for this value is 5 - 86400. Required when + * defaultConsistencyPolicy is set to 'BoundedStaleness'. */ @JsonProperty(value = "maxIntervalInSeconds") private Integer maxIntervalInSeconds; diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/DatabaseAccountConnectionString.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/DatabaseAccountConnectionString.java index 14767cde04c..803e9f48e82 100755 --- a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/DatabaseAccountConnectionString.java +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/DatabaseAccountConnectionString.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * Connection string for the DocumentDB account. + * Connection string for the Cosmos DB account. */ public class DatabaseAccountConnectionString { /** diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/DatabaseAccountKind.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/DatabaseAccountKind.java index e79520a1311..a1f0d2938ab 100755 --- a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/DatabaseAccountKind.java +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/DatabaseAccountKind.java @@ -8,55 +8,37 @@ package com.microsoft.azure.management.cosmosdb; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; /** * Defines values for DatabaseAccountKind. */ -public final class DatabaseAccountKind { +public final class DatabaseAccountKind extends ExpandableStringEnum { /** Static value GlobalDocumentDB for DatabaseAccountKind. */ - public static final DatabaseAccountKind GLOBAL_DOCUMENT_DB = new DatabaseAccountKind("GlobalDocumentDB"); + public static final DatabaseAccountKind GLOBAL_DOCUMENT_DB = fromString("GlobalDocumentDB"); /** Static value MongoDB for DatabaseAccountKind. */ - public static final DatabaseAccountKind MONGO_DB = new DatabaseAccountKind("MongoDB"); + public static final DatabaseAccountKind MONGO_DB = fromString("MongoDB"); /** Static value Parse for DatabaseAccountKind. */ - public static final DatabaseAccountKind PARSE = new DatabaseAccountKind("Parse"); - - private String value; + public static final DatabaseAccountKind PARSE = fromString("Parse"); /** - * Creates a custom value for DatabaseAccountKind. - * @param value the custom value + * Creates or finds a DatabaseAccountKind from its string representation. + * @param name a name to look for + * @return the corresponding DatabaseAccountKind */ - public DatabaseAccountKind(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return value; + @JsonCreator + public static DatabaseAccountKind fromString(String name) { + return fromString(name, DatabaseAccountKind.class); } - @Override - public int hashCode() { - return value.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof DatabaseAccountKind)) { - return false; - } - if (obj == this) { - return true; - } - DatabaseAccountKind rhs = (DatabaseAccountKind) obj; - if (value == null) { - return rhs.value == null; - } else { - return value.equals(rhs.value); - } + /** + * @return known DatabaseAccountKind values + */ + public static Collection values() { + return values(DatabaseAccountKind.class); } } diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/DatabaseAccountPatchParameters.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/DatabaseAccountPatchParameters.java index 8f50271d564..08ca07ab248 100755 --- a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/DatabaseAccountPatchParameters.java +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/DatabaseAccountPatchParameters.java @@ -9,18 +9,27 @@ package com.microsoft.azure.management.cosmosdb; import java.util.Map; +import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; /** - * Parameters for patching Azure DocumentDB database account properties. + * Parameters for patching Azure Cosmos DB database account properties. */ +@JsonFlatten public class DatabaseAccountPatchParameters { /** * The tags property. */ - @JsonProperty(value = "tags", required = true) + @JsonProperty(value = "tags") private Map tags; + /** + * List of Cosmos DB capabilities for the account. + */ + @JsonProperty(value = "properties.capabilities") + private List capabilities; + /** * Get the tags value. * @@ -41,4 +50,24 @@ public DatabaseAccountPatchParameters withTags(Map tags) { return this; } + /** + * Get the capabilities value. + * + * @return the capabilities value + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Set the capabilities value. + * + * @param capabilities the capabilities value to set + * @return the DatabaseAccountPatchParameters object itself. + */ + public DatabaseAccountPatchParameters withCapabilities(List capabilities) { + this.capabilities = capabilities; + return this; + } + } diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/DefaultConsistencyLevel.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/DefaultConsistencyLevel.java index 59b330fe3d9..7bd4dfa6c04 100755 --- a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/DefaultConsistencyLevel.java +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/DefaultConsistencyLevel.java @@ -25,7 +25,10 @@ public enum DefaultConsistencyLevel { BOUNDED_STALENESS("BoundedStaleness"), /** Enum value Strong. */ - STRONG("Strong"); + STRONG("Strong"), + + /** Enum value ConsistentPrefix. */ + CONSISTENT_PREFIX("ConsistentPrefix"); /** The actual serialized value for a DefaultConsistencyLevel instance. */ private String value; diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/ErrorResponse.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/ErrorResponse.java new file mode 100644 index 00000000000..b93c50717f8 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/ErrorResponse.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error Response. + */ +public class ErrorResponse { + /** + * Error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the code value. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/ErrorResponseException.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/ErrorResponseException.java new file mode 100644 index 00000000000..71b7269815f --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/FailoverPolicies.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/FailoverPolicies.java index 6d2a798606e..4ed8fc8b9f2 100755 --- a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/FailoverPolicies.java +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/FailoverPolicies.java @@ -9,7 +9,6 @@ package com.microsoft.azure.management.cosmosdb; import java.util.List; -import com.microsoft.azure.management.cosmosdb.implementation.FailoverPolicyInner; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -19,15 +18,15 @@ public class FailoverPolicies { /** * List of failover policies. */ - @JsonProperty(value = "failoverPolicies") - private List failoverPolicies; + @JsonProperty(value = "failoverPolicies", required = true) + private List failoverPolicies; /** * Get the failoverPolicies value. * * @return the failoverPolicies value */ - public List failoverPolicies() { + public List failoverPolicies() { return this.failoverPolicies; } @@ -37,7 +36,7 @@ public List failoverPolicies() { * @param failoverPolicies the failoverPolicies value to set * @return the FailoverPolicies object itself. */ - public FailoverPolicies withFailoverPolicies(List failoverPolicies) { + public FailoverPolicies withFailoverPolicies(List failoverPolicies) { this.failoverPolicies = failoverPolicies; return this; } diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/FailoverPolicy.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/FailoverPolicy.java new file mode 100644 index 00000000000..6cab973abb2 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/FailoverPolicy.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The failover policy for a given region of a database account. + */ +public class FailoverPolicy { + /** + * The unique identifier of the region in which the database account + * replicates to. Example: + * &lt;accountName&gt;-&lt;locationName&gt;. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The name of the region in which the database account exists. + */ + @JsonProperty(value = "locationName") + private String locationName; + + /** + * The failover priority of the region. A failover priority of 0 indicates + * a write region. The maximum value for a failover priority = (total + * number of regions - 1). Failover priority values must be unique for each + * of the regions in which the database account exists. + */ + @JsonProperty(value = "failoverPriority") + private Integer failoverPriority; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the locationName value. + * + * @return the locationName value + */ + public String locationName() { + return this.locationName; + } + + /** + * Set the locationName value. + * + * @param locationName the locationName value to set + * @return the FailoverPolicy object itself. + */ + public FailoverPolicy withLocationName(String locationName) { + this.locationName = locationName; + return this; + } + + /** + * Get the failoverPriority value. + * + * @return the failoverPriority value + */ + public Integer failoverPriority() { + return this.failoverPriority; + } + + /** + * Set the failoverPriority value. + * + * @param failoverPriority the failoverPriority value to set + * @return the FailoverPolicy object itself. + */ + public FailoverPolicy withFailoverPriority(Integer failoverPriority) { + this.failoverPriority = failoverPriority; + return this; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/KeyKind.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/KeyKind.java index d887bbbb4c8..885d3d553f1 100755 --- a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/KeyKind.java +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/KeyKind.java @@ -8,58 +8,40 @@ package com.microsoft.azure.management.cosmosdb; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; /** * Defines values for KeyKind. */ -public final class KeyKind { +public final class KeyKind extends ExpandableStringEnum { /** Static value primary for KeyKind. */ - public static final KeyKind PRIMARY = new KeyKind("primary"); + public static final KeyKind PRIMARY = fromString("primary"); /** Static value secondary for KeyKind. */ - public static final KeyKind SECONDARY = new KeyKind("secondary"); + public static final KeyKind SECONDARY = fromString("secondary"); /** Static value primaryReadonly for KeyKind. */ - public static final KeyKind PRIMARY_READONLY = new KeyKind("primaryReadonly"); + public static final KeyKind PRIMARY_READONLY = fromString("primaryReadonly"); /** Static value secondaryReadonly for KeyKind. */ - public static final KeyKind SECONDARY_READONLY = new KeyKind("secondaryReadonly"); - - private String value; + public static final KeyKind SECONDARY_READONLY = fromString("secondaryReadonly"); /** - * Creates a custom value for KeyKind. - * @param value the custom value + * Creates or finds a KeyKind from its string representation. + * @param name a name to look for + * @return the corresponding KeyKind */ - public KeyKind(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return value; + @JsonCreator + public static KeyKind fromString(String name) { + return fromString(name, KeyKind.class); } - @Override - public int hashCode() { - return value.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof KeyKind)) { - return false; - } - if (obj == this) { - return true; - } - KeyKind rhs = (KeyKind) obj; - if (value == null) { - return rhs.value == null; - } else { - return value.equals(rhs.value); - } + /** + * @return known KeyKind values + */ + public static Collection values() { + return values(KeyKind.class); } } diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/Location.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/Location.java index fa1d4e903dc..1c4a996c171 100755 --- a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/Location.java +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/Location.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * A region in which the Azure DocumentDB database account is deployed. + * A region in which the Azure Cosmos DB database account is deployed. */ public class Location { /** diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/MetricAvailability.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/MetricAvailability.java new file mode 100644 index 00000000000..fa1d2d3fc6a --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/MetricAvailability.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The availability of the metric. + */ +public class MetricAvailability { + /** + * The time grain to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /** + * The retention for the metric values. + */ + @JsonProperty(value = "retention", access = JsonProperty.Access.WRITE_ONLY) + private String retention; + + /** + * Get the timeGrain value. + * + * @return the timeGrain value + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the retention value. + * + * @return the retention value + */ + public String retention() { + return this.retention; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/MetricName.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/MetricName.java new file mode 100644 index 00000000000..4227fcedaf7 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/MetricName.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A metric name. + */ +public class MetricName { + /** + * The name of the metric. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /** + * The friendly name of the metric. + */ + @JsonProperty(value = "localizedValue", access = JsonProperty.Access.WRITE_ONLY) + private String localizedValue; + + /** + * Get the value value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Get the localizedValue value. + * + * @return the localizedValue value + */ + public String localizedValue() { + return this.localizedValue; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/MetricValue.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/MetricValue.java new file mode 100644 index 00000000000..c7dd375d417 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/MetricValue.java @@ -0,0 +1,108 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents metrics values. + */ +public class MetricValue { + /** + * The number of values for the metric. + */ + @JsonProperty(value = "_count", access = JsonProperty.Access.WRITE_ONLY) + private Double _count; + + /** + * The average value of the metric. + */ + @JsonProperty(value = "average", access = JsonProperty.Access.WRITE_ONLY) + private Double average; + + /** + * The max value of the metric. + */ + @JsonProperty(value = "maximum", access = JsonProperty.Access.WRITE_ONLY) + private Double maximum; + + /** + * The min value of the metric. + */ + @JsonProperty(value = "minimum", access = JsonProperty.Access.WRITE_ONLY) + private Double minimum; + + /** + * The metric timestamp (ISO-8601 format). + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime timestamp; + + /** + * The total value of the metric. + */ + @JsonProperty(value = "total", access = JsonProperty.Access.WRITE_ONLY) + private Double total; + + /** + * Get the _count value. + * + * @return the _count value + */ + public Double _count() { + return this._count; + } + + /** + * Get the average value. + * + * @return the average value + */ + public Double average() { + return this.average; + } + + /** + * Get the maximum value. + * + * @return the maximum value + */ + public Double maximum() { + return this.maximum; + } + + /** + * Get the minimum value. + * + * @return the minimum value + */ + public Double minimum() { + return this.minimum; + } + + /** + * Get the timestamp value. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Get the total value. + * + * @return the total value + */ + public Double total() { + return this.total; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/OperationDisplay.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/OperationDisplay.java new file mode 100644 index 00000000000..4378c594a9c --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/OperationDisplay.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.ResourceProvider. + */ + @JsonProperty(value = "Provider") + private String provider; + + /** + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + @JsonProperty(value = "Resource") + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "Operation") + private String operation; + + /** + * Description of operation. + */ + @JsonProperty(value = "Description") + private String description; + + /** + * Get the provider value. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider value. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource value. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation value. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation value. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description value. + * + * @param description the description value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/PercentileMetricValue.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/PercentileMetricValue.java new file mode 100644 index 00000000000..e6c53f0f08e --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/PercentileMetricValue.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents percentile metrics values. + */ +public class PercentileMetricValue extends MetricValue { + /** + * The 10th percentile value for the metric. + */ + @JsonProperty(value = "P10", access = JsonProperty.Access.WRITE_ONLY) + private Double p10; + + /** + * The 25th percentile value for the metric. + */ + @JsonProperty(value = "P25", access = JsonProperty.Access.WRITE_ONLY) + private Double p25; + + /** + * The 50th percentile value for the metric. + */ + @JsonProperty(value = "P50", access = JsonProperty.Access.WRITE_ONLY) + private Double p50; + + /** + * The 75th percentile value for the metric. + */ + @JsonProperty(value = "P75", access = JsonProperty.Access.WRITE_ONLY) + private Double p75; + + /** + * The 90th percentile value for the metric. + */ + @JsonProperty(value = "P90", access = JsonProperty.Access.WRITE_ONLY) + private Double p90; + + /** + * The 95th percentile value for the metric. + */ + @JsonProperty(value = "P95", access = JsonProperty.Access.WRITE_ONLY) + private Double p95; + + /** + * The 99th percentile value for the metric. + */ + @JsonProperty(value = "P99", access = JsonProperty.Access.WRITE_ONLY) + private Double p99; + + /** + * Get the p10 value. + * + * @return the p10 value + */ + public Double p10() { + return this.p10; + } + + /** + * Get the p25 value. + * + * @return the p25 value + */ + public Double p25() { + return this.p25; + } + + /** + * Get the p50 value. + * + * @return the p50 value + */ + public Double p50() { + return this.p50; + } + + /** + * Get the p75 value. + * + * @return the p75 value + */ + public Double p75() { + return this.p75; + } + + /** + * Get the p90 value. + * + * @return the p90 value + */ + public Double p90() { + return this.p90; + } + + /** + * Get the p95 value. + * + * @return the p95 value + */ + public Double p95() { + return this.p95; + } + + /** + * Get the p99 value. + * + * @return the p99 value + */ + public Double p99() { + return this.p99; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/PrimaryAggregationType.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/PrimaryAggregationType.java new file mode 100644 index 00000000000..f9a45cf47d5 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/PrimaryAggregationType.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PrimaryAggregationType. + */ +public final class PrimaryAggregationType extends ExpandableStringEnum { + /** Static value None for PrimaryAggregationType. */ + public static final PrimaryAggregationType NONE = fromString("None"); + + /** Static value Average for PrimaryAggregationType. */ + public static final PrimaryAggregationType AVERAGE = fromString("Average"); + + /** Static value Total for PrimaryAggregationType. */ + public static final PrimaryAggregationType TOTAL = fromString("Total"); + + /** Static value Minimimum for PrimaryAggregationType. */ + public static final PrimaryAggregationType MINIMIMUM = fromString("Minimimum"); + + /** Static value Maximum for PrimaryAggregationType. */ + public static final PrimaryAggregationType MAXIMUM = fromString("Maximum"); + + /** Static value Last for PrimaryAggregationType. */ + public static final PrimaryAggregationType LAST = fromString("Last"); + + /** + * Creates or finds a PrimaryAggregationType from its string representation. + * @param name a name to look for + * @return the corresponding PrimaryAggregationType + */ + @JsonCreator + public static PrimaryAggregationType fromString(String name) { + return fromString(name, PrimaryAggregationType.class); + } + + /** + * @return known PrimaryAggregationType values + */ + public static Collection values() { + return values(PrimaryAggregationType.class); + } +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/RegionForOnlineOffline.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/RegionForOnlineOffline.java new file mode 100644 index 00000000000..9e0e2c8a64f --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/RegionForOnlineOffline.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB region to online or offline. + */ +public class RegionForOnlineOffline { + /** + * Cosmos DB region, with spaces between words and each word capitalized. + */ + @JsonProperty(value = "region", required = true) + private String region; + + /** + * Get the region value. + * + * @return the region value + */ + public String region() { + return this.region; + } + + /** + * Set the region value. + * + * @param region the region value to set + * @return the RegionForOnlineOffline object itself. + */ + public RegionForOnlineOffline withRegion(String region) { + this.region = region; + return this; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/UnitType.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/UnitType.java new file mode 100644 index 00000000000..d6d041a59e7 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/UnitType.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for UnitType. + */ +public final class UnitType extends ExpandableStringEnum { + /** Static value Count for UnitType. */ + public static final UnitType COUNT = fromString("Count"); + + /** Static value Bytes for UnitType. */ + public static final UnitType BYTES = fromString("Bytes"); + + /** Static value Seconds for UnitType. */ + public static final UnitType SECONDS = fromString("Seconds"); + + /** Static value Percent for UnitType. */ + public static final UnitType PERCENT = fromString("Percent"); + + /** Static value CountPerSecond for UnitType. */ + public static final UnitType COUNT_PER_SECOND = fromString("CountPerSecond"); + + /** Static value BytesPerSecond for UnitType. */ + public static final UnitType BYTES_PER_SECOND = fromString("BytesPerSecond"); + + /** Static value Milliseconds for UnitType. */ + public static final UnitType MILLISECONDS = fromString("Milliseconds"); + + /** + * Creates or finds a UnitType from its string representation. + * @param name a name to look for + * @return the corresponding UnitType + */ + @JsonCreator + public static UnitType fromString(String name) { + return fromString(name, UnitType.class); + } + + /** + * @return known UnitType values + */ + public static Collection values() { + return values(UnitType.class); + } +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/VirtualNetworkRule.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/VirtualNetworkRule.java new file mode 100644 index 00000000000..32b3192bf00 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/VirtualNetworkRule.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Virtual Network ACL Rule object. + */ +public class VirtualNetworkRule { + /** + * Resource ID of a subnet, for example: + * /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withId(String id) { + this.id = id; + return this; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/CollectionPartitionRegionsInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/CollectionPartitionRegionsInner.java new file mode 100644 index 00000000000..16bf4f0dd3a --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/CollectionPartitionRegionsInner.java @@ -0,0 +1,180 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in CollectionPartitionRegions. + */ +public class CollectionPartitionRegionsInner { + /** The Retrofit service to perform REST calls. */ + private CollectionPartitionRegionsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of CollectionPartitionRegionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CollectionPartitionRegionsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(CollectionPartitionRegionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for CollectionPartitionRegions to be + * used by Retrofit to perform actually REST calls. + */ + interface CollectionPartitionRegionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.CollectionPartitionRegions listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("region") String region, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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 List<PartitionMetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionMetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionMetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, region, databaseRid, collectionRid, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/CollectionPartitionsInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/CollectionPartitionsInner.java new file mode 100644 index 00000000000..725e3567029 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/CollectionPartitionsInner.java @@ -0,0 +1,385 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in CollectionPartitions. + */ +public class CollectionPartitionsInner { + /** The Retrofit service to perform REST calls. */ + private CollectionPartitionsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of CollectionPartitionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CollectionPartitionsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(CollectionPartitionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for CollectionPartitions to be + * used by Retrofit to perform actually REST calls. + */ + interface CollectionPartitionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.CollectionPartitions listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.CollectionPartitions listUsages" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages") + Observable> listUsages(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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 List<PartitionMetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionMetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionMetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @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 List<PartitionUsageInner> object if successful. + */ + public List listUsages(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid).toBlocking().single().body(); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @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> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid), serviceCallback); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionUsageInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionUsageInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listUsagesDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @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 List<PartitionUsageInner> object if successful. + */ + public List listUsages(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).toBlocking().single().body(); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @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> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter), serviceCallback); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionUsageInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionUsageInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid 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.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listUsagesDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listUsagesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/CollectionRegionsInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/CollectionRegionsInner.java new file mode 100644 index 00000000000..b11dfeb4500 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/CollectionRegionsInner.java @@ -0,0 +1,180 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in CollectionRegions. + */ +public class CollectionRegionsInner { + /** The Retrofit service to perform REST calls. */ + private CollectionRegionsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of CollectionRegionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CollectionRegionsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(CollectionRegionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for CollectionRegions to be + * used by Retrofit to perform actually REST calls. + */ + interface CollectionRegionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.CollectionRegions listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("region") String region, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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 List<MetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, region, databaseRid, collectionRid, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/CollectionsInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/CollectionsInner.java new file mode 100644 index 00000000000..18c119faa90 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/CollectionsInner.java @@ -0,0 +1,494 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Collections. + */ +public class CollectionsInner { + /** The Retrofit service to perform REST calls. */ + private CollectionsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of CollectionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CollectionsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(CollectionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Collections to be + * used by Retrofit to perform actually REST calls. + */ + interface CollectionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.Collections listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.Collections listUsages" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages") + Observable> listUsages(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.Collections listMetricDefinitions" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions") + Observable> listMetricDefinitions(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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 List<MetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @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 List<UsageInner> object if successful. + */ + public List listUsages(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid).toBlocking().single().body(); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @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> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid), serviceCallback); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listUsagesDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @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 List<UsageInner> object if successful. + */ + public List listUsages(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).toBlocking().single().body(); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @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> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter), serviceCallback); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid 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.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listUsagesDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listUsagesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves metric defintions for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @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 List<MetricDefinitionInner> object if successful. + */ + public List listMetricDefinitions(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid).toBlocking().single().body(); + } + + /** + * Retrieves metric defintions for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @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> listMetricDefinitionsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid), serviceCallback); + } + + /** + * Retrieves metric defintions for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable> listMetricDefinitionsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves metric defintions for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable>> listMetricDefinitionsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid 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.listMetricDefinitions(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricDefinitionsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricDefinitionsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/CosmosDBImpl.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/CosmosDBImpl.java new file mode 100644 index 00000000000..429f5daf1a3 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/CosmosDBImpl.java @@ -0,0 +1,364 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the CosmosDBImpl class. + */ +public class CosmosDBImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Azure subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public CosmosDBImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Version of the API to be used with the client request. The current version is 2015-04-08. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2015-04-08. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public CosmosDBImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public CosmosDBImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public CosmosDBImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The DatabaseAccountsInner object to access its operations. + */ + private DatabaseAccountsInner databaseAccounts; + + /** + * Gets the DatabaseAccountsInner object to access its operations. + * @return the DatabaseAccountsInner object. + */ + public DatabaseAccountsInner databaseAccounts() { + return this.databaseAccounts; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The DatabasesInner object to access its operations. + */ + private DatabasesInner databases; + + /** + * Gets the DatabasesInner object to access its operations. + * @return the DatabasesInner object. + */ + public DatabasesInner databases() { + return this.databases; + } + + /** + * The CollectionsInner object to access its operations. + */ + private CollectionsInner collections; + + /** + * Gets the CollectionsInner object to access its operations. + * @return the CollectionsInner object. + */ + public CollectionsInner collections() { + return this.collections; + } + + /** + * The CollectionRegionsInner object to access its operations. + */ + private CollectionRegionsInner collectionRegions; + + /** + * Gets the CollectionRegionsInner object to access its operations. + * @return the CollectionRegionsInner object. + */ + public CollectionRegionsInner collectionRegions() { + return this.collectionRegions; + } + + /** + * The DatabaseAccountRegionsInner object to access its operations. + */ + private DatabaseAccountRegionsInner databaseAccountRegions; + + /** + * Gets the DatabaseAccountRegionsInner object to access its operations. + * @return the DatabaseAccountRegionsInner object. + */ + public DatabaseAccountRegionsInner databaseAccountRegions() { + return this.databaseAccountRegions; + } + + /** + * The PercentileSourceTargetsInner object to access its operations. + */ + private PercentileSourceTargetsInner percentileSourceTargets; + + /** + * Gets the PercentileSourceTargetsInner object to access its operations. + * @return the PercentileSourceTargetsInner object. + */ + public PercentileSourceTargetsInner percentileSourceTargets() { + return this.percentileSourceTargets; + } + + /** + * The PercentileTargetsInner object to access its operations. + */ + private PercentileTargetsInner percentileTargets; + + /** + * Gets the PercentileTargetsInner object to access its operations. + * @return the PercentileTargetsInner object. + */ + public PercentileTargetsInner percentileTargets() { + return this.percentileTargets; + } + + /** + * The PercentilesInner object to access its operations. + */ + private PercentilesInner percentiles; + + /** + * Gets the PercentilesInner object to access its operations. + * @return the PercentilesInner object. + */ + public PercentilesInner percentiles() { + return this.percentiles; + } + + /** + * The CollectionPartitionRegionsInner object to access its operations. + */ + private CollectionPartitionRegionsInner collectionPartitionRegions; + + /** + * Gets the CollectionPartitionRegionsInner object to access its operations. + * @return the CollectionPartitionRegionsInner object. + */ + public CollectionPartitionRegionsInner collectionPartitionRegions() { + return this.collectionPartitionRegions; + } + + /** + * The CollectionPartitionsInner object to access its operations. + */ + private CollectionPartitionsInner collectionPartitions; + + /** + * Gets the CollectionPartitionsInner object to access its operations. + * @return the CollectionPartitionsInner object. + */ + public CollectionPartitionsInner collectionPartitions() { + return this.collectionPartitions; + } + + /** + * The PartitionKeyRangeIdsInner object to access its operations. + */ + private PartitionKeyRangeIdsInner partitionKeyRangeIds; + + /** + * Gets the PartitionKeyRangeIdsInner object to access its operations. + * @return the PartitionKeyRangeIdsInner object. + */ + public PartitionKeyRangeIdsInner partitionKeyRangeIds() { + return this.partitionKeyRangeIds; + } + + /** + * The PartitionKeyRangeIdRegionsInner object to access its operations. + */ + private PartitionKeyRangeIdRegionsInner partitionKeyRangeIdRegions; + + /** + * Gets the PartitionKeyRangeIdRegionsInner object to access its operations. + * @return the PartitionKeyRangeIdRegionsInner object. + */ + public PartitionKeyRangeIdRegionsInner partitionKeyRangeIdRegions() { + return this.partitionKeyRangeIdRegions; + } + + /** + * Initializes an instance of CosmosDB client. + * + * @param credentials the management credentials for Azure + */ + public CosmosDBImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of CosmosDB client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public CosmosDBImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of CosmosDB client. + * + * @param restClient the REST client to connect to Azure. + */ + public CosmosDBImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2015-04-08"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.databaseAccounts = new DatabaseAccountsInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.databases = new DatabasesInner(restClient().retrofit(), this); + this.collections = new CollectionsInner(restClient().retrofit(), this); + this.collectionRegions = new CollectionRegionsInner(restClient().retrofit(), this); + this.databaseAccountRegions = new DatabaseAccountRegionsInner(restClient().retrofit(), this); + this.percentileSourceTargets = new PercentileSourceTargetsInner(restClient().retrofit(), this); + this.percentileTargets = new PercentileTargetsInner(restClient().retrofit(), this); + this.percentiles = new PercentilesInner(restClient().retrofit(), this); + this.collectionPartitionRegions = new CollectionPartitionRegionsInner(restClient().retrofit(), this); + this.collectionPartitions = new CollectionPartitionsInner(restClient().retrofit(), this); + this.partitionKeyRangeIds = new PartitionKeyRangeIdsInner(restClient().retrofit(), this); + this.partitionKeyRangeIdRegions = new PartitionKeyRangeIdRegionsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "CosmosDB", "2015-04-08"); + } +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountCreateUpdateParametersInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountCreateUpdateParametersInner.java index bc7a019fc6f..6001a488f3d 100755 --- a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountCreateUpdateParametersInner.java +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountCreateUpdateParametersInner.java @@ -12,12 +12,14 @@ import com.microsoft.azure.management.cosmosdb.ConsistencyPolicy; import java.util.List; import com.microsoft.azure.management.cosmosdb.Location; +import com.microsoft.azure.management.cosmosdb.Capability; +import com.microsoft.azure.management.cosmosdb.VirtualNetworkRule; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.Resource; /** - * Parameters to create and update DocumentDB database accounts. + * Parameters to create and update Cosmos DB database accounts. */ @JsonFlatten public class DatabaseAccountCreateUpdateParametersInner extends Resource { @@ -30,14 +32,14 @@ public class DatabaseAccountCreateUpdateParametersInner extends Resource { private DatabaseAccountKind kind; /** - * The consistency policy for the DocumentDB account. + * The consistency policy for the Cosmos DB account. */ @JsonProperty(value = "properties.consistencyPolicy") private ConsistencyPolicy consistencyPolicy; /** * An array that contains the georeplication locations enabled for the - * DocumentDB account. + * Cosmos DB account. */ @JsonProperty(value = "properties.locations", required = true) private List locations; @@ -49,15 +51,41 @@ public class DatabaseAccountCreateUpdateParametersInner extends Resource { private String databaseAccountOfferType; /** - * DocumentDB Firewall Support: This value specifies the set of IP - * addresses or IP address ranges in CIDR form to be included as the - * allowed list of client IPs for a given database account. IP - * addresses/ranges must be comma separated and must not contain any - * spaces. + * Cosmos DB Firewall Support: This value specifies the set of IP addresses + * or IP address ranges in CIDR form to be included as the allowed list of + * client IPs for a given database account. IP addresses/ranges must be + * comma separated and must not contain any spaces. */ @JsonProperty(value = "properties.ipRangeFilter") private String ipRangeFilter; + /** + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + @JsonProperty(value = "properties.isVirtualNetworkFilterEnabled") + private Boolean isVirtualNetworkFilterEnabled; + + /** + * Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will + * result in a new write region for the account and is chosen based on the + * failover priorities configured for the account. + */ + @JsonProperty(value = "properties.enableAutomaticFailover") + private Boolean enableAutomaticFailover; + + /** + * List of Cosmos DB capabilities for the account. + */ + @JsonProperty(value = "properties.capabilities") + private List capabilities; + + /** + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + @JsonProperty(value = "properties.virtualNetworkRules") + private List virtualNetworkRules; + /** * Creates an instance of DatabaseAccountCreateUpdateParametersInner class. */ @@ -165,4 +193,84 @@ public DatabaseAccountCreateUpdateParametersInner withIpRangeFilter(String ipRan return this; } + /** + * Get the isVirtualNetworkFilterEnabled value. + * + * @return the isVirtualNetworkFilterEnabled value + */ + public Boolean isVirtualNetworkFilterEnabled() { + return this.isVirtualNetworkFilterEnabled; + } + + /** + * Set the isVirtualNetworkFilterEnabled value. + * + * @param isVirtualNetworkFilterEnabled the isVirtualNetworkFilterEnabled value to set + * @return the DatabaseAccountCreateUpdateParametersInner object itself. + */ + public DatabaseAccountCreateUpdateParametersInner withIsVirtualNetworkFilterEnabled(Boolean isVirtualNetworkFilterEnabled) { + this.isVirtualNetworkFilterEnabled = isVirtualNetworkFilterEnabled; + return this; + } + + /** + * Get the enableAutomaticFailover value. + * + * @return the enableAutomaticFailover value + */ + public Boolean enableAutomaticFailover() { + return this.enableAutomaticFailover; + } + + /** + * Set the enableAutomaticFailover value. + * + * @param enableAutomaticFailover the enableAutomaticFailover value to set + * @return the DatabaseAccountCreateUpdateParametersInner object itself. + */ + public DatabaseAccountCreateUpdateParametersInner withEnableAutomaticFailover(Boolean enableAutomaticFailover) { + this.enableAutomaticFailover = enableAutomaticFailover; + return this; + } + + /** + * Get the capabilities value. + * + * @return the capabilities value + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Set the capabilities value. + * + * @param capabilities the capabilities value to set + * @return the DatabaseAccountCreateUpdateParametersInner object itself. + */ + public DatabaseAccountCreateUpdateParametersInner withCapabilities(List capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + * Get the virtualNetworkRules value. + * + * @return the virtualNetworkRules value + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set the virtualNetworkRules value. + * + * @param virtualNetworkRules the virtualNetworkRules value to set + * @return the DatabaseAccountCreateUpdateParametersInner object itself. + */ + public DatabaseAccountCreateUpdateParametersInner withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + } diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountInner.java index 30b23d751d5..73f3d8c0ba5 100755 --- a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountInner.java +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountInner.java @@ -12,13 +12,16 @@ import com.microsoft.azure.management.cosmosdb.DatabaseAccountOfferType; import com.microsoft.azure.management.cosmosdb.ConsistencyPolicy; import java.util.List; +import com.microsoft.azure.management.cosmosdb.Capability; import com.microsoft.azure.management.cosmosdb.Location; +import com.microsoft.azure.management.cosmosdb.FailoverPolicy; +import com.microsoft.azure.management.cosmosdb.VirtualNetworkRule; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.Resource; /** - * A DocumentDB database account. + * An Azure Cosmos DB database account. */ @JsonFlatten public class DatabaseAccountInner extends Resource { @@ -37,42 +40,62 @@ public class DatabaseAccountInner extends Resource { private String provisioningState; /** - * The connection endpoint for the DocumentDB database account. + * The connection endpoint for the Cosmos DB database account. */ @JsonProperty(value = "properties.documentEndpoint", access = JsonProperty.Access.WRITE_ONLY) private String documentEndpoint; /** - * The offer type for the DocumentDB database account. Default value: + * The offer type for the Cosmos DB database account. Default value: * Standard. Possible values include: 'Standard'. */ @JsonProperty(value = "properties.databaseAccountOfferType", access = JsonProperty.Access.WRITE_ONLY) private DatabaseAccountOfferType databaseAccountOfferType; /** - * DocumentDB Firewall Support: This value specifies the set of IP - * addresses or IP address ranges in CIDR form to be included as the - * allowed list of client IPs for a given database account. IP - * addresses/ranges must be comma separated and must not contain any - * spaces. + * Cosmos DB Firewall Support: This value specifies the set of IP addresses + * or IP address ranges in CIDR form to be included as the allowed list of + * client IPs for a given database account. IP addresses/ranges must be + * comma separated and must not contain any spaces. */ @JsonProperty(value = "properties.ipRangeFilter") private String ipRangeFilter; /** - * The consistency policy for the DocumentDB database account. + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + @JsonProperty(value = "properties.isVirtualNetworkFilterEnabled") + private Boolean isVirtualNetworkFilterEnabled; + + /** + * Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will + * result in a new write region for the account and is chosen based on the + * failover priorities configured for the account. + */ + @JsonProperty(value = "properties.enableAutomaticFailover") + private Boolean enableAutomaticFailover; + + /** + * The consistency policy for the Cosmos DB database account. */ @JsonProperty(value = "properties.consistencyPolicy") private ConsistencyPolicy consistencyPolicy; /** - * An array that contains the write location for the DocumentDB account. + * List of Cosmos DB capabilities for the account. + */ + @JsonProperty(value = "properties.capabilities") + private List capabilities; + + /** + * An array that contains the write location for the Cosmos DB account. */ @JsonProperty(value = "properties.writeLocations", access = JsonProperty.Access.WRITE_ONLY) private List writeLocations; /** - * An array that contains of the read locations enabled for the DocumentDB + * An array that contains of the read locations enabled for the Cosmos DB * account. */ @JsonProperty(value = "properties.readLocations", access = JsonProperty.Access.WRITE_ONLY) @@ -82,7 +105,13 @@ public class DatabaseAccountInner extends Resource { * An array that contains the regions ordered by their failover priorities. */ @JsonProperty(value = "properties.failoverPolicies", access = JsonProperty.Access.WRITE_ONLY) - private List failoverPolicies; + private List failoverPolicies; + + /** + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + @JsonProperty(value = "properties.virtualNetworkRules") + private List virtualNetworkRules; /** * Get the kind value. @@ -162,6 +191,46 @@ public DatabaseAccountInner withIpRangeFilter(String ipRangeFilter) { return this; } + /** + * Get the isVirtualNetworkFilterEnabled value. + * + * @return the isVirtualNetworkFilterEnabled value + */ + public Boolean isVirtualNetworkFilterEnabled() { + return this.isVirtualNetworkFilterEnabled; + } + + /** + * Set the isVirtualNetworkFilterEnabled value. + * + * @param isVirtualNetworkFilterEnabled the isVirtualNetworkFilterEnabled value to set + * @return the DatabaseAccountInner object itself. + */ + public DatabaseAccountInner withIsVirtualNetworkFilterEnabled(Boolean isVirtualNetworkFilterEnabled) { + this.isVirtualNetworkFilterEnabled = isVirtualNetworkFilterEnabled; + return this; + } + + /** + * Get the enableAutomaticFailover value. + * + * @return the enableAutomaticFailover value + */ + public Boolean enableAutomaticFailover() { + return this.enableAutomaticFailover; + } + + /** + * Set the enableAutomaticFailover value. + * + * @param enableAutomaticFailover the enableAutomaticFailover value to set + * @return the DatabaseAccountInner object itself. + */ + public DatabaseAccountInner withEnableAutomaticFailover(Boolean enableAutomaticFailover) { + this.enableAutomaticFailover = enableAutomaticFailover; + return this; + } + /** * Get the consistencyPolicy value. * @@ -182,6 +251,26 @@ public DatabaseAccountInner withConsistencyPolicy(ConsistencyPolicy consistencyP return this; } + /** + * Get the capabilities value. + * + * @return the capabilities value + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Set the capabilities value. + * + * @param capabilities the capabilities value to set + * @return the DatabaseAccountInner object itself. + */ + public DatabaseAccountInner withCapabilities(List capabilities) { + this.capabilities = capabilities; + return this; + } + /** * Get the writeLocations value. * @@ -205,8 +294,28 @@ public List readLocations() { * * @return the failoverPolicies value */ - public List failoverPolicies() { + public List failoverPolicies() { return this.failoverPolicies; } + /** + * Get the virtualNetworkRules value. + * + * @return the virtualNetworkRules value + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set the virtualNetworkRules value. + * + * @param virtualNetworkRules the virtualNetworkRules value to set + * @return the DatabaseAccountInner object itself. + */ + public DatabaseAccountInner withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + } diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountListConnectionStringsResultInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountListConnectionStringsResultInner.java new file mode 100644 index 00000000000..079880992cc --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountListConnectionStringsResultInner.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import java.util.List; +import com.microsoft.azure.management.cosmosdb.DatabaseAccountConnectionString; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The connection strings for the given database account. + */ +public class DatabaseAccountListConnectionStringsResultInner { + /** + * An array that contains the connection strings for the Cosmos DB account. + */ + @JsonProperty(value = "connectionStrings") + private List connectionStrings; + + /** + * Get the connectionStrings value. + * + * @return the connectionStrings value + */ + public List connectionStrings() { + return this.connectionStrings; + } + + /** + * Set the connectionStrings value. + * + * @param connectionStrings the connectionStrings value to set + * @return the DatabaseAccountListConnectionStringsResultInner object itself. + */ + public DatabaseAccountListConnectionStringsResultInner withConnectionStrings(List connectionStrings) { + this.connectionStrings = connectionStrings; + return this; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountListKeysResultInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountListKeysResultInner.java new file mode 100644 index 00000000000..54aead76754 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountListKeysResultInner.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The access keys for the given database account. + */ +@JsonFlatten +public class DatabaseAccountListKeysResultInner { + /** + * Base 64 encoded value of the primary read-write key. + */ + @JsonProperty(value = "primaryMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String primaryMasterKey; + + /** + * Base 64 encoded value of the secondary read-write key. + */ + @JsonProperty(value = "secondaryMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryMasterKey; + + /** + * Base 64 encoded value of the primary read-only key. + */ + @JsonProperty(value = "properties.primaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String primaryReadonlyMasterKey; + + /** + * Base 64 encoded value of the secondary read-only key. + */ + @JsonProperty(value = "properties.secondaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryReadonlyMasterKey; + + /** + * Get the primaryMasterKey value. + * + * @return the primaryMasterKey value + */ + public String primaryMasterKey() { + return this.primaryMasterKey; + } + + /** + * Get the secondaryMasterKey value. + * + * @return the secondaryMasterKey value + */ + public String secondaryMasterKey() { + return this.secondaryMasterKey; + } + + /** + * Get the primaryReadonlyMasterKey value. + * + * @return the primaryReadonlyMasterKey value + */ + public String primaryReadonlyMasterKey() { + return this.primaryReadonlyMasterKey; + } + + /** + * Get the secondaryReadonlyMasterKey value. + * + * @return the secondaryReadonlyMasterKey value + */ + public String secondaryReadonlyMasterKey() { + return this.secondaryReadonlyMasterKey; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountPatchParametersInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountPatchParametersInner.java new file mode 100644 index 00000000000..34f3262bb1d --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountPatchParametersInner.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import java.util.Map; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.Capability; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters for patching Azure Cosmos DB database account properties. + */ +@JsonFlatten +public class DatabaseAccountPatchParametersInner { + /** + * The tags property. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * List of Cosmos DB capabilities for the account. + */ + @JsonProperty(value = "properties.capabilities") + private List capabilities; + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the DatabaseAccountPatchParametersInner object itself. + */ + public DatabaseAccountPatchParametersInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the capabilities value. + * + * @return the capabilities value + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Set the capabilities value. + * + * @param capabilities the capabilities value to set + * @return the DatabaseAccountPatchParametersInner object itself. + */ + public DatabaseAccountPatchParametersInner withCapabilities(List capabilities) { + this.capabilities = capabilities; + return this; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountRegionsInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountRegionsInner.java new file mode 100644 index 00000000000..7112b843442 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountRegionsInner.java @@ -0,0 +1,166 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseAccountRegions. + */ +public class DatabaseAccountRegionsInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseAccountRegionsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of DatabaseAccountRegionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseAccountRegionsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(DatabaseAccountRegionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseAccountRegions to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseAccountRegionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.DatabaseAccountRegions listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("region") String region, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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 List<MetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String region, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String region, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String region, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String region, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, region, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountsInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountsInner.java index 3eaa3219398..7515878c04c 100755 --- a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountsInner.java +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabaseAccountsInner.java @@ -16,8 +16,11 @@ import com.microsoft.azure.CloudException; import com.microsoft.azure.management.cosmosdb.DatabaseAccountPatchParameters; import com.microsoft.azure.management.cosmosdb.DatabaseAccountRegenerateKeyParameters; +import com.microsoft.azure.management.cosmosdb.ErrorResponseException; import com.microsoft.azure.management.cosmosdb.FailoverPolicies; +import com.microsoft.azure.management.cosmosdb.FailoverPolicy; import com.microsoft.azure.management.cosmosdb.KeyKind; +import com.microsoft.azure.management.cosmosdb.RegionForOnlineOffline; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -26,7 +29,6 @@ import com.microsoft.rest.Validator; import java.io.IOException; import java.util.List; -import java.util.Map; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; @@ -51,7 +53,7 @@ public class DatabaseAccountsInner implements InnerSupportsGet> patch(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body DatabaseAccountPatchParameters updateParameters, @Header("User-Agent") String userAgent); + Observable> patch(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Body DatabaseAccountPatchParameters updateParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.DatabaseAccounts beginPatch" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}") - Observable> beginPatch(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body DatabaseAccountPatchParameters updateParameters, @Header("User-Agent") String userAgent); + Observable> beginPatch(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Body DatabaseAccountPatchParameters updateParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.DatabaseAccounts createOrUpdate" }) @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}") @@ -121,6 +123,22 @@ interface DatabaseAccountsService { @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings") Observable> listConnectionStrings(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.DatabaseAccounts offlineRegion" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion") + Observable> offlineRegion(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegionForOnlineOffline regionParameterForOffline, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.DatabaseAccounts beginOfflineRegion" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion") + Observable> beginOfflineRegion(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegionForOnlineOffline regionParameterForOffline, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.DatabaseAccounts onlineRegion" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion") + Observable> onlineRegion(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegionForOnlineOffline regionParameterForOnline, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.DatabaseAccounts beginOnlineRegion" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion") + Observable> beginOnlineRegion(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegionForOnlineOffline regionParameterForOnline, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.DatabaseAccounts listReadOnlyKeys" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys") Observable> listReadOnlyKeys(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -137,13 +155,25 @@ interface DatabaseAccountsService { @HEAD("providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}") Observable> checkNameExists(@Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.DatabaseAccounts listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.DatabaseAccounts listUsages" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/usages") + Observable> listUsages(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.DatabaseAccounts listMetricDefinitions" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metricDefinitions") + Observable> listMetricDefinitions(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** - * Retrieves the properties of an existing Azure DocumentDB database account. + * Retrieves the properties of an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @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 @@ -154,10 +184,10 @@ public DatabaseAccountInner getByResourceGroup(String resourceGroupName, String } /** - * Retrieves the properties of an existing Azure DocumentDB database account. + * Retrieves the properties of an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -167,10 +197,10 @@ public ServiceFuture getByResourceGroupAsync(String resour } /** - * Retrieves the properties of an existing Azure DocumentDB database account. + * Retrieves the properties of an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the DatabaseAccountInner object */ @@ -184,10 +214,10 @@ public DatabaseAccountInner call(ServiceResponse response) } /** - * Retrieves the properties of an existing Azure DocumentDB database account. + * Retrieves the properties of an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the DatabaseAccountInner object */ @@ -205,17 +235,17 @@ public Observable> getByResourceGroupWithS throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = getByResourceGroupDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); } - }); + } + }); } private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { @@ -226,45 +256,45 @@ private ServiceResponse getByResourceGroupDelegate(Respons } /** - * Patches the properties of an existing Azure DocumentDB database account. + * Patches the properties of an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @param tags the Map<String, String> value + * @param accountName Cosmos DB database account name. + * @param updateParameters The tags parameter to patch for the current database account. * @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 DatabaseAccountInner object if successful. */ - public DatabaseAccountInner patch(String resourceGroupName, String accountName, Map tags) { - return patchWithServiceResponseAsync(resourceGroupName, accountName, tags).toBlocking().last().body(); + public DatabaseAccountInner patch(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) { + return patchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).toBlocking().last().body(); } /** - * Patches the properties of an existing Azure DocumentDB database account. + * Patches the properties of an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @param tags the Map<String, String> value + * @param accountName Cosmos DB database account name. + * @param updateParameters The tags parameter to patch for the current database account. * @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 patchAsync(String resourceGroupName, String accountName, Map tags, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(patchWithServiceResponseAsync(resourceGroupName, accountName, tags), serviceCallback); + public ServiceFuture patchAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(patchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters), serviceCallback); } /** - * Patches the properties of an existing Azure DocumentDB database account. + * Patches the properties of an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @param tags the Map<String, String> value + * @param accountName Cosmos DB database account name. + * @param updateParameters The tags parameter to patch for the current database account. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable patchAsync(String resourceGroupName, String accountName, Map tags) { - return patchWithServiceResponseAsync(resourceGroupName, accountName, tags).map(new Func1, DatabaseAccountInner>() { + public Observable patchAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) { + return patchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).map(new Func1, DatabaseAccountInner>() { @Override public DatabaseAccountInner call(ServiceResponse response) { return response.body(); @@ -273,15 +303,15 @@ public DatabaseAccountInner call(ServiceResponse response) } /** - * Patches the properties of an existing Azure DocumentDB database account. + * Patches the properties of an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @param tags the Map<String, String> value + * @param accountName Cosmos DB database account name. + * @param updateParameters The tags parameter to patch for the current database account. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable> patchWithServiceResponseAsync(String resourceGroupName, String accountName, Map tags) { + public Observable> patchWithServiceResponseAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -294,56 +324,54 @@ public Observable> patchWithServiceRespons if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - if (tags == null) { - throw new IllegalArgumentException("Parameter tags is required and cannot be null."); + if (updateParameters == null) { + throw new IllegalArgumentException("Parameter updateParameters is required and cannot be null."); } - Validator.validate(tags); - DatabaseAccountPatchParameters updateParameters = new DatabaseAccountPatchParameters(); - updateParameters.withTags(tags); - Observable> observable = service.patch(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), updateParameters, this.client.userAgent()); + Validator.validate(updateParameters); + Observable> observable = service.patch(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), updateParameters, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); } /** - * Patches the properties of an existing Azure DocumentDB database account. + * Patches the properties of an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @param tags the Map<String, String> value + * @param accountName Cosmos DB database account name. + * @param updateParameters The tags parameter to patch for the current database account. * @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 DatabaseAccountInner object if successful. */ - public DatabaseAccountInner beginPatch(String resourceGroupName, String accountName, Map tags) { - return beginPatchWithServiceResponseAsync(resourceGroupName, accountName, tags).toBlocking().single().body(); + public DatabaseAccountInner beginPatch(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) { + return beginPatchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).toBlocking().single().body(); } /** - * Patches the properties of an existing Azure DocumentDB database account. + * Patches the properties of an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @param tags the Map<String, String> value + * @param accountName Cosmos DB database account name. + * @param updateParameters The tags parameter to patch for the current database account. * @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 beginPatchAsync(String resourceGroupName, String accountName, Map tags, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginPatchWithServiceResponseAsync(resourceGroupName, accountName, tags), serviceCallback); + public ServiceFuture beginPatchAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginPatchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters), serviceCallback); } /** - * Patches the properties of an existing Azure DocumentDB database account. + * Patches the properties of an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @param tags the Map<String, String> value + * @param accountName Cosmos DB database account name. + * @param updateParameters The tags parameter to patch for the current database account. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the DatabaseAccountInner object */ - public Observable beginPatchAsync(String resourceGroupName, String accountName, Map tags) { - return beginPatchWithServiceResponseAsync(resourceGroupName, accountName, tags).map(new Func1, DatabaseAccountInner>() { + public Observable beginPatchAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) { + return beginPatchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).map(new Func1, DatabaseAccountInner>() { @Override public DatabaseAccountInner call(ServiceResponse response) { return response.body(); @@ -352,15 +380,15 @@ public DatabaseAccountInner call(ServiceResponse response) } /** - * Patches the properties of an existing Azure DocumentDB database account. + * Patches the properties of an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @param tags the Map<String, String> value + * @param accountName Cosmos DB database account name. + * @param updateParameters The tags parameter to patch for the current database account. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the DatabaseAccountInner object */ - public Observable> beginPatchWithServiceResponseAsync(String resourceGroupName, String accountName, Map tags) { + public Observable> beginPatchWithServiceResponseAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -373,24 +401,22 @@ public Observable> beginPatchWithServiceRe if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - if (tags == null) { - throw new IllegalArgumentException("Parameter tags is required and cannot be null."); - } - Validator.validate(tags); - DatabaseAccountPatchParameters updateParameters = new DatabaseAccountPatchParameters(); - updateParameters.withTags(tags); - return service.beginPatch(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), updateParameters, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = beginPatchDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } + if (updateParameters == null) { + throw new IllegalArgumentException("Parameter updateParameters is required and cannot be null."); + } + Validator.validate(updateParameters); + return service.beginPatch(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), updateParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginPatchDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); } - }); + } + }); } private ServiceResponse beginPatchDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { @@ -401,10 +427,10 @@ private ServiceResponse beginPatchDelegate(Response createOrUpdateAsync(String resourceGr } /** - * Creates or updates an Azure DocumentDB database account. + * Creates or updates an Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @param createUpdateParameters The parameters to provide for the current database account. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -448,10 +474,10 @@ public DatabaseAccountInner call(ServiceResponse response) } /** - * Creates or updates an Azure DocumentDB database account. + * Creates or updates an Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @param createUpdateParameters The parameters to provide for the current database account. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -478,10 +504,10 @@ public Observable> createOrUpdateWithServi } /** - * Creates or updates an Azure DocumentDB database account. + * Creates or updates an Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @param createUpdateParameters The parameters to provide for the current database account. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server @@ -493,10 +519,10 @@ public DatabaseAccountInner beginCreateOrUpdate(String resourceGroupName, String } /** - * Creates or updates an Azure DocumentDB database account. + * Creates or updates an Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @param createUpdateParameters The parameters to provide for the current database account. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -507,10 +533,10 @@ public ServiceFuture beginCreateOrUpdateAsync(String resou } /** - * Creates or updates an Azure DocumentDB database account. + * Creates or updates an Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @param createUpdateParameters The parameters to provide for the current database account. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the DatabaseAccountInner object @@ -525,10 +551,10 @@ public DatabaseAccountInner call(ServiceResponse response) } /** - * Creates or updates an Azure DocumentDB database account. + * Creates or updates an Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @param createUpdateParameters The parameters to provide for the current database account. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the DatabaseAccountInner object @@ -551,17 +577,17 @@ public Observable> beginCreateOrUpdateWith } Validator.validate(createUpdateParameters); return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), createUpdateParameters, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); } - }); + } + }); } private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { @@ -572,10 +598,10 @@ private ServiceResponse beginCreateOrUpdateDelegate(Respon } /** - * Deletes an existing Azure DocumentDB database account. + * Deletes an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @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 @@ -585,10 +611,10 @@ public void delete(String resourceGroupName, String accountName) { } /** - * Deletes an existing Azure DocumentDB database account. + * Deletes an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -598,10 +624,10 @@ public ServiceFuture deleteAsync(String resourceGroupName, String accountN } /** - * Deletes an existing Azure DocumentDB database account. + * Deletes an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ @@ -615,10 +641,10 @@ public Void call(ServiceResponse response) { } /** - * Deletes an existing Azure DocumentDB database account. + * Deletes an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ @@ -640,10 +666,10 @@ public Observable> deleteWithServiceResponseAsync(String r } /** - * Deletes an existing Azure DocumentDB database account. + * Deletes an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @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 @@ -653,10 +679,10 @@ public void beginDelete(String resourceGroupName, String accountName) { } /** - * Deletes an existing Azure DocumentDB database account. + * Deletes an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -666,10 +692,10 @@ public ServiceFuture beginDeleteAsync(String resourceGroupName, String acc } /** - * Deletes an existing Azure DocumentDB database account. + * Deletes an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ @@ -683,10 +709,10 @@ public Void call(ServiceResponse response) { } /** - * Deletes an existing Azure DocumentDB database account. + * Deletes an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ @@ -704,17 +730,17 @@ public Observable> beginDeleteWithServiceResponseAsync(Str throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.beginDelete(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = beginDeleteDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); } - }); + } + }); } private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { @@ -726,113 +752,43 @@ private ServiceResponse beginDeleteDelegate(Response respons } /** - * Changes the failover priority for the Azure DocumentDB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - * - * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @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 - */ - public void failoverPriorityChange(String resourceGroupName, String accountName) { - failoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().last().body(); - } - - /** - * Changes the failover priority for the Azure DocumentDB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - * - * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @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 failoverPriorityChangeAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(failoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); - } - - /** - * Changes the failover priority for the Azure DocumentDB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - * - * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request - */ - public Observable failoverPriorityChangeAsync(String resourceGroupName, String accountName) { - return failoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, Void>() { - @Override - public Void call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Changes the failover priority for the Azure DocumentDB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - * - * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request - */ - public Observable> failoverPriorityChangeWithServiceResponseAsync(String resourceGroupName, String accountName) { - if (this.client.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); - } - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); - } - if (accountName == null) { - throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); - } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - final String failoverPoliciesConverted = null; - FailoverPolicies failoverParameters = new FailoverPolicies(); - failoverParameters.withFailoverPolicies(null); - Observable> observable = service.failoverPriorityChange(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), failoverParameters, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); - } - /** - * Changes the failover priority for the Azure DocumentDB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @param failoverPolicies List of failover policies. * @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 */ - public void failoverPriorityChange(String resourceGroupName, String accountName, List failoverPolicies) { + public void failoverPriorityChange(String resourceGroupName, String accountName, List failoverPolicies) { failoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).toBlocking().last().body(); } /** - * Changes the failover priority for the Azure DocumentDB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @param failoverPolicies List of failover policies. * @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 failoverPriorityChangeAsync(String resourceGroupName, String accountName, List failoverPolicies, final ServiceCallback serviceCallback) { + public ServiceFuture failoverPriorityChangeAsync(String resourceGroupName, String accountName, List failoverPolicies, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(failoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies), serviceCallback); } /** - * Changes the failover priority for the Azure DocumentDB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @param failoverPolicies List of failover policies. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable failoverPriorityChangeAsync(String resourceGroupName, String accountName, List failoverPolicies) { + public Observable failoverPriorityChangeAsync(String resourceGroupName, String accountName, List failoverPolicies) { return failoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).map(new Func1, Void>() { @Override public Void call(ServiceResponse response) { @@ -842,15 +798,15 @@ public Void call(ServiceResponse response) { } /** - * Changes the failover priority for the Azure DocumentDB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @param failoverPolicies List of failover policies. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable> failoverPriorityChangeWithServiceResponseAsync(String resourceGroupName, String accountName, List failoverPolicies) { + public Observable> failoverPriorityChangeWithServiceResponseAsync(String resourceGroupName, String accountName, List failoverPolicies) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -863,6 +819,9 @@ public Observable> failoverPriorityChangeWithServiceRespon if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } + if (failoverPolicies == null) { + throw new IllegalArgumentException("Parameter failoverPolicies is required and cannot be null."); + } Validator.validate(failoverPolicies); FailoverPolicies failoverParameters = new FailoverPolicies(); failoverParameters.withFailoverPolicies(failoverPolicies); @@ -871,124 +830,43 @@ public Observable> failoverPriorityChangeWithServiceRespon } /** - * Changes the failover priority for the Azure DocumentDB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - * - * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @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 - */ - public void beginFailoverPriorityChange(String resourceGroupName, String accountName) { - beginFailoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); - } - - /** - * Changes the failover priority for the Azure DocumentDB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - * - * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @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 beginFailoverPriorityChangeAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginFailoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); - } - - /** - * Changes the failover priority for the Azure DocumentDB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - * - * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. - */ - public Observable beginFailoverPriorityChangeAsync(String resourceGroupName, String accountName) { - return beginFailoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, Void>() { - @Override - public Void call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Changes the failover priority for the Azure DocumentDB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. - */ - public Observable> beginFailoverPriorityChangeWithServiceResponseAsync(String resourceGroupName, String accountName) { - if (this.client.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); - } - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); - } - if (accountName == null) { - throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); - } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - final List failoverPolicies = null; - FailoverPolicies failoverParameters = new FailoverPolicies(); - failoverParameters.withFailoverPolicies(null); - return service.beginFailoverPriorityChange(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), failoverParameters, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = beginFailoverPriorityChangeDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - /** - * Changes the failover priority for the Azure DocumentDB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. - * - * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @param failoverPolicies List of failover policies. * @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 */ - public void beginFailoverPriorityChange(String resourceGroupName, String accountName, List failoverPolicies) { + public void beginFailoverPriorityChange(String resourceGroupName, String accountName, List failoverPolicies) { beginFailoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).toBlocking().single().body(); } /** - * Changes the failover priority for the Azure DocumentDB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @param failoverPolicies List of failover policies. * @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 beginFailoverPriorityChangeAsync(String resourceGroupName, String accountName, List failoverPolicies, final ServiceCallback serviceCallback) { + public ServiceFuture beginFailoverPriorityChangeAsync(String resourceGroupName, String accountName, List failoverPolicies, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(beginFailoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies), serviceCallback); } /** - * Changes the failover priority for the Azure DocumentDB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @param failoverPolicies List of failover policies. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ - public Observable beginFailoverPriorityChangeAsync(String resourceGroupName, String accountName, List failoverPolicies) { + public Observable beginFailoverPriorityChangeAsync(String resourceGroupName, String accountName, List failoverPolicies) { return beginFailoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).map(new Func1, Void>() { @Override public Void call(ServiceResponse response) { @@ -998,15 +876,15 @@ public Void call(ServiceResponse response) { } /** - * Changes the failover priority for the Azure DocumentDB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @param failoverPolicies List of failover policies. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ - public Observable> beginFailoverPriorityChangeWithServiceResponseAsync(String resourceGroupName, String accountName, List failoverPolicies) { + public Observable> beginFailoverPriorityChangeWithServiceResponseAsync(String resourceGroupName, String accountName, List failoverPolicies) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1019,21 +897,24 @@ public Observable> beginFailoverPriorityChangeWithServiceR if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } + if (failoverPolicies == null) { + throw new IllegalArgumentException("Parameter failoverPolicies is required and cannot be null."); + } Validator.validate(failoverPolicies); FailoverPolicies failoverParameters = new FailoverPolicies(); failoverParameters.withFailoverPolicies(failoverPolicies); return service.beginFailoverPriorityChange(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), failoverParameters, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = beginFailoverPriorityChangeDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginFailoverPriorityChangeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); } - }); + } + }); } private ServiceResponse beginFailoverPriorityChangeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { @@ -1045,7 +926,7 @@ private ServiceResponse beginFailoverPriorityChangeDelegate(Response object if successful. */ @@ -1062,7 +943,7 @@ public Page nextPage(String nextPageLink) { } /** - * Lists all the Azure DocumentDB database accounts available under the subscription. + * Lists all the Azure Cosmos DB database accounts available under the subscription. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceFuture} object @@ -1072,7 +953,7 @@ public ServiceFuture> listAsync(final ServiceCallback } /** - * Lists all the Azure DocumentDB database accounts available under the subscription. + * Lists all the Azure Cosmos DB database accounts available under the subscription. * * @return the observable to the List<DatabaseAccountInner> object */ @@ -1088,7 +969,7 @@ public Page call(ServiceResponse>> listWithServiceRe throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); } - }); + } + }); } private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { @@ -1122,7 +1007,7 @@ private ServiceResponse> listDelegate(Response object if successful. @@ -1140,7 +1025,7 @@ public Page nextPage(String nextPageLink) { } /** - * Lists all the Azure DocumentDB database accounts available under the given resource group. + * Lists all the Azure Cosmos DB database accounts available under the given resource group. * * @param resourceGroupName Name of an Azure resource group. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -1151,7 +1036,7 @@ public ServiceFuture> listByResourceGroupAsync(String } /** - * Lists all the Azure DocumentDB database accounts available under the given resource group. + * Lists all the Azure Cosmos DB database accounts available under the given resource group. * * @param resourceGroupName Name of an Azure resource group. * @return the observable to the List<DatabaseAccountInner> object @@ -1168,7 +1053,7 @@ public Page call(ServiceResponse>> listByResourceGro throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = listByResourceGroupDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); } - }); + } + }); } private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { @@ -1206,58 +1095,58 @@ private ServiceResponse> listByResourceGroupDeleg } /** - * Lists the access keys for the specified Azure DocumentDB database account. + * Lists the access keys for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @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 DatabaseAccountListKeysResult object if successful. + * @return the DatabaseAccountListKeysResultInner object if successful. */ - public DatabaseAccountListKeysResult listKeys(String resourceGroupName, String accountName) { + public DatabaseAccountListKeysResultInner listKeys(String resourceGroupName, String accountName) { return listKeysWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); } /** - * Lists the access keys for the specified Azure DocumentDB database account. + * Lists the access keys for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @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 listKeysAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + public ServiceFuture listKeysAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); } /** - * Lists the access keys for the specified Azure DocumentDB database account. + * Lists the access keys for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DatabaseAccountListKeysResult object + * @return the observable to the DatabaseAccountListKeysResultInner object */ - public Observable listKeysAsync(String resourceGroupName, String accountName) { - return listKeysWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, DatabaseAccountListKeysResult>() { + public Observable listKeysAsync(String resourceGroupName, String accountName) { + return listKeysWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, DatabaseAccountListKeysResultInner>() { @Override - public DatabaseAccountListKeysResult call(ServiceResponse response) { + public DatabaseAccountListKeysResultInner call(ServiceResponse response) { return response.body(); } }); } /** - * Lists the access keys for the specified Azure DocumentDB database account. + * Lists the access keys for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DatabaseAccountListKeysResult object + * @return the observable to the DatabaseAccountListKeysResultInner object */ - public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String accountName) { + public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String accountName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1271,79 +1160,79 @@ public Observable> listKeysWithSe throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listKeys(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = listKeysDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); } - }); + } + }); } - private ServiceResponse listKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse listKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } /** - * Lists the connection strings for the specified Azure DocumentDB database account. + * Lists the connection strings for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @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 DatabaseAccountListConnectionStringsResult object if successful. + * @return the DatabaseAccountListConnectionStringsResultInner object if successful. */ - public DatabaseAccountListConnectionStringsResult listConnectionStrings(String resourceGroupName, String accountName) { + public DatabaseAccountListConnectionStringsResultInner listConnectionStrings(String resourceGroupName, String accountName) { return listConnectionStringsWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); } /** - * Lists the connection strings for the specified Azure DocumentDB database account. + * Lists the connection strings for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @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 listConnectionStringsAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + public ServiceFuture listConnectionStringsAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(listConnectionStringsWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); } /** - * Lists the connection strings for the specified Azure DocumentDB database account. + * Lists the connection strings for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DatabaseAccountListConnectionStringsResult object + * @return the observable to the DatabaseAccountListConnectionStringsResultInner object */ - public Observable listConnectionStringsAsync(String resourceGroupName, String accountName) { - return listConnectionStringsWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, DatabaseAccountListConnectionStringsResult>() { + public Observable listConnectionStringsAsync(String resourceGroupName, String accountName) { + return listConnectionStringsWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, DatabaseAccountListConnectionStringsResultInner>() { @Override - public DatabaseAccountListConnectionStringsResult call(ServiceResponse response) { + public DatabaseAccountListConnectionStringsResultInner call(ServiceResponse response) { return response.body(); } }); } /** - * Lists the connection strings for the specified Azure DocumentDB database account. + * Lists the connection strings for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DatabaseAccountListConnectionStringsResult object + * @return the observable to the DatabaseAccountListConnectionStringsResultInner object */ - public Observable> listConnectionStringsWithServiceResponseAsync(String resourceGroupName, String accountName) { + public Observable> listConnectionStringsWithServiceResponseAsync(String resourceGroupName, String accountName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1357,79 +1246,82 @@ public Observable> l throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listConnectionStrings(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = listConnectionStringsDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listConnectionStringsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); } - }); + } + }); } - private ServiceResponse listConnectionStringsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse listConnectionStringsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } /** - * Lists the read-only access keys for the specified Azure DocumentDB database account. + * Offline the specified region for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the DatabaseAccountListReadOnlyKeysResultInner object if successful. */ - public DatabaseAccountListReadOnlyKeysResultInner listReadOnlyKeys(String resourceGroupName, String accountName) { - return listReadOnlyKeysWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + public void offlineRegion(String resourceGroupName, String accountName, String region) { + offlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).toBlocking().last().body(); } /** - * Lists the read-only access keys for the specified Azure DocumentDB database account. + * Offline the specified region for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. * @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 listReadOnlyKeysAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listReadOnlyKeysWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + public ServiceFuture offlineRegionAsync(String resourceGroupName, String accountName, String region, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(offlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region), serviceCallback); } /** - * Lists the read-only access keys for the specified Azure DocumentDB database account. + * Offline the specified region for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DatabaseAccountListReadOnlyKeysResultInner object + * @return the observable for the request */ - public Observable listReadOnlyKeysAsync(String resourceGroupName, String accountName) { - return listReadOnlyKeysWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, DatabaseAccountListReadOnlyKeysResultInner>() { + public Observable offlineRegionAsync(String resourceGroupName, String accountName, String region) { + return offlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).map(new Func1, Void>() { @Override - public DatabaseAccountListReadOnlyKeysResultInner call(ServiceResponse response) { + public Void call(ServiceResponse response) { return response.body(); } }); } /** - * Lists the read-only access keys for the specified Azure DocumentDB database account. + * Offline the specified region for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DatabaseAccountListReadOnlyKeysResultInner object + * @return the observable for the request */ - public Observable> listReadOnlyKeysWithServiceResponseAsync(String resourceGroupName, String accountName) { + public Observable> offlineRegionWithServiceResponseAsync(String resourceGroupName, String accountName, String region) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1442,66 +1334,54 @@ public Observable> l if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - return service.listReadOnlyKeys(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = listReadOnlyKeysDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse listReadOnlyKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) - .build(response); + if (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + RegionForOnlineOffline regionParameterForOffline = new RegionForOnlineOffline(); + regionParameterForOffline.withRegion(region); + Observable> observable = service.offlineRegion(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), regionParameterForOffline, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } /** - * Regenerates an access key for the specified Azure DocumentDB database account. + * Offline the specified region for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ - public void regenerateKey(String resourceGroupName, String accountName, KeyKind keyKind) { - regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind).toBlocking().last().body(); + public void beginOfflineRegion(String resourceGroupName, String accountName, String region) { + beginOfflineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).toBlocking().single().body(); } /** - * Regenerates an access key for the specified Azure DocumentDB database account. + * Offline the specified region for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. * @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 regenerateKeyAsync(String resourceGroupName, String accountName, KeyKind keyKind, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind), serviceCallback); + public ServiceFuture beginOfflineRegionAsync(String resourceGroupName, String accountName, String region, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginOfflineRegionWithServiceResponseAsync(resourceGroupName, accountName, region), serviceCallback); } /** - * Regenerates an access key for the specified Azure DocumentDB database account. + * Offline the specified region for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request + * @return the {@link ServiceResponse} object if successful. */ - public Observable regenerateKeyAsync(String resourceGroupName, String accountName, KeyKind keyKind) { - return regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind).map(new Func1, Void>() { + public Observable beginOfflineRegionAsync(String resourceGroupName, String accountName, String region) { + return beginOfflineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).map(new Func1, Void>() { @Override public Void call(ServiceResponse response) { return response.body(); @@ -1510,15 +1390,15 @@ public Void call(ServiceResponse response) { } /** - * Regenerates an access key for the specified Azure DocumentDB database account. + * Offline the specified region for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request + * @return the {@link ServiceResponse} object if successful. */ - public Observable> regenerateKeyWithServiceResponseAsync(String resourceGroupName, String accountName, KeyKind keyKind) { + public Observable> beginOfflineRegionWithServiceResponseAsync(String resourceGroupName, String accountName, String region) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1531,54 +1411,72 @@ public Observable> regenerateKeyWithServiceResponseAsync(S if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - if (keyKind == null) { - throw new IllegalArgumentException("Parameter keyKind is required and cannot be null."); - } - DatabaseAccountRegenerateKeyParameters keyToRegenerate = new DatabaseAccountRegenerateKeyParameters(); - keyToRegenerate.withKeyKind(keyKind); - Observable> observable = service.regenerateKey(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), keyToRegenerate, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + if (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + RegionForOnlineOffline regionParameterForOffline = new RegionForOnlineOffline(); + regionParameterForOffline.withRegion(region); + return service.beginOfflineRegion(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), regionParameterForOffline, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginOfflineRegionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginOfflineRegionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); } /** - * Regenerates an access key for the specified Azure DocumentDB database account. + * Online the specified region for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ - public void beginRegenerateKey(String resourceGroupName, String accountName, KeyKind keyKind) { - beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind).toBlocking().single().body(); + public void onlineRegion(String resourceGroupName, String accountName, String region) { + onlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).toBlocking().last().body(); } /** - * Regenerates an access key for the specified Azure DocumentDB database account. + * Online the specified region for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. * @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 beginRegenerateKeyAsync(String resourceGroupName, String accountName, KeyKind keyKind, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind), serviceCallback); + public ServiceFuture onlineRegionAsync(String resourceGroupName, String accountName, String region, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(onlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region), serviceCallback); } /** - * Regenerates an access key for the specified Azure DocumentDB database account. + * Online the specified region for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable for the request */ - public Observable beginRegenerateKeyAsync(String resourceGroupName, String accountName, KeyKind keyKind) { - return beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind).map(new Func1, Void>() { + public Observable onlineRegionAsync(String resourceGroupName, String accountName, String region) { + return onlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).map(new Func1, Void>() { @Override public Void call(ServiceResponse response) { return response.body(); @@ -1587,15 +1485,15 @@ public Void call(ServiceResponse response) { } /** - * Regenerates an access key for the specified Azure DocumentDB database account. + * Online the specified region for the specified Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. - * @param accountName DocumentDB database account name. - * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable for the request */ - public Observable> beginRegenerateKeyWithServiceResponseAsync(String resourceGroupName, String accountName, KeyKind keyKind) { + public Observable> onlineRegionWithServiceResponseAsync(String resourceGroupName, String accountName, String region) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -1608,109 +1506,812 @@ public Observable> beginRegenerateKeyWithServiceResponseAs if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - if (keyKind == null) { - throw new IllegalArgumentException("Parameter keyKind is required and cannot be null."); + if (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); } - DatabaseAccountRegenerateKeyParameters keyToRegenerate = new DatabaseAccountRegenerateKeyParameters(); - keyToRegenerate.withKeyKind(keyKind); - return service.beginRegenerateKey(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), keyToRegenerate, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = beginRegenerateKeyDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse beginRegenerateKeyDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .register(202, new TypeToken() { }.getType()) - .registerError(CloudException.class) - .build(response); + RegionForOnlineOffline regionParameterForOnline = new RegionForOnlineOffline(); + regionParameterForOnline.withRegion(region); + Observable> observable = service.onlineRegion(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), regionParameterForOnline, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } /** - * Checks that the Azure DocumentDB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * Online the specified region for the specified Azure Cosmos DB database account. * - * @param accountName DocumentDB database account name. + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the boolean object if successful. */ - public boolean checkNameExists(String accountName) { - return checkNameExistsWithServiceResponseAsync(accountName).toBlocking().single().body(); + public void beginOnlineRegion(String resourceGroupName, String accountName, String region) { + beginOnlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).toBlocking().single().body(); } /** - * Checks that the Azure DocumentDB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * Online the specified region for the specified Azure Cosmos DB database account. * - * @param accountName DocumentDB database account name. + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. * @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 checkNameExistsAsync(String accountName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(checkNameExistsWithServiceResponseAsync(accountName), serviceCallback); + public ServiceFuture beginOnlineRegionAsync(String resourceGroupName, String accountName, String region, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginOnlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region), serviceCallback); } /** - * Checks that the Azure DocumentDB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * Online the specified region for the specified Azure Cosmos DB database account. * - * @param accountName DocumentDB database account name. + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Boolean object + * @return the {@link ServiceResponse} object if successful. */ - public Observable checkNameExistsAsync(String accountName) { - return checkNameExistsWithServiceResponseAsync(accountName).map(new Func1, Boolean>() { + public Observable beginOnlineRegionAsync(String resourceGroupName, String accountName, String region) { + return beginOnlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).map(new Func1, Void>() { @Override - public Boolean call(ServiceResponse response) { + public Void call(ServiceResponse response) { return response.body(); } }); } /** - * Checks that the Azure DocumentDB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * Online the specified region for the specified Azure Cosmos DB database account. * - * @param accountName DocumentDB database account name. + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Boolean object + * @return the {@link ServiceResponse} object if successful. */ - public Observable> checkNameExistsWithServiceResponseAsync(String accountName) { + public Observable> beginOnlineRegionWithServiceResponseAsync(String resourceGroupName, String accountName, String region) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } if (accountName == null) { throw new IllegalArgumentException("Parameter accountName 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.checkNameExists(accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = checkNameExistsDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } + if (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + RegionForOnlineOffline regionParameterForOnline = new RegionForOnlineOffline(); + regionParameterForOnline.withRegion(region); + return service.beginOnlineRegion(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), regionParameterForOnline, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginOnlineRegionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); } - }); + } + }); } - private ServiceResponse checkNameExistsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse beginOnlineRegionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .register(404, new TypeToken() { }.getType()) - .registerError(CloudException.class) - .buildEmpty(response); + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); } -} - + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @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 DatabaseAccountListReadOnlyKeysResultInner object if successful. + */ + public DatabaseAccountListReadOnlyKeysResultInner listReadOnlyKeys(String resourceGroupName, String accountName) { + return listReadOnlyKeysWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @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 listReadOnlyKeysAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listReadOnlyKeysWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountListReadOnlyKeysResultInner object + */ + public Observable listReadOnlyKeysAsync(String resourceGroupName, String accountName) { + return listReadOnlyKeysWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, DatabaseAccountListReadOnlyKeysResultInner>() { + @Override + public DatabaseAccountListReadOnlyKeysResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountListReadOnlyKeysResultInner object + */ + public Observable> listReadOnlyKeysWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName 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.listReadOnlyKeys(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listReadOnlyKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listReadOnlyKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @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 + */ + public void regenerateKey(String resourceGroupName, String accountName, KeyKind keyKind) { + regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind).toBlocking().last().body(); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @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 regenerateKeyAsync(String resourceGroupName, String accountName, KeyKind keyKind, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind), serviceCallback); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable regenerateKeyAsync(String resourceGroupName, String accountName, KeyKind keyKind) { + return regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> regenerateKeyWithServiceResponseAsync(String resourceGroupName, String accountName, KeyKind keyKind) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (keyKind == null) { + throw new IllegalArgumentException("Parameter keyKind is required and cannot be null."); + } + DatabaseAccountRegenerateKeyParameters keyToRegenerate = new DatabaseAccountRegenerateKeyParameters(); + keyToRegenerate.withKeyKind(keyKind); + Observable> observable = service.regenerateKey(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), keyToRegenerate, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @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 + */ + public void beginRegenerateKey(String resourceGroupName, String accountName, KeyKind keyKind) { + beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind).toBlocking().single().body(); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @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 beginRegenerateKeyAsync(String resourceGroupName, String accountName, KeyKind keyKind, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind), serviceCallback); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginRegenerateKeyAsync(String resourceGroupName, String accountName, KeyKind keyKind) { + return beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginRegenerateKeyWithServiceResponseAsync(String resourceGroupName, String accountName, KeyKind keyKind) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (keyKind == null) { + throw new IllegalArgumentException("Parameter keyKind is required and cannot be null."); + } + DatabaseAccountRegenerateKeyParameters keyToRegenerate = new DatabaseAccountRegenerateKeyParameters(); + keyToRegenerate.withKeyKind(keyKind); + return service.beginRegenerateKey(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), keyToRegenerate, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginRegenerateKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRegenerateKeyDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @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 boolean object if successful. + */ + public boolean checkNameExists(String accountName) { + return checkNameExistsWithServiceResponseAsync(accountName).toBlocking().single().body(); + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @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 checkNameExistsAsync(String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameExistsWithServiceResponseAsync(accountName), serviceCallback); + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable checkNameExistsAsync(String accountName) { + return checkNameExistsWithServiceResponseAsync(accountName).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> checkNameExistsWithServiceResponseAsync(String accountName) { + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName 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.checkNameExists(accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkNameExistsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameExistsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildEmpty(response); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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 List<MetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @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 List<UsageInner> object if successful. + */ + public List listUsages(String resourceGroupName, String accountName) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @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> listUsagesAsync(String resourceGroupName, String accountName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String accountName) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listUsagesDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @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 List<UsageInner> object if successful. + */ + public List listUsages(String resourceGroupName, String accountName, String filter) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, filter).toBlocking().single().body(); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @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> listUsagesAsync(String resourceGroupName, String accountName, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, accountName, filter), serviceCallback); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String accountName, String filter) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(String resourceGroupName, String accountName, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName 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.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listUsagesDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listUsagesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves metric defintions for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @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 List<MetricDefinitionInner> object if successful. + */ + public List listMetricDefinitions(String resourceGroupName, String accountName) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Retrieves metric defintions for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @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> listMetricDefinitionsAsync(String resourceGroupName, String accountName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Retrieves metric defintions for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable> listMetricDefinitionsAsync(String resourceGroupName, String accountName) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves metric defintions for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable>> listMetricDefinitionsWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName 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.listMetricDefinitions(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricDefinitionsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricDefinitionsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabasesInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabasesInner.java new file mode 100644 index 00000000000..13360d41344 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/DatabasesInner.java @@ -0,0 +1,466 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Databases. + */ +public class DatabasesInner { + /** The Retrofit service to perform REST calls. */ + private DatabasesService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of DatabasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabasesInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(DatabasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Databases to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.Databases listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.Databases listUsages" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages") + Observable> listUsages(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.Databases listMetricDefinitions" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions") + Observable> listMetricDefinitions(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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 List<MetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String databaseRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @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 List<UsageInner> object if successful. + */ + public List listUsages(String resourceGroupName, String accountName, String databaseRid) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid).toBlocking().single().body(); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @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> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid), serviceCallback); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listUsagesDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @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 List<UsageInner> object if successful. + */ + public List listUsages(String resourceGroupName, String accountName, String databaseRid, String filter) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, filter).toBlocking().single().body(); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @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> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, filter), serviceCallback); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String filter) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid 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.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listUsagesDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listUsagesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves metric defintions for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @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 List<MetricDefinitionInner> object if successful. + */ + public List listMetricDefinitions(String resourceGroupName, String accountName, String databaseRid) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid).toBlocking().single().body(); + } + + /** + * Retrieves metric defintions for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @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> listMetricDefinitionsAsync(String resourceGroupName, String accountName, String databaseRid, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid), serviceCallback); + } + + /** + * Retrieves metric defintions for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable> listMetricDefinitionsAsync(String resourceGroupName, String accountName, String databaseRid) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves metric defintions for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable>> listMetricDefinitionsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid 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.listMetricDefinitions(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricDefinitionsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricDefinitionsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/MetricDefinitionInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/MetricDefinitionInner.java new file mode 100644 index 00000000000..f8656b449b1 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/MetricDefinitionInner.java @@ -0,0 +1,111 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import java.util.List; +import com.microsoft.azure.management.cosmosdb.MetricAvailability; +import com.microsoft.azure.management.cosmosdb.PrimaryAggregationType; +import com.microsoft.azure.management.cosmosdb.UnitType; +import com.microsoft.azure.management.cosmosdb.MetricName; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The definition of a metric. + */ +public class MetricDefinitionInner { + /** + * The list of metric availabilities for the account. + */ + @JsonProperty(value = "metricAvailabilities", access = JsonProperty.Access.WRITE_ONLY) + private List metricAvailabilities; + + /** + * The primary aggregation type of the metric. Possible values include: + * 'None', 'Average', 'Total', 'Minimimum', 'Maximum', 'Last'. + */ + @JsonProperty(value = "primaryAggregationType", access = JsonProperty.Access.WRITE_ONLY) + private PrimaryAggregationType primaryAggregationType; + + /** + * The unit of the metric. Possible values include: 'Count', 'Bytes', + * 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + * 'Milliseconds'. + */ + @JsonProperty(value = "unit") + private UnitType unit; + + /** + * The resource uri of the database. + */ + @JsonProperty(value = "resourceUri", access = JsonProperty.Access.WRITE_ONLY) + private String resourceUri; + + /** + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /** + * Get the metricAvailabilities value. + * + * @return the metricAvailabilities value + */ + public List metricAvailabilities() { + return this.metricAvailabilities; + } + + /** + * Get the primaryAggregationType value. + * + * @return the primaryAggregationType value + */ + public PrimaryAggregationType primaryAggregationType() { + return this.primaryAggregationType; + } + + /** + * Get the unit value. + * + * @return the unit value + */ + public UnitType unit() { + return this.unit; + } + + /** + * Set the unit value. + * + * @param unit the unit value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withUnit(UnitType unit) { + this.unit = unit; + return this; + } + + /** + * Get the resourceUri value. + * + * @return the resourceUri value + */ + public String resourceUri() { + return this.resourceUri; + } + + /** + * Get the name value. + * + * @return the name value + */ + public MetricName name() { + return this.name; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/MetricInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/MetricInner.java new file mode 100644 index 00000000000..6c52f2672ad --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/MetricInner.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.cosmosdb.UnitType; +import com.microsoft.azure.management.cosmosdb.MetricName; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.MetricValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Metric data. + */ +public class MetricInner { + /** + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * The time grain to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /** + * The unit of the metric. Possible values include: 'Count', 'Bytes', + * 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + * 'Milliseconds'. + */ + @JsonProperty(value = "unit") + private UnitType unit; + + /** + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /** + * The metric values for the specified time window and timestep. + */ + @JsonProperty(value = "metricValues", access = JsonProperty.Access.WRITE_ONLY) + private List metricValues; + + /** + * Get the startTime value. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime value. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get the timeGrain value. + * + * @return the timeGrain value + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the unit value. + * + * @return the unit value + */ + public UnitType unit() { + return this.unit; + } + + /** + * Set the unit value. + * + * @param unit the unit value to set + * @return the MetricInner object itself. + */ + public MetricInner withUnit(UnitType unit) { + this.unit = unit; + return this; + } + + /** + * Get the name value. + * + * @return the name value + */ + public MetricName name() { + return this.name; + } + + /** + * Get the metricValues value. + * + * @return the metricValues value + */ + public List metricValues() { + return this.metricValues; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/OperationInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/OperationInner.java new file mode 100644 index 00000000000..c2d5a8767e3 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/OperationInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import com.microsoft.azure.management.cosmosdb.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display value. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display value. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/OperationsInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/OperationsInner.java new file mode 100644 index 00000000000..ccac063f355 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.Operations list" }) + @GET("providers/Microsoft.DocumentDB/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @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<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @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> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @param nextPageLink The NextLink from the previous successful call to List 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<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PageImpl1.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PageImpl1.java new file mode 100644 index 00000000000..c57dbe79f2d --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PartitionKeyRangeIdRegionsInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PartitionKeyRangeIdRegionsInner.java new file mode 100644 index 00000000000..8307606c183 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PartitionKeyRangeIdRegionsInner.java @@ -0,0 +1,187 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PartitionKeyRangeIdRegions. + */ +public class PartitionKeyRangeIdRegionsInner { + /** The Retrofit service to perform REST calls. */ + private PartitionKeyRangeIdRegionsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of PartitionKeyRangeIdRegionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PartitionKeyRangeIdRegionsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(PartitionKeyRangeIdRegionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PartitionKeyRangeIdRegions to be + * used by Retrofit to perform actually REST calls. + */ + interface PartitionKeyRangeIdRegionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.PartitionKeyRangeIdRegions listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("region") String region, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Path("partitionKeyRangeId") String partitionKeyRangeId, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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 List<PartitionMetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionMetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionMetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid is required and cannot be null."); + } + if (partitionKeyRangeId == null) { + throw new IllegalArgumentException("Parameter partitionKeyRangeId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PartitionKeyRangeIdsInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PartitionKeyRangeIdsInner.java new file mode 100644 index 00000000000..fb4fb96ad69 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PartitionKeyRangeIdsInner.java @@ -0,0 +1,180 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PartitionKeyRangeIds. + */ +public class PartitionKeyRangeIdsInner { + /** The Retrofit service to perform REST calls. */ + private PartitionKeyRangeIdsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of PartitionKeyRangeIdsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PartitionKeyRangeIdsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(PartitionKeyRangeIdsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PartitionKeyRangeIds to be + * used by Retrofit to perform actually REST calls. + */ + interface PartitionKeyRangeIdsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.PartitionKeyRangeIds listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Path("partitionKeyRangeId") String partitionKeyRangeId, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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 List<PartitionMetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionMetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionMetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid is required and cannot be null."); + } + if (partitionKeyRangeId == null) { + throw new IllegalArgumentException("Parameter partitionKeyRangeId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PartitionMetricInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PartitionMetricInner.java new file mode 100644 index 00000000000..7c08c32483e --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PartitionMetricInner.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The metric values for a single partition. + */ +public class PartitionMetricInner extends MetricInner { + /** + * The parition id (GUID identifier) of the metric values. + */ + @JsonProperty(value = "partitionId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionId; + + /** + * The partition key range id (integer identifier) of the metric values. + */ + @JsonProperty(value = "partitionKeyRangeId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionKeyRangeId; + + /** + * Get the partitionId value. + * + * @return the partitionId value + */ + public String partitionId() { + return this.partitionId; + } + + /** + * Get the partitionKeyRangeId value. + * + * @return the partitionKeyRangeId value + */ + public String partitionKeyRangeId() { + return this.partitionKeyRangeId; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PartitionUsageInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PartitionUsageInner.java new file mode 100644 index 00000000000..30028a873cb --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PartitionUsageInner.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The partition level usage data for a usage request. + */ +public class PartitionUsageInner extends UsageInner { + /** + * The parition id (GUID identifier) of the usages. + */ + @JsonProperty(value = "partitionId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionId; + + /** + * The partition key range id (integer identifier) of the usages. + */ + @JsonProperty(value = "partitionKeyRangeId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionKeyRangeId; + + /** + * Get the partitionId value. + * + * @return the partitionId value + */ + public String partitionId() { + return this.partitionId; + } + + /** + * Get the partitionKeyRangeId value. + * + * @return the partitionKeyRangeId value + */ + public String partitionKeyRangeId() { + return this.partitionKeyRangeId; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PercentileMetricInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PercentileMetricInner.java new file mode 100644 index 00000000000..43232b78737 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PercentileMetricInner.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.cosmosdb.UnitType; +import com.microsoft.azure.management.cosmosdb.MetricName; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.PercentileMetricValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Percentile Metric data. + */ +public class PercentileMetricInner { + /** + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * The time grain to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /** + * The unit of the metric. Possible values include: 'Count', 'Bytes', + * 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + * 'Milliseconds'. + */ + @JsonProperty(value = "unit") + private UnitType unit; + + /** + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /** + * The percentile metric values for the specified time window and timestep. + */ + @JsonProperty(value = "metricValues", access = JsonProperty.Access.WRITE_ONLY) + private List metricValues; + + /** + * Get the startTime value. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime value. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get the timeGrain value. + * + * @return the timeGrain value + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the unit value. + * + * @return the unit value + */ + public UnitType unit() { + return this.unit; + } + + /** + * Set the unit value. + * + * @param unit the unit value to set + * @return the PercentileMetricInner object itself. + */ + public PercentileMetricInner withUnit(UnitType unit) { + this.unit = unit; + return this; + } + + /** + * Get the name value. + * + * @return the name value + */ + public MetricName name() { + return this.name; + } + + /** + * Get the metricValues value. + * + * @return the metricValues value + */ + public List metricValues() { + return this.metricValues; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PercentileSourceTargetsInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PercentileSourceTargetsInner.java new file mode 100644 index 00000000000..06b6fcc2b66 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PercentileSourceTargetsInner.java @@ -0,0 +1,173 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PercentileSourceTargets. + */ +public class PercentileSourceTargetsInner { + /** The Retrofit service to perform REST calls. */ + private PercentileSourceTargetsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of PercentileSourceTargetsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PercentileSourceTargetsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(PercentileSourceTargetsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PercentileSourceTargets to be + * used by Retrofit to perform actually REST calls. + */ + interface PercentileSourceTargetsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.PercentileSourceTargets listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("sourceRegion") String sourceRegion, @Path("targetRegion") String targetRegion, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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 List<PercentileMetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, sourceRegion, targetRegion, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, sourceRegion, targetRegion, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PercentileMetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, sourceRegion, targetRegion, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PercentileMetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (sourceRegion == null) { + throw new IllegalArgumentException("Parameter sourceRegion is required and cannot be null."); + } + if (targetRegion == null) { + throw new IllegalArgumentException("Parameter targetRegion is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, sourceRegion, targetRegion, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PercentileTargetsInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PercentileTargetsInner.java new file mode 100644 index 00000000000..f75413b180b --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PercentileTargetsInner.java @@ -0,0 +1,166 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PercentileTargets. + */ +public class PercentileTargetsInner { + /** The Retrofit service to perform REST calls. */ + private PercentileTargetsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of PercentileTargetsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PercentileTargetsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(PercentileTargetsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PercentileTargets to be + * used by Retrofit to perform actually REST calls. + */ + interface PercentileTargetsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.PercentileTargets listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("targetRegion") String targetRegion, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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 List<PercentileMetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String targetRegion, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, targetRegion, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String targetRegion, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, targetRegion, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PercentileMetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String targetRegion, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, targetRegion, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PercentileMetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String targetRegion, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (targetRegion == null) { + throw new IllegalArgumentException("Parameter targetRegion is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, targetRegion, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PercentilesInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PercentilesInner.java new file mode 100644 index 00000000000..e16319d1555 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/PercentilesInner.java @@ -0,0 +1,159 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Percentiles. + */ +public class PercentilesInner { + /** The Retrofit service to perform REST calls. */ + private PercentilesService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of PercentilesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PercentilesInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(PercentilesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Percentiles to be + * used by Retrofit to perform actually REST calls. + */ + interface PercentilesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.Percentiles listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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 List<PercentileMetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PercentileMetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PercentileMetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listMetricsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/UsageInner.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/UsageInner.java new file mode 100644 index 00000000000..2adbf4d4a64 --- /dev/null +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/UsageInner.java @@ -0,0 +1,107 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.implementation; + +import com.microsoft.azure.management.cosmosdb.UnitType; +import com.microsoft.azure.management.cosmosdb.MetricName; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The usage data for a usage request. + */ +public class UsageInner { + /** + * The unit of the metric. Possible values include: 'Count', 'Bytes', + * 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + * 'Milliseconds'. + */ + @JsonProperty(value = "unit") + private UnitType unit; + + /** + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /** + * The quota period used to summarize the usage values. + */ + @JsonProperty(value = "quotaPeriod", access = JsonProperty.Access.WRITE_ONLY) + private String quotaPeriod; + + /** + * Maximum value for this metric. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Integer limit; + + /** + * Current value for this metric. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Integer currentValue; + + /** + * Get the unit value. + * + * @return the unit value + */ + public UnitType unit() { + return this.unit; + } + + /** + * Set the unit value. + * + * @param unit the unit value to set + * @return the UsageInner object itself. + */ + public UsageInner withUnit(UnitType unit) { + this.unit = unit; + return this; + } + + /** + * Get the name value. + * + * @return the name value + */ + public MetricName name() { + return this.name; + } + + /** + * Get the quotaPeriod value. + * + * @return the quotaPeriod value + */ + public String quotaPeriod() { + return this.quotaPeriod; + } + + /** + * Get the limit value. + * + * @return the limit value + */ + public Integer limit() { + return this.limit; + } + + /** + * Get the currentValue value. + * + * @return the currentValue value + */ + public Integer currentValue() { + return this.currentValue; + } + +} diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/package-info.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/package-info.java index 562c9e45637..50e395b9e96 100755 --- a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/package-info.java +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/implementation/package-info.java @@ -5,7 +5,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the implementation classes for DocumentDB. - * Azure DocumentDB Database Service Resource Provider REST API. + * This package contains the implementation classes for CosmosDB. + * Azure Cosmos DB Database Service Resource Provider REST API. */ package com.microsoft.azure.management.cosmosdb.implementation; diff --git a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/package-info.java b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/package-info.java index 0cd26985a38..bc833e5f710 100755 --- a/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/package-info.java +++ b/azure-mgmt-cosmosdb/src/main/java/com/microsoft/azure/management/cosmosdb/package-info.java @@ -5,7 +5,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the classes for DocumentDB. - * Azure DocumentDB Database Service Resource Provider REST API. + * This package contains the classes for CosmosDB. + * Azure Cosmos DB Database Service Resource Provider REST API. */ package com.microsoft.azure.management.cosmosdb;