diff --git a/eng/mgmt/automation/api-specs.yaml b/eng/mgmt/automation/api-specs.yaml index 15d6e6fbdedf..6a372d671809 100644 --- a/eng/mgmt/automation/api-specs.yaml +++ b/eng/mgmt/automation/api-specs.yaml @@ -21,6 +21,10 @@ containerregistry: suffix: generated containerservice: suffix: generated +containerservice/Microsoft.ContainerService/aks: + suffix: generated +containerservice/Microsoft.ContainerService/fleet: + service: containerservicefleet cosmos-db: service: cosmos suffix: generated diff --git a/eng/mgmt/automation/generate.py b/eng/mgmt/automation/generate.py index 7af7074670ab..cb9107bd2722 100755 --- a/eng/mgmt/automation/generate.py +++ b/eng/mgmt/automation/generate.py @@ -19,6 +19,7 @@ generate, get_and_update_service_from_api_specs, get_suffix_from_api_specs, + update_spec, ) os.chdir(pwd) @@ -117,16 +118,17 @@ def sdk_automation_autorest(config: dict) -> List[dict]: for readme in config['relatedReadmeMdFiles']: match = re.search( - 'specification/([^/]+)/resource-manager/readme.md', + 'specification/([^/]+)/resource-manager(/.*)*/readme.md', readme, re.IGNORECASE, ) if not match: logging.info( - '[Skip] readme path does not format as specification/*/resource-manager/readme.md' + '[Skip] readme path does not format as specification/*/resource-manager/*/readme.md' ) else: spec = match.group(1) + spec = update_spec(spec, match.group(2)) service = get_and_update_service_from_api_specs( api_specs_file, spec) @@ -209,7 +211,7 @@ def main(): readme = args['readme'] match = re.match( - 'specification/([^/]+)/resource-manager/readme.md', + 'specification/([^/]+)/resource-manager(/.*)*/readme.md', readme, re.IGNORECASE, ) @@ -218,6 +220,7 @@ def main(): readme = 'specification/{0}/resource-manager/readme.md'.format(spec) else: spec = match.group(1) + spec = update_spec(spec, match.group(2)) args['readme'] = readme args['spec'] = spec diff --git a/eng/mgmt/automation/generate_data.py b/eng/mgmt/automation/generate_data.py index 61fe3609483e..964f472edd13 100755 --- a/eng/mgmt/automation/generate_data.py +++ b/eng/mgmt/automation/generate_data.py @@ -389,7 +389,7 @@ def generate( def compile_package(sdk_root: str, group_id: str, module: str) -> bool: - command = 'mvn --no-transfer-progress clean verify package -f {0}/pom.xml -Dmaven.javadoc.skip -Dgpg.skip -DskipTestCompile -Drevapi.skip -pl {1}:{2} -am'.format( + command = 'mvn --no-transfer-progress clean verify package -f {0}/pom.xml -Dmaven.javadoc.skip -Dgpg.skip -DskipTestCompile -Djacoco.skip -Drevapi.skip -pl {1}:{2} -am'.format( sdk_root, group_id, module) logging.info(command) if os.system(command) != 0: diff --git a/eng/mgmt/automation/generate_utils.py b/eng/mgmt/automation/generate_utils.py index 58320386dd44..90833f394576 100644 --- a/eng/mgmt/automation/generate_utils.py +++ b/eng/mgmt/automation/generate_utils.py @@ -291,3 +291,9 @@ def get_suffix_from_api_specs(api_specs_file: str, spec: str): return api_spec.get('suffix') return None + + +def update_spec(spec: str, subspec: str) -> str: + if subspec: + spec = spec + subspec + return spec diff --git a/eng/mgmt/automation/parameters.py b/eng/mgmt/automation/parameters.py index 4d56d09ee9c7..c1053b591659 100644 --- a/eng/mgmt/automation/parameters.py +++ b/eng/mgmt/automation/parameters.py @@ -16,7 +16,7 @@ SDK_ROOT = '../../../' # related to file dir AUTOREST_CORE_VERSION = '3.9.3' -AUTOREST_JAVA = '@autorest/java@4.1.13' +AUTOREST_JAVA = '@autorest/java@4.1.14' DEFAULT_VERSION = '1.0.0-beta.1' GROUP_ID = 'com.azure.resourcemanager' API_SPECS_FILE = 'api-specs.yaml' diff --git a/eng/mgmt/automation/sdk_generate.py b/eng/mgmt/automation/sdk_generate.py index 02b8790b469f..832ab0a93ce2 100755 --- a/eng/mgmt/automation/sdk_generate.py +++ b/eng/mgmt/automation/sdk_generate.py @@ -24,6 +24,7 @@ generate, get_and_update_service_from_api_specs, get_suffix_from_api_specs, + update_spec, ) os.chdir(pwd) @@ -162,16 +163,17 @@ def sdk_automation_autorest(config: dict) -> List[dict]: readme = config['relatedReadmeMdFile'] match = re.search( - '(specification)?/?([^/]+)/resource-manager/readme.md', + '(specification)?/?([^/]+)/resource-manager(/.*)*/readme.md', readme, re.IGNORECASE, ) if not match: logging.info( - '[Skip] readme path does not format as */resource-manager/readme.md' + '[Skip] readme path does not format as */resource-manager/*/readme.md' ) else: spec = match.group(2) + spec = update_spec(spec, match.group(3)) service = get_and_update_service_from_api_specs( api_specs_file, spec) @@ -267,6 +269,7 @@ def main(): readme = 'specification/{0}/resource-manager/readme.md'.format(spec) else: spec = match.group(1) + spec = update_spec(spec, match.group(2)) args['readme'] = readme args['spec'] = spec diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 08c21ef3b866..0f9c517c59a2 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -395,6 +395,7 @@ com.azure.resourcemanager:azure-resourcemanager-billingbenefits;1.0.0-beta.1;1.0 com.azure.resourcemanager:azure-resourcemanager-providerhub;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-reservations;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-storagemover;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-containerservicefleet;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/AnomalyDetectorAsyncClient.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/AnomalyDetectorAsyncClient.java index c4f93d00ce06..1c8810c30cdb 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/AnomalyDetectorAsyncClient.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/AnomalyDetectorAsyncClient.java @@ -301,7 +301,7 @@ public Mono> detectUnivariateChangePointWithResponse( * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return detection results for the given resultId along with {@link Response} on successful completion of {@link + * @return detections results for the given resultId along with {@link Response} on successful completion of {@link * Mono}. */ @Generated @@ -701,7 +701,7 @@ public Mono> getMultivariateModelWithResponse(String modelI * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return detection results for the given resultId along with {@link Response} on successful completion of {@link + * @return detections results for the given resultId along with {@link Response} on successful completion of {@link * Mono}. */ @Generated @@ -885,7 +885,7 @@ public Mono detectUnivariateChangePoint( * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return detection results for the given resultId on successful completion of {@link Mono}. + * @return detections results for the given resultId on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) @@ -940,8 +940,9 @@ public Mono trainMultivariateModel(ModelInfo modelInfo) { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return response of listing models as paginated response with {@link PagedFlux}. */ + @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - PagedFlux listMultivariateModels(Integer skip, Integer top) { + public PagedFlux listMultivariateModels(Integer skip, Integer top) { // Generated convenience method for listMultivariateModels RequestOptions requestOptions = new RequestOptions(); if (skip != null) { @@ -1081,7 +1082,7 @@ public Mono getMultivariateModel(String modelId) { * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return detection results for the given resultId on successful completion of {@link Mono}. + * @return detections results for the given resultId on successful completion of {@link Mono}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/AnomalyDetectorClient.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/AnomalyDetectorClient.java index 6cf43d0d3f13..14dcb61475d4 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/AnomalyDetectorClient.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/AnomalyDetectorClient.java @@ -291,7 +291,7 @@ public Response detectUnivariateChangePointWithResponse( * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return detection results for the given resultId along with {@link Response}. + * @return detections results for the given resultId along with {@link Response}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) @@ -690,7 +690,7 @@ public Response getMultivariateModelWithResponse(String modelId, Req * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return detection results for the given resultId along with {@link Response}. + * @return detections results for the given resultId along with {@link Response}. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) @@ -873,7 +873,7 @@ public UnivariateChangePointDetectionResult detectUnivariateChangePoint( * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return detection results for the given resultId. + * @return detections results for the given resultId. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) @@ -928,8 +928,9 @@ public AnomalyDetectionModel trainMultivariateModel(ModelInfo modelInfo) { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return response of listing models as paginated response with {@link PagedIterable}. */ + @Generated @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listMultivariateModels(Integer skip, Integer top) { + public PagedIterable listMultivariateModels(Integer skip, Integer top) { // Generated convenience method for listMultivariateModels return new PagedIterable<>(client.listMultivariateModels(skip, top)); } @@ -1016,7 +1017,7 @@ public AnomalyDetectionModel getMultivariateModel(String modelId) { * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return detection results for the given resultId. + * @return detections results for the given resultId. */ @Generated @ServiceMethod(returns = ReturnType.SINGLE) diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/implementation/AnomalyDetectorClientImpl.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/implementation/AnomalyDetectorClientImpl.java index c691ab0a7989..7bf148c1c606 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/implementation/AnomalyDetectorClientImpl.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/implementation/AnomalyDetectorClientImpl.java @@ -834,7 +834,7 @@ public Response detectUnivariateChangePointWithResponse( * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return detection results for the given resultId along with {@link Response} on successful completion of {@link + * @return detections results for the given resultId along with {@link Response} on successful completion of {@link * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -920,7 +920,7 @@ public Mono> getMultivariateBatchDetectionResultWithRespons * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return detection results for the given resultId along with {@link Response}. + * @return detections results for the given resultId along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getMultivariateBatchDetectionResultWithResponse( @@ -1753,7 +1753,7 @@ public Response getMultivariateModelWithResponse(String modelId, Req * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return detection results for the given resultId along with {@link Response} on successful completion of {@link + * @return detections results for the given resultId along with {@link Response} on successful completion of {@link * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -1855,7 +1855,7 @@ public Mono> detectMultivariateBatchAnomalyWithResponseAsyn * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return detection results for the given resultId along with {@link Response}. + * @return detections results for the given resultId along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response detectMultivariateBatchAnomalyWithResponse( diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/AlignMode.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/AlignMode.java index 0f3275035816..051002ad0526 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/AlignMode.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/AlignMode.java @@ -4,48 +4,43 @@ package com.azure.ai.anomalydetector.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for AlignMode. */ -public enum AlignMode { - /** Enum value Inner. */ - INNER("Inner"), +public final class AlignMode extends ExpandableStringEnum { + /** Static value Inner for AlignMode. */ + public static final AlignMode INNER = fromString("Inner"); - /** Enum value Outer. */ - OUTER("Outer"); + /** Static value Outer for AlignMode. */ + public static final AlignMode OUTER = fromString("Outer"); - /** The actual serialized value for a AlignMode instance. */ - private final String value; - - AlignMode(String value) { - this.value = value; - } + /** + * Creates a new instance of AlignMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AlignMode() {} /** - * Parses a serialized value to a AlignMode instance. + * Creates or finds a AlignMode from its string representation. * - * @param value the serialized value to parse. - * @return the parsed AlignMode object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding AlignMode. */ @JsonCreator - public static AlignMode fromString(String value) { - if (value == null) { - return null; - } - AlignMode[] items = AlignMode.values(); - for (AlignMode item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static AlignMode fromString(String name) { + return fromString(name, AlignMode.class); } - /** {@inheritDoc} */ - @JsonValue - @Override - public String toString() { - return this.value; + /** + * Gets known AlignMode values. + * + * @return known AlignMode values. + */ + public static Collection values() { + return values(AlignMode.class); } } diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/DataSchema.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/DataSchema.java index e46cc49ba461..d970e88666df 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/DataSchema.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/DataSchema.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for DataSchema. */ +/** Data schema of input data source: OneTable or MultiTable. The default DataSchema is OneTable. */ public final class DataSchema extends ExpandableStringEnum { /** Static value OneTable for DataSchema. */ public static final DataSchema ONE_TABLE = fromString("OneTable"); @@ -16,6 +16,14 @@ public final class DataSchema extends ExpandableStringEnum { /** Static value MultiTable for DataSchema. */ public static final DataSchema MULTI_TABLE = fromString("MultiTable"); + /** + * Creates a new instance of DataSchema value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DataSchema() {} + /** * Creates or finds a DataSchema from its string representation. * diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/FillNAMethod.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/FillNAMethod.java index 2b55dea587e0..136f6221d31d 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/FillNAMethod.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/FillNAMethod.java @@ -8,7 +8,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for FillNAMethod. */ +/** + * An optional field, indicating how missing values will be filled. One of Previous, Subsequent, Linear, Zero, Fixed. + */ public final class FillNAMethod extends ExpandableStringEnum { /** Static value Previous for FillNAMethod. */ public static final FillNAMethod PREVIOUS = fromString("Previous"); @@ -25,6 +27,14 @@ public final class FillNAMethod extends ExpandableStringEnum { /** Static value Fixed for FillNAMethod. */ public static final FillNAMethod FIXED = fromString("Fixed"); + /** + * Creates a new instance of FillNAMethod value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FillNAMethod() {} + /** * Creates or finds a FillNAMethod from its string representation. * diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/ImputeMode.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/ImputeMode.java index e71130dd0df8..f1b4891086cb 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/ImputeMode.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/ImputeMode.java @@ -28,6 +28,14 @@ public final class ImputeMode extends ExpandableStringEnum { /** Static value notFill for ImputeMode. */ public static final ImputeMode NOT_FILL = fromString("notFill"); + /** + * Creates a new instance of ImputeMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ImputeMode() {} + /** * Creates or finds a ImputeMode from its string representation. * diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/ModelStatus.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/ModelStatus.java index 2ff7519fd5d9..7a1a5960b0d9 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/ModelStatus.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/ModelStatus.java @@ -4,54 +4,49 @@ package com.azure.ai.anomalydetector.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for ModelStatus. */ -public enum ModelStatus { - /** Enum value CREATED. */ - CREATED("CREATED"), +public final class ModelStatus extends ExpandableStringEnum { + /** Static value CREATED for ModelStatus. */ + public static final ModelStatus CREATED = fromString("CREATED"); - /** Enum value RUNNING. */ - RUNNING("RUNNING"), + /** Static value RUNNING for ModelStatus. */ + public static final ModelStatus RUNNING = fromString("RUNNING"); - /** Enum value READY. */ - READY("READY"), + /** Static value READY for ModelStatus. */ + public static final ModelStatus READY = fromString("READY"); - /** Enum value FAILED. */ - FAILED("FAILED"); + /** Static value FAILED for ModelStatus. */ + public static final ModelStatus FAILED = fromString("FAILED"); - /** The actual serialized value for a ModelStatus instance. */ - private final String value; - - ModelStatus(String value) { - this.value = value; - } + /** + * Creates a new instance of ModelStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ModelStatus() {} /** - * Parses a serialized value to a ModelStatus instance. + * Creates or finds a ModelStatus from its string representation. * - * @param value the serialized value to parse. - * @return the parsed ModelStatus object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding ModelStatus. */ @JsonCreator - public static ModelStatus fromString(String value) { - if (value == null) { - return null; - } - ModelStatus[] items = ModelStatus.values(); - for (ModelStatus item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static ModelStatus fromString(String name) { + return fromString(name, ModelStatus.class); } - /** {@inheritDoc} */ - @JsonValue - @Override - public String toString() { - return this.value; + /** + * Gets known ModelStatus values. + * + * @return known ModelStatus values. + */ + public static Collection values() { + return values(ModelStatus.class); } } diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/MultivariateBatchDetectionStatus.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/MultivariateBatchDetectionStatus.java index c3f17996f22c..bd51e097ee1d 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/MultivariateBatchDetectionStatus.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/MultivariateBatchDetectionStatus.java @@ -4,54 +4,49 @@ package com.azure.ai.anomalydetector.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for MultivariateBatchDetectionStatus. */ -public enum MultivariateBatchDetectionStatus { - /** Enum value CREATED. */ - CREATED("CREATED"), +public final class MultivariateBatchDetectionStatus extends ExpandableStringEnum { + /** Static value CREATED for MultivariateBatchDetectionStatus. */ + public static final MultivariateBatchDetectionStatus CREATED = fromString("CREATED"); - /** Enum value RUNNING. */ - RUNNING("RUNNING"), + /** Static value RUNNING for MultivariateBatchDetectionStatus. */ + public static final MultivariateBatchDetectionStatus RUNNING = fromString("RUNNING"); - /** Enum value READY. */ - READY("READY"), + /** Static value READY for MultivariateBatchDetectionStatus. */ + public static final MultivariateBatchDetectionStatus READY = fromString("READY"); - /** Enum value FAILED. */ - FAILED("FAILED"); + /** Static value FAILED for MultivariateBatchDetectionStatus. */ + public static final MultivariateBatchDetectionStatus FAILED = fromString("FAILED"); - /** The actual serialized value for a MultivariateBatchDetectionStatus instance. */ - private final String value; - - MultivariateBatchDetectionStatus(String value) { - this.value = value; - } + /** + * Creates a new instance of MultivariateBatchDetectionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MultivariateBatchDetectionStatus() {} /** - * Parses a serialized value to a MultivariateBatchDetectionStatus instance. + * Creates or finds a MultivariateBatchDetectionStatus from its string representation. * - * @param value the serialized value to parse. - * @return the parsed MultivariateBatchDetectionStatus object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding MultivariateBatchDetectionStatus. */ @JsonCreator - public static MultivariateBatchDetectionStatus fromString(String value) { - if (value == null) { - return null; - } - MultivariateBatchDetectionStatus[] items = MultivariateBatchDetectionStatus.values(); - for (MultivariateBatchDetectionStatus item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static MultivariateBatchDetectionStatus fromString(String name) { + return fromString(name, MultivariateBatchDetectionStatus.class); } - /** {@inheritDoc} */ - @JsonValue - @Override - public String toString() { - return this.value; + /** + * Gets known MultivariateBatchDetectionStatus values. + * + * @return known MultivariateBatchDetectionStatus values. + */ + public static Collection values() { + return values(MultivariateBatchDetectionStatus.class); } } diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/MultivariateDetectionResult.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/MultivariateDetectionResult.java index aa2938743296..d5fcc1a6e21c 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/MultivariateDetectionResult.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/MultivariateDetectionResult.java @@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** Detection results for the given resultId. */ +/** Detections results for the given resultId. */ @Immutable public final class MultivariateDetectionResult { /* diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/TimeGranularity.java b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/TimeGranularity.java index fea416ba0eca..e817d059182f 100644 --- a/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/TimeGranularity.java +++ b/sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/models/TimeGranularity.java @@ -4,69 +4,64 @@ package com.azure.ai.anomalydetector.models; +import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Collection; /** Defines values for TimeGranularity. */ -public enum TimeGranularity { - /** Enum value yearly. */ - YEARLY("yearly"), +public final class TimeGranularity extends ExpandableStringEnum { + /** Static value yearly for TimeGranularity. */ + public static final TimeGranularity YEARLY = fromString("yearly"); - /** Enum value monthly. */ - MONTHLY("monthly"), + /** Static value monthly for TimeGranularity. */ + public static final TimeGranularity MONTHLY = fromString("monthly"); - /** Enum value weekly. */ - WEEKLY("weekly"), + /** Static value weekly for TimeGranularity. */ + public static final TimeGranularity WEEKLY = fromString("weekly"); - /** Enum value daily. */ - DAILY("daily"), + /** Static value daily for TimeGranularity. */ + public static final TimeGranularity DAILY = fromString("daily"); - /** Enum value hourly. */ - HOURLY("hourly"), + /** Static value hourly for TimeGranularity. */ + public static final TimeGranularity HOURLY = fromString("hourly"); - /** Enum value minutely. */ - PER_MINUTE("minutely"), + /** Static value minutely for TimeGranularity. */ + public static final TimeGranularity PER_MINUTE = fromString("minutely"); - /** Enum value secondly. */ - PER_SECOND("secondly"), + /** Static value secondly for TimeGranularity. */ + public static final TimeGranularity PER_SECOND = fromString("secondly"); - /** Enum value microsecond. */ - MICROSECOND("microsecond"), + /** Static value microsecond for TimeGranularity. */ + public static final TimeGranularity MICROSECOND = fromString("microsecond"); - /** Enum value none. */ - NONE("none"); + /** Static value none for TimeGranularity. */ + public static final TimeGranularity NONE = fromString("none"); - /** The actual serialized value for a TimeGranularity instance. */ - private final String value; - - TimeGranularity(String value) { - this.value = value; - } + /** + * Creates a new instance of TimeGranularity value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TimeGranularity() {} /** - * Parses a serialized value to a TimeGranularity instance. + * Creates or finds a TimeGranularity from its string representation. * - * @param value the serialized value to parse. - * @return the parsed TimeGranularity object, or null if unable to parse. + * @param name a name to look for. + * @return the corresponding TimeGranularity. */ @JsonCreator - public static TimeGranularity fromString(String value) { - if (value == null) { - return null; - } - TimeGranularity[] items = TimeGranularity.values(); - for (TimeGranularity item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static TimeGranularity fromString(String name) { + return fromString(name, TimeGranularity.class); } - /** {@inheritDoc} */ - @JsonValue - @Override - public String toString() { - return this.value; + /** + * Gets known TimeGranularity values. + * + * @return known TimeGranularity values. + */ + public static Collection values() { + return values(TimeGranularity.class); } }