diff --git a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/CheckSkuAvailabilityParameter.java b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/CheckSkuAvailabilityParameter.java index f4a7cb70a9a..7696093595b 100644 --- a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/CheckSkuAvailabilityParameter.java +++ b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/CheckSkuAvailabilityParameter.java @@ -22,11 +22,13 @@ public class CheckSkuAvailabilityParameter { private List skus; /** - * The Kind of the resource. Possible values include: 'Academic', - * 'Bing.Autosuggest', 'Bing.Search', 'Bing.Speech', 'Bing.SpellCheck', - * 'ComputerVision', 'ContentModerator', 'CustomSpeech', 'Emotion', 'Face', - * 'LUIS', 'Recommendations', 'SpeakerRecognition', 'Speech', - * 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM'. + * The Kind of the resource. Possible values include: + * 'Bing.Autosuggest.v7', 'Bing.CustomSearch', 'Bing.Search.v7', + * 'Bing.Speech', 'Bing.SpellCheck.v7', 'ComputerVision', + * 'ContentModerator', 'CustomSpeech', 'CustomVision.Prediction', + * 'CustomVision.Training', 'Emotion', 'Face', 'LUIS', 'QnAMaker', + * 'SpeakerRecognition', 'SpeechTranslation', 'TextAnalytics', + * 'TextTranslation', 'WebLM'. */ @JsonProperty(value = "kind", required = true) private Kind kind; diff --git a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/CheckSkuAvailabilityResult.java b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/CheckSkuAvailabilityResult.java index 07f8c532e26..ff7f4d01e50 100644 --- a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/CheckSkuAvailabilityResult.java +++ b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/CheckSkuAvailabilityResult.java @@ -15,11 +15,13 @@ */ public class CheckSkuAvailabilityResult { /** - * The Kind of the resource. Possible values include: 'Academic', - * 'Bing.Autosuggest', 'Bing.Search', 'Bing.Speech', 'Bing.SpellCheck', - * 'ComputerVision', 'ContentModerator', 'CustomSpeech', 'Emotion', 'Face', - * 'LUIS', 'Recommendations', 'SpeakerRecognition', 'Speech', - * 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM'. + * The Kind of the resource. Possible values include: + * 'Bing.Autosuggest.v7', 'Bing.CustomSearch', 'Bing.Search.v7', + * 'Bing.Speech', 'Bing.SpellCheck.v7', 'ComputerVision', + * 'ContentModerator', 'CustomSpeech', 'CustomVision.Prediction', + * 'CustomVision.Training', 'Emotion', 'Face', 'LUIS', 'QnAMaker', + * 'SpeakerRecognition', 'SpeechTranslation', 'TextAnalytics', + * 'TextTranslation', 'WebLM'. */ @JsonProperty(value = "kind") private Kind kind; diff --git a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/Kind.java b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/Kind.java index 3c267eff63e..298df8e21a9 100644 --- a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/Kind.java +++ b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/Kind.java @@ -8,100 +8,85 @@ package com.microsoft.azure.management.cognitiveservices; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; /** * Defines values for Kind. */ -public final class Kind { - /** Static value Academic for Kind. */ - public static final Kind ACADEMIC = new Kind("Academic"); +public final class Kind extends ExpandableStringEnum { + /** Static value Bing.Autosuggest.v7 for Kind. */ + public static final Kind BING_AUTOSUGGESTV7 = fromString("Bing.Autosuggest.v7"); - /** Static value Bing.Autosuggest for Kind. */ - public static final Kind BING_AUTOSUGGEST = new Kind("Bing.Autosuggest"); + /** Static value Bing.CustomSearch for Kind. */ + public static final Kind BING_CUSTOM_SEARCH = fromString("Bing.CustomSearch"); - /** Static value Bing.Search for Kind. */ - public static final Kind BING_SEARCH = new Kind("Bing.Search"); + /** Static value Bing.Search.v7 for Kind. */ + public static final Kind BING_SEARCHV7 = fromString("Bing.Search.v7"); /** Static value Bing.Speech for Kind. */ - public static final Kind BING_SPEECH = new Kind("Bing.Speech"); + public static final Kind BING_SPEECH = fromString("Bing.Speech"); - /** Static value Bing.SpellCheck for Kind. */ - public static final Kind BING_SPELL_CHECK = new Kind("Bing.SpellCheck"); + /** Static value Bing.SpellCheck.v7 for Kind. */ + public static final Kind BING_SPELL_CHECKV7 = fromString("Bing.SpellCheck.v7"); /** Static value ComputerVision for Kind. */ - public static final Kind COMPUTER_VISION = new Kind("ComputerVision"); + public static final Kind COMPUTER_VISION = fromString("ComputerVision"); /** Static value ContentModerator for Kind. */ - public static final Kind CONTENT_MODERATOR = new Kind("ContentModerator"); + public static final Kind CONTENT_MODERATOR = fromString("ContentModerator"); /** Static value CustomSpeech for Kind. */ - public static final Kind CUSTOM_SPEECH = new Kind("CustomSpeech"); + public static final Kind CUSTOM_SPEECH = fromString("CustomSpeech"); + + /** Static value CustomVision.Prediction for Kind. */ + public static final Kind CUSTOM_VISION_PREDICTION = fromString("CustomVision.Prediction"); + + /** Static value CustomVision.Training for Kind. */ + public static final Kind CUSTOM_VISION_TRAINING = fromString("CustomVision.Training"); /** Static value Emotion for Kind. */ - public static final Kind EMOTION = new Kind("Emotion"); + public static final Kind EMOTION = fromString("Emotion"); /** Static value Face for Kind. */ - public static final Kind FACE = new Kind("Face"); + public static final Kind FACE = fromString("Face"); /** Static value LUIS for Kind. */ - public static final Kind LUIS = new Kind("LUIS"); + public static final Kind LUIS = fromString("LUIS"); - /** Static value Recommendations for Kind. */ - public static final Kind RECOMMENDATIONS = new Kind("Recommendations"); + /** Static value QnAMaker for Kind. */ + public static final Kind QN_AMAKER = fromString("QnAMaker"); /** Static value SpeakerRecognition for Kind. */ - public static final Kind SPEAKER_RECOGNITION = new Kind("SpeakerRecognition"); - - /** Static value Speech for Kind. */ - public static final Kind SPEECH = new Kind("Speech"); + public static final Kind SPEAKER_RECOGNITION = fromString("SpeakerRecognition"); /** Static value SpeechTranslation for Kind. */ - public static final Kind SPEECH_TRANSLATION = new Kind("SpeechTranslation"); + public static final Kind SPEECH_TRANSLATION = fromString("SpeechTranslation"); /** Static value TextAnalytics for Kind. */ - public static final Kind TEXT_ANALYTICS = new Kind("TextAnalytics"); + public static final Kind TEXT_ANALYTICS = fromString("TextAnalytics"); /** Static value TextTranslation for Kind. */ - public static final Kind TEXT_TRANSLATION = new Kind("TextTranslation"); + public static final Kind TEXT_TRANSLATION = fromString("TextTranslation"); /** Static value WebLM for Kind. */ - public static final Kind WEB_LM = new Kind("WebLM"); - - private String value; + public static final Kind WEB_LM = fromString("WebLM"); /** - * Creates a custom value for Kind. - * @param value the custom value + * Creates or finds a Kind from its string representation. + * @param name a name to look for + * @return the corresponding Kind */ - public Kind(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return value; - } - - @Override - public int hashCode() { - return value.hashCode(); + @JsonCreator + public static Kind fromString(String name) { + return fromString(name, Kind.class); } - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Kind)) { - return false; - } - if (obj == this) { - return true; - } - Kind rhs = (Kind) obj; - if (value == null) { - return rhs.value == null; - } else { - return value.equals(rhs.value); - } + /** + * @return known Kind values + */ + public static Collection values() { + return values(Kind.class); } } diff --git a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/MetricName.java b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/MetricName.java new file mode 100644 index 00000000000..17d8af9741e --- /dev/null +++ b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/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.cognitiveservices; + +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-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/ProvisioningState.java b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/ProvisioningState.java index d2375f7a635..848e92ac6bf 100644 --- a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/ProvisioningState.java +++ b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/ProvisioningState.java @@ -8,52 +8,46 @@ package com.microsoft.azure.management.cognitiveservices; +import java.util.Collection; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import com.microsoft.rest.ExpandableStringEnum; /** * Defines values for ProvisioningState. */ -public enum ProvisioningState { - /** Enum value Creating. */ - CREATING("Creating"), +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Creating for ProvisioningState. */ + public static final ProvisioningState CREATING = fromString("Creating"); - /** Enum value ResolvingDNS. */ - RESOLVING_DNS("ResolvingDNS"), + /** Static value ResolvingDNS for ProvisioningState. */ + public static final ProvisioningState RESOLVING_DNS = fromString("ResolvingDNS"); - /** Enum value Succeeded. */ - SUCCEEDED("Succeeded"), + /** Static value Moving for ProvisioningState. */ + public static final ProvisioningState MOVING = fromString("Moving"); - /** Enum value Failed. */ - FAILED("Failed"); + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); - /** The actual serialized value for a ProvisioningState instance. */ - private String value; + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); - ProvisioningState(String value) { - this.value = value; - } + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); /** - * Parses a serialized value to a ProvisioningState instance. - * - * @param value the serialized value to parse. - * @return the parsed ProvisioningState object, or null if unable to parse. + * Creates or finds a ProvisioningState from its string representation. + * @param name a name to look for + * @return the corresponding ProvisioningState */ @JsonCreator - public static ProvisioningState fromString(String value) { - ProvisioningState[] items = ProvisioningState.values(); - for (ProvisioningState item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** + * @return known ProvisioningState values + */ + public static Collection values() { + return values(ProvisioningState.class); } } diff --git a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/QuotaUsageStatus.java b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/QuotaUsageStatus.java new file mode 100644 index 00000000000..f715ffec809 --- /dev/null +++ b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/QuotaUsageStatus.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.cognitiveservices; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for QuotaUsageStatus. + */ +public final class QuotaUsageStatus extends ExpandableStringEnum { + /** Static value Included for QuotaUsageStatus. */ + public static final QuotaUsageStatus INCLUDED = fromString("Included"); + + /** Static value Blocked for QuotaUsageStatus. */ + public static final QuotaUsageStatus BLOCKED = fromString("Blocked"); + + /** Static value InOverage for QuotaUsageStatus. */ + public static final QuotaUsageStatus IN_OVERAGE = fromString("InOverage"); + + /** Static value Unknown for QuotaUsageStatus. */ + public static final QuotaUsageStatus UNKNOWN = fromString("Unknown"); + + /** + * Creates or finds a QuotaUsageStatus from its string representation. + * @param name a name to look for + * @return the corresponding QuotaUsageStatus + */ + @JsonCreator + public static QuotaUsageStatus fromString(String name) { + return fromString(name, QuotaUsageStatus.class); + } + + /** + * @return known QuotaUsageStatus values + */ + public static Collection values() { + return values(QuotaUsageStatus.class); + } +} diff --git a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/SkuName.java b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/SkuName.java index 0362d920432..543f2b488c5 100644 --- a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/SkuName.java +++ b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/SkuName.java @@ -8,79 +8,61 @@ package com.microsoft.azure.management.cognitiveservices; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; /** * Defines values for SkuName. */ -public final class SkuName { +public final class SkuName extends ExpandableStringEnum { /** Static value F0 for SkuName. */ - public static final SkuName F0 = new SkuName("F0"); + public static final SkuName F0 = fromString("F0"); /** Static value P0 for SkuName. */ - public static final SkuName P0 = new SkuName("P0"); + public static final SkuName P0 = fromString("P0"); /** Static value P1 for SkuName. */ - public static final SkuName P1 = new SkuName("P1"); + public static final SkuName P1 = fromString("P1"); /** Static value P2 for SkuName. */ - public static final SkuName P2 = new SkuName("P2"); + public static final SkuName P2 = fromString("P2"); /** Static value S0 for SkuName. */ - public static final SkuName S0 = new SkuName("S0"); + public static final SkuName S0 = fromString("S0"); /** Static value S1 for SkuName. */ - public static final SkuName S1 = new SkuName("S1"); + public static final SkuName S1 = fromString("S1"); /** Static value S2 for SkuName. */ - public static final SkuName S2 = new SkuName("S2"); + public static final SkuName S2 = fromString("S2"); /** Static value S3 for SkuName. */ - public static final SkuName S3 = new SkuName("S3"); + public static final SkuName S3 = fromString("S3"); /** Static value S4 for SkuName. */ - public static final SkuName S4 = new SkuName("S4"); + public static final SkuName S4 = fromString("S4"); /** Static value S5 for SkuName. */ - public static final SkuName S5 = new SkuName("S5"); + public static final SkuName S5 = fromString("S5"); /** Static value S6 for SkuName. */ - public static final SkuName S6 = new SkuName("S6"); - - private String value; + public static final SkuName S6 = fromString("S6"); /** - * Creates a custom value for SkuName. - * @param value the custom value + * Creates or finds a SkuName from its string representation. + * @param name a name to look for + * @return the corresponding SkuName */ - public SkuName(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return value; + @JsonCreator + public static SkuName fromString(String name) { + return fromString(name, SkuName.class); } - @Override - public int hashCode() { - return value.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof SkuName)) { - return false; - } - if (obj == this) { - return true; - } - SkuName rhs = (SkuName) obj; - if (value == null) { - return rhs.value == null; - } else { - return value.equals(rhs.value); - } + /** + * @return known SkuName values + */ + public static Collection values() { + return values(SkuName.class); } } diff --git a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/UnitType.java b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/UnitType.java new file mode 100644 index 00000000000..45c8cb8275f --- /dev/null +++ b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/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.cognitiveservices; + +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-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/Usage.java b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/Usage.java new file mode 100644 index 00000000000..5c438bc666b --- /dev/null +++ b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/Usage.java @@ -0,0 +1,147 @@ +/** + * 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.cognitiveservices; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The usage data for a usage request. + */ +public class Usage { + /** + * 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 Double limit; + + /** + * Current value for this metric. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Double currentValue; + + /** + * Next reset time for current quota. + */ + @JsonProperty(value = "nextResetTime", access = JsonProperty.Access.WRITE_ONLY) + private String nextResetTime; + + /** + * Cognitive Services account quota usage status. Possible values include: + * 'Included', 'Blocked', 'InOverage', 'Unknown'. + */ + @JsonProperty(value = "status") + private QuotaUsageStatus status; + + /** + * 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 Usage object itself. + */ + public Usage 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 Double limit() { + return this.limit; + } + + /** + * Get the currentValue value. + * + * @return the currentValue value + */ + public Double currentValue() { + return this.currentValue; + } + + /** + * Get the nextResetTime value. + * + * @return the nextResetTime value + */ + public String nextResetTime() { + return this.nextResetTime; + } + + /** + * Get the status value. + * + * @return the status value + */ + public QuotaUsageStatus status() { + return this.status; + } + + /** + * Set the status value. + * + * @param status the status value to set + * @return the Usage object itself. + */ + public Usage withStatus(QuotaUsageStatus status) { + this.status = status; + return this; + } + +} diff --git a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/AccountsInner.java b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/AccountsInner.java index 9197ebaabbf..715cf04ad10 100644 --- a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/AccountsInner.java +++ b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/AccountsInner.java @@ -8,23 +8,36 @@ package com.microsoft.azure.management.cognitiveservices.implementation; +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsGet; +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsDelete; import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsListing; import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.cognitiveservices.CognitiveServicesAccountUpdateParameters; import com.microsoft.azure.management.cognitiveservices.ErrorException; +import com.microsoft.azure.management.cognitiveservices.KeyName; +import com.microsoft.azure.management.cognitiveservices.RegenerateKeyParameters; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; +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; import retrofit2.http.Header; import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; import retrofit2.http.Query; import retrofit2.http.Url; import retrofit2.Response; @@ -35,7 +48,7 @@ * An instance of this class provides access to all the operations defined * in Accounts. */ -public class AccountsInner implements InnerSupportsListing { +public class AccountsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { /** The Retrofit service to perform REST calls. */ private AccountsService service; /** The service client containing this operation class. */ @@ -57,6 +70,22 @@ public AccountsInner(Retrofit retrofit, CognitiveServicesManagementClientImpl cl * used by Retrofit to perform actually REST calls. */ interface AccountsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cognitiveservices.Accounts create" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Body CognitiveServicesAccountCreateParametersInner parameters, @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.cognitiveservices.Accounts update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CognitiveServicesAccountUpdateParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cognitiveservices.Accounts delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @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.cognitiveservices.Accounts getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @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.cognitiveservices.Accounts listByResourceGroup" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts") Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -65,6 +94,22 @@ interface AccountsService { @GET("subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/accounts") Observable> list(@Path("subscriptionId") String subscriptionId, @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.cognitiveservices.Accounts listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/listKeys") + Observable> listKeys(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @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.cognitiveservices.Accounts regenerateKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/regenerateKey") + Observable> regenerateKey(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegenerateKeyParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cognitiveservices.Accounts listSkus" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/skus") + Observable> listSkus(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @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.cognitiveservices.Accounts getUsages" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/usages") + Observable> getUsages(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @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.cognitiveservices.Accounts listByResourceGroupNext" }) @GET Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -75,6 +120,456 @@ interface AccountsService { } + /** + * Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param parameters The parameters to provide for the created account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CognitiveServicesAccountInner object if successful. + */ + public CognitiveServicesAccountInner create(String resourceGroupName, String accountName, CognitiveServicesAccountCreateParametersInner parameters) { + return createWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body(); + } + + /** + * Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param parameters The parameters to provide for the created 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 createAsync(String resourceGroupName, String accountName, CognitiveServicesAccountCreateParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, accountName, parameters), serviceCallback); + } + + /** + * Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param parameters The parameters to provide for the created account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CognitiveServicesAccountInner object + */ + public Observable createAsync(String resourceGroupName, String accountName, CognitiveServicesAccountCreateParametersInner parameters) { + return createWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1, CognitiveServicesAccountInner>() { + @Override + public CognitiveServicesAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param parameters The parameters to provide for the created account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CognitiveServicesAccountInner object + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String accountName, CognitiveServicesAccountCreateParametersInner parameters) { + 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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.create(resourceGroupName, accountName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Updates a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CognitiveServicesAccountInner object if successful. + */ + public CognitiveServicesAccountInner update(String resourceGroupName, String accountName) { + return updateWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Updates a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services 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 updateAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Updates a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CognitiveServicesAccountInner object + */ + public Observable updateAsync(String resourceGroupName, String accountName) { + return updateWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, CognitiveServicesAccountInner>() { + @Override + public CognitiveServicesAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CognitiveServicesAccountInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String accountName) { + 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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final SkuInner sku = null; + final Map tags = null; + CognitiveServicesAccountUpdateParameters parameters = new CognitiveServicesAccountUpdateParameters(); + parameters.withSku(null); + parameters.withTags(null); + return service.update(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param sku Gets or sets the SKU of the resource. + * @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CognitiveServicesAccountInner object if successful. + */ + public CognitiveServicesAccountInner update(String resourceGroupName, String accountName, SkuInner sku, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, sku, tags).toBlocking().single().body(); + } + + /** + * Updates a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param sku Gets or sets the SKU of the resource. + * @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. + * @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 updateAsync(String resourceGroupName, String accountName, SkuInner sku, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName, sku, tags), serviceCallback); + } + + /** + * Updates a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param sku Gets or sets the SKU of the resource. + * @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CognitiveServicesAccountInner object + */ + public Observable updateAsync(String resourceGroupName, String accountName, SkuInner sku, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, sku, tags).map(new Func1, CognitiveServicesAccountInner>() { + @Override + public CognitiveServicesAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param sku Gets or sets the SKU of the resource. + * @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CognitiveServicesAccountInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String accountName, SkuInner sku, Map tags) { + 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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(sku); + Validator.validate(tags); + CognitiveServicesAccountUpdateParameters parameters = new CognitiveServicesAccountUpdateParameters(); + parameters.withSku(sku); + parameters.withTags(tags); + return service.update(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Deletes a Cognitive Services account from the resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String accountName) { + deleteWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Deletes a Cognitive Services account from the resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services 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 deleteAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Deletes a Cognitive Services account from the resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String accountName) { + return deleteWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a Cognitive Services account from the resource group. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String accountName) { + 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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Returns a Cognitive Services account specified by the parameters. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CognitiveServicesAccountInner object if successful. + */ + public CognitiveServicesAccountInner getByResourceGroup(String resourceGroupName, String accountName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Returns a Cognitive Services account specified by the parameters. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services 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 getByResourceGroupAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Returns a Cognitive Services account specified by the parameters. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CognitiveServicesAccountInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String accountName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, CognitiveServicesAccountInner>() { + @Override + public CognitiveServicesAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns a Cognitive Services account specified by the parameters. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CognitiveServicesAccountInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String accountName) { + 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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, accountName, this.client.subscriptionId(), 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); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + /** * Returns all the resources of a particular type belonging to a resource group. * @@ -297,6 +792,359 @@ private ServiceResponse> listDelegate(Re .build(response); } + /** + * Lists the account keys for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CognitiveServicesAccountKeysInner object if successful. + */ + public CognitiveServicesAccountKeysInner listKeys(String resourceGroupName, String accountName) { + return listKeysWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Lists the account keys for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services 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 listKeysAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Lists the account keys for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CognitiveServicesAccountKeysInner object + */ + public Observable listKeysAsync(String resourceGroupName, String accountName) { + return listKeysWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, CognitiveServicesAccountKeysInner>() { + @Override + public CognitiveServicesAccountKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the account keys for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CognitiveServicesAccountKeysInner object + */ + public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String accountName) { + 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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listKeys(resourceGroupName, accountName, this.client.subscriptionId(), 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); + } + } + }); + } + + private ServiceResponse listKeysDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Regenerates the specified account key for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param keyName key name to generate (Key1|Key2). Possible values include: 'Key1', 'Key2' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CognitiveServicesAccountKeysInner object if successful. + */ + public CognitiveServicesAccountKeysInner regenerateKey(String resourceGroupName, String accountName, KeyName keyName) { + return regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyName).toBlocking().single().body(); + } + + /** + * Regenerates the specified account key for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param keyName key name to generate (Key1|Key2). Possible values include: 'Key1', 'Key2' + * @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, KeyName keyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyName), serviceCallback); + } + + /** + * Regenerates the specified account key for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param keyName key name to generate (Key1|Key2). Possible values include: 'Key1', 'Key2' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CognitiveServicesAccountKeysInner object + */ + public Observable regenerateKeyAsync(String resourceGroupName, String accountName, KeyName keyName) { + return regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyName).map(new Func1, CognitiveServicesAccountKeysInner>() { + @Override + public CognitiveServicesAccountKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the specified account key for the specified Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @param keyName key name to generate (Key1|Key2). Possible values include: 'Key1', 'Key2' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CognitiveServicesAccountKeysInner object + */ + public Observable> regenerateKeyWithServiceResponseAsync(String resourceGroupName, String accountName, KeyName keyName) { + 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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (keyName == null) { + throw new IllegalArgumentException("Parameter keyName is required and cannot be null."); + } + RegenerateKeyParameters parameters = new RegenerateKeyParameters(); + parameters.withKeyName(keyName); + return service.regenerateKey(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateKeyDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * List available SKUs for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CognitiveServicesAccountEnumerateSkusResultInner object if successful. + */ + public CognitiveServicesAccountEnumerateSkusResultInner listSkus(String resourceGroupName, String accountName) { + return listSkusWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * List available SKUs for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services 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 listSkusAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listSkusWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * List available SKUs for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CognitiveServicesAccountEnumerateSkusResultInner object + */ + public Observable listSkusAsync(String resourceGroupName, String accountName) { + return listSkusWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, CognitiveServicesAccountEnumerateSkusResultInner>() { + @Override + public CognitiveServicesAccountEnumerateSkusResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * List available SKUs for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CognitiveServicesAccountEnumerateSkusResultInner object + */ + public Observable> listSkusWithServiceResponseAsync(String resourceGroupName, String accountName) { + 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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listSkus(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listSkusDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listSkusDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Get usages for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UsagesResultInner object if successful. + */ + public UsagesResultInner getUsages(String resourceGroupName, String accountName) { + return getUsagesWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Get usages for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services 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 getUsagesAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getUsagesWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Get usages for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UsagesResultInner object + */ + public Observable getUsagesAsync(String resourceGroupName, String accountName) { + return getUsagesWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, UsagesResultInner>() { + @Override + public UsagesResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get usages for the requested Cognitive Services account. + * + * @param resourceGroupName The name of the resource group within the user's subscription. + * @param accountName The name of Cognitive Services account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UsagesResultInner object + */ + public Observable> getUsagesWithServiceResponseAsync(String resourceGroupName, String accountName) { + 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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getUsages(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.filter(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getUsagesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getUsagesDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + /** * Returns all the resources of a particular type belonging to a resource group. * diff --git a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/CheckSkuAvailabilitysInner.java b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/CheckSkuAvailabilitysInner.java index 8b4675a2824..7bda6d89827 100644 --- a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/CheckSkuAvailabilitysInner.java +++ b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/CheckSkuAvailabilitysInner.java @@ -66,43 +66,46 @@ interface CheckSkuAvailabilitysService { /** * Check available SKUs. * + * @param location Resource location. * @param skus The SKU of the resource. - * @param kind The Kind of the resource. Possible values include: 'Academic', 'Bing.Autosuggest', 'Bing.Search', 'Bing.Speech', 'Bing.SpellCheck', 'ComputerVision', 'ContentModerator', 'CustomSpeech', 'Emotion', 'Face', 'LUIS', 'Recommendations', 'SpeakerRecognition', 'Speech', 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM' + * @param kind The Kind of the resource. Possible values include: 'Bing.Autosuggest.v7', 'Bing.CustomSearch', 'Bing.Search.v7', 'Bing.Speech', 'Bing.SpellCheck.v7', 'ComputerVision', 'ContentModerator', 'CustomSpeech', 'CustomVision.Prediction', 'CustomVision.Training', 'Emotion', 'Face', 'LUIS', 'QnAMaker', 'SpeakerRecognition', 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM' * @param type The Type of the resource. * @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 CheckSkuAvailabilityResultListInner object if successful. */ - public CheckSkuAvailabilityResultListInner list(List skus, Kind kind, String type) { - return listWithServiceResponseAsync(skus, kind, type).toBlocking().single().body(); + public CheckSkuAvailabilityResultListInner list(String location, List skus, Kind kind, String type) { + return listWithServiceResponseAsync(location, skus, kind, type).toBlocking().single().body(); } /** * Check available SKUs. * + * @param location Resource location. * @param skus The SKU of the resource. - * @param kind The Kind of the resource. Possible values include: 'Academic', 'Bing.Autosuggest', 'Bing.Search', 'Bing.Speech', 'Bing.SpellCheck', 'ComputerVision', 'ContentModerator', 'CustomSpeech', 'Emotion', 'Face', 'LUIS', 'Recommendations', 'SpeakerRecognition', 'Speech', 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM' + * @param kind The Kind of the resource. Possible values include: 'Bing.Autosuggest.v7', 'Bing.CustomSearch', 'Bing.Search.v7', 'Bing.Speech', 'Bing.SpellCheck.v7', 'ComputerVision', 'ContentModerator', 'CustomSpeech', 'CustomVision.Prediction', 'CustomVision.Training', 'Emotion', 'Face', 'LUIS', 'QnAMaker', 'SpeakerRecognition', 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM' * @param type The Type of the resource. * @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(List skus, Kind kind, String type, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listWithServiceResponseAsync(skus, kind, type), serviceCallback); + public ServiceFuture listAsync(String location, List skus, Kind kind, String type, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(location, skus, kind, type), serviceCallback); } /** * Check available SKUs. * + * @param location Resource location. * @param skus The SKU of the resource. - * @param kind The Kind of the resource. Possible values include: 'Academic', 'Bing.Autosuggest', 'Bing.Search', 'Bing.Speech', 'Bing.SpellCheck', 'ComputerVision', 'ContentModerator', 'CustomSpeech', 'Emotion', 'Face', 'LUIS', 'Recommendations', 'SpeakerRecognition', 'Speech', 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM' + * @param kind The Kind of the resource. Possible values include: 'Bing.Autosuggest.v7', 'Bing.CustomSearch', 'Bing.Search.v7', 'Bing.Speech', 'Bing.SpellCheck.v7', 'ComputerVision', 'ContentModerator', 'CustomSpeech', 'CustomVision.Prediction', 'CustomVision.Training', 'Emotion', 'Face', 'LUIS', 'QnAMaker', 'SpeakerRecognition', 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', 'WebLM' * @param type The Type of the resource. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the CheckSkuAvailabilityResultListInner object */ - public Observable listAsync(List skus, Kind kind, String type) { - return listWithServiceResponseAsync(skus, kind, type).map(new Func1, CheckSkuAvailabilityResultListInner>() { + public Observable listAsync(String location, List skus, Kind kind, String type) { + return listWithServiceResponseAsync(location, skus, kind, type).map(new Func1, CheckSkuAvailabilityResultListInner>() { @Override public CheckSkuAvailabilityResultListInner call(ServiceResponse response) { return response.body(); @@ -113,18 +116,19 @@ public CheckSkuAvailabilityResultListInner call(ServiceResponse> listWithServiceResponseAsync(List skus, Kind kind, String type) { + public Observable> listWithServiceResponseAsync(String location, List skus, Kind kind, String type) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (this.client.location() == null) { - throw new IllegalArgumentException("Parameter this.client.location() is required and cannot be null."); + if (location == null) { + throw new IllegalArgumentException("Parameter location is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); @@ -143,7 +147,7 @@ public Observable> listWith parameters.withSkus(skus); parameters.withKind(kind); parameters.withType(type); - return service.list(this.client.subscriptionId(), this.client.location(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + return service.list(this.client.subscriptionId(), location, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { diff --git a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/CognitiveServicesAccountCreateParametersInner.java b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/CognitiveServicesAccountCreateParametersInner.java index d0dd9573f6e..711d6ce61e7 100644 --- a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/CognitiveServicesAccountCreateParametersInner.java +++ b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/CognitiveServicesAccountCreateParametersInner.java @@ -24,11 +24,12 @@ public class CognitiveServicesAccountCreateParametersInner { /** * Required. Gets or sets the Kind of the resource. Possible values - * include: 'Academic', 'Bing.Autosuggest', 'Bing.Search', 'Bing.Speech', - * 'Bing.SpellCheck', 'ComputerVision', 'ContentModerator', 'CustomSpeech', - * 'Emotion', 'Face', 'LUIS', 'Recommendations', 'SpeakerRecognition', - * 'Speech', 'SpeechTranslation', 'TextAnalytics', 'TextTranslation', - * 'WebLM'. + * include: 'Bing.Autosuggest.v7', 'Bing.CustomSearch', 'Bing.Search.v7', + * 'Bing.Speech', 'Bing.SpellCheck.v7', 'ComputerVision', + * 'ContentModerator', 'CustomSpeech', 'CustomVision.Prediction', + * 'CustomVision.Training', 'Emotion', 'Face', 'LUIS', 'QnAMaker', + * 'SpeakerRecognition', 'SpeechTranslation', 'TextAnalytics', + * 'TextTranslation', 'WebLM'. */ @JsonProperty(value = "kind", required = true) private Kind kind; diff --git a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/CognitiveServicesAccountInner.java b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/CognitiveServicesAccountInner.java index 0158856cde3..1b032530000 100644 --- a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/CognitiveServicesAccountInner.java +++ b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/CognitiveServicesAccountInner.java @@ -28,7 +28,7 @@ public class CognitiveServicesAccountInner { /** * The id of the created account. */ - @JsonProperty(value = "id") + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) private String id; /** @@ -46,13 +46,13 @@ public class CognitiveServicesAccountInner { /** * The name of the created account. */ - @JsonProperty(value = "name") + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) private String name; /** * Gets the status of the cognitive services account at the time the * operation was called. Possible values include: 'Creating', - * 'ResolvingDNS', 'Succeeded', 'Failed'. + * 'ResolvingDNS', 'Moving', 'Deleting', 'Succeeded', 'Failed'. */ @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; @@ -88,7 +88,7 @@ public class CognitiveServicesAccountInner { /** * Resource type. */ - @JsonProperty(value = "type") + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) private String type; /** @@ -120,17 +120,6 @@ public String id() { return this.id; } - /** - * Set the id value. - * - * @param id the id value to set - * @return the CognitiveServicesAccountInner object itself. - */ - public CognitiveServicesAccountInner withId(String id) { - this.id = id; - return this; - } - /** * Get the kind value. * @@ -180,17 +169,6 @@ public String name() { return this.name; } - /** - * Set the name value. - * - * @param name the name value to set - * @return the CognitiveServicesAccountInner object itself. - */ - public CognitiveServicesAccountInner withName(String name) { - this.name = name; - return this; - } - /** * Get the provisioningState value. * @@ -289,15 +267,4 @@ public String type() { return this.type; } - /** - * Set the type value. - * - * @param type the type value to set - * @return the CognitiveServicesAccountInner object itself. - */ - public CognitiveServicesAccountInner withType(String type) { - this.type = type; - return this; - } - } diff --git a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/CognitiveServicesManagementClientImpl.java b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/CognitiveServicesManagementClientImpl.java index ec7bfc30c7a..01a1c75ce12 100644 --- a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/CognitiveServicesManagementClientImpl.java +++ b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/CognitiveServicesManagementClientImpl.java @@ -63,26 +63,26 @@ public String apiVersion() { return this.apiVersion; } - /** Resource location. */ - private String location; + /** 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). */ + private String filter; /** - * Gets Resource location. + * Gets 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). * - * @return the location value. + * @return the filter value. */ - public String location() { - return this.location; + public String filter() { + return this.filter; } /** - * Sets Resource location. + * Sets 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 location the location value. + * @param filter the filter value. * @return the service client itself */ - public CognitiveServicesManagementClientImpl withLocation(String location) { - this.location = location; + public CognitiveServicesManagementClientImpl withFilter(String filter) { + this.filter = filter; return this; } @@ -155,19 +155,6 @@ public CognitiveServicesManagementClientImpl withGenerateClientRequestId(boolean return this; } - /** - * The CognitiveServicesAccountsInner object to access its operations. - */ - private CognitiveServicesAccountsInner cognitiveServicesAccounts; - - /** - * Gets the CognitiveServicesAccountsInner object to access its operations. - * @return the CognitiveServicesAccountsInner object. - */ - public CognitiveServicesAccountsInner cognitiveServicesAccounts() { - return this.cognitiveServicesAccounts; - } - /** * The AccountsInner object to access its operations. */ @@ -242,7 +229,6 @@ protected void initialize() { this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; - this.cognitiveServicesAccounts = new CognitiveServicesAccountsInner(restClient().retrofit(), this); this.accounts = new AccountsInner(restClient().retrofit(), this); this.operations = new OperationsInner(restClient().retrofit(), this); this.checkSkuAvailabilitys = new CheckSkuAvailabilitysInner(restClient().retrofit(), this); diff --git a/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/UsagesResultInner.java b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/UsagesResultInner.java new file mode 100644 index 00000000000..ebf258060a9 --- /dev/null +++ b/azure-mgmt-cognitiveservices/src/main/java/com/microsoft/azure/management/cognitiveservices/implementation/UsagesResultInner.java @@ -0,0 +1,34 @@ +/** + * 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.cognitiveservices.implementation; + +import java.util.List; +import com.microsoft.azure.management.cognitiveservices.Usage; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The response to a list usage request. + */ +public class UsagesResultInner { + /** + * The list of usages for Cognitive Service account. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value value. + * + * @return the value value + */ + public List value() { + return this.value; + } + +}