Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgmt, migrate azure-resourcemanager-resources to azure-json #41277

Merged
merged 15 commits into from
Aug 2, 2024
  •  
  •  
  •  
80 changes: 40 additions & 40 deletions sdk/resourcemanager/api-specs.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions sdk/resourcemanager/azure-resourcemanager-resources/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
<artifactId>azure-core-management</artifactId>
<version>1.15.1</version> <!-- {x-version-update;com.azure:azure-core-management;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-json</artifactId>
<version>1.2.0</version> <!-- {x-version-update;com.azure:azure-json;dependency} -->
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public interface TagOperationsClient {
* specified entity can have a maximum of 50 tags.
*
* @param scope The resource scope.
* @param parameters Wrapper resource for tags API requests and responses.
* @param parameters The parameters parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
Expand All @@ -351,7 +351,7 @@ public interface TagOperationsClient {
* specified entity can have a maximum of 50 tags.
*
* @param scope The resource scope.
* @param parameters Wrapper resource for tags API requests and responses.
* @param parameters The parameters parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
Expand All @@ -368,7 +368,7 @@ PollerFlux<PollResult<TagsResourceInner>, TagsResourceInner> beginCreateOrUpdate
* specified entity can have a maximum of 50 tags.
*
* @param scope The resource scope.
* @param parameters Wrapper resource for tags API requests and responses.
* @param parameters The parameters parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
Expand All @@ -385,7 +385,7 @@ SyncPoller<PollResult<TagsResourceInner>, TagsResourceInner> beginCreateOrUpdate
* specified entity can have a maximum of 50 tags.
*
* @param scope The resource scope.
* @param parameters Wrapper resource for tags API requests and responses.
* @param parameters The parameters parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
Expand All @@ -403,7 +403,7 @@ SyncPoller<PollResult<TagsResourceInner>, TagsResourceInner> beginCreateOrUpdate
* specified entity can have a maximum of 50 tags.
*
* @param scope The resource scope.
* @param parameters Wrapper resource for tags API requests and responses.
* @param parameters The parameters parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
Expand All @@ -419,7 +419,7 @@ SyncPoller<PollResult<TagsResourceInner>, TagsResourceInner> beginCreateOrUpdate
* specified entity can have a maximum of 50 tags.
*
* @param scope The resource scope.
* @param parameters Wrapper resource for tags API requests and responses.
* @param parameters The parameters parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
Expand All @@ -435,7 +435,7 @@ SyncPoller<PollResult<TagsResourceInner>, TagsResourceInner> beginCreateOrUpdate
* specified entity can have a maximum of 50 tags.
*
* @param scope The resource scope.
* @param parameters Wrapper resource for tags API requests and responses.
* @param parameters The parameters parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
Expand All @@ -455,7 +455,7 @@ SyncPoller<PollResult<TagsResourceInner>, TagsResourceInner> beginCreateOrUpdate
* name/value pairs.
*
* @param scope The resource scope.
* @param parameters Wrapper resource for tags patch API request only.
* @param parameters The parameters parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
Expand All @@ -475,7 +475,7 @@ SyncPoller<PollResult<TagsResourceInner>, TagsResourceInner> beginCreateOrUpdate
* name/value pairs.
*
* @param scope The resource scope.
* @param parameters Wrapper resource for tags patch API request only.
* @param parameters The parameters parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
Expand All @@ -495,7 +495,7 @@ PollerFlux<PollResult<TagsResourceInner>, TagsResourceInner> beginUpdateAtScopeA
* name/value pairs.
*
* @param scope The resource scope.
* @param parameters Wrapper resource for tags patch API request only.
* @param parameters The parameters parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
Expand All @@ -515,7 +515,7 @@ SyncPoller<PollResult<TagsResourceInner>, TagsResourceInner> beginUpdateAtScope(
* name/value pairs.
*
* @param scope The resource scope.
* @param parameters Wrapper resource for tags patch API request only.
* @param parameters The parameters parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
Expand All @@ -536,7 +536,7 @@ SyncPoller<PollResult<TagsResourceInner>, TagsResourceInner> beginUpdateAtScope(
* name/value pairs.
*
* @param scope The resource scope.
* @param parameters Wrapper resource for tags patch API request only.
* @param parameters The parameters parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
Expand All @@ -555,7 +555,7 @@ SyncPoller<PollResult<TagsResourceInner>, TagsResourceInner> beginUpdateAtScope(
* name/value pairs.
*
* @param scope The resource scope.
* @param parameters Wrapper resource for tags patch API request only.
* @param parameters The parameters parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
Expand All @@ -574,7 +574,7 @@ SyncPoller<PollResult<TagsResourceInner>, TagsResourceInner> beginUpdateAtScope(
* name/value pairs.
*
* @param scope The resource scope.
* @param parameters Wrapper resource for tags patch API request only.
* @param parameters The parameters parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.resources.models.ChangeProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.IOException;

/**
* Change Resource.
Expand All @@ -17,9 +20,23 @@ public final class ChangeResourceResultInner extends ProxyResource {
/*
* The properties of a change
*/
@JsonProperty(value = "properties")
private ChangeProperties properties;

/*
* Fully qualified resource Id for the resource.
*/
private String id;

/*
* The name of the resource.
*/
private String name;

/*
* The type of the resource.
*/
private String type;

/**
* Creates an instance of ChangeResourceResultInner class.
*/
Expand All @@ -46,6 +63,36 @@ public ChangeResourceResultInner withProperties(ChangeProperties properties) {
return this;
}

/**
* Get the id property: Fully qualified resource Id for the resource.
*
* @return the id value.
*/
@Override
public String id() {
return this.id;
}

/**
* Get the name property: The name of the resource.
*
* @return the name value.
*/
@Override
public String name() {
return this.name;
}

/**
* Get the type property: The type of the resource.
*
* @return the type value.
*/
@Override
public String type() {
return this.type;
}

/**
* Validates the instance.
*
Expand All @@ -56,4 +103,47 @@ 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 ChangeResourceResultInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ChangeResourceResultInner 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 ChangeResourceResultInner.
*/
public static ChangeResourceResultInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ChangeResourceResultInner deserializedChangeResourceResultInner = new ChangeResourceResultInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("id".equals(fieldName)) {
deserializedChangeResourceResultInner.id = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedChangeResourceResultInner.name = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedChangeResourceResultInner.type = reader.getString();
} else if ("properties".equals(fieldName)) {
deserializedChangeResourceResultInner.properties = ChangeProperties.fromJson(reader);
} else {
reader.skipChildren();
}
}

return deserializedChangeResourceResultInner;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,31 @@
package com.azure.resourcemanager.resources.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.resources.models.ResourceNameStatus;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.IOException;

/**
* Resource Name valid if not a reserved word, does not contain a reserved word and does not start with a reserved word.
*/
@Fluent
public final class CheckResourceNameResultInner {
public final class CheckResourceNameResultInner implements JsonSerializable<CheckResourceNameResultInner> {
/*
* Name of Resource
*/
@JsonProperty(value = "name")
private String name;

/*
* Type of Resource
*/
@JsonProperty(value = "type")
private String type;

/*
* Is the resource name Allowed or Reserved
*/
@JsonProperty(value = "status")
private ResourceNameStatus status;

/**
Expand Down Expand Up @@ -104,4 +105,46 @@ public CheckResourceNameResultInner withStatus(ResourceNameStatus status) {
*/
public void validate() {
}

/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("name", this.name);
jsonWriter.writeStringField("type", this.type);
jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString());
return jsonWriter.writeEndObject();
}

/**
* Reads an instance of CheckResourceNameResultInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of CheckResourceNameResultInner 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 CheckResourceNameResultInner.
*/
public static CheckResourceNameResultInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
CheckResourceNameResultInner deserializedCheckResourceNameResultInner = new CheckResourceNameResultInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("name".equals(fieldName)) {
deserializedCheckResourceNameResultInner.name = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedCheckResourceNameResultInner.type = reader.getString();
} else if ("status".equals(fieldName)) {
deserializedCheckResourceNameResultInner.status = ResourceNameStatus.fromString(reader.getString());
} else {
reader.skipChildren();
}
}

return deserializedCheckResourceNameResultInner;
});
}
}
Loading