diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 7f30cad9f4d3..38607cdd89d1 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -430,7 +430,7 @@ com.azure.resourcemanager:azure-resourcemanager-billingbenefits;1.0.0-beta.2;1.0 com.azure.resourcemanager:azure-resourcemanager-providerhub;1.1.0;1.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-reservations;1.0.0-beta.3;1.0.0-beta.4 com.azure.resourcemanager:azure-resourcemanager-containerservicefleet;1.1.0;1.2.0-beta.2 -com.azure.resourcemanager:azure-resourcemanager-storagemover;1.2.0;1.3.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-storagemover;1.2.0;1.3.0 com.azure.resourcemanager:azure-resourcemanager-graphservices;1.1.0;1.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-voiceservices;1.1.0;1.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-paloaltonetworks-ngfw;1.1.0;1.2.0-beta.1 diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/CHANGELOG.md b/sdk/storagemover/azure-resourcemanager-storagemover/CHANGELOG.md index d142e4df1d81..eb064221685a 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/CHANGELOG.md +++ b/sdk/storagemover/azure-resourcemanager-storagemover/CHANGELOG.md @@ -1,14 +1,39 @@ # Release History -## 1.3.0-beta.1 (Unreleased) +## 1.3.0 (2024-12-23) -### Features Added +- Azure Resource Manager Storage Mover client library for Java. This package contains Microsoft Azure SDK for Storage Mover Management SDK. The Azure Storage Mover REST API. Package tag package-2024-07. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Breaking Changes -### Bugs Fixed +#### Serialization/Deserialization change + +- `Jackson` is removed from dependency and no longer supported. + +##### Migration Guide + +If you are using `Jackson`/`ObjectMapper` for manual serialization/deserialization, configure your `ObjectMapper` for backward compatibility: +```java +objectMapper.registerModule(com.azure.core.serializer.json.jackson.JacksonJsonProvider.getJsonSerializableDatabindModule()); +``` + +#### `StorageMoverManager` was modified + +* `fluent.StorageMoverClient serviceClient()` -> `fluent.StorageMoverManagementClient serviceClient()` + +#### `models.Minute` was modified + +* `fromInt(int)` was removed + +### Features Added + +#### `models.Minute` was modified -### Other Changes +* `getValue()` was added +* `hashCode()` was added +* `equals(java.lang.Object)` was added +* `toString()` was added +* `fromValue(java.lang.Integer)` was added ## 1.2.0 (2024-06-24) diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/README.md b/sdk/storagemover/azure-resourcemanager-storagemover/README.md index fa5c5adda896..7e98289756b1 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/README.md +++ b/sdk/storagemover/azure-resourcemanager-storagemover/README.md @@ -1,8 +1,8 @@ -# Azure Resource Manager StorageMover client library for Java +# Azure Resource Manager Storage Mover client library for Java -Azure Resource Manager StorageMover client library for Java. +Azure Resource Manager Storage Mover client library for Java. -This package contains Microsoft Azure SDK for StorageMover Management SDK. The Azure Storage Mover REST API. Package tag package-2024-07. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for Storage Mover Management SDK. The Azure Storage Mover REST API. Package tag package-2024-07. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-storagemover - 1.2.0 + 1.3.0 ``` [//]: # ({x-version-update-end}) @@ -45,15 +45,11 @@ Azure Management Libraries require a `TokenCredential` implementation for authen ### Authentication -By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables. +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. -- `AZURE_CLIENT_ID` for Azure client ID. -- `AZURE_TENANT_ID` for Azure tenant ID. -- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. -In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. - -With above configuration, `azure` client can be authenticated using the following code: +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); @@ -104,6 +100,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ [azure_subscription]: https://azure.microsoft.com/free/ [azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials [azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty [authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md [design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/pom.xml b/sdk/storagemover/azure-resourcemanager-storagemover/pom.xml index 4b57064badf9..3e228600ded0 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/pom.xml +++ b/sdk/storagemover/azure-resourcemanager-storagemover/pom.xml @@ -14,11 +14,11 @@ com.azure.resourcemanager azure-resourcemanager-storagemover - 1.3.0-beta.1 + 1.3.0 jar - Microsoft Azure SDK for StorageMover Management - This package contains Microsoft Azure SDK for StorageMover Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Azure Storage Mover REST API. Package tag package-2024-07. + Microsoft Azure SDK for Storage Mover Management + This package contains Microsoft Azure SDK for Storage Mover Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Azure Storage Mover REST API. Package tag package-2024-07. https://github.com/Azure/azure-sdk-for-java @@ -45,6 +45,8 @@ UTF-8 0 0 + false + true diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/StorageMoverManager.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/StorageMoverManager.java index badacfc4eea2..10a33c66ad44 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/StorageMoverManager.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/StorageMoverManager.java @@ -11,26 +11,26 @@ import com.azure.core.http.HttpPipelinePosition; import com.azure.core.http.policy.AddDatePolicy; import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.HttpPolicyProviders; import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryOptions; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.storagemover.fluent.StorageMoverClient; +import com.azure.resourcemanager.storagemover.fluent.StorageMoverManagementClient; import com.azure.resourcemanager.storagemover.implementation.AgentsImpl; import com.azure.resourcemanager.storagemover.implementation.EndpointsImpl; import com.azure.resourcemanager.storagemover.implementation.JobDefinitionsImpl; import com.azure.resourcemanager.storagemover.implementation.JobRunsImpl; import com.azure.resourcemanager.storagemover.implementation.OperationsImpl; import com.azure.resourcemanager.storagemover.implementation.ProjectsImpl; -import com.azure.resourcemanager.storagemover.implementation.StorageMoverClientBuilder; +import com.azure.resourcemanager.storagemover.implementation.StorageMoverManagementClientBuilder; import com.azure.resourcemanager.storagemover.implementation.StorageMoversImpl; import com.azure.resourcemanager.storagemover.models.Agents; import com.azure.resourcemanager.storagemover.models.Endpoints; @@ -65,12 +65,12 @@ public final class StorageMoverManager { private JobRuns jobRuns; - private final StorageMoverClient clientObject; + private final StorageMoverManagementClient clientObject; private StorageMoverManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = new StorageMoverClientBuilder().pipeline(httpPipeline) + this.clientObject = new StorageMoverManagementClientBuilder().pipeline(httpPipeline) .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) .subscriptionId(profile.getSubscriptionId()) .defaultPollInterval(defaultPollInterval) @@ -78,11 +78,11 @@ private StorageMoverManager(HttpPipeline httpPipeline, AzureProfile profile, Dur } /** - * Creates an instance of StorageMover service API entry point. + * Creates an instance of Storage Mover service API entry point. * * @param credential the credential to use. * @param profile the Azure profile for client. - * @return the StorageMover service API instance. + * @return the Storage Mover service API instance. */ public static StorageMoverManager authenticate(TokenCredential credential, AzureProfile profile) { Objects.requireNonNull(credential, "'credential' cannot be null."); @@ -91,11 +91,11 @@ public static StorageMoverManager authenticate(TokenCredential credential, Azure } /** - * Creates an instance of StorageMover service API entry point. + * Creates an instance of Storage Mover service API entry point. * * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. * @param profile the Azure profile for client. - * @return the StorageMover service API instance. + * @return the Storage Mover service API instance. */ public static StorageMoverManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); @@ -214,11 +214,11 @@ public Configurable withDefaultPollInterval(Duration defaultPollInterval) { } /** - * Creates an instance of StorageMover service API entry point. + * Creates an instance of Storage Mover service API entry point. * * @param credential the credential to use. * @param profile the Azure profile for client. - * @return the StorageMover service API instance. + * @return the Storage Mover service API instance. */ public StorageMoverManager authenticate(TokenCredential credential, AzureProfile profile) { Objects.requireNonNull(credential, "'credential' cannot be null."); @@ -229,7 +229,7 @@ public StorageMoverManager authenticate(TokenCredential credential, AzureProfile .append("-") .append("com.azure.resourcemanager.storagemover") .append("/") - .append("1.2.0"); + .append("1.3.0"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -262,7 +262,7 @@ public StorageMoverManager authenticate(TokenCredential credential, AzureProfile HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); - policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies.addAll(this.policies.stream() .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) .collect(Collectors.toList())); @@ -360,12 +360,12 @@ public JobRuns jobRuns() { } /** - * Gets wrapped service client StorageMoverClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. + * Gets wrapped service client StorageMoverManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. * - * @return Wrapped service client StorageMoverClient. + * @return Wrapped service client StorageMoverManagementClient. */ - public StorageMoverClient serviceClient() { + public StorageMoverManagementClient serviceClient() { return this.clientObject; } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/StorageMoverClient.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/StorageMoverManagementClient.java similarity index 95% rename from sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/StorageMoverClient.java rename to sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/StorageMoverManagementClient.java index 206c706d965f..a9cf3fe65591 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/StorageMoverClient.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/StorageMoverManagementClient.java @@ -8,9 +8,9 @@ import java.time.Duration; /** - * The interface for StorageMoverClient class. + * The interface for StorageMoverManagementClient class. */ -public interface StorageMoverClient { +public interface StorageMoverManagementClient { /** * Gets The ID of the target subscription. * diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentInner.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentInner.java index 3a56bab67986..0eeb69c95570 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentInner.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentInner.java @@ -8,11 +8,14 @@ import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.models.AgentPropertiesErrorDetails; import com.azure.resourcemanager.storagemover.models.AgentStatus; import com.azure.resourcemanager.storagemover.models.ProvisioningState; import com.azure.resourcemanager.storagemover.models.UploadLimitSchedule; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; /** @@ -23,15 +26,28 @@ public final class AgentInner extends ProxyResource { /* * The properties property. */ - @JsonProperty(value = "properties", required = true) private AgentProperties innerProperties = new AgentProperties(); /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of AgentInner class. */ @@ -56,6 +72,36 @@ public SystemData systemData() { return this.systemData; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the description property: A description for the Agent. * @@ -259,4 +305,49 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(AgentInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AgentInner. + */ + public static AgentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentInner deserializedAgentInner = new AgentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAgentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAgentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAgentInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedAgentInner.innerProperties = AgentProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedAgentInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAgentInner; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentProperties.java index d05bbe99ab5f..8c62b1034cc2 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentProperties.java @@ -5,83 +5,77 @@ package com.azure.resourcemanager.storagemover.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.models.AgentPropertiesErrorDetails; import com.azure.resourcemanager.storagemover.models.AgentStatus; import com.azure.resourcemanager.storagemover.models.ProvisioningState; import com.azure.resourcemanager.storagemover.models.UploadLimitSchedule; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; /** * The AgentProperties model. */ @Fluent -public final class AgentProperties { +public final class AgentProperties implements JsonSerializable { /* * A description for the Agent. */ - @JsonProperty(value = "description") private String description; /* * The Agent version. */ - @JsonProperty(value = "agentVersion", access = JsonProperty.Access.WRITE_ONLY) private String agentVersion; /* * The fully qualified resource ID of the Hybrid Compute resource for the Agent. */ - @JsonProperty(value = "arcResourceId", required = true) private String arcResourceId; /* * The VM UUID of the Hybrid Compute resource for the Agent. */ - @JsonProperty(value = "arcVmUuid", required = true) private String arcVmUuid; /* * The Agent status. */ - @JsonProperty(value = "agentStatus", access = JsonProperty.Access.WRITE_ONLY) private AgentStatus agentStatus; /* * The last updated time of the Agent status. */ - @JsonProperty(value = "lastStatusUpdate", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime lastStatusUpdate; /* * Local IP address reported by the Agent. */ - @JsonProperty(value = "localIPAddress", access = JsonProperty.Access.WRITE_ONLY) private String localIpAddress; /* * Available memory reported by the Agent, in MB. */ - @JsonProperty(value = "memoryInMB", access = JsonProperty.Access.WRITE_ONLY) private Long memoryInMB; /* * Available compute cores reported by the Agent. */ - @JsonProperty(value = "numberOfCores", access = JsonProperty.Access.WRITE_ONLY) private Long numberOfCores; /* * Uptime of the Agent in seconds. */ - @JsonProperty(value = "uptimeInSeconds", access = JsonProperty.Access.WRITE_ONLY) private Long uptimeInSeconds; /* * The agent's local time zone represented in Windows format. */ - @JsonProperty(value = "timeZone", access = JsonProperty.Access.WRITE_ONLY) private String timeZone; /* @@ -89,19 +83,16 @@ public final class AgentProperties { * (migrating files) are affected. Control plane operations ensure seamless migration functionality and are not * limited by this schedule. The schedule is interpreted with the agent's local time. */ - @JsonProperty(value = "uploadLimitSchedule") private UploadLimitSchedule uploadLimitSchedule; /* * The errorDetails property. */ - @JsonProperty(value = "errorDetails", access = JsonProperty.Access.WRITE_ONLY) private AgentPropertiesErrorDetails errorDetails; /* * The provisioning state of this resource. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /** @@ -309,4 +300,71 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(AgentProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("arcResourceId", this.arcResourceId); + jsonWriter.writeStringField("arcVmUuid", this.arcVmUuid); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeJsonField("uploadLimitSchedule", this.uploadLimitSchedule); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AgentProperties. + */ + public static AgentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentProperties deserializedAgentProperties = new AgentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("arcResourceId".equals(fieldName)) { + deserializedAgentProperties.arcResourceId = reader.getString(); + } else if ("arcVmUuid".equals(fieldName)) { + deserializedAgentProperties.arcVmUuid = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedAgentProperties.description = reader.getString(); + } else if ("agentVersion".equals(fieldName)) { + deserializedAgentProperties.agentVersion = reader.getString(); + } else if ("agentStatus".equals(fieldName)) { + deserializedAgentProperties.agentStatus = AgentStatus.fromString(reader.getString()); + } else if ("lastStatusUpdate".equals(fieldName)) { + deserializedAgentProperties.lastStatusUpdate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("localIPAddress".equals(fieldName)) { + deserializedAgentProperties.localIpAddress = reader.getString(); + } else if ("memoryInMB".equals(fieldName)) { + deserializedAgentProperties.memoryInMB = reader.getNullable(JsonReader::getLong); + } else if ("numberOfCores".equals(fieldName)) { + deserializedAgentProperties.numberOfCores = reader.getNullable(JsonReader::getLong); + } else if ("uptimeInSeconds".equals(fieldName)) { + deserializedAgentProperties.uptimeInSeconds = reader.getNullable(JsonReader::getLong); + } else if ("timeZone".equals(fieldName)) { + deserializedAgentProperties.timeZone = reader.getString(); + } else if ("uploadLimitSchedule".equals(fieldName)) { + deserializedAgentProperties.uploadLimitSchedule = UploadLimitSchedule.fromJson(reader); + } else if ("errorDetails".equals(fieldName)) { + deserializedAgentProperties.errorDetails = AgentPropertiesErrorDetails.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedAgentProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAgentProperties; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentUpdateProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentUpdateProperties.java index 234b3aa1f81f..67805b2b495f 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentUpdateProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/AgentUpdateProperties.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.storagemover.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.models.UploadLimitSchedule; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * The AgentUpdateProperties model. */ @Fluent -public final class AgentUpdateProperties { +public final class AgentUpdateProperties implements JsonSerializable { /* * A description for the Agent. */ - @JsonProperty(value = "description") private String description; /* @@ -24,7 +27,6 @@ public final class AgentUpdateProperties { * (migrating files) are affected. Control plane operations ensure seamless migration functionality and are not * limited by this schedule. The schedule is interpreted with the agent's local time. */ - @JsonProperty(value = "uploadLimitSchedule") private UploadLimitSchedule uploadLimitSchedule; /** @@ -89,4 +91,43 @@ public void validate() { uploadLimitSchedule().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeJsonField("uploadLimitSchedule", this.uploadLimitSchedule); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentUpdateProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AgentUpdateProperties. + */ + public static AgentUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentUpdateProperties deserializedAgentUpdateProperties = new AgentUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedAgentUpdateProperties.description = reader.getString(); + } else if ("uploadLimitSchedule".equals(fieldName)) { + deserializedAgentUpdateProperties.uploadLimitSchedule = UploadLimitSchedule.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAgentUpdateProperties; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/EndpointInner.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/EndpointInner.java index c1f1800684e9..261c97cc4b4c 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/EndpointInner.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/EndpointInner.java @@ -8,8 +8,11 @@ import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.models.EndpointBaseProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * The Endpoint resource, which contains information about file sources and targets. @@ -19,15 +22,28 @@ public final class EndpointInner extends ProxyResource { /* * The resource specific properties for the Storage Mover resource. */ - @JsonProperty(value = "properties", required = true) private EndpointBaseProperties properties; /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of EndpointInner class. */ @@ -63,6 +79,36 @@ public SystemData systemData() { return this.systemData; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -78,4 +124,49 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(EndpointInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EndpointInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EndpointInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EndpointInner. + */ + public static EndpointInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EndpointInner deserializedEndpointInner = new EndpointInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedEndpointInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedEndpointInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedEndpointInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedEndpointInner.properties = EndpointBaseProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedEndpointInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEndpointInner; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionInner.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionInner.java index 37532da798a5..131702b3dd74 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionInner.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionInner.java @@ -8,10 +8,13 @@ import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.models.CopyMode; import com.azure.resourcemanager.storagemover.models.JobRunStatus; import com.azure.resourcemanager.storagemover.models.ProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * The Job Definition resource. @@ -21,15 +24,28 @@ public final class JobDefinitionInner extends ProxyResource { /* * Job definition properties. */ - @JsonProperty(value = "properties", required = true) private JobDefinitionProperties innerProperties = new JobDefinitionProperties(); /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of JobDefinitionInner class. */ @@ -54,6 +70,36 @@ public SystemData systemData() { return this.systemData; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the description property: A description for the Job Definition. * @@ -296,4 +342,49 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(JobDefinitionInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobDefinitionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobDefinitionInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the JobDefinitionInner. + */ + public static JobDefinitionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JobDefinitionInner deserializedJobDefinitionInner = new JobDefinitionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedJobDefinitionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedJobDefinitionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedJobDefinitionInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedJobDefinitionInner.innerProperties = JobDefinitionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedJobDefinitionInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedJobDefinitionInner; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionProperties.java index a71d2c73378e..92d9e1235f49 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionProperties.java @@ -6,98 +6,88 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.models.CopyMode; import com.azure.resourcemanager.storagemover.models.JobRunStatus; import com.azure.resourcemanager.storagemover.models.ProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Job definition properties. */ @Fluent -public final class JobDefinitionProperties { +public final class JobDefinitionProperties implements JsonSerializable { /* * A description for the Job Definition. */ - @JsonProperty(value = "description") private String description; /* * Strategy to use for copy. */ - @JsonProperty(value = "copyMode", required = true) private CopyMode copyMode; /* * The name of the source Endpoint. */ - @JsonProperty(value = "sourceName", required = true) private String sourceName; /* * Fully qualified resource ID of the source Endpoint. */ - @JsonProperty(value = "sourceResourceId", access = JsonProperty.Access.WRITE_ONLY) private String sourceResourceId; /* * The subpath to use when reading from the source Endpoint. */ - @JsonProperty(value = "sourceSubpath") private String sourceSubpath; /* * The name of the target Endpoint. */ - @JsonProperty(value = "targetName", required = true) private String targetName; /* * Fully qualified resource ID of the target Endpoint. */ - @JsonProperty(value = "targetResourceId", access = JsonProperty.Access.WRITE_ONLY) private String targetResourceId; /* * The subpath to use when writing to the target Endpoint. */ - @JsonProperty(value = "targetSubpath") private String targetSubpath; /* * The name of the Job Run in a non-terminal state, if exists. */ - @JsonProperty(value = "latestJobRunName", access = JsonProperty.Access.WRITE_ONLY) private String latestJobRunName; /* * The fully qualified resource ID of the Job Run in a non-terminal state, if exists. */ - @JsonProperty(value = "latestJobRunResourceId", access = JsonProperty.Access.WRITE_ONLY) private String latestJobRunResourceId; /* * The current status of the Job Run in a non-terminal state, if exists. */ - @JsonProperty(value = "latestJobRunStatus", access = JsonProperty.Access.WRITE_ONLY) private JobRunStatus latestJobRunStatus; /* * Name of the Agent to assign for new Job Runs of this Job Definition. */ - @JsonProperty(value = "agentName") private String agentName; /* * Fully qualified resource id of the Agent to assign for new Job Runs of this Job Definition. */ - @JsonProperty(value = "agentResourceId", access = JsonProperty.Access.WRITE_ONLY) private String agentResourceId; /* * The provisioning state of this resource. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /** @@ -335,4 +325,75 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(JobDefinitionProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("copyMode", this.copyMode == null ? null : this.copyMode.toString()); + jsonWriter.writeStringField("sourceName", this.sourceName); + jsonWriter.writeStringField("targetName", this.targetName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("sourceSubpath", this.sourceSubpath); + jsonWriter.writeStringField("targetSubpath", this.targetSubpath); + jsonWriter.writeStringField("agentName", this.agentName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobDefinitionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobDefinitionProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the JobDefinitionProperties. + */ + public static JobDefinitionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JobDefinitionProperties deserializedJobDefinitionProperties = new JobDefinitionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("copyMode".equals(fieldName)) { + deserializedJobDefinitionProperties.copyMode = CopyMode.fromString(reader.getString()); + } else if ("sourceName".equals(fieldName)) { + deserializedJobDefinitionProperties.sourceName = reader.getString(); + } else if ("targetName".equals(fieldName)) { + deserializedJobDefinitionProperties.targetName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedJobDefinitionProperties.description = reader.getString(); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedJobDefinitionProperties.sourceResourceId = reader.getString(); + } else if ("sourceSubpath".equals(fieldName)) { + deserializedJobDefinitionProperties.sourceSubpath = reader.getString(); + } else if ("targetResourceId".equals(fieldName)) { + deserializedJobDefinitionProperties.targetResourceId = reader.getString(); + } else if ("targetSubpath".equals(fieldName)) { + deserializedJobDefinitionProperties.targetSubpath = reader.getString(); + } else if ("latestJobRunName".equals(fieldName)) { + deserializedJobDefinitionProperties.latestJobRunName = reader.getString(); + } else if ("latestJobRunResourceId".equals(fieldName)) { + deserializedJobDefinitionProperties.latestJobRunResourceId = reader.getString(); + } else if ("latestJobRunStatus".equals(fieldName)) { + deserializedJobDefinitionProperties.latestJobRunStatus + = JobRunStatus.fromString(reader.getString()); + } else if ("agentName".equals(fieldName)) { + deserializedJobDefinitionProperties.agentName = reader.getString(); + } else if ("agentResourceId".equals(fieldName)) { + deserializedJobDefinitionProperties.agentResourceId = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedJobDefinitionProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedJobDefinitionProperties; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionUpdateProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionUpdateProperties.java index c4c3e3f7b10c..ae16fbfde2f8 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionUpdateProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobDefinitionUpdateProperties.java @@ -5,30 +5,31 @@ package com.azure.resourcemanager.storagemover.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.models.CopyMode; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Job definition properties. */ @Fluent -public final class JobDefinitionUpdateProperties { +public final class JobDefinitionUpdateProperties implements JsonSerializable { /* * A description for the Job Definition. */ - @JsonProperty(value = "description") private String description; /* * Strategy to use for copy. */ - @JsonProperty(value = "copyMode") private CopyMode copyMode; /* * Name of the Agent to assign for new Job Runs of this Job Definition. */ - @JsonProperty(value = "agentName") private String agentName; /** @@ -104,4 +105,47 @@ public JobDefinitionUpdateProperties withAgentName(String agentName) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("copyMode", this.copyMode == null ? null : this.copyMode.toString()); + jsonWriter.writeStringField("agentName", this.agentName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobDefinitionUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobDefinitionUpdateProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the JobDefinitionUpdateProperties. + */ + public static JobDefinitionUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JobDefinitionUpdateProperties deserializedJobDefinitionUpdateProperties + = new JobDefinitionUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedJobDefinitionUpdateProperties.description = reader.getString(); + } else if ("copyMode".equals(fieldName)) { + deserializedJobDefinitionUpdateProperties.copyMode = CopyMode.fromString(reader.getString()); + } else if ("agentName".equals(fieldName)) { + deserializedJobDefinitionUpdateProperties.agentName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedJobDefinitionUpdateProperties; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunInner.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunInner.java index 85fee9cb9447..bed3aca28564 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunInner.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunInner.java @@ -7,11 +7,14 @@ import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.models.JobRunError; import com.azure.resourcemanager.storagemover.models.JobRunScanStatus; import com.azure.resourcemanager.storagemover.models.JobRunStatus; import com.azure.resourcemanager.storagemover.models.ProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; /** @@ -22,15 +25,28 @@ public final class JobRunInner extends ProxyResource { /* * Job run properties. */ - @JsonProperty(value = "properties") private JobRunProperties innerProperties; /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of JobRunInner class. */ @@ -55,6 +71,36 @@ public SystemData systemData() { return this.systemData; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the status property: The state of the job execution. * @@ -322,4 +368,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobRunInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobRunInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the JobRunInner. + */ + public static JobRunInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JobRunInner deserializedJobRunInner = new JobRunInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedJobRunInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedJobRunInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedJobRunInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedJobRunInner.innerProperties = JobRunProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedJobRunInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedJobRunInner; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunProperties.java index a8a751ef7743..71dcebbae246 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunProperties.java @@ -5,184 +5,161 @@ package com.azure.resourcemanager.storagemover.fluent.models; import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.models.JobRunError; import com.azure.resourcemanager.storagemover.models.JobRunScanStatus; import com.azure.resourcemanager.storagemover.models.JobRunStatus; import com.azure.resourcemanager.storagemover.models.ProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; /** * Job run properties. */ @Immutable -public final class JobRunProperties { +public final class JobRunProperties implements JsonSerializable { /* * The state of the job execution. */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) private JobRunStatus status; /* * The status of Agent's scanning of source. */ - @JsonProperty(value = "scanStatus", access = JsonProperty.Access.WRITE_ONLY) private JobRunScanStatus scanStatus; /* * Name of the Agent assigned to this run. */ - @JsonProperty(value = "agentName", access = JsonProperty.Access.WRITE_ONLY) private String agentName; /* * Fully qualified resource id of the Agent assigned to this run. */ - @JsonProperty(value = "agentResourceId", access = JsonProperty.Access.WRITE_ONLY) private String agentResourceId; /* * Start time of the run. Null if no Agent reported that the job has started. */ - @JsonProperty(value = "executionStartTime", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime executionStartTime; /* * End time of the run. Null if Agent has not reported that the job has ended. */ - @JsonProperty(value = "executionEndTime", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime executionEndTime; /* * The last updated time of the Job Run. */ - @JsonProperty(value = "lastStatusUpdate", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime lastStatusUpdate; /* * Number of items scanned so far in source. */ - @JsonProperty(value = "itemsScanned", access = JsonProperty.Access.WRITE_ONLY) private Long itemsScanned; /* * Number of items that will not be transferred, as they are excluded by user configuration. */ - @JsonProperty(value = "itemsExcluded", access = JsonProperty.Access.WRITE_ONLY) private Long itemsExcluded; /* * Number of items that will not be transferred, as they are unsupported on target. */ - @JsonProperty(value = "itemsUnsupported", access = JsonProperty.Access.WRITE_ONLY) private Long itemsUnsupported; /* * Number of items that will not be transferred, as they are already found on target (e.g. mirror mode). */ - @JsonProperty(value = "itemsNoTransferNeeded", access = JsonProperty.Access.WRITE_ONLY) private Long itemsNoTransferNeeded; /* * Number of items that were attempted to transfer and failed. */ - @JsonProperty(value = "itemsFailed", access = JsonProperty.Access.WRITE_ONLY) private Long itemsFailed; /* * Number of items successfully transferred to target. */ - @JsonProperty(value = "itemsTransferred", access = JsonProperty.Access.WRITE_ONLY) private Long itemsTransferred; /* * Bytes of data scanned so far in source. */ - @JsonProperty(value = "bytesScanned", access = JsonProperty.Access.WRITE_ONLY) private Long bytesScanned; /* * Bytes of data that will not be transferred, as they are excluded by user configuration. */ - @JsonProperty(value = "bytesExcluded", access = JsonProperty.Access.WRITE_ONLY) private Long bytesExcluded; /* * Bytes of data that will not be transferred, as they are unsupported on target. */ - @JsonProperty(value = "bytesUnsupported", access = JsonProperty.Access.WRITE_ONLY) private Long bytesUnsupported; /* * Bytes of data that will not be transferred, as they are already found on target (e.g. mirror mode). */ - @JsonProperty(value = "bytesNoTransferNeeded", access = JsonProperty.Access.WRITE_ONLY) private Long bytesNoTransferNeeded; /* * Bytes of data that were attempted to transfer and failed. */ - @JsonProperty(value = "bytesFailed", access = JsonProperty.Access.WRITE_ONLY) private Long bytesFailed; /* * Bytes of data successfully transferred to target. */ - @JsonProperty(value = "bytesTransferred", access = JsonProperty.Access.WRITE_ONLY) private Long bytesTransferred; /* * Name of source Endpoint resource. This resource may no longer exist. */ - @JsonProperty(value = "sourceName", access = JsonProperty.Access.WRITE_ONLY) private String sourceName; /* * Fully qualified resource id of source Endpoint. This id may no longer exist. */ - @JsonProperty(value = "sourceResourceId", access = JsonProperty.Access.WRITE_ONLY) private String sourceResourceId; /* * Copy of source Endpoint resource's properties at time of Job Run creation. */ - @JsonProperty(value = "sourceProperties", access = JsonProperty.Access.WRITE_ONLY) private Object sourceProperties; /* * Name of target Endpoint resource. This resource may no longer exist. */ - @JsonProperty(value = "targetName", access = JsonProperty.Access.WRITE_ONLY) private String targetName; /* * Fully qualified resource id of of Endpoint. This id may no longer exist. */ - @JsonProperty(value = "targetResourceId", access = JsonProperty.Access.WRITE_ONLY) private String targetResourceId; /* * Copy of Endpoint resource's properties at time of Job Run creation. */ - @JsonProperty(value = "targetProperties", access = JsonProperty.Access.WRITE_ONLY) private Object targetProperties; /* * Copy of parent Job Definition's properties at time of Job Run creation. */ - @JsonProperty(value = "jobDefinitionProperties", access = JsonProperty.Access.WRITE_ONLY) private Object jobDefinitionProperties; /* * Error details. */ - @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) private JobRunError error; /* * The provisioning state of this resource. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /** @@ -458,4 +435,96 @@ public void validate() { error().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobRunProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobRunProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the JobRunProperties. + */ + public static JobRunProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JobRunProperties deserializedJobRunProperties = new JobRunProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedJobRunProperties.status = JobRunStatus.fromString(reader.getString()); + } else if ("scanStatus".equals(fieldName)) { + deserializedJobRunProperties.scanStatus = JobRunScanStatus.fromString(reader.getString()); + } else if ("agentName".equals(fieldName)) { + deserializedJobRunProperties.agentName = reader.getString(); + } else if ("agentResourceId".equals(fieldName)) { + deserializedJobRunProperties.agentResourceId = reader.getString(); + } else if ("executionStartTime".equals(fieldName)) { + deserializedJobRunProperties.executionStartTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("executionEndTime".equals(fieldName)) { + deserializedJobRunProperties.executionEndTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastStatusUpdate".equals(fieldName)) { + deserializedJobRunProperties.lastStatusUpdate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("itemsScanned".equals(fieldName)) { + deserializedJobRunProperties.itemsScanned = reader.getNullable(JsonReader::getLong); + } else if ("itemsExcluded".equals(fieldName)) { + deserializedJobRunProperties.itemsExcluded = reader.getNullable(JsonReader::getLong); + } else if ("itemsUnsupported".equals(fieldName)) { + deserializedJobRunProperties.itemsUnsupported = reader.getNullable(JsonReader::getLong); + } else if ("itemsNoTransferNeeded".equals(fieldName)) { + deserializedJobRunProperties.itemsNoTransferNeeded = reader.getNullable(JsonReader::getLong); + } else if ("itemsFailed".equals(fieldName)) { + deserializedJobRunProperties.itemsFailed = reader.getNullable(JsonReader::getLong); + } else if ("itemsTransferred".equals(fieldName)) { + deserializedJobRunProperties.itemsTransferred = reader.getNullable(JsonReader::getLong); + } else if ("bytesScanned".equals(fieldName)) { + deserializedJobRunProperties.bytesScanned = reader.getNullable(JsonReader::getLong); + } else if ("bytesExcluded".equals(fieldName)) { + deserializedJobRunProperties.bytesExcluded = reader.getNullable(JsonReader::getLong); + } else if ("bytesUnsupported".equals(fieldName)) { + deserializedJobRunProperties.bytesUnsupported = reader.getNullable(JsonReader::getLong); + } else if ("bytesNoTransferNeeded".equals(fieldName)) { + deserializedJobRunProperties.bytesNoTransferNeeded = reader.getNullable(JsonReader::getLong); + } else if ("bytesFailed".equals(fieldName)) { + deserializedJobRunProperties.bytesFailed = reader.getNullable(JsonReader::getLong); + } else if ("bytesTransferred".equals(fieldName)) { + deserializedJobRunProperties.bytesTransferred = reader.getNullable(JsonReader::getLong); + } else if ("sourceName".equals(fieldName)) { + deserializedJobRunProperties.sourceName = reader.getString(); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedJobRunProperties.sourceResourceId = reader.getString(); + } else if ("sourceProperties".equals(fieldName)) { + deserializedJobRunProperties.sourceProperties = reader.readUntyped(); + } else if ("targetName".equals(fieldName)) { + deserializedJobRunProperties.targetName = reader.getString(); + } else if ("targetResourceId".equals(fieldName)) { + deserializedJobRunProperties.targetResourceId = reader.getString(); + } else if ("targetProperties".equals(fieldName)) { + deserializedJobRunProperties.targetProperties = reader.readUntyped(); + } else if ("jobDefinitionProperties".equals(fieldName)) { + deserializedJobRunProperties.jobDefinitionProperties = reader.readUntyped(); + } else if ("error".equals(fieldName)) { + deserializedJobRunProperties.error = JobRunError.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedJobRunProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedJobRunProperties; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunResourceIdInner.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunResourceIdInner.java index 3ee17f1f4e42..58ef74a0d829 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunResourceIdInner.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/JobRunResourceIdInner.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.storagemover.fluent.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Response that identifies a Job Run. */ @Immutable -public final class JobRunResourceIdInner { +public final class JobRunResourceIdInner implements JsonSerializable { /* * Fully qualified resource id of the Job Run. */ - @JsonProperty(value = "jobRunResourceId", access = JsonProperty.Access.WRITE_ONLY) private String jobRunResourceId; /** @@ -40,4 +43,39 @@ public String jobRunResourceId() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobRunResourceIdInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobRunResourceIdInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the JobRunResourceIdInner. + */ + public static JobRunResourceIdInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JobRunResourceIdInner deserializedJobRunResourceIdInner = new JobRunResourceIdInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("jobRunResourceId".equals(fieldName)) { + deserializedJobRunResourceIdInner.jobRunResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedJobRunResourceIdInner; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/OperationInner.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/OperationInner.java index 0811bf2910c8..3f3f28aa5121 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/OperationInner.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/OperationInner.java @@ -5,10 +5,14 @@ package com.azure.resourcemanager.storagemover.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.models.ActionType; import com.azure.resourcemanager.storagemover.models.OperationDisplay; import com.azure.resourcemanager.storagemover.models.Origin; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * REST API Operation @@ -16,38 +20,33 @@ * Details of a REST API operation, returned from the Resource Provider Operations API. */ @Fluent -public final class OperationInner { +public final class OperationInner implements JsonSerializable { /* * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) private String name; /* * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for * ARM/control-plane operations. */ - @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) private Boolean isDataAction; /* * Localized display information for this particular operation. */ - @JsonProperty(value = "display") private OperationDisplay display; /* * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default * value is "user,system" */ - @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) private Origin origin; /* * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ - @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) private ActionType actionType; /** @@ -126,4 +125,48 @@ public void validate() { display().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectInner.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectInner.java index eb97e4f87133..3eaf814972b2 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectInner.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectInner.java @@ -7,8 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.models.ProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * The Project resource. @@ -18,15 +21,28 @@ public final class ProjectInner extends ProxyResource { /* * Project properties. */ - @JsonProperty(value = "properties") private ProjectProperties innerProperties; /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ProjectInner class. */ @@ -51,6 +67,36 @@ public SystemData systemData() { return this.systemData; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the description property: A description for the Project. * @@ -93,4 +139,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProjectInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProjectInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ProjectInner. + */ + public static ProjectInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProjectInner deserializedProjectInner = new ProjectInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedProjectInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedProjectInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedProjectInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedProjectInner.innerProperties = ProjectProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedProjectInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedProjectInner; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectProperties.java index e6c4b1edf1a5..842ffbf976f2 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectProperties.java @@ -5,24 +5,26 @@ package com.azure.resourcemanager.storagemover.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.models.ProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Project properties. */ @Fluent -public final class ProjectProperties { +public final class ProjectProperties implements JsonSerializable { /* * A description for the Project. */ - @JsonProperty(value = "description") private String description; /* * The provisioning state of this resource. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /** @@ -67,4 +69,42 @@ public ProvisioningState provisioningState() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProjectProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProjectProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ProjectProperties. + */ + public static ProjectProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProjectProperties deserializedProjectProperties = new ProjectProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedProjectProperties.description = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedProjectProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedProjectProperties; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectUpdateProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectUpdateProperties.java index 8c634152237b..8bb113c0c4f0 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectUpdateProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/ProjectUpdateProperties.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.storagemover.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Project properties. */ @Fluent -public final class ProjectUpdateProperties { +public final class ProjectUpdateProperties implements JsonSerializable { /* * A description for the Project. */ - @JsonProperty(value = "description") private String description; /** @@ -51,4 +54,40 @@ public ProjectUpdateProperties withDescription(String description) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProjectUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProjectUpdateProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ProjectUpdateProperties. + */ + public static ProjectUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProjectUpdateProperties deserializedProjectUpdateProperties = new ProjectUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedProjectUpdateProperties.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProjectUpdateProperties; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverInner.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverInner.java index 4b1855730391..7767cddc1616 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverInner.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverInner.java @@ -7,8 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.models.ProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -19,15 +22,28 @@ public final class StorageMoverInner extends Resource { /* * The resource specific properties for the Storage Mover resource. */ - @JsonProperty(value = "properties") private StorageMoverProperties innerProperties; /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of StorageMoverInner class. */ @@ -52,6 +68,36 @@ public SystemData systemData() { return this.systemData; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -112,4 +158,56 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageMoverInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageMoverInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the StorageMoverInner. + */ + public static StorageMoverInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageMoverInner deserializedStorageMoverInner = new StorageMoverInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedStorageMoverInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedStorageMoverInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedStorageMoverInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedStorageMoverInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedStorageMoverInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedStorageMoverInner.innerProperties = StorageMoverProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedStorageMoverInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageMoverInner; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverProperties.java index 832bef9fb693..155eadc86b5e 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverProperties.java @@ -5,24 +5,26 @@ package com.azure.resourcemanager.storagemover.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.models.ProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * The resource specific properties for the Storage Mover resource. */ @Fluent -public final class StorageMoverProperties { +public final class StorageMoverProperties implements JsonSerializable { /* * A description for the Storage Mover. */ - @JsonProperty(value = "description") private String description; /* * The provisioning state of this resource. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /** @@ -67,4 +69,43 @@ public ProvisioningState provisioningState() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageMoverProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageMoverProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the StorageMoverProperties. + */ + public static StorageMoverProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageMoverProperties deserializedStorageMoverProperties = new StorageMoverProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedStorageMoverProperties.description = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedStorageMoverProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageMoverProperties; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverUpdateProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverUpdateProperties.java index d4c242464005..287a55b97399 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverUpdateProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/StorageMoverUpdateProperties.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.storagemover.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The resource specific properties for the Storage Mover resource. */ @Fluent -public final class StorageMoverUpdateProperties { +public final class StorageMoverUpdateProperties implements JsonSerializable { /* * A description for the Storage Mover. */ - @JsonProperty(value = "description") private String description; /** @@ -51,4 +54,40 @@ public StorageMoverUpdateProperties withDescription(String description) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageMoverUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageMoverUpdateProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the StorageMoverUpdateProperties. + */ + public static StorageMoverUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageMoverUpdateProperties deserializedStorageMoverUpdateProperties = new StorageMoverUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedStorageMoverUpdateProperties.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageMoverUpdateProperties; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/package-info.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/package-info.java index 902c0cb674b3..be2f9a08cf0b 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/package-info.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/models/package-info.java @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * Package containing the inner data models for StorageMoverClient. + * Package containing the inner data models for StorageMoverManagementClient. * The Azure Storage Mover REST API. */ package com.azure.resourcemanager.storagemover.fluent.models; diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/package-info.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/package-info.java index 057ca33c4a71..2a7e7901faf1 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/package-info.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/fluent/package-info.java @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * Package containing the service clients for StorageMoverClient. + * Package containing the service clients for StorageMoverManagementClient. * The Azure Storage Mover REST API. */ package com.azure.resourcemanager.storagemover.fluent; diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/AgentsClientImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/AgentsClientImpl.java index f9dd188ef6ba..c898b28cf3fa 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/AgentsClientImpl.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/AgentsClientImpl.java @@ -52,24 +52,24 @@ public final class AgentsClientImpl implements AgentsClient { /** * The service client containing this operation class. */ - private final StorageMoverClientImpl client; + private final StorageMoverManagementClientImpl client; /** * Initializes an instance of AgentsClientImpl. * * @param client the instance of the service client containing this operation class. */ - AgentsClientImpl(StorageMoverClientImpl client) { + AgentsClientImpl(StorageMoverManagementClientImpl client) { this.service = RestProxy.create(AgentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for StorageMoverClientAgents to be used by the proxy service to perform - * REST calls. + * The interface defining all the services for StorageMoverManagementClientAgents to be used by the proxy service to + * perform REST calls. */ @Host("{$host}") - @ServiceInterface(name = "StorageMoverClientAg") + @ServiceInterface(name = "StorageMoverManageme") public interface AgentsService { @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/agents") diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/EndpointsClientImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/EndpointsClientImpl.java index 0207f5580c08..1d0eff7919e5 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/EndpointsClientImpl.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/EndpointsClientImpl.java @@ -52,25 +52,25 @@ public final class EndpointsClientImpl implements EndpointsClient { /** * The service client containing this operation class. */ - private final StorageMoverClientImpl client; + private final StorageMoverManagementClientImpl client; /** * Initializes an instance of EndpointsClientImpl. * * @param client the instance of the service client containing this operation class. */ - EndpointsClientImpl(StorageMoverClientImpl client) { + EndpointsClientImpl(StorageMoverManagementClientImpl client) { this.service = RestProxy.create(EndpointsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for StorageMoverClientEndpoints to be used by the proxy service to - * perform REST calls. + * The interface defining all the services for StorageMoverManagementClientEndpoints to be used by the proxy service + * to perform REST calls. */ @Host("{$host}") - @ServiceInterface(name = "StorageMoverClientEn") + @ServiceInterface(name = "StorageMoverManageme") public interface EndpointsService { @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/endpoints") diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobDefinitionsClientImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobDefinitionsClientImpl.java index 4e1c87b3abfb..144496decee5 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobDefinitionsClientImpl.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobDefinitionsClientImpl.java @@ -54,25 +54,25 @@ public final class JobDefinitionsClientImpl implements JobDefinitionsClient { /** * The service client containing this operation class. */ - private final StorageMoverClientImpl client; + private final StorageMoverManagementClientImpl client; /** * Initializes an instance of JobDefinitionsClientImpl. * * @param client the instance of the service client containing this operation class. */ - JobDefinitionsClientImpl(StorageMoverClientImpl client) { + JobDefinitionsClientImpl(StorageMoverManagementClientImpl client) { this.service = RestProxy.create(JobDefinitionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for StorageMoverClientJobDefinitions to be used by the proxy service to - * perform REST calls. + * The interface defining all the services for StorageMoverManagementClientJobDefinitions to be used by the proxy + * service to perform REST calls. */ @Host("{$host}") - @ServiceInterface(name = "StorageMoverClientJo") + @ServiceInterface(name = "StorageMoverManageme") public interface JobDefinitionsService { @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions") diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunsClientImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunsClientImpl.java index de0a559868cc..4466f6bc5a5e 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunsClientImpl.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/JobRunsClientImpl.java @@ -42,24 +42,24 @@ public final class JobRunsClientImpl implements JobRunsClient { /** * The service client containing this operation class. */ - private final StorageMoverClientImpl client; + private final StorageMoverManagementClientImpl client; /** * Initializes an instance of JobRunsClientImpl. * * @param client the instance of the service client containing this operation class. */ - JobRunsClientImpl(StorageMoverClientImpl client) { + JobRunsClientImpl(StorageMoverManagementClientImpl client) { this.service = RestProxy.create(JobRunsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for StorageMoverClientJobRuns to be used by the proxy service to perform - * REST calls. + * The interface defining all the services for StorageMoverManagementClientJobRuns to be used by the proxy service + * to perform REST calls. */ @Host("{$host}") - @ServiceInterface(name = "StorageMoverClientJo") + @ServiceInterface(name = "StorageMoverManageme") public interface JobRunsService { @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}/jobRuns") diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/OperationsClientImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/OperationsClientImpl.java index 7ca0d29193a0..60621d6360b8 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/OperationsClientImpl.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/OperationsClientImpl.java @@ -42,25 +42,25 @@ public final class OperationsClientImpl implements OperationsClient { /** * The service client containing this operation class. */ - private final StorageMoverClientImpl client; + private final StorageMoverManagementClientImpl client; /** * Initializes an instance of OperationsClientImpl. * * @param client the instance of the service client containing this operation class. */ - OperationsClientImpl(StorageMoverClientImpl client) { + OperationsClientImpl(StorageMoverManagementClientImpl client) { this.service = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for StorageMoverClientOperations to be used by the proxy service to - * perform REST calls. + * The interface defining all the services for StorageMoverManagementClientOperations to be used by the proxy + * service to perform REST calls. */ @Host("{$host}") - @ServiceInterface(name = "StorageMoverClientOp") + @ServiceInterface(name = "StorageMoverManageme") public interface OperationsService { @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.StorageMover/operations") diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/ProjectsClientImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/ProjectsClientImpl.java index a1e92a5aac23..c3715dfde11e 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/ProjectsClientImpl.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/ProjectsClientImpl.java @@ -52,24 +52,24 @@ public final class ProjectsClientImpl implements ProjectsClient { /** * The service client containing this operation class. */ - private final StorageMoverClientImpl client; + private final StorageMoverManagementClientImpl client; /** * Initializes an instance of ProjectsClientImpl. * * @param client the instance of the service client containing this operation class. */ - ProjectsClientImpl(StorageMoverClientImpl client) { + ProjectsClientImpl(StorageMoverManagementClientImpl client) { this.service = RestProxy.create(ProjectsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for StorageMoverClientProjects to be used by the proxy service to perform - * REST calls. + * The interface defining all the services for StorageMoverManagementClientProjects to be used by the proxy service + * to perform REST calls. */ @Host("{$host}") - @ServiceInterface(name = "StorageMoverClientPr") + @ServiceInterface(name = "StorageMoverManageme") public interface ProjectsService { @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects") diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverClientBuilder.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverManagementClientBuilder.java similarity index 67% rename from sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverClientBuilder.java rename to sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverManagementClientBuilder.java index d73de67524a3..61a56bc24f45 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverClientBuilder.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverManagementClientBuilder.java @@ -15,10 +15,10 @@ import java.time.Duration; /** - * A builder for creating a new instance of the StorageMoverClientImpl type. + * A builder for creating a new instance of the StorageMoverManagementClientImpl type. */ -@ServiceClientBuilder(serviceClients = { StorageMoverClientImpl.class }) -public final class StorageMoverClientBuilder { +@ServiceClientBuilder(serviceClients = { StorageMoverManagementClientImpl.class }) +public final class StorageMoverManagementClientBuilder { /* * The ID of the target subscription. */ @@ -28,9 +28,9 @@ public final class StorageMoverClientBuilder { * Sets The ID of the target subscription. * * @param subscriptionId the subscriptionId value. - * @return the StorageMoverClientBuilder. + * @return the StorageMoverManagementClientBuilder. */ - public StorageMoverClientBuilder subscriptionId(String subscriptionId) { + public StorageMoverManagementClientBuilder subscriptionId(String subscriptionId) { this.subscriptionId = subscriptionId; return this; } @@ -44,9 +44,9 @@ public StorageMoverClientBuilder subscriptionId(String subscriptionId) { * Sets server parameter. * * @param endpoint the endpoint value. - * @return the StorageMoverClientBuilder. + * @return the StorageMoverManagementClientBuilder. */ - public StorageMoverClientBuilder endpoint(String endpoint) { + public StorageMoverManagementClientBuilder endpoint(String endpoint) { this.endpoint = endpoint; return this; } @@ -60,9 +60,9 @@ public StorageMoverClientBuilder endpoint(String endpoint) { * Sets The environment to connect to. * * @param environment the environment value. - * @return the StorageMoverClientBuilder. + * @return the StorageMoverManagementClientBuilder. */ - public StorageMoverClientBuilder environment(AzureEnvironment environment) { + public StorageMoverManagementClientBuilder environment(AzureEnvironment environment) { this.environment = environment; return this; } @@ -76,9 +76,9 @@ public StorageMoverClientBuilder environment(AzureEnvironment environment) { * Sets The HTTP pipeline to send requests through. * * @param pipeline the pipeline value. - * @return the StorageMoverClientBuilder. + * @return the StorageMoverManagementClientBuilder. */ - public StorageMoverClientBuilder pipeline(HttpPipeline pipeline) { + public StorageMoverManagementClientBuilder pipeline(HttpPipeline pipeline) { this.pipeline = pipeline; return this; } @@ -92,9 +92,9 @@ public StorageMoverClientBuilder pipeline(HttpPipeline pipeline) { * Sets The default poll interval for long-running operation. * * @param defaultPollInterval the defaultPollInterval value. - * @return the StorageMoverClientBuilder. + * @return the StorageMoverManagementClientBuilder. */ - public StorageMoverClientBuilder defaultPollInterval(Duration defaultPollInterval) { + public StorageMoverManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { this.defaultPollInterval = defaultPollInterval; return this; } @@ -108,19 +108,19 @@ public StorageMoverClientBuilder defaultPollInterval(Duration defaultPollInterva * Sets The serializer to serialize an object into a string. * * @param serializerAdapter the serializerAdapter value. - * @return the StorageMoverClientBuilder. + * @return the StorageMoverManagementClientBuilder. */ - public StorageMoverClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + public StorageMoverManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { this.serializerAdapter = serializerAdapter; return this; } /** - * Builds an instance of StorageMoverClientImpl with the provided parameters. + * Builds an instance of StorageMoverManagementClientImpl with the provided parameters. * - * @return an instance of StorageMoverClientImpl. + * @return an instance of StorageMoverManagementClientImpl. */ - public StorageMoverClientImpl buildClient() { + public StorageMoverManagementClientImpl buildClient() { String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; HttpPipeline localPipeline = (pipeline != null) @@ -131,8 +131,8 @@ public StorageMoverClientImpl buildClient() { SerializerAdapter localSerializerAdapter = (serializerAdapter != null) ? serializerAdapter : SerializerFactory.createDefaultManagementSerializerAdapter(); - StorageMoverClientImpl client = new StorageMoverClientImpl(localPipeline, localSerializerAdapter, - localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + StorageMoverManagementClientImpl client = new StorageMoverManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); return client; } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverClientImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverManagementClientImpl.java similarity index 95% rename from sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverClientImpl.java rename to sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverManagementClientImpl.java index 3ae13724837b..1df6a0b31e6d 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverClientImpl.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoverManagementClientImpl.java @@ -13,8 +13,8 @@ import com.azure.core.management.AzureEnvironment; import com.azure.core.management.exception.ManagementError; import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollerFactory; import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; @@ -29,7 +29,7 @@ import com.azure.resourcemanager.storagemover.fluent.JobRunsClient; import com.azure.resourcemanager.storagemover.fluent.OperationsClient; import com.azure.resourcemanager.storagemover.fluent.ProjectsClient; -import com.azure.resourcemanager.storagemover.fluent.StorageMoverClient; +import com.azure.resourcemanager.storagemover.fluent.StorageMoverManagementClient; import com.azure.resourcemanager.storagemover.fluent.StorageMoversClient; import java.io.IOException; import java.lang.reflect.Type; @@ -41,10 +41,10 @@ import reactor.core.publisher.Mono; /** - * Initializes a new instance of the StorageMoverClientImpl type. + * Initializes a new instance of the StorageMoverManagementClientImpl type. */ -@ServiceClient(builder = StorageMoverClientBuilder.class) -public final class StorageMoverClientImpl implements StorageMoverClient { +@ServiceClient(builder = StorageMoverManagementClientBuilder.class) +public final class StorageMoverManagementClientImpl implements StorageMoverManagementClient { /** * The ID of the target subscription. */ @@ -228,7 +228,7 @@ public JobRunsClient getJobRuns() { } /** - * Initializes an instance of StorageMoverClient client. + * Initializes an instance of StorageMoverManagementClient client. * * @param httpPipeline The HTTP pipeline to send requests through. * @param serializerAdapter The serializer to serialize an object into a string. @@ -237,8 +237,8 @@ public JobRunsClient getJobRuns() { * @param subscriptionId The ID of the target subscription. * @param endpoint server parameter. */ - StorageMoverClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, - AzureEnvironment environment, String subscriptionId, String endpoint) { + StorageMoverManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String subscriptionId, String endpoint) { this.httpPipeline = httpPipeline; this.serializerAdapter = serializerAdapter; this.defaultPollInterval = defaultPollInterval; @@ -380,5 +380,5 @@ public Mono getBodyAsString(Charset charset) { } } - private static final ClientLogger LOGGER = new ClientLogger(StorageMoverClientImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(StorageMoverManagementClientImpl.class); } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoversClientImpl.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoversClientImpl.java index e891d5baa388..f3e797204530 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoversClientImpl.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/StorageMoversClientImpl.java @@ -52,25 +52,25 @@ public final class StorageMoversClientImpl implements StorageMoversClient { /** * The service client containing this operation class. */ - private final StorageMoverClientImpl client; + private final StorageMoverManagementClientImpl client; /** * Initializes an instance of StorageMoversClientImpl. * * @param client the instance of the service client containing this operation class. */ - StorageMoversClientImpl(StorageMoverClientImpl client) { + StorageMoversClientImpl(StorageMoverManagementClientImpl client) { this.service = RestProxy.create(StorageMoversService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for StorageMoverClientStorageMovers to be used by the proxy service to - * perform REST calls. + * The interface defining all the services for StorageMoverManagementClientStorageMovers to be used by the proxy + * service to perform REST calls. */ @Host("{$host}") - @ServiceInterface(name = "StorageMoverClientSt") + @ServiceInterface(name = "StorageMoverManageme") public interface StorageMoversService { @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.StorageMover/storageMovers") diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/package-info.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/package-info.java index 687749aa6e80..1c8477f16c00 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/package-info.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/implementation/package-info.java @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * Package containing the implementations for StorageMoverClient. + * Package containing the implementations for StorageMoverManagementClient. * The Azure Storage Mover REST API. */ package com.azure.resourcemanager.storagemover.implementation; diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ActionType.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ActionType.java index d57a459d9d7f..56a804b12407 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ActionType.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ActionType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -32,7 +31,6 @@ public ActionType() { * @param name a name to look for. * @return the corresponding ActionType. */ - @JsonCreator public static ActionType fromString(String name) { return fromString(name, ActionType.class); } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentList.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentList.java index a389b70d2332..85ef28e265f3 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentList.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentList.java @@ -5,26 +5,28 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.fluent.models.AgentInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of Agents. */ @Immutable -public final class AgentList { +public final class AgentList implements JsonSerializable { /* * The value property. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * Request URL that can be used to query next page of containers. Returned when total number of requested containers * exceed maximum page size. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -62,4 +64,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentList if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the AgentList. + */ + public static AgentList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentList deserializedAgentList = new AgentList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> AgentInner.fromJson(reader1)); + deserializedAgentList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAgentList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAgentList; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentPropertiesErrorDetails.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentPropertiesErrorDetails.java index 3b95f635a11f..57a0eeaafa0c 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentPropertiesErrorDetails.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentPropertiesErrorDetails.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The AgentPropertiesErrorDetails model. */ @Fluent -public final class AgentPropertiesErrorDetails { +public final class AgentPropertiesErrorDetails implements JsonSerializable { /* * Error code reported by Agent */ - @JsonProperty(value = "code") private String code; /* * Expanded description of reported error code */ - @JsonProperty(value = "message") private String message; /** @@ -77,4 +79,43 @@ public AgentPropertiesErrorDetails withMessage(String message) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentPropertiesErrorDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentPropertiesErrorDetails if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AgentPropertiesErrorDetails. + */ + public static AgentPropertiesErrorDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentPropertiesErrorDetails deserializedAgentPropertiesErrorDetails = new AgentPropertiesErrorDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedAgentPropertiesErrorDetails.code = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedAgentPropertiesErrorDetails.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAgentPropertiesErrorDetails; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentStatus.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentStatus.java index d76f935e8f6d..333096e9d594 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentStatus.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentStatus.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -57,7 +56,6 @@ public AgentStatus() { * @param name a name to look for. * @return the corresponding AgentStatus. */ - @JsonCreator public static AgentStatus fromString(String name) { return fromString(name, AgentStatus.class); } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentUpdateParameters.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentUpdateParameters.java index 41e67febc12e..b3f1cf204951 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentUpdateParameters.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AgentUpdateParameters.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.fluent.models.AgentUpdateProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * The Agent resource. */ @Fluent -public final class AgentUpdateParameters { +public final class AgentUpdateParameters implements JsonSerializable { /* * The properties property. */ - @JsonProperty(value = "properties") private AgentUpdateProperties innerProperties; /** @@ -96,4 +99,40 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentUpdateParameters if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AgentUpdateParameters. + */ + public static AgentUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentUpdateParameters deserializedAgentUpdateParameters = new AgentUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedAgentUpdateParameters.innerProperties = AgentUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAgentUpdateParameters; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureKeyVaultSmbCredentials.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureKeyVaultSmbCredentials.java index 8282dc0bb7c1..8a46e621f48b 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureKeyVaultSmbCredentials.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureKeyVaultSmbCredentials.java @@ -5,39 +5,29 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Azure Key Vault secret URIs which store the credentials. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "type", - defaultImpl = AzureKeyVaultSmbCredentials.class, - visible = true) -@JsonTypeName("AzureKeyVaultSmb") @Fluent public final class AzureKeyVaultSmbCredentials extends Credentials { /* * The Credentials type. */ - @JsonTypeId - @JsonProperty(value = "type", required = true) private CredentialType type = CredentialType.AZURE_KEY_VAULT_SMB; /* * The Azure Key Vault secret URI which stores the username. Use empty string to clean-up existing value. */ - @JsonProperty(value = "usernameUri") private String usernameUri; /* * The Azure Key Vault secret URI which stores the password. Use empty string to clean-up existing value. */ - @JsonProperty(value = "passwordUri") private String passwordUri; /** @@ -107,6 +97,47 @@ public AzureKeyVaultSmbCredentials withPasswordUri(String passwordUri) { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("usernameUri", this.usernameUri); + jsonWriter.writeStringField("passwordUri", this.passwordUri); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureKeyVaultSmbCredentials from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureKeyVaultSmbCredentials if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureKeyVaultSmbCredentials. + */ + public static AzureKeyVaultSmbCredentials fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureKeyVaultSmbCredentials deserializedAzureKeyVaultSmbCredentials = new AzureKeyVaultSmbCredentials(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedAzureKeyVaultSmbCredentials.type = CredentialType.fromString(reader.getString()); + } else if ("usernameUri".equals(fieldName)) { + deserializedAzureKeyVaultSmbCredentials.usernameUri = reader.getString(); + } else if ("passwordUri".equals(fieldName)) { + deserializedAzureKeyVaultSmbCredentials.passwordUri = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureKeyVaultSmbCredentials; + }); } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageBlobContainerEndpointProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageBlobContainerEndpointProperties.java index 857ba4435727..084b05a19e5a 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageBlobContainerEndpointProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageBlobContainerEndpointProperties.java @@ -6,39 +6,29 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The properties of Azure Storage blob container endpoint. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "endpointType", - defaultImpl = AzureStorageBlobContainerEndpointProperties.class, - visible = true) -@JsonTypeName("AzureStorageBlobContainer") @Fluent public final class AzureStorageBlobContainerEndpointProperties extends EndpointBaseProperties { /* * The Endpoint resource type. */ - @JsonTypeId - @JsonProperty(value = "endpointType", required = true) private EndpointType endpointType = EndpointType.AZURE_STORAGE_BLOB_CONTAINER; /* * The Azure Resource ID of the storage account that is the target destination. */ - @JsonProperty(value = "storageAccountResourceId", required = true) private String storageAccountResourceId; /* * The name of the Storage blob container that is the target destination. */ - @JsonProperty(value = "blobContainerName", required = true) private String blobContainerName; /** @@ -115,7 +105,6 @@ public AzureStorageBlobContainerEndpointProperties withDescription(String descri */ @Override public void validate() { - super.validate(); if (storageAccountResourceId() == null) { throw LOGGER.atError() .log(new IllegalArgumentException( @@ -129,4 +118,56 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(AzureStorageBlobContainerEndpointProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", description()); + jsonWriter.writeStringField("storageAccountResourceId", this.storageAccountResourceId); + jsonWriter.writeStringField("blobContainerName", this.blobContainerName); + jsonWriter.writeStringField("endpointType", this.endpointType == null ? null : this.endpointType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureStorageBlobContainerEndpointProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureStorageBlobContainerEndpointProperties if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureStorageBlobContainerEndpointProperties. + */ + public static AzureStorageBlobContainerEndpointProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureStorageBlobContainerEndpointProperties deserializedAzureStorageBlobContainerEndpointProperties + = new AzureStorageBlobContainerEndpointProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedAzureStorageBlobContainerEndpointProperties.withDescription(reader.getString()); + } else if ("provisioningState".equals(fieldName)) { + deserializedAzureStorageBlobContainerEndpointProperties + .withProvisioningState(ProvisioningState.fromString(reader.getString())); + } else if ("storageAccountResourceId".equals(fieldName)) { + deserializedAzureStorageBlobContainerEndpointProperties.storageAccountResourceId + = reader.getString(); + } else if ("blobContainerName".equals(fieldName)) { + deserializedAzureStorageBlobContainerEndpointProperties.blobContainerName = reader.getString(); + } else if ("endpointType".equals(fieldName)) { + deserializedAzureStorageBlobContainerEndpointProperties.endpointType + = EndpointType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureStorageBlobContainerEndpointProperties; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageBlobContainerEndpointUpdateProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageBlobContainerEndpointUpdateProperties.java index 4ca4dbdfa123..859f1863c691 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageBlobContainerEndpointUpdateProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageBlobContainerEndpointUpdateProperties.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The AzureStorageBlobContainerEndpointUpdateProperties model. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "endpointType", - defaultImpl = AzureStorageBlobContainerEndpointUpdateProperties.class, - visible = true) -@JsonTypeName("AzureStorageBlobContainer") @Fluent public final class AzureStorageBlobContainerEndpointUpdateProperties extends EndpointBaseUpdateProperties { /* * The Endpoint resource type. */ - @JsonTypeId - @JsonProperty(value = "endpointType", required = true) private EndpointType endpointType = EndpointType.AZURE_STORAGE_BLOB_CONTAINER; /** @@ -60,6 +52,46 @@ public AzureStorageBlobContainerEndpointUpdateProperties withDescription(String */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", description()); + jsonWriter.writeStringField("endpointType", this.endpointType == null ? null : this.endpointType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureStorageBlobContainerEndpointUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureStorageBlobContainerEndpointUpdateProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureStorageBlobContainerEndpointUpdateProperties. + */ + public static AzureStorageBlobContainerEndpointUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureStorageBlobContainerEndpointUpdateProperties deserializedAzureStorageBlobContainerEndpointUpdateProperties + = new AzureStorageBlobContainerEndpointUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedAzureStorageBlobContainerEndpointUpdateProperties.withDescription(reader.getString()); + } else if ("endpointType".equals(fieldName)) { + deserializedAzureStorageBlobContainerEndpointUpdateProperties.endpointType + = EndpointType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureStorageBlobContainerEndpointUpdateProperties; + }); } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageSmbFileShareEndpointProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageSmbFileShareEndpointProperties.java index 37709df04bfc..4fc734170402 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageSmbFileShareEndpointProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageSmbFileShareEndpointProperties.java @@ -6,39 +6,29 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The properties of Azure Storage SMB file share endpoint. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "endpointType", - defaultImpl = AzureStorageSmbFileShareEndpointProperties.class, - visible = true) -@JsonTypeName("AzureStorageSmbFileShare") @Fluent public final class AzureStorageSmbFileShareEndpointProperties extends EndpointBaseProperties { /* * The Endpoint resource type. */ - @JsonTypeId - @JsonProperty(value = "endpointType", required = true) private EndpointType endpointType = EndpointType.AZURE_STORAGE_SMB_FILE_SHARE; /* * The Azure Resource ID of the storage account. */ - @JsonProperty(value = "storageAccountResourceId", required = true) private String storageAccountResourceId; /* * The name of the Azure Storage file share. */ - @JsonProperty(value = "fileShareName", required = true) private String fileShareName; /** @@ -113,7 +103,6 @@ public AzureStorageSmbFileShareEndpointProperties withDescription(String descrip */ @Override public void validate() { - super.validate(); if (storageAccountResourceId() == null) { throw LOGGER.atError() .log(new IllegalArgumentException( @@ -127,4 +116,56 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(AzureStorageSmbFileShareEndpointProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", description()); + jsonWriter.writeStringField("storageAccountResourceId", this.storageAccountResourceId); + jsonWriter.writeStringField("fileShareName", this.fileShareName); + jsonWriter.writeStringField("endpointType", this.endpointType == null ? null : this.endpointType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureStorageSmbFileShareEndpointProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureStorageSmbFileShareEndpointProperties if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureStorageSmbFileShareEndpointProperties. + */ + public static AzureStorageSmbFileShareEndpointProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureStorageSmbFileShareEndpointProperties deserializedAzureStorageSmbFileShareEndpointProperties + = new AzureStorageSmbFileShareEndpointProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedAzureStorageSmbFileShareEndpointProperties.withDescription(reader.getString()); + } else if ("provisioningState".equals(fieldName)) { + deserializedAzureStorageSmbFileShareEndpointProperties + .withProvisioningState(ProvisioningState.fromString(reader.getString())); + } else if ("storageAccountResourceId".equals(fieldName)) { + deserializedAzureStorageSmbFileShareEndpointProperties.storageAccountResourceId + = reader.getString(); + } else if ("fileShareName".equals(fieldName)) { + deserializedAzureStorageSmbFileShareEndpointProperties.fileShareName = reader.getString(); + } else if ("endpointType".equals(fieldName)) { + deserializedAzureStorageSmbFileShareEndpointProperties.endpointType + = EndpointType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureStorageSmbFileShareEndpointProperties; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageSmbFileShareEndpointUpdateProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageSmbFileShareEndpointUpdateProperties.java index c6ef80a50ce9..1c09e516d07e 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageSmbFileShareEndpointUpdateProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/AzureStorageSmbFileShareEndpointUpdateProperties.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The properties of Azure Storage SMB file share endpoint to update. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "endpointType", - defaultImpl = AzureStorageSmbFileShareEndpointUpdateProperties.class, - visible = true) -@JsonTypeName("AzureStorageSmbFileShare") @Fluent public final class AzureStorageSmbFileShareEndpointUpdateProperties extends EndpointBaseUpdateProperties { /* * The Endpoint resource type. */ - @JsonTypeId - @JsonProperty(value = "endpointType", required = true) private EndpointType endpointType = EndpointType.AZURE_STORAGE_SMB_FILE_SHARE; /** @@ -60,6 +52,46 @@ public AzureStorageSmbFileShareEndpointUpdateProperties withDescription(String d */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", description()); + jsonWriter.writeStringField("endpointType", this.endpointType == null ? null : this.endpointType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureStorageSmbFileShareEndpointUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureStorageSmbFileShareEndpointUpdateProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureStorageSmbFileShareEndpointUpdateProperties. + */ + public static AzureStorageSmbFileShareEndpointUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureStorageSmbFileShareEndpointUpdateProperties deserializedAzureStorageSmbFileShareEndpointUpdateProperties + = new AzureStorageSmbFileShareEndpointUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedAzureStorageSmbFileShareEndpointUpdateProperties.withDescription(reader.getString()); + } else if ("endpointType".equals(fieldName)) { + deserializedAzureStorageSmbFileShareEndpointUpdateProperties.endpointType + = EndpointType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureStorageSmbFileShareEndpointUpdateProperties; + }); } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/CopyMode.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/CopyMode.java index ff99134fc5d4..ad3d364eb443 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/CopyMode.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/CopyMode.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,7 +36,6 @@ public CopyMode() { * @param name a name to look for. * @return the corresponding CopyMode. */ - @JsonCreator public static CopyMode fromString(String name) { return fromString(name, CopyMode.class); } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/CredentialType.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/CredentialType.java index 03920f65d7d3..08f4e3416aa6 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/CredentialType.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/CredentialType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -32,7 +31,6 @@ public CredentialType() { * @param name a name to look for. * @return the corresponding CredentialType. */ - @JsonCreator public static CredentialType fromString(String name) { return fromString(name, CredentialType.class); } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Credentials.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Credentials.java index 6c004fce4f7f..4d79dd50f00c 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Credentials.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Credentials.java @@ -5,25 +5,20 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Credentials. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", defaultImpl = Credentials.class, visible = true) -@JsonTypeName("Credentials") -@JsonSubTypes({ @JsonSubTypes.Type(name = "AzureKeyVaultSmb", value = AzureKeyVaultSmbCredentials.class) }) @Immutable -public class Credentials { +public class Credentials implements JsonSerializable { /* * The Credentials type. */ - @JsonTypeId - @JsonProperty(value = "type", required = true) private CredentialType type = CredentialType.fromString("Credentials"); /** @@ -48,4 +43,65 @@ public CredentialType type() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Credentials from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Credentials if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the Credentials. + */ + public static Credentials fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureKeyVaultSmb".equals(discriminatorValue)) { + return AzureKeyVaultSmbCredentials.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static Credentials fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Credentials deserializedCredentials = new Credentials(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedCredentials.type = CredentialType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCredentials; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/DayOfWeek.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/DayOfWeek.java index e7985b40987f..2bd31678a101 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/DayOfWeek.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/DayOfWeek.java @@ -4,9 +4,6 @@ package com.azure.resourcemanager.storagemover.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - /** * The day of week. */ @@ -61,7 +58,6 @@ public enum DayOfWeek { * @param value the serialized value to parse. * @return the parsed DayOfWeek object, or null if unable to parse. */ - @JsonCreator public static DayOfWeek fromString(String value) { if (value == null) { return null; @@ -78,7 +74,6 @@ public static DayOfWeek fromString(String value) { /** * {@inheritDoc} */ - @JsonValue @Override public String toString() { return this.value; diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseProperties.java index ac0dfd5283ec..fa0d6ccfb99c 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseProperties.java @@ -5,45 +5,30 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The resource specific properties for the Storage Mover resource. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "endpointType", - defaultImpl = EndpointBaseProperties.class, - visible = true) -@JsonTypeName("EndpointBaseProperties") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "AzureStorageBlobContainer", value = AzureStorageBlobContainerEndpointProperties.class), - @JsonSubTypes.Type(name = "NfsMount", value = NfsMountEndpointProperties.class), - @JsonSubTypes.Type(name = "AzureStorageSmbFileShare", value = AzureStorageSmbFileShareEndpointProperties.class), - @JsonSubTypes.Type(name = "SmbMount", value = SmbMountEndpointProperties.class) }) @Fluent -public class EndpointBaseProperties { +public class EndpointBaseProperties implements JsonSerializable { /* * The Endpoint resource type. */ - @JsonTypeId - @JsonProperty(value = "endpointType", required = true) private EndpointType endpointType = EndpointType.fromString("EndpointBaseProperties"); /* * A description for the Endpoint. */ - @JsonProperty(value = "description") private String description; /* * The provisioning state of this resource. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /** @@ -90,6 +75,17 @@ public ProvisioningState provisioningState() { return this.provisioningState; } + /** + * Set the provisioningState property: The provisioning state of this resource. + * + * @param provisioningState the provisioningState value to set. + * @return the EndpointBaseProperties object itself. + */ + EndpointBaseProperties withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + /** * Validates the instance. * @@ -97,4 +93,77 @@ public ProvisioningState provisioningState() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("endpointType", this.endpointType == null ? null : this.endpointType.toString()); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EndpointBaseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EndpointBaseProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the EndpointBaseProperties. + */ + public static EndpointBaseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("endpointType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureStorageBlobContainer".equals(discriminatorValue)) { + return AzureStorageBlobContainerEndpointProperties.fromJson(readerToUse.reset()); + } else if ("NfsMount".equals(discriminatorValue)) { + return NfsMountEndpointProperties.fromJson(readerToUse.reset()); + } else if ("AzureStorageSmbFileShare".equals(discriminatorValue)) { + return AzureStorageSmbFileShareEndpointProperties.fromJson(readerToUse.reset()); + } else if ("SmbMount".equals(discriminatorValue)) { + return SmbMountEndpointProperties.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static EndpointBaseProperties fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EndpointBaseProperties deserializedEndpointBaseProperties = new EndpointBaseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("endpointType".equals(fieldName)) { + deserializedEndpointBaseProperties.endpointType = EndpointType.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedEndpointBaseProperties.description = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedEndpointBaseProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedEndpointBaseProperties; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseUpdateParameters.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseUpdateParameters.java index bbe93dfbb45a..777902479c1b 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseUpdateParameters.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseUpdateParameters.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Endpoint resource. */ @Fluent -public final class EndpointBaseUpdateParameters { +public final class EndpointBaseUpdateParameters implements JsonSerializable { /* * The Endpoint resource, which contains information about file sources and targets. */ - @JsonProperty(value = "properties") private EndpointBaseUpdateProperties properties; /** @@ -54,4 +57,40 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EndpointBaseUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EndpointBaseUpdateParameters if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EndpointBaseUpdateParameters. + */ + public static EndpointBaseUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EndpointBaseUpdateParameters deserializedEndpointBaseUpdateParameters = new EndpointBaseUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedEndpointBaseUpdateParameters.properties = EndpointBaseUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEndpointBaseUpdateParameters; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseUpdateProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseUpdateProperties.java index ee6b18be135c..0501c7867c32 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseUpdateProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointBaseUpdateProperties.java @@ -5,43 +5,25 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Endpoint resource, which contains information about file sources and targets. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "endpointType", - defaultImpl = EndpointBaseUpdateProperties.class, - visible = true) -@JsonTypeName("EndpointBaseUpdateProperties") -@JsonSubTypes({ - @JsonSubTypes.Type( - name = "AzureStorageBlobContainer", - value = AzureStorageBlobContainerEndpointUpdateProperties.class), - @JsonSubTypes.Type(name = "NfsMount", value = NfsMountEndpointUpdateProperties.class), - @JsonSubTypes.Type( - name = "AzureStorageSmbFileShare", - value = AzureStorageSmbFileShareEndpointUpdateProperties.class), - @JsonSubTypes.Type(name = "SmbMount", value = SmbMountEndpointUpdateProperties.class) }) @Fluent -public class EndpointBaseUpdateProperties { +public class EndpointBaseUpdateProperties implements JsonSerializable { /* * The Endpoint resource type. */ - @JsonTypeId - @JsonProperty(value = "endpointType", required = true) private EndpointType endpointType = EndpointType.fromString("EndpointBaseUpdateProperties"); /* * A description for the Endpoint. */ - @JsonProperty(value = "description") private String description; /** @@ -86,4 +68,74 @@ public EndpointBaseUpdateProperties withDescription(String description) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("endpointType", this.endpointType == null ? null : this.endpointType.toString()); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EndpointBaseUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EndpointBaseUpdateProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EndpointBaseUpdateProperties. + */ + public static EndpointBaseUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("endpointType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureStorageBlobContainer".equals(discriminatorValue)) { + return AzureStorageBlobContainerEndpointUpdateProperties.fromJson(readerToUse.reset()); + } else if ("NfsMount".equals(discriminatorValue)) { + return NfsMountEndpointUpdateProperties.fromJson(readerToUse.reset()); + } else if ("AzureStorageSmbFileShare".equals(discriminatorValue)) { + return AzureStorageSmbFileShareEndpointUpdateProperties.fromJson(readerToUse.reset()); + } else if ("SmbMount".equals(discriminatorValue)) { + return SmbMountEndpointUpdateProperties.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static EndpointBaseUpdateProperties fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EndpointBaseUpdateProperties deserializedEndpointBaseUpdateProperties = new EndpointBaseUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("endpointType".equals(fieldName)) { + deserializedEndpointBaseUpdateProperties.endpointType = EndpointType.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedEndpointBaseUpdateProperties.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEndpointBaseUpdateProperties; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointList.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointList.java index d098b3f8941a..14f57b21c322 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointList.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointList.java @@ -5,26 +5,28 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.fluent.models.EndpointInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of Endpoints. */ @Immutable -public final class EndpointList { +public final class EndpointList implements JsonSerializable { /* * The value property. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * Request URL that can be used to query next page of containers. Returned when total number of requested containers * exceed maximum page size. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -62,4 +64,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EndpointList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EndpointList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the EndpointList. + */ + public static EndpointList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EndpointList deserializedEndpointList = new EndpointList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> EndpointInner.fromJson(reader1)); + deserializedEndpointList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedEndpointList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEndpointList; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointType.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointType.java index 57c30d23d881..4bb560a6b531 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointType.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/EndpointType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -47,7 +46,6 @@ public EndpointType() { * @param name a name to look for. * @return the corresponding EndpointType. */ - @JsonCreator public static EndpointType fromString(String name) { return fromString(name, EndpointType.class); } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitionList.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitionList.java index fa71b7972e29..c881c310ac91 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitionList.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitionList.java @@ -5,26 +5,28 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.fluent.models.JobDefinitionInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of Job Definitions. */ @Immutable -public final class JobDefinitionList { +public final class JobDefinitionList implements JsonSerializable { /* * The value property. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * Request URL that can be used to query next page of containers. Returned when total number of requested containers * exceed maximum page size. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -62,4 +64,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobDefinitionList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobDefinitionList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the JobDefinitionList. + */ + public static JobDefinitionList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JobDefinitionList deserializedJobDefinitionList = new JobDefinitionList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> JobDefinitionInner.fromJson(reader1)); + deserializedJobDefinitionList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedJobDefinitionList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedJobDefinitionList; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitionUpdateParameters.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitionUpdateParameters.java index 7b7ff49b2a01..300e9a076e5c 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitionUpdateParameters.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobDefinitionUpdateParameters.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.fluent.models.JobDefinitionUpdateProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * The Job Definition resource. */ @Fluent -public final class JobDefinitionUpdateParameters { +public final class JobDefinitionUpdateParameters implements JsonSerializable { /* * Job definition properties. */ - @JsonProperty(value = "properties") private JobDefinitionUpdateProperties innerProperties; /** @@ -113,4 +116,42 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobDefinitionUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobDefinitionUpdateParameters if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the JobDefinitionUpdateParameters. + */ + public static JobDefinitionUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JobDefinitionUpdateParameters deserializedJobDefinitionUpdateParameters + = new JobDefinitionUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedJobDefinitionUpdateParameters.innerProperties + = JobDefinitionUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedJobDefinitionUpdateParameters; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunError.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunError.java index b2d55cae1329..46e7aa46e20b 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunError.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunError.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Error type. */ @Fluent -public final class JobRunError { +public final class JobRunError implements JsonSerializable { /* * Error code of the given entry. */ - @JsonProperty(value = "code") private String code; /* * Error message of the given entry. */ - @JsonProperty(value = "message") private String message; /* * Target of the given error entry. */ - @JsonProperty(value = "target") private String target; /** @@ -103,4 +104,46 @@ public JobRunError withTarget(String target) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code); + jsonWriter.writeStringField("message", this.message); + jsonWriter.writeStringField("target", this.target); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobRunError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobRunError if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the JobRunError. + */ + public static JobRunError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JobRunError deserializedJobRunError = new JobRunError(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedJobRunError.code = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedJobRunError.message = reader.getString(); + } else if ("target".equals(fieldName)) { + deserializedJobRunError.target = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedJobRunError; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunList.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunList.java index e7cfb700855d..320cdf8438f2 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunList.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunList.java @@ -5,26 +5,28 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.fluent.models.JobRunInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of Job Runs. */ @Immutable -public final class JobRunList { +public final class JobRunList implements JsonSerializable { /* * The value property. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * Request URL that can be used to query next page of containers. Returned when total number of requested containers * exceed maximum page size. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -62,4 +64,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobRunList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobRunList if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the JobRunList. + */ + public static JobRunList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JobRunList deserializedJobRunList = new JobRunList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> JobRunInner.fromJson(reader1)); + deserializedJobRunList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedJobRunList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedJobRunList; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunScanStatus.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunScanStatus.java index 6dd27a914b35..ba2df4b96c91 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunScanStatus.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunScanStatus.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public JobRunScanStatus() { * @param name a name to look for. * @return the corresponding JobRunScanStatus. */ - @JsonCreator public static JobRunScanStatus fromString(String name) { return fromString(name, JobRunScanStatus.class); } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunStatus.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunStatus.java index 5ee54dc83634..66fe4c2464a2 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunStatus.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/JobRunStatus.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -72,7 +71,6 @@ public JobRunStatus() { * @param name a name to look for. * @return the corresponding JobRunStatus. */ - @JsonCreator public static JobRunStatus fromString(String name) { return fromString(name, JobRunStatus.class); } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Minute.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Minute.java index 6f7ab20beee2..39090f52ffa2 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Minute.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Minute.java @@ -4,50 +4,80 @@ package com.azure.resourcemanager.storagemover.models; -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; +import com.azure.core.util.ExpandableEnum; +import java.util.ArrayList; import java.util.Collection; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; /** * The minute element of the time. Allowed values are 0 and 30. If not specified, its value defaults to 0. */ -public final class Minute extends ExpandableStringEnum { +public final class Minute implements ExpandableEnum { + private static final Map VALUES = new ConcurrentHashMap<>(); + + private static final Function NEW_INSTANCE = Minute::new; + /** * Static value 0 for Minute. */ - public static final Minute ZERO = fromInt(0); + public static final Minute ZERO = fromValue(0); /** * Static value 30 for Minute. */ - public static final Minute THREE_ZERO = fromInt(30); + public static final Minute THREE_ZERO = fromValue(30); - /** - * Creates a new instance of Minute value. - * - * @deprecated Use the {@link #fromInt(int)} factory method. - */ - @Deprecated - public Minute() { + private final Integer value; + + private Minute(Integer value) { + this.value = value; } /** - * Creates or finds a Minute from its string representation. + * Creates or finds a Minute. * - * @param name a name to look for. + * @param value a value to look for. * @return the corresponding Minute. */ - @JsonCreator - public static Minute fromInt(int name) { - return fromString(String.valueOf(name), Minute.class); + public static Minute fromValue(Integer value) { + Objects.requireNonNull(value, "'value' cannot be null."); + return VALUES.computeIfAbsent(value, NEW_INSTANCE); } /** * Gets known Minute values. * - * @return known Minute values. + * @return Known Minute values. */ public static Collection values() { - return values(Minute.class); + return new ArrayList<>(VALUES.values()); + } + + /** + * Gets the value of the Minute instance. + * + * @return the value of the Minute instance. + */ + @Override + public Integer getValue() { + return this.value; + } + + @Override + public String toString() { + return Objects.toString(this.value); + } + + @Override + public boolean equals(Object obj) { + return this == obj; + } + + @Override + public int hashCode() { + return Objects.hashCode(this.value); } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsMountEndpointProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsMountEndpointProperties.java index d380c6a02285..1873a7ea3568 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsMountEndpointProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsMountEndpointProperties.java @@ -6,45 +6,34 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The properties of NFS share endpoint. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "endpointType", - defaultImpl = NfsMountEndpointProperties.class, - visible = true) -@JsonTypeName("NfsMount") @Fluent public final class NfsMountEndpointProperties extends EndpointBaseProperties { /* * The Endpoint resource type. */ - @JsonTypeId - @JsonProperty(value = "endpointType", required = true) private EndpointType endpointType = EndpointType.NFS_MOUNT; /* * The host name or IP address of the server exporting the file system. */ - @JsonProperty(value = "host", required = true) private String host; /* * The NFS protocol version. */ - @JsonProperty(value = "nfsVersion") private NfsVersion nfsVersion; /* * The directory being exported from the server. */ - @JsonProperty(value = "export", required = true) private String export; /** @@ -139,7 +128,6 @@ public NfsMountEndpointProperties withDescription(String description) { */ @Override public void validate() { - super.validate(); if (host() == null) { throw LOGGER.atError() .log( @@ -153,4 +141,56 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(NfsMountEndpointProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", description()); + jsonWriter.writeStringField("host", this.host); + jsonWriter.writeStringField("export", this.export); + jsonWriter.writeStringField("endpointType", this.endpointType == null ? null : this.endpointType.toString()); + jsonWriter.writeStringField("nfsVersion", this.nfsVersion == null ? null : this.nfsVersion.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NfsMountEndpointProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NfsMountEndpointProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NfsMountEndpointProperties. + */ + public static NfsMountEndpointProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NfsMountEndpointProperties deserializedNfsMountEndpointProperties = new NfsMountEndpointProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedNfsMountEndpointProperties.withDescription(reader.getString()); + } else if ("provisioningState".equals(fieldName)) { + deserializedNfsMountEndpointProperties + .withProvisioningState(ProvisioningState.fromString(reader.getString())); + } else if ("host".equals(fieldName)) { + deserializedNfsMountEndpointProperties.host = reader.getString(); + } else if ("export".equals(fieldName)) { + deserializedNfsMountEndpointProperties.export = reader.getString(); + } else if ("endpointType".equals(fieldName)) { + deserializedNfsMountEndpointProperties.endpointType = EndpointType.fromString(reader.getString()); + } else if ("nfsVersion".equals(fieldName)) { + deserializedNfsMountEndpointProperties.nfsVersion = NfsVersion.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedNfsMountEndpointProperties; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsMountEndpointUpdateProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsMountEndpointUpdateProperties.java index 507d1af5ce84..9dc1ff0cabcf 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsMountEndpointUpdateProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsMountEndpointUpdateProperties.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The NfsMountEndpointUpdateProperties model. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "endpointType", - defaultImpl = NfsMountEndpointUpdateProperties.class, - visible = true) -@JsonTypeName("NfsMount") @Fluent public final class NfsMountEndpointUpdateProperties extends EndpointBaseUpdateProperties { /* * The Endpoint resource type. */ - @JsonTypeId - @JsonProperty(value = "endpointType", required = true) private EndpointType endpointType = EndpointType.NFS_MOUNT; /** @@ -60,6 +52,46 @@ public NfsMountEndpointUpdateProperties withDescription(String description) { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", description()); + jsonWriter.writeStringField("endpointType", this.endpointType == null ? null : this.endpointType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NfsMountEndpointUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NfsMountEndpointUpdateProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the NfsMountEndpointUpdateProperties. + */ + public static NfsMountEndpointUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NfsMountEndpointUpdateProperties deserializedNfsMountEndpointUpdateProperties + = new NfsMountEndpointUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedNfsMountEndpointUpdateProperties.withDescription(reader.getString()); + } else if ("endpointType".equals(fieldName)) { + deserializedNfsMountEndpointUpdateProperties.endpointType + = EndpointType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedNfsMountEndpointUpdateProperties; + }); } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsVersion.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsVersion.java index 6a6edc88334b..0637d3391d0d 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsVersion.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/NfsVersion.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public NfsVersion() { * @param name a name to look for. * @return the corresponding NfsVersion. */ - @JsonCreator public static NfsVersion fromString(String name) { return fromString(name, NfsVersion.class); } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/OperationDisplay.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/OperationDisplay.java index 406cd1cb9d56..ce3af088c69d 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/OperationDisplay.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/OperationDisplay.java @@ -5,38 +5,38 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Localized display information for this particular operation. */ @Immutable -public final class OperationDisplay { +public final class OperationDisplay implements JsonSerializable { /* * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or * "Microsoft Compute". */ - @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) private String provider; /* * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or * "Job Schedule Collections". */ - @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) private String resource; /* * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. * "Create or Update Virtual Machine", "Restart Virtual Machine". */ - @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) private String operation; /* * The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ - @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /** @@ -92,4 +92,45 @@ public String description() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/OperationListResult.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/OperationListResult.java index b2f415944169..a326b8ec8097 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/OperationListResult.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/OperationListResult.java @@ -5,8 +5,12 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.fluent.models.OperationInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -14,17 +18,15 @@ * results. */ @Immutable -public final class OperationListResult { +public final class OperationListResult implements JsonSerializable { /* * List of operations supported by the resource provider */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * URL to get the next set of operation list results (if there are any). */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -61,4 +63,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Origin.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Origin.java index dd08af0b14b3..dc065702c61c 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Origin.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Origin.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -43,7 +42,6 @@ public Origin() { * @param name a name to look for. * @return the corresponding Origin. */ - @JsonCreator public static Origin fromString(String name) { return fromString(name, Origin.class); } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProjectList.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProjectList.java index 86b4b6e0b570..a55e1f47be81 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProjectList.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProjectList.java @@ -5,26 +5,28 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.fluent.models.ProjectInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of Project resources. */ @Immutable -public final class ProjectList { +public final class ProjectList implements JsonSerializable { /* * The value property. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * Request URL that can be used to query next page of containers. Returned when total number of requested containers * exceed maximum page size. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -62,4 +64,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProjectList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProjectList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ProjectList. + */ + public static ProjectList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProjectList deserializedProjectList = new ProjectList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ProjectInner.fromJson(reader1)); + deserializedProjectList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedProjectList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProjectList; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProjectUpdateParameters.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProjectUpdateParameters.java index 3e0a70b30b0f..bb20692fcd58 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProjectUpdateParameters.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProjectUpdateParameters.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.fluent.models.ProjectUpdateProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * The Project resource. */ @Fluent -public final class ProjectUpdateParameters { +public final class ProjectUpdateParameters implements JsonSerializable { /* * Project properties. */ - @JsonProperty(value = "properties") private ProjectUpdateProperties innerProperties; /** @@ -67,4 +70,40 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProjectUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProjectUpdateParameters if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ProjectUpdateParameters. + */ + public static ProjectUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProjectUpdateParameters deserializedProjectUpdateParameters = new ProjectUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedProjectUpdateParameters.innerProperties = ProjectUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedProjectUpdateParameters; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProvisioningState.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProvisioningState.java index ddb838fb0143..6361ecd1004d 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProvisioningState.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/ProvisioningState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -47,7 +46,6 @@ public ProvisioningState() { * @param name a name to look for. * @return the corresponding ProvisioningState. */ - @JsonCreator public static ProvisioningState fromString(String name) { return fromString(name, ProvisioningState.class); } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Recurrence.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Recurrence.java index 93e6ddf0b463..8291dd70f288 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Recurrence.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Recurrence.java @@ -6,23 +6,25 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The schedule recurrence. */ @Fluent -public class Recurrence { +public class Recurrence implements JsonSerializable { /* * The start time of the schedule recurrence. Full hour and 30-minute intervals are supported. */ - @JsonProperty(value = "startTime", required = true) private Time startTime; /* * The end time of the schedule recurrence. Full hour and 30-minute intervals are supported. */ - @JsonProperty(value = "endTime", required = true) private Time endTime; /** @@ -96,4 +98,44 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(Recurrence.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("startTime", this.startTime); + jsonWriter.writeJsonField("endTime", this.endTime); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Recurrence from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Recurrence if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Recurrence. + */ + public static Recurrence fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Recurrence deserializedRecurrence = new Recurrence(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("startTime".equals(fieldName)) { + deserializedRecurrence.startTime = Time.fromJson(reader); + } else if ("endTime".equals(fieldName)) { + deserializedRecurrence.endTime = Time.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRecurrence; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/SmbMountEndpointProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/SmbMountEndpointProperties.java index a2b121a4c279..63a8678e0e9a 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/SmbMountEndpointProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/SmbMountEndpointProperties.java @@ -6,45 +6,34 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The properties of SMB share endpoint. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "endpointType", - defaultImpl = SmbMountEndpointProperties.class, - visible = true) -@JsonTypeName("SmbMount") @Fluent public final class SmbMountEndpointProperties extends EndpointBaseProperties { /* * The Endpoint resource type. */ - @JsonTypeId - @JsonProperty(value = "endpointType", required = true) private EndpointType endpointType = EndpointType.SMB_MOUNT; /* * The host name or IP address of the server exporting the file system. */ - @JsonProperty(value = "host", required = true) private String host; /* * The name of the SMB share being exported from the server. */ - @JsonProperty(value = "shareName", required = true) private String shareName; /* * The Azure Key Vault secret URIs which store the required credentials to access the SMB share. */ - @JsonProperty(value = "credentials") private AzureKeyVaultSmbCredentials credentials; /** @@ -141,7 +130,6 @@ public SmbMountEndpointProperties withDescription(String description) { */ @Override public void validate() { - super.validate(); if (host() == null) { throw LOGGER.atError() .log( @@ -158,4 +146,56 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(SmbMountEndpointProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", description()); + jsonWriter.writeStringField("host", this.host); + jsonWriter.writeStringField("shareName", this.shareName); + jsonWriter.writeStringField("endpointType", this.endpointType == null ? null : this.endpointType.toString()); + jsonWriter.writeJsonField("credentials", this.credentials); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SmbMountEndpointProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SmbMountEndpointProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SmbMountEndpointProperties. + */ + public static SmbMountEndpointProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SmbMountEndpointProperties deserializedSmbMountEndpointProperties = new SmbMountEndpointProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedSmbMountEndpointProperties.withDescription(reader.getString()); + } else if ("provisioningState".equals(fieldName)) { + deserializedSmbMountEndpointProperties + .withProvisioningState(ProvisioningState.fromString(reader.getString())); + } else if ("host".equals(fieldName)) { + deserializedSmbMountEndpointProperties.host = reader.getString(); + } else if ("shareName".equals(fieldName)) { + deserializedSmbMountEndpointProperties.shareName = reader.getString(); + } else if ("endpointType".equals(fieldName)) { + deserializedSmbMountEndpointProperties.endpointType = EndpointType.fromString(reader.getString()); + } else if ("credentials".equals(fieldName)) { + deserializedSmbMountEndpointProperties.credentials = AzureKeyVaultSmbCredentials.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSmbMountEndpointProperties; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/SmbMountEndpointUpdateProperties.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/SmbMountEndpointUpdateProperties.java index b7362a4f67b8..61e83fffceb5 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/SmbMountEndpointUpdateProperties.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/SmbMountEndpointUpdateProperties.java @@ -5,33 +5,24 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The properties of SMB share endpoint to update. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "endpointType", - defaultImpl = SmbMountEndpointUpdateProperties.class, - visible = true) -@JsonTypeName("SmbMount") @Fluent public final class SmbMountEndpointUpdateProperties extends EndpointBaseUpdateProperties { /* * The Endpoint resource type. */ - @JsonTypeId - @JsonProperty(value = "endpointType", required = true) private EndpointType endpointType = EndpointType.SMB_MOUNT; /* * The Azure Key Vault secret URIs which store the required credentials to access the SMB share. */ - @JsonProperty(value = "credentials") private AzureKeyVaultSmbCredentials credentials; /** @@ -88,9 +79,53 @@ public SmbMountEndpointUpdateProperties withDescription(String description) { */ @Override public void validate() { - super.validate(); if (credentials() != null) { credentials().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", description()); + jsonWriter.writeStringField("endpointType", this.endpointType == null ? null : this.endpointType.toString()); + jsonWriter.writeJsonField("credentials", this.credentials); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SmbMountEndpointUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SmbMountEndpointUpdateProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SmbMountEndpointUpdateProperties. + */ + public static SmbMountEndpointUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SmbMountEndpointUpdateProperties deserializedSmbMountEndpointUpdateProperties + = new SmbMountEndpointUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedSmbMountEndpointUpdateProperties.withDescription(reader.getString()); + } else if ("endpointType".equals(fieldName)) { + deserializedSmbMountEndpointUpdateProperties.endpointType + = EndpointType.fromString(reader.getString()); + } else if ("credentials".equals(fieldName)) { + deserializedSmbMountEndpointUpdateProperties.credentials + = AzureKeyVaultSmbCredentials.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSmbMountEndpointUpdateProperties; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMoverList.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMoverList.java index bac9828ed59b..efe8cdd5ad87 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMoverList.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMoverList.java @@ -5,26 +5,28 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.fluent.models.StorageMoverInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of Storage Movers. */ @Immutable -public final class StorageMoverList { +public final class StorageMoverList implements JsonSerializable { /* * The value property. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * Request URL that can be used to query next page of containers. Returned when total number of requested containers * exceed maximum page size. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -62,4 +64,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageMoverList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageMoverList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the StorageMoverList. + */ + public static StorageMoverList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageMoverList deserializedStorageMoverList = new StorageMoverList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> StorageMoverInner.fromJson(reader1)); + deserializedStorageMoverList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedStorageMoverList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageMoverList; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMoverUpdateParameters.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMoverUpdateParameters.java index 2f28fd34d7cc..b2740544f0ab 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMoverUpdateParameters.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/StorageMoverUpdateParameters.java @@ -5,27 +5,27 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.storagemover.fluent.models.StorageMoverUpdateProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** * The Storage Mover resource. */ @Fluent -public final class StorageMoverUpdateParameters { +public final class StorageMoverUpdateParameters implements JsonSerializable { /* * The resource specific properties for the Storage Mover resource. */ - @JsonProperty(value = "properties") private StorageMoverUpdateProperties innerProperties; /* * Resource tags. */ - @JsonProperty(value = "tags") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; /** @@ -96,4 +96,45 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageMoverUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageMoverUpdateParameters if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the StorageMoverUpdateParameters. + */ + public static StorageMoverUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageMoverUpdateParameters deserializedStorageMoverUpdateParameters = new StorageMoverUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedStorageMoverUpdateParameters.innerProperties + = StorageMoverUpdateProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedStorageMoverUpdateParameters.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedStorageMoverUpdateParameters; + }); + } } diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Time.java b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Time.java index c711a20cabb0..99ece2b701a0 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Time.java +++ b/sdk/storagemover/azure-resourcemanager-storagemover/src/main/java/com/azure/resourcemanager/storagemover/models/Time.java @@ -5,24 +5,26 @@ package com.azure.resourcemanager.storagemover.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The time of day. */ @Fluent -public final class Time { +public final class Time implements JsonSerializable