Skip to content

Commit

Permalink
azure-json, migrate cdn and monitor (#41480)
Browse files Browse the repository at this point in the history
* config

monitor config

* regen

regen

regen

* regen

regen

* manual code

manual code

* changelog

* add remaining changelogs
  • Loading branch information
XiaofeiCao authored Aug 14, 2024
1 parent 2e4620c commit 95e2981
Show file tree
Hide file tree
Showing 882 changed files with 31,016 additions and 8,789 deletions.
4 changes: 2 additions & 2 deletions sdk/resourcemanager/api-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"dir": "azure-resourcemanager-cdn",
"source": "specification/cdn/resource-manager/readme.md",
"package": "com.azure.resourcemanager.cdn",
"args": "--tag=package-2024-02 --rename-model=CdnEndpoint:EndpointResource --stream-style-serialization=false"
"args": "--tag=package-2024-02 --rename-model=CdnEndpoint:EndpointResource"
},
"compute": {
"dir": "azure-resourcemanager-compute",
Expand Down Expand Up @@ -168,7 +168,7 @@
"dir": "azure-resourcemanager-monitor",
"source": "specification/monitor/resource-manager/readme.md",
"package": "com.azure.resourcemanager.monitor",
"args": "--tag=package-composite-v1 --modelerfour.lenient-model-deduplication=true --add-inner=AutoscaleProfile,ScaleRule,LocalizableString,DiagnosticSettingsCategoryResourceCollection --rename-model=MetricUnit:Unit --stream-style-serialization=false",
"args": "--tag=package-composite-v1 --modelerfour.lenient-model-deduplication=true --add-inner=AutoscaleProfile,ScaleRule,LocalizableString,DiagnosticSettingsCategoryResourceCollection --rename-model=MetricUnit:Unit",
"note": "Use commit c0f92082a788895368a738a9200e24971157d7ca, and remove Swagger from Microsoft.Monitor"
},
"monitor-hybrid": {
Expand Down
2 changes: 2 additions & 0 deletions sdk/resourcemanager/azure-resourcemanager-cdn/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

### Other Changes

- Replaced `Jackson` with `azure-json` for serialization/deserialization.

## 2.41.0 (2024-07-25)

### Other Changes
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
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.cdn.models.AfdDomainHttpsParameters;
import com.azure.resourcemanager.cdn.models.AfdProvisioningState;
import com.azure.resourcemanager.cdn.models.DeploymentStatus;
import com.azure.resourcemanager.cdn.models.DomainValidationProperties;
import com.azure.resourcemanager.cdn.models.DomainValidationState;
import com.azure.resourcemanager.cdn.models.ResourceReference;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.IOException;
import java.util.Map;

/**
Expand All @@ -25,15 +28,28 @@ public final class AfdDomainInner extends ProxyResource {
/*
* The JSON object that contains the properties of the domain to create.
*/
@JsonProperty(value = "properties")
private AfdDomainProperties innerProperties;

/*
* Read only system data
*/
@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 AfdDomainInner class.
*/
Expand All @@ -58,6 +74,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 domainValidationState property: Provisioning substate shows the progress of custom HTTPS
* enabling/disabling process step by step. DCV stands for DomainControlValidation.
Expand Down Expand Up @@ -201,8 +247,8 @@ public AfdDomainInner withAzureDnsZone(ResourceReference azureDnsZone) {
}

/**
* Get the preValidatedCustomDomainResourceId property: Resource reference to the Azure resource where custom
* domain ownership was prevalidated.
* Get the preValidatedCustomDomainResourceId property: Resource reference to the Azure resource where custom domain
* ownership was prevalidated.
*
* @return the preValidatedCustomDomainResourceId value.
*/
Expand All @@ -211,8 +257,8 @@ public ResourceReference preValidatedCustomDomainResourceId() {
}

/**
* Set the preValidatedCustomDomainResourceId property: Resource reference to the Azure resource where custom
* domain ownership was prevalidated.
* Set the preValidatedCustomDomainResourceId property: Resource reference to the Azure resource where custom domain
* ownership was prevalidated.
*
* @param preValidatedCustomDomainResourceId the preValidatedCustomDomainResourceId value to set.
* @return the AfdDomainInner object itself.
Expand All @@ -235,4 +281,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 AfdDomainInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AfdDomainInner 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 AfdDomainInner.
*/
public static AfdDomainInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AfdDomainInner deserializedAfdDomainInner = new AfdDomainInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("id".equals(fieldName)) {
deserializedAfdDomainInner.id = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedAfdDomainInner.name = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedAfdDomainInner.type = reader.getString();
} else if ("properties".equals(fieldName)) {
deserializedAfdDomainInner.innerProperties = AfdDomainProperties.fromJson(reader);
} else if ("systemData".equals(fieldName)) {
deserializedAfdDomainInner.systemData = SystemData.fromJson(reader);
} else {
reader.skipChildren();
}
}

return deserializedAfdDomainInner;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@

import com.azure.core.annotation.Fluent;
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.cdn.models.AfdDomainHttpsParameters;
import com.azure.resourcemanager.cdn.models.AfdProvisioningState;
import com.azure.resourcemanager.cdn.models.DeploymentStatus;
import com.azure.resourcemanager.cdn.models.DomainValidationProperties;
import com.azure.resourcemanager.cdn.models.DomainValidationState;
import com.azure.resourcemanager.cdn.models.ResourceReference;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.IOException;
import java.util.Map;

/**
Expand All @@ -25,40 +27,38 @@ public final class AfdDomainProperties extends AfdDomainUpdatePropertiesParamete
* Provisioning substate shows the progress of custom HTTPS enabling/disabling process step by step. DCV stands for
* DomainControlValidation.
*/
@JsonProperty(value = "domainValidationState", access = JsonProperty.Access.WRITE_ONLY)
private DomainValidationState domainValidationState;

/*
* The host name of the domain. Must be a domain name.
*/
@JsonProperty(value = "hostName", required = true)
private String hostname;

/*
* Key-Value pair representing migration properties for domains.
*/
@JsonProperty(value = "extendedProperties")
@JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
private Map<String, String> extendedProperties;

/*
* Values the customer needs to validate domain ownership
*/
@JsonProperty(value = "validationProperties", access = JsonProperty.Access.WRITE_ONLY)
private DomainValidationProperties validationProperties;

/*
* Provisioning status
*/
@JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
private AfdProvisioningState provisioningState;

/*
* The deploymentStatus property.
*/
@JsonProperty(value = "deploymentStatus", access = JsonProperty.Access.WRITE_ONLY)
private DeploymentStatus deploymentStatus;

/*
* The name of the profile which holds the domain.
*/
private String profileName;

/**
* Creates an instance of AfdDomainProperties class.
*/
Expand Down Expand Up @@ -142,6 +142,16 @@ public DeploymentStatus deploymentStatus() {
return this.deploymentStatus;
}

/**
* Get the profileName property: The name of the profile which holds the domain.
*
* @return the profileName value.
*/
@Override
public String profileName() {
return this.profileName;
}

/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -179,13 +189,77 @@ public AfdDomainProperties withAzureDnsZone(ResourceReference azureDnsZone) {
public void validate() {
super.validate();
if (hostname() == null) {
throw LOGGER.logExceptionAsError(
new IllegalArgumentException("Missing required property hostname in model AfdDomainProperties"));
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property hostname in model AfdDomainProperties"));
}
if (validationProperties() != null) {
validationProperties().validate();
}
}

private static final ClientLogger LOGGER = new ClientLogger(AfdDomainProperties.class);

/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("tlsSettings", tlsSettings());
jsonWriter.writeJsonField("azureDnsZone", azureDnsZone());
jsonWriter.writeJsonField("preValidatedCustomDomainResourceId", preValidatedCustomDomainResourceId());
jsonWriter.writeStringField("hostName", this.hostname);
jsonWriter.writeMapField("extendedProperties", this.extendedProperties,
(writer, element) -> writer.writeString(element));
return jsonWriter.writeEndObject();
}

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

if ("profileName".equals(fieldName)) {
deserializedAfdDomainProperties.profileName = reader.getString();
} else if ("tlsSettings".equals(fieldName)) {
deserializedAfdDomainProperties.withTlsSettings(AfdDomainHttpsParameters.fromJson(reader));
} else if ("azureDnsZone".equals(fieldName)) {
deserializedAfdDomainProperties.withAzureDnsZone(ResourceReference.fromJson(reader));
} else if ("preValidatedCustomDomainResourceId".equals(fieldName)) {
deserializedAfdDomainProperties
.withPreValidatedCustomDomainResourceId(ResourceReference.fromJson(reader));
} else if ("hostName".equals(fieldName)) {
deserializedAfdDomainProperties.hostname = reader.getString();
} else if ("domainValidationState".equals(fieldName)) {
deserializedAfdDomainProperties.domainValidationState
= DomainValidationState.fromString(reader.getString());
} else if ("extendedProperties".equals(fieldName)) {
Map<String, String> extendedProperties = reader.readMap(reader1 -> reader1.getString());
deserializedAfdDomainProperties.extendedProperties = extendedProperties;
} else if ("validationProperties".equals(fieldName)) {
deserializedAfdDomainProperties.validationProperties = DomainValidationProperties.fromJson(reader);
} else if ("provisioningState".equals(fieldName)) {
deserializedAfdDomainProperties.provisioningState
= AfdProvisioningState.fromString(reader.getString());
} else if ("deploymentStatus".equals(fieldName)) {
deserializedAfdDomainProperties.deploymentStatus = DeploymentStatus.fromString(reader.getString());
} else {
reader.skipChildren();
}
}

return deserializedAfdDomainProperties;
});
}
}
Loading

0 comments on commit 95e2981

Please sign in to comment.