diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt
index 463235e850c52..f6584e917f14c 100644
--- a/eng/versioning/version_client.txt
+++ b/eng/versioning/version_client.txt
@@ -445,8 +445,8 @@ com.azure.resourcemanager:azure-resourcemanager-managementgroups;1.0.0-beta.2;1.
com.azure.resourcemanager:azure-resourcemanager-managednetworkfabric;1.1.0;1.2.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-iotfirmwaredefense;1.1.0;1.2.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-quantum;1.0.0-beta.3;1.0.0-beta.4
+com.azure.resourcemanager:azure-resourcemanager-chaos;1.1.0;1.2.0
com.azure.resourcemanager:azure-resourcemanager-sphere;1.1.0;1.2.0-beta.1
-com.azure.resourcemanager:azure-resourcemanager-chaos;1.1.0;1.2.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-defendereasm;1.0.0-beta.2;1.0.0-beta.3
com.azure.resourcemanager:azure-resourcemanager-hdinsight-containers;1.0.0-beta.3;1.0.0-beta.4
com.azure.resourcemanager:azure-resourcemanager-apicenter;1.1.0;1.2.0-beta.1
diff --git a/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md b/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md
index ce03fbe3ff670..3c86c916310cb 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md
+++ b/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md
@@ -1,14 +1,64 @@
# Release History
-## 1.2.0-beta.1 (Unreleased)
+## 1.2.0 (2024-12-19)
-### Features Added
+- Azure Resource Manager Chaos client library for Java. This package contains Microsoft Azure SDK for Chaos Management SDK. Chaos Management Client. Package tag package-2024-01. 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());
+```
+
+#### `models.OperationStatus` was modified
+
+* `java.lang.String endTime()` -> `java.time.OffsetDateTime endTime()`
+* `java.lang.String startTime()` -> `java.time.OffsetDateTime startTime()`
+
+### Features Added
+
+#### `models.ChaosTargetListSelector` was modified
+
+* `type()` was added
+
+#### `models.DelayAction` was modified
+
+* `type()` was added
+
+#### `models.ChaosTargetQuerySelector` was modified
+
+* `type()` was added
+
+#### `models.ContinuousAction` was modified
+
+* `type()` was added
+
+#### `models.ChaosTargetFilter` was modified
+
+* `type()` was added
+
+#### `models.ChaosTargetSimpleFilter` was modified
+
+* `type()` was added
+
+#### `models.ChaosExperimentAction` was modified
+
+* `type()` was added
+
+#### `models.DiscreteAction` was modified
+
+* `type()` was added
+
+#### `models.ChaosTargetSelector` was modified
-### Other Changes
+* `type()` was added
## 1.1.0 (2024-03-15)
diff --git a/sdk/chaos/azure-resourcemanager-chaos/README.md b/sdk/chaos/azure-resourcemanager-chaos/README.md
index 4aaf374a2027c..a140203fe8be7 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/README.md
+++ b/sdk/chaos/azure-resourcemanager-chaos/README.md
@@ -32,7 +32,7 @@ Various documentation is available to help you get started
com.azure.resourcemanager
azure-resourcemanager-chaos
- 1.1.0
+ 1.2.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);
@@ -74,6 +70,19 @@ See [API design][design] for general introduction on design and key concepts on
## Examples
+```java
+keyVaultManager.vaults()
+ .define(kvName)
+ .withRegion(REGION)
+ .withExistingResourceGroup(resourceGroupName)
+ .withRoleBasedAccessControl()
+ .withSku(SkuName.STANDARD)
+ .create();
+
+target = chaosManager.targets()
+ .createOrUpdate(resourceGroupName, "microsoft.keyvault", "vaults", kvName, "microsoft-keyvault",
+ new TargetInner().withLocation(REGION.name()).withProperties(Collections.emptyMap()));
+```
[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md)
@@ -97,6 +106,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/chaos/azure-resourcemanager-chaos/SAMPLE.md b/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md
index fa5e6756ef177..a66670314ad05 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md
+++ b/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md
@@ -62,9 +62,9 @@ public final class CapabilitiesCreateOrUpdateSamples {
*/
public static void createUpdateACapabilityThatExtendsAVirtualMachineTargetResource(
com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.capabilities().createOrUpdateWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines",
- "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.0", new CapabilityInner(),
- com.azure.core.util.Context.NONE);
+ manager.capabilities()
+ .createOrUpdateWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
+ "Microsoft-VirtualMachine", "Shutdown-1.0", new CapabilityInner(), com.azure.core.util.Context.NONE);
}
}
```
@@ -87,8 +87,9 @@ public final class CapabilitiesDeleteSamples {
*/
public static void deleteACapabilityThatExtendsAVirtualMachineTargetResource(
com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.capabilities().deleteWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
- "Microsoft-VirtualMachine", "Shutdown-1.0", com.azure.core.util.Context.NONE);
+ manager.capabilities()
+ .deleteWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
+ "Microsoft-VirtualMachine", "Shutdown-1.0", com.azure.core.util.Context.NONE);
}
}
```
@@ -111,8 +112,9 @@ public final class CapabilitiesGetSamples {
*/
public static void
getACapabilityThatExtendsAVirtualMachineTargetResource(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.capabilities().getWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
- "Microsoft-VirtualMachine", "Shutdown-1.0", com.azure.core.util.Context.NONE);
+ manager.capabilities()
+ .getWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
+ "Microsoft-VirtualMachine", "Shutdown-1.0", com.azure.core.util.Context.NONE);
}
}
```
@@ -135,8 +137,9 @@ public final class CapabilitiesListSamples {
*/
public static void listAllCapabilitiesThatExtendAVirtualMachineTargetResource(
com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.capabilities().list("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
- "Microsoft-VirtualMachine", null, com.azure.core.util.Context.NONE);
+ manager.capabilities()
+ .list("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", null,
+ com.azure.core.util.Context.NONE);
}
}
```
@@ -159,8 +162,8 @@ public final class CapabilityTypesGetSamples {
*/
public static void getACapabilityTypeForAVirtualMachineTargetResourceOnWestus2Location(
com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.capabilityTypes().getWithResponse("westus2", "Microsoft-VirtualMachine", "Shutdown-1.0",
- com.azure.core.util.Context.NONE);
+ manager.capabilityTypes()
+ .getWithResponse("westus2", "Microsoft-VirtualMachine", "Shutdown-1.0", com.azure.core.util.Context.NONE);
}
}
```
@@ -239,7 +242,9 @@ public final class ExperimentsCreateOrUpdateSamples {
* @param manager Entry point to ChaosManager.
*/
public static void createUpdateAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.experiments().define("exampleExperiment").withRegion("eastus2euap")
+ manager.experiments()
+ .define("exampleExperiment")
+ .withRegion("eastus2euap")
.withExistingResourceGroup("exampleRG")
.withSteps(
Arrays.asList(new ChaosExperimentStep().withName("step1")
@@ -251,9 +256,11 @@ public final class ExperimentsCreateOrUpdateSamples {
Arrays.asList(new KeyValuePair().withKey("fakeTokenPlaceholder").withValue("false")))
.withSelectorId("selector1")))))))
.withSelectors(Arrays.asList(new ChaosTargetListSelector().withId("selector1")
- .withTargets(Arrays.asList(new TargetReference().withType(TargetReferenceType.CHAOS_TARGET).withId(
- "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine")))))
- .withIdentity(new ResourceIdentity().withType(ResourceIdentityType.SYSTEM_ASSIGNED)).create();
+ .withTargets(Arrays.asList(new TargetReference().withType(TargetReferenceType.CHAOS_TARGET)
+ .withId(
+ "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine")))))
+ .withIdentity(new ResourceIdentity().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
+ .create();
}
}
```
@@ -297,8 +304,9 @@ public final class ExperimentsExecutionDetailsSamples {
* @param manager Entry point to ChaosManager.
*/
public static void getExperimentExecutionDetails(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.experiments().executionDetailsWithResponse("exampleRG", "exampleExperiment",
- "f24500ad-744e-4a26-864b-b76199eac333", com.azure.core.util.Context.NONE);
+ manager.experiments()
+ .executionDetailsWithResponse("exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333",
+ com.azure.core.util.Context.NONE);
}
}
```
@@ -320,8 +328,8 @@ public final class ExperimentsGetByResourceGroupSamples {
* @param manager Entry point to ChaosManager.
*/
public static void getAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.experiments().getByResourceGroupWithResponse("exampleRG", "exampleExperiment",
- com.azure.core.util.Context.NONE);
+ manager.experiments()
+ .getByResourceGroupWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE);
}
}
```
@@ -343,8 +351,9 @@ public final class ExperimentsGetExecutionSamples {
* @param manager Entry point to ChaosManager.
*/
public static void getTheExecutionOfAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.experiments().getExecutionWithResponse("exampleRG", "exampleExperiment",
- "f24500ad-744e-4a26-864b-b76199eac333", com.azure.core.util.Context.NONE);
+ manager.experiments()
+ .getExecutionWithResponse("exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333",
+ com.azure.core.util.Context.NONE);
}
}
```
@@ -466,10 +475,12 @@ public final class ExperimentsUpdateSamples {
Experiment resource = manager.experiments()
.getByResourceGroupWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE)
.getValue();
- resource.update().withTags(mapOf("key1", "fakeTokenPlaceholder", "key2", "fakeTokenPlaceholder")).withIdentity(
- new ResourceIdentity().withType(ResourceIdentityType.USER_ASSIGNED).withUserAssignedIdentities(mapOf(
- "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI",
- new UserAssignedIdentity())))
+ resource.update()
+ .withTags(mapOf("key1", "fakeTokenPlaceholder", "key2", "fakeTokenPlaceholder"))
+ .withIdentity(new ResourceIdentity().withType(ResourceIdentityType.USER_ASSIGNED)
+ .withUserAssignedIdentities(mapOf(
+ "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI",
+ new UserAssignedIdentity())))
.apply();
}
@@ -504,8 +515,8 @@ public final class OperationStatusesGetSamples {
* @param manager Entry point to ChaosManager.
*/
public static void getSpecificOperationStatus(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.operationStatuses().getWithResponse("West US", "713192d7-503f-477a-9cfe-4efc3ee2bd11",
- com.azure.core.util.Context.NONE);
+ manager.operationStatuses()
+ .getWithResponse("West US", "713192d7-503f-477a-9cfe-4efc3ee2bd11", com.azure.core.util.Context.NONE);
}
}
```
@@ -579,13 +590,14 @@ public final class TargetsCreateOrUpdateSamples {
*/
public static void createUpdateATargetThatExtendsAVirtualMachineResource(
com.azure.resourcemanager.chaos.ChaosManager manager) throws IOException {
- manager.targets().createOrUpdateWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
- "Microsoft-Agent",
- new TargetInner().withProperties(mapOf("identities",
- SerializerFactory.createDefaultManagementSerializerAdapter().deserialize(
- "[{\"type\":\"CertificateSubjectIssuer\",\"subject\":\"CN=example.subject\"}]", Object.class,
- SerializerEncoding.JSON))),
- com.azure.core.util.Context.NONE);
+ manager.targets()
+ .createOrUpdateWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
+ "Microsoft-Agent",
+ new TargetInner().withProperties(mapOf("identities",
+ SerializerFactory.createDefaultManagementSerializerAdapter()
+ .deserialize("[{\"type\":\"CertificateSubjectIssuer\",\"subject\":\"CN=example.subject\"}]",
+ Object.class, SerializerEncoding.JSON))),
+ com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@@ -620,8 +632,9 @@ public final class TargetsDeleteSamples {
*/
public static void
deleteATargetThatExtendsAVirtualMachineResource(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.targets().deleteWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
- "Microsoft-Agent", com.azure.core.util.Context.NONE);
+ manager.targets()
+ .deleteWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent",
+ com.azure.core.util.Context.NONE);
}
}
```
@@ -644,8 +657,9 @@ public final class TargetsGetSamples {
*/
public static void
getATargetThatExtendsAVirtualMachineResource(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.targets().getWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
- "Microsoft-Agent", com.azure.core.util.Context.NONE);
+ manager.targets()
+ .getWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent",
+ com.azure.core.util.Context.NONE);
}
}
```
@@ -668,8 +682,9 @@ public final class TargetsListSamples {
*/
public static void
listAllTargetsThatExtendAVirtualMachineResource(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.targets().list("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", null,
- com.azure.core.util.Context.NONE);
+ manager.targets()
+ .list("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", null,
+ com.azure.core.util.Context.NONE);
}
}
```
diff --git a/sdk/chaos/azure-resourcemanager-chaos/pom.xml b/sdk/chaos/azure-resourcemanager-chaos/pom.xml
index c89a0e143acf5..85419e5aedade 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/pom.xml
+++ b/sdk/chaos/azure-resourcemanager-chaos/pom.xml
@@ -14,7 +14,7 @@
com.azure.resourcemanager
azure-resourcemanager-chaos
- 1.2.0-beta.1
+ 1.2.0
jar
Microsoft Azure SDK for Chaos Management
@@ -45,6 +45,8 @@
UTF-8
0
0
+ false
+ true
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/ChaosManager.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/ChaosManager.java
index 14c663927577a..97227acbd3a56 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/ChaosManager.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/ChaosManager.java
@@ -11,6 +11,7 @@
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.BearerTokenAuthenticationPolicy;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.http.policy.HttpLoggingPolicy;
import com.azure.core.http.policy.HttpPipelinePolicy;
@@ -19,7 +20,6 @@
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;
@@ -229,7 +229,7 @@ public ChaosManager authenticate(TokenCredential credential, AzureProfile profil
.append("-")
.append("com.azure.resourcemanager.chaos")
.append("/")
- .append("1.1.0");
+ .append("1.2.0");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder.append(" (")
.append(Configuration.getGlobalConfiguration().get("java.version"))
@@ -262,7 +262,7 @@ public ChaosManager authenticate(TokenCredential credential, AzureProfile profil
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()));
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityInner.java
index 77d0fabdd71f2..88dd47d4314f7 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityInner.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityInner.java
@@ -7,7 +7,10 @@
import com.azure.core.annotation.Immutable;
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import com.azure.json.JsonReader;
+import com.azure.json.JsonToken;
+import com.azure.json.JsonWriter;
+import java.io.IOException;
/**
* Model that represents a Capability resource.
@@ -17,15 +20,28 @@ public final class CapabilityInner extends ProxyResource {
/*
* The standard system metadata of a resource type.
*/
- @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
private SystemData systemData;
/*
* The properties of a capability resource.
*/
- @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY)
private CapabilityProperties innerProperties;
+ /*
+ * 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 CapabilityInner class.
*/
@@ -50,6 +66,36 @@ private CapabilityProperties innerProperties() {
return this.innerProperties;
}
+ /**
+ * 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 publisher property: String of the Publisher that this Capability extends.
*
@@ -105,4 +151,48 @@ public void validate() {
innerProperties().validate();
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of CapabilityInner from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of CapabilityInner 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 CapabilityInner.
+ */
+ public static CapabilityInner fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ CapabilityInner deserializedCapabilityInner = new CapabilityInner();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("id".equals(fieldName)) {
+ deserializedCapabilityInner.id = reader.getString();
+ } else if ("name".equals(fieldName)) {
+ deserializedCapabilityInner.name = reader.getString();
+ } else if ("type".equals(fieldName)) {
+ deserializedCapabilityInner.type = reader.getString();
+ } else if ("systemData".equals(fieldName)) {
+ deserializedCapabilityInner.systemData = SystemData.fromJson(reader);
+ } else if ("properties".equals(fieldName)) {
+ deserializedCapabilityInner.innerProperties = CapabilityProperties.fromJson(reader);
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedCapabilityInner;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityProperties.java
index 2380ddf8be90a..8f64462599341 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityProperties.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityProperties.java
@@ -5,41 +5,40 @@
package com.azure.resourcemanager.chaos.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;
/**
* Model that represents the Capability properties model.
*/
@Immutable
-public final class CapabilityProperties {
+public final class CapabilityProperties implements JsonSerializable {
/*
* String of the Publisher that this Capability extends.
*/
- @JsonProperty(value = "publisher", access = JsonProperty.Access.WRITE_ONLY)
private String publisher;
/*
* String of the Target Type that this Capability extends.
*/
- @JsonProperty(value = "targetType", access = JsonProperty.Access.WRITE_ONLY)
private String targetType;
/*
* Localized string of the description.
*/
- @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY)
private String description;
/*
* URL to retrieve JSON schema of the Capability parameters.
*/
- @JsonProperty(value = "parametersSchema", access = JsonProperty.Access.WRITE_ONLY)
private String parametersSchema;
/*
* String of the URN for this Capability Type.
*/
- @JsonProperty(value = "urn", access = JsonProperty.Access.WRITE_ONLY)
private String urn;
/**
@@ -100,4 +99,47 @@ public String urn() {
*/
public void validate() {
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of CapabilityProperties from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of CapabilityProperties 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 CapabilityProperties.
+ */
+ public static CapabilityProperties fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ CapabilityProperties deserializedCapabilityProperties = new CapabilityProperties();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("publisher".equals(fieldName)) {
+ deserializedCapabilityProperties.publisher = reader.getString();
+ } else if ("targetType".equals(fieldName)) {
+ deserializedCapabilityProperties.targetType = reader.getString();
+ } else if ("description".equals(fieldName)) {
+ deserializedCapabilityProperties.description = reader.getString();
+ } else if ("parametersSchema".equals(fieldName)) {
+ deserializedCapabilityProperties.parametersSchema = reader.getString();
+ } else if ("urn".equals(fieldName)) {
+ deserializedCapabilityProperties.urn = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedCapabilityProperties;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeInner.java
index ffea085d3935f..16d896faffe06 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeInner.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeInner.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.chaos.models.CapabilityTypePropertiesRuntimeProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.IOException;
import java.util.List;
/**
@@ -19,21 +22,33 @@ public final class CapabilityTypeInner extends ProxyResource {
/*
* The system metadata properties of the capability type resource.
*/
- @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
private SystemData systemData;
/*
* Location of the Capability Type resource.
*/
- @JsonProperty(value = "location")
private String location;
/*
* The properties of the capability type resource.
*/
- @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY)
private CapabilityTypeProperties innerProperties;
+ /*
+ * 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 CapabilityTypeInner class.
*/
@@ -78,6 +93,36 @@ private CapabilityTypeProperties innerProperties() {
return this.innerProperties;
}
+ /**
+ * 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 publisher property: String of the Publisher that this Capability Type extends.
*
@@ -220,4 +265,51 @@ public void validate() {
innerProperties().validate();
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("location", this.location);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of CapabilityTypeInner from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of CapabilityTypeInner 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 CapabilityTypeInner.
+ */
+ public static CapabilityTypeInner fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ CapabilityTypeInner deserializedCapabilityTypeInner = new CapabilityTypeInner();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("id".equals(fieldName)) {
+ deserializedCapabilityTypeInner.id = reader.getString();
+ } else if ("name".equals(fieldName)) {
+ deserializedCapabilityTypeInner.name = reader.getString();
+ } else if ("type".equals(fieldName)) {
+ deserializedCapabilityTypeInner.type = reader.getString();
+ } else if ("systemData".equals(fieldName)) {
+ deserializedCapabilityTypeInner.systemData = SystemData.fromJson(reader);
+ } else if ("location".equals(fieldName)) {
+ deserializedCapabilityTypeInner.location = reader.getString();
+ } else if ("properties".equals(fieldName)) {
+ deserializedCapabilityTypeInner.innerProperties = CapabilityTypeProperties.fromJson(reader);
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedCapabilityTypeInner;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeProperties.java
index 823c0f6fffdcf..1dad8bc5d8669 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeProperties.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeProperties.java
@@ -5,73 +5,67 @@
package com.azure.resourcemanager.chaos.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.chaos.models.CapabilityTypePropertiesRuntimeProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.IOException;
import java.util.List;
/**
* Model that represents the Capability Type properties model.
*/
@Fluent
-public final class CapabilityTypeProperties {
+public final class CapabilityTypeProperties implements JsonSerializable {
/*
* String of the Publisher that this Capability Type extends.
*/
- @JsonProperty(value = "publisher", access = JsonProperty.Access.WRITE_ONLY)
private String publisher;
/*
* String of the Target Type that this Capability Type extends.
*/
- @JsonProperty(value = "targetType", access = JsonProperty.Access.WRITE_ONLY)
private String targetType;
/*
* Localized string of the display name.
*/
- @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY)
private String displayName;
/*
* Localized string of the description.
*/
- @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY)
private String description;
/*
* URL to retrieve JSON schema of the Capability Type parameters.
*/
- @JsonProperty(value = "parametersSchema", access = JsonProperty.Access.WRITE_ONLY)
private String parametersSchema;
/*
* String of the URN for this Capability Type.
*/
- @JsonProperty(value = "urn", access = JsonProperty.Access.WRITE_ONLY)
private String urn;
/*
* String of the kind of this Capability Type.
*/
- @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY)
private String kind;
/*
* Control plane actions necessary to execute capability type.
*/
- @JsonProperty(value = "azureRbacActions")
private List azureRbacActions;
/*
* Data plane actions necessary to execute capability type.
*/
- @JsonProperty(value = "azureRbacDataActions")
private List azureRbacDataActions;
/*
* Runtime properties of this Capability Type.
*/
- @JsonProperty(value = "runtimeProperties")
private CapabilityTypePropertiesRuntimeProperties runtimeProperties;
/**
@@ -213,4 +207,65 @@ public void validate() {
runtimeProperties().validate();
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeArrayField("azureRbacActions", this.azureRbacActions,
+ (writer, element) -> writer.writeString(element));
+ jsonWriter.writeArrayField("azureRbacDataActions", this.azureRbacDataActions,
+ (writer, element) -> writer.writeString(element));
+ jsonWriter.writeJsonField("runtimeProperties", this.runtimeProperties);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of CapabilityTypeProperties from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of CapabilityTypeProperties 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 CapabilityTypeProperties.
+ */
+ public static CapabilityTypeProperties fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ CapabilityTypeProperties deserializedCapabilityTypeProperties = new CapabilityTypeProperties();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("publisher".equals(fieldName)) {
+ deserializedCapabilityTypeProperties.publisher = reader.getString();
+ } else if ("targetType".equals(fieldName)) {
+ deserializedCapabilityTypeProperties.targetType = reader.getString();
+ } else if ("displayName".equals(fieldName)) {
+ deserializedCapabilityTypeProperties.displayName = reader.getString();
+ } else if ("description".equals(fieldName)) {
+ deserializedCapabilityTypeProperties.description = reader.getString();
+ } else if ("parametersSchema".equals(fieldName)) {
+ deserializedCapabilityTypeProperties.parametersSchema = reader.getString();
+ } else if ("urn".equals(fieldName)) {
+ deserializedCapabilityTypeProperties.urn = reader.getString();
+ } else if ("kind".equals(fieldName)) {
+ deserializedCapabilityTypeProperties.kind = reader.getString();
+ } else if ("azureRbacActions".equals(fieldName)) {
+ List azureRbacActions = reader.readArray(reader1 -> reader1.getString());
+ deserializedCapabilityTypeProperties.azureRbacActions = azureRbacActions;
+ } else if ("azureRbacDataActions".equals(fieldName)) {
+ List azureRbacDataActions = reader.readArray(reader1 -> reader1.getString());
+ deserializedCapabilityTypeProperties.azureRbacDataActions = azureRbacDataActions;
+ } else if ("runtimeProperties".equals(fieldName)) {
+ deserializedCapabilityTypeProperties.runtimeProperties
+ = CapabilityTypePropertiesRuntimeProperties.fromJson(reader);
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedCapabilityTypeProperties;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsInner.java
index a9206b47ee9e4..ce96789954797 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsInner.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsInner.java
@@ -5,37 +5,37 @@
package com.azure.resourcemanager.chaos.fluent.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.chaos.models.ExperimentExecutionDetailsPropertiesRunInformation;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.IOException;
import java.time.OffsetDateTime;
/**
* Model that represents the execution details of an Experiment.
*/
@Immutable
-public final class ExperimentExecutionDetailsInner {
+public final class ExperimentExecutionDetailsInner implements JsonSerializable {
/*
* String of the resource type.
*/
- @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY)
private String type;
/*
* String of the fully qualified resource ID.
*/
- @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
private String id;
/*
* String of the resource name.
*/
- @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
private String name;
/*
* The properties of the experiment execution details.
*/
- @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY)
private ExperimentExecutionDetailsProperties innerProperties;
/**
@@ -144,4 +144,47 @@ public void validate() {
innerProperties().validate();
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ExperimentExecutionDetailsInner from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ExperimentExecutionDetailsInner 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 ExperimentExecutionDetailsInner.
+ */
+ public static ExperimentExecutionDetailsInner fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ExperimentExecutionDetailsInner deserializedExperimentExecutionDetailsInner
+ = new ExperimentExecutionDetailsInner();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("type".equals(fieldName)) {
+ deserializedExperimentExecutionDetailsInner.type = reader.getString();
+ } else if ("id".equals(fieldName)) {
+ deserializedExperimentExecutionDetailsInner.id = reader.getString();
+ } else if ("name".equals(fieldName)) {
+ deserializedExperimentExecutionDetailsInner.name = reader.getString();
+ } else if ("properties".equals(fieldName)) {
+ deserializedExperimentExecutionDetailsInner.innerProperties
+ = ExperimentExecutionDetailsProperties.fromJson(reader);
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedExperimentExecutionDetailsInner;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsProperties.java
index d8094e07050fb..cc3245583b434 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsProperties.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsProperties.java
@@ -5,8 +5,12 @@
package com.azure.resourcemanager.chaos.fluent.models;
import com.azure.core.annotation.Immutable;
+import com.azure.core.util.CoreUtils;
+import com.azure.json.JsonReader;
+import com.azure.json.JsonToken;
+import com.azure.json.JsonWriter;
import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsPropertiesRunInformation;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.IOException;
import java.time.OffsetDateTime;
/**
@@ -17,21 +21,33 @@ public final class ExperimentExecutionDetailsProperties extends ExperimentExecut
/*
* The reason why the execution failed.
*/
- @JsonProperty(value = "failureReason", access = JsonProperty.Access.WRITE_ONLY)
private String failureReason;
/*
* String that represents the last action date time.
*/
- @JsonProperty(value = "lastActionAt", access = JsonProperty.Access.WRITE_ONLY)
private OffsetDateTime lastActionAt;
/*
* The information of the experiment run.
*/
- @JsonProperty(value = "runInformation", access = JsonProperty.Access.WRITE_ONLY)
private ExperimentExecutionDetailsPropertiesRunInformation runInformation;
+ /*
+ * String that represents the stop date time.
+ */
+ private OffsetDateTime stoppedAt;
+
+ /*
+ * String that represents the start date time.
+ */
+ private OffsetDateTime startedAt;
+
+ /*
+ * The status of the execution.
+ */
+ private String status;
+
/**
* Creates an instance of ExperimentExecutionDetailsProperties class.
*/
@@ -65,6 +81,36 @@ public ExperimentExecutionDetailsPropertiesRunInformation runInformation() {
return this.runInformation;
}
+ /**
+ * Get the stoppedAt property: String that represents the stop date time.
+ *
+ * @return the stoppedAt value.
+ */
+ @Override
+ public OffsetDateTime stoppedAt() {
+ return this.stoppedAt;
+ }
+
+ /**
+ * Get the startedAt property: String that represents the start date time.
+ *
+ * @return the startedAt value.
+ */
+ @Override
+ public OffsetDateTime startedAt() {
+ return this.startedAt;
+ }
+
+ /**
+ * Get the status property: The status of the execution.
+ *
+ * @return the status value.
+ */
+ @Override
+ public String status() {
+ return this.status;
+ }
+
/**
* Validates the instance.
*
@@ -72,9 +118,58 @@ public ExperimentExecutionDetailsPropertiesRunInformation runInformation() {
*/
@Override
public void validate() {
- super.validate();
if (runInformation() != null) {
runInformation().validate();
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ExperimentExecutionDetailsProperties from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ExperimentExecutionDetailsProperties 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 ExperimentExecutionDetailsProperties.
+ */
+ public static ExperimentExecutionDetailsProperties fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ExperimentExecutionDetailsProperties deserializedExperimentExecutionDetailsProperties
+ = new ExperimentExecutionDetailsProperties();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("status".equals(fieldName)) {
+ deserializedExperimentExecutionDetailsProperties.status = reader.getString();
+ } else if ("startedAt".equals(fieldName)) {
+ deserializedExperimentExecutionDetailsProperties.startedAt = reader
+ .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
+ } else if ("stoppedAt".equals(fieldName)) {
+ deserializedExperimentExecutionDetailsProperties.stoppedAt = reader
+ .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
+ } else if ("failureReason".equals(fieldName)) {
+ deserializedExperimentExecutionDetailsProperties.failureReason = reader.getString();
+ } else if ("lastActionAt".equals(fieldName)) {
+ deserializedExperimentExecutionDetailsProperties.lastActionAt = reader
+ .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
+ } else if ("runInformation".equals(fieldName)) {
+ deserializedExperimentExecutionDetailsProperties.runInformation
+ = ExperimentExecutionDetailsPropertiesRunInformation.fromJson(reader);
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedExperimentExecutionDetailsProperties;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionInner.java
index 420ffd70a2dfe..df958584e6e65 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionInner.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionInner.java
@@ -5,36 +5,36 @@
package com.azure.resourcemanager.chaos.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;
import java.time.OffsetDateTime;
/**
* Model that represents the execution of a Experiment.
*/
@Immutable
-public final class ExperimentExecutionInner {
+public final class ExperimentExecutionInner implements JsonSerializable {
/*
* String of the resource type.
*/
- @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY)
private String type;
/*
* String of the fully qualified resource ID.
*/
- @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
private String id;
/*
* String of the resource name.
*/
- @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
private String name;
/*
* The properties of experiment execution status.
*/
- @JsonProperty(value = "properties")
private ExperimentExecutionProperties innerProperties;
/**
@@ -116,4 +116,47 @@ 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 ExperimentExecutionInner from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ExperimentExecutionInner 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 ExperimentExecutionInner.
+ */
+ public static ExperimentExecutionInner fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ExperimentExecutionInner deserializedExperimentExecutionInner = new ExperimentExecutionInner();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("type".equals(fieldName)) {
+ deserializedExperimentExecutionInner.type = reader.getString();
+ } else if ("id".equals(fieldName)) {
+ deserializedExperimentExecutionInner.id = reader.getString();
+ } else if ("name".equals(fieldName)) {
+ deserializedExperimentExecutionInner.name = reader.getString();
+ } else if ("properties".equals(fieldName)) {
+ deserializedExperimentExecutionInner.innerProperties
+ = ExperimentExecutionProperties.fromJson(reader);
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedExperimentExecutionInner;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionProperties.java
index 0338e23a53bbf..338aa56c85a71 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionProperties.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionProperties.java
@@ -5,30 +5,32 @@
package com.azure.resourcemanager.chaos.fluent.models;
import com.azure.core.annotation.Immutable;
-import com.fasterxml.jackson.annotation.JsonProperty;
+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 java.io.IOException;
import java.time.OffsetDateTime;
/**
* Model that represents the execution properties of an Experiment.
*/
@Immutable
-public class ExperimentExecutionProperties {
+public class ExperimentExecutionProperties implements JsonSerializable {
/*
* The status of the execution.
*/
- @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY)
private String status;
/*
* String that represents the start date time.
*/
- @JsonProperty(value = "startedAt", access = JsonProperty.Access.WRITE_ONLY)
private OffsetDateTime startedAt;
/*
* String that represents the stop date time.
*/
- @JsonProperty(value = "stoppedAt", access = JsonProperty.Access.WRITE_ONLY)
private OffsetDateTime stoppedAt;
/**
@@ -46,6 +48,17 @@ public String status() {
return this.status;
}
+ /**
+ * Set the status property: The status of the execution.
+ *
+ * @param status the status value to set.
+ * @return the ExperimentExecutionProperties object itself.
+ */
+ ExperimentExecutionProperties withStatus(String status) {
+ this.status = status;
+ return this;
+ }
+
/**
* Get the startedAt property: String that represents the start date time.
*
@@ -55,6 +68,17 @@ public OffsetDateTime startedAt() {
return this.startedAt;
}
+ /**
+ * Set the startedAt property: String that represents the start date time.
+ *
+ * @param startedAt the startedAt value to set.
+ * @return the ExperimentExecutionProperties object itself.
+ */
+ ExperimentExecutionProperties withStartedAt(OffsetDateTime startedAt) {
+ this.startedAt = startedAt;
+ return this;
+ }
+
/**
* Get the stoppedAt property: String that represents the stop date time.
*
@@ -64,6 +88,17 @@ public OffsetDateTime stoppedAt() {
return this.stoppedAt;
}
+ /**
+ * Set the stoppedAt property: String that represents the stop date time.
+ *
+ * @param stoppedAt the stoppedAt value to set.
+ * @return the ExperimentExecutionProperties object itself.
+ */
+ ExperimentExecutionProperties withStoppedAt(OffsetDateTime stoppedAt) {
+ this.stoppedAt = stoppedAt;
+ return this;
+ }
+
/**
* Validates the instance.
*
@@ -71,4 +106,46 @@ public OffsetDateTime stoppedAt() {
*/
public void validate() {
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ExperimentExecutionProperties from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ExperimentExecutionProperties 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 ExperimentExecutionProperties.
+ */
+ public static ExperimentExecutionProperties fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ExperimentExecutionProperties deserializedExperimentExecutionProperties
+ = new ExperimentExecutionProperties();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("status".equals(fieldName)) {
+ deserializedExperimentExecutionProperties.status = reader.getString();
+ } else if ("startedAt".equals(fieldName)) {
+ deserializedExperimentExecutionProperties.startedAt = reader
+ .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
+ } else if ("stoppedAt".equals(fieldName)) {
+ deserializedExperimentExecutionProperties.stoppedAt = reader
+ .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedExperimentExecutionProperties;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentInner.java
index 70656ef6bef37..b034403833ae8 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentInner.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentInner.java
@@ -8,11 +8,14 @@
import com.azure.core.management.Resource;
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.chaos.models.ChaosExperimentStep;
import com.azure.resourcemanager.chaos.models.ChaosTargetSelector;
import com.azure.resourcemanager.chaos.models.ProvisioningState;
import com.azure.resourcemanager.chaos.models.ResourceIdentity;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.IOException;
import java.util.List;
import java.util.Map;
@@ -24,21 +27,33 @@ public final class ExperimentInner extends Resource {
/*
* The system metadata of the experiment resource.
*/
- @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
private SystemData systemData;
/*
* The identity of the experiment resource.
*/
- @JsonProperty(value = "identity")
private ResourceIdentity identity;
/*
* The properties of the experiment resource.
*/
- @JsonProperty(value = "properties", required = true)
private ExperimentProperties innerProperties = new ExperimentProperties();
+ /*
+ * 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 ExperimentInner class.
*/
@@ -83,6 +98,36 @@ private ExperimentProperties innerProperties() {
return this.innerProperties;
}
+ /**
+ * 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}
*/
@@ -166,12 +211,68 @@ public void validate() {
identity().validate();
}
if (innerProperties() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property innerProperties in model ExperimentInner"));
+ throw LOGGER.atError()
+ .log(
+ new IllegalArgumentException("Missing required property innerProperties in model ExperimentInner"));
} else {
innerProperties().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(ExperimentInner.class);
+
+ /**
+ * {@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);
+ jsonWriter.writeJsonField("identity", this.identity);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ExperimentInner from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ExperimentInner 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 ExperimentInner.
+ */
+ public static ExperimentInner fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ExperimentInner deserializedExperimentInner = new ExperimentInner();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("id".equals(fieldName)) {
+ deserializedExperimentInner.id = reader.getString();
+ } else if ("name".equals(fieldName)) {
+ deserializedExperimentInner.name = reader.getString();
+ } else if ("type".equals(fieldName)) {
+ deserializedExperimentInner.type = reader.getString();
+ } else if ("location".equals(fieldName)) {
+ deserializedExperimentInner.withLocation(reader.getString());
+ } else if ("tags".equals(fieldName)) {
+ Map tags = reader.readMap(reader1 -> reader1.getString());
+ deserializedExperimentInner.withTags(tags);
+ } else if ("properties".equals(fieldName)) {
+ deserializedExperimentInner.innerProperties = ExperimentProperties.fromJson(reader);
+ } else if ("systemData".equals(fieldName)) {
+ deserializedExperimentInner.systemData = SystemData.fromJson(reader);
+ } else if ("identity".equals(fieldName)) {
+ deserializedExperimentInner.identity = ResourceIdentity.fromJson(reader);
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedExperimentInner;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentProperties.java
index bb1445fe5dc11..d954e4f1c2403 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentProperties.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentProperties.java
@@ -6,33 +6,34 @@
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.chaos.models.ChaosExperimentStep;
import com.azure.resourcemanager.chaos.models.ChaosTargetSelector;
import com.azure.resourcemanager.chaos.models.ProvisioningState;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.IOException;
import java.util.List;
/**
* Model that represents the Experiment properties model.
*/
@Fluent
-public final class ExperimentProperties {
+public final class ExperimentProperties implements JsonSerializable {
/*
* Most recent provisioning state for the given experiment resource.
*/
- @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
private ProvisioningState provisioningState;
/*
* List of steps.
*/
- @JsonProperty(value = "steps", required = true)
private List steps;
/*
* List of selectors.
*/
- @JsonProperty(value = "selectors", required = true)
private List selectors;
/**
@@ -97,18 +98,65 @@ public ExperimentProperties withSelectors(List selectors) {
*/
public void validate() {
if (steps() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property steps in model ExperimentProperties"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property steps in model ExperimentProperties"));
} else {
steps().forEach(e -> e.validate());
}
if (selectors() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property selectors in model ExperimentProperties"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property selectors in model ExperimentProperties"));
} else {
selectors().forEach(e -> e.validate());
}
}
private static final ClientLogger LOGGER = new ClientLogger(ExperimentProperties.class);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeArrayField("steps", this.steps, (writer, element) -> writer.writeJson(element));
+ jsonWriter.writeArrayField("selectors", this.selectors, (writer, element) -> writer.writeJson(element));
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ExperimentProperties from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ExperimentProperties 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 ExperimentProperties.
+ */
+ public static ExperimentProperties fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ExperimentProperties deserializedExperimentProperties = new ExperimentProperties();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("steps".equals(fieldName)) {
+ List steps
+ = reader.readArray(reader1 -> ChaosExperimentStep.fromJson(reader1));
+ deserializedExperimentProperties.steps = steps;
+ } else if ("selectors".equals(fieldName)) {
+ List selectors
+ = reader.readArray(reader1 -> ChaosTargetSelector.fromJson(reader1));
+ deserializedExperimentProperties.selectors = selectors;
+ } else if ("provisioningState".equals(fieldName)) {
+ deserializedExperimentProperties.provisioningState
+ = ProvisioningState.fromString(reader.getString());
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedExperimentProperties;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationInner.java
index d71cf2dbad10e..113129ee153dd 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationInner.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationInner.java
@@ -5,10 +5,14 @@
package com.azure.resourcemanager.chaos.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.chaos.models.ActionType;
import com.azure.resourcemanager.chaos.models.OperationDisplay;
import com.azure.resourcemanager.chaos.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/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationStatusInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationStatusInner.java
index 24456ee1cf196..bfcf9bb40f928 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationStatusInner.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationStatusInner.java
@@ -6,47 +6,47 @@
import com.azure.core.annotation.Fluent;
import com.azure.core.management.exception.ManagementError;
-import com.fasterxml.jackson.annotation.JsonProperty;
+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 java.io.IOException;
+import java.time.OffsetDateTime;
/**
* The status of operation.
*/
@Fluent
-public final class OperationStatusInner {
+public final class OperationStatusInner implements JsonSerializable {
/*
* The operation Id.
*/
- @JsonProperty(value = "id")
private String id;
/*
* The operation name.
*/
- @JsonProperty(value = "name")
private String name;
/*
* The start time of the operation.
*/
- @JsonProperty(value = "startTime")
- private String startTime;
+ private OffsetDateTime startTime;
/*
* The end time of the operation.
*/
- @JsonProperty(value = "endTime")
- private String endTime;
+ private OffsetDateTime endTime;
/*
* The status of the operation.
*/
- @JsonProperty(value = "status")
private String status;
/*
* The error object.
*/
- @JsonProperty(value = "error")
private ManagementError error;
/**
@@ -100,41 +100,19 @@ public OperationStatusInner withName(String name) {
*
* @return the startTime value.
*/
- public String startTime() {
+ public OffsetDateTime startTime() {
return this.startTime;
}
- /**
- * Set the startTime property: The start time of the operation.
- *
- * @param startTime the startTime value to set.
- * @return the OperationStatusInner object itself.
- */
- public OperationStatusInner withStartTime(String startTime) {
- this.startTime = startTime;
- return this;
- }
-
/**
* Get the endTime property: The end time of the operation.
*
* @return the endTime value.
*/
- public String endTime() {
+ public OffsetDateTime endTime() {
return this.endTime;
}
- /**
- * Set the endTime property: The end time of the operation.
- *
- * @param endTime the endTime value to set.
- * @return the OperationStatusInner object itself.
- */
- public OperationStatusInner withEndTime(String endTime) {
- this.endTime = endTime;
- return this;
- }
-
/**
* Get the status property: The status of the operation.
*
@@ -182,4 +160,55 @@ public OperationStatusInner withError(ManagementError error) {
*/
public void validate() {
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("id", this.id);
+ jsonWriter.writeStringField("name", this.name);
+ jsonWriter.writeStringField("status", this.status);
+ jsonWriter.writeJsonField("error", this.error);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of OperationStatusInner from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of OperationStatusInner 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 OperationStatusInner.
+ */
+ public static OperationStatusInner fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ OperationStatusInner deserializedOperationStatusInner = new OperationStatusInner();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("id".equals(fieldName)) {
+ deserializedOperationStatusInner.id = reader.getString();
+ } else if ("name".equals(fieldName)) {
+ deserializedOperationStatusInner.name = reader.getString();
+ } else if ("startTime".equals(fieldName)) {
+ deserializedOperationStatusInner.startTime = reader
+ .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
+ } else if ("endTime".equals(fieldName)) {
+ deserializedOperationStatusInner.endTime = reader
+ .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
+ } else if ("status".equals(fieldName)) {
+ deserializedOperationStatusInner.status = reader.getString();
+ } else if ("error".equals(fieldName)) {
+ deserializedOperationStatusInner.error = ManagementError.fromJson(reader);
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedOperationStatusInner;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetInner.java
index 2700e264d225d..9c7156ae10fc9 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetInner.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetInner.java
@@ -8,8 +8,10 @@
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import com.azure.json.JsonReader;
+import com.azure.json.JsonToken;
+import com.azure.json.JsonWriter;
+import java.io.IOException;
import java.util.Map;
/**
@@ -20,22 +22,33 @@ public final class TargetInner extends ProxyResource {
/*
* The system metadata of the target resource.
*/
- @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
private SystemData systemData;
/*
* Location of the target resource.
*/
- @JsonProperty(value = "location")
private String location;
/*
* The properties of the target resource.
*/
- @JsonProperty(value = "properties", required = true)
- @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
private Map properties;
+ /*
+ * 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 TargetInner class.
*/
@@ -91,6 +104,36 @@ public TargetInner withProperties(Map properties) {
return this;
}
+ /**
+ * 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.
*
@@ -98,10 +141,59 @@ public TargetInner withProperties(Map properties) {
*/
public void validate() {
if (properties() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property properties in model TargetInner"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property properties in model TargetInner"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(TargetInner.class);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeMapField("properties", this.properties, (writer, element) -> writer.writeUntyped(element));
+ jsonWriter.writeStringField("location", this.location);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of TargetInner from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of TargetInner 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 TargetInner.
+ */
+ public static TargetInner fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ TargetInner deserializedTargetInner = new TargetInner();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("id".equals(fieldName)) {
+ deserializedTargetInner.id = reader.getString();
+ } else if ("name".equals(fieldName)) {
+ deserializedTargetInner.name = reader.getString();
+ } else if ("type".equals(fieldName)) {
+ deserializedTargetInner.type = reader.getString();
+ } else if ("properties".equals(fieldName)) {
+ Map properties = reader.readMap(reader1 -> reader1.readUntyped());
+ deserializedTargetInner.properties = properties;
+ } else if ("systemData".equals(fieldName)) {
+ deserializedTargetInner.systemData = SystemData.fromJson(reader);
+ } else if ("location".equals(fieldName)) {
+ deserializedTargetInner.location = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedTargetInner;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeInner.java
index 7977d4e0b5d8b..0f944a6e9ac34 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeInner.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeInner.java
@@ -8,7 +8,10 @@
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import com.azure.json.JsonReader;
+import com.azure.json.JsonToken;
+import com.azure.json.JsonWriter;
+import java.io.IOException;
import java.util.List;
/**
@@ -19,21 +22,33 @@ public final class TargetTypeInner extends ProxyResource {
/*
* The system metadata properties of the target type resource.
*/
- @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
private SystemData systemData;
/*
* Location of the Target Type resource.
*/
- @JsonProperty(value = "location")
private String location;
/*
* The properties of the target type resource.
*/
- @JsonProperty(value = "properties", required = true)
private TargetTypeProperties innerProperties = new TargetTypeProperties();
+ /*
+ * 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 TargetTypeInner class.
*/
@@ -78,6 +93,36 @@ private TargetTypeProperties innerProperties() {
return this.innerProperties;
}
+ /**
+ * 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 displayName property: Localized string of the display name.
*
@@ -121,12 +166,61 @@ public List resourceTypes() {
*/
public void validate() {
if (innerProperties() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property innerProperties in model TargetTypeInner"));
+ throw LOGGER.atError()
+ .log(
+ new IllegalArgumentException("Missing required property innerProperties in model TargetTypeInner"));
} else {
innerProperties().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(TargetTypeInner.class);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeJsonField("properties", this.innerProperties);
+ jsonWriter.writeStringField("location", this.location);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of TargetTypeInner from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of TargetTypeInner 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 TargetTypeInner.
+ */
+ public static TargetTypeInner fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ TargetTypeInner deserializedTargetTypeInner = new TargetTypeInner();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("id".equals(fieldName)) {
+ deserializedTargetTypeInner.id = reader.getString();
+ } else if ("name".equals(fieldName)) {
+ deserializedTargetTypeInner.name = reader.getString();
+ } else if ("type".equals(fieldName)) {
+ deserializedTargetTypeInner.type = reader.getString();
+ } else if ("properties".equals(fieldName)) {
+ deserializedTargetTypeInner.innerProperties = TargetTypeProperties.fromJson(reader);
+ } else if ("systemData".equals(fieldName)) {
+ deserializedTargetTypeInner.systemData = SystemData.fromJson(reader);
+ } else if ("location".equals(fieldName)) {
+ deserializedTargetTypeInner.location = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedTargetTypeInner;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeProperties.java
index 56be5f6e63786..7d3ee13e3ea3c 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeProperties.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeProperties.java
@@ -5,36 +5,36 @@
package com.azure.resourcemanager.chaos.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;
import java.util.List;
/**
* Model that represents the base Target Type properties model.
*/
@Immutable
-public final class TargetTypeProperties {
+public final class TargetTypeProperties implements JsonSerializable {
/*
* Localized string of the display name.
*/
- @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY)
private String displayName;
/*
* Localized string of the description.
*/
- @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY)
private String description;
/*
* URL to retrieve JSON schema of the Target Type properties.
*/
- @JsonProperty(value = "propertiesSchema", access = JsonProperty.Access.WRITE_ONLY)
private String propertiesSchema;
/*
* List of resource types this Target Type can extend.
*/
- @JsonProperty(value = "resourceTypes", access = JsonProperty.Access.WRITE_ONLY)
private List resourceTypes;
/**
@@ -86,4 +86,46 @@ public List resourceTypes() {
*/
public void validate() {
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of TargetTypeProperties from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of TargetTypeProperties 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 TargetTypeProperties.
+ */
+ public static TargetTypeProperties fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ TargetTypeProperties deserializedTargetTypeProperties = new TargetTypeProperties();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("displayName".equals(fieldName)) {
+ deserializedTargetTypeProperties.displayName = reader.getString();
+ } else if ("description".equals(fieldName)) {
+ deserializedTargetTypeProperties.description = reader.getString();
+ } else if ("propertiesSchema".equals(fieldName)) {
+ deserializedTargetTypeProperties.propertiesSchema = reader.getString();
+ } else if ("resourceTypes".equals(fieldName)) {
+ List resourceTypes = reader.readArray(reader1 -> reader1.getString());
+ deserializedTargetTypeProperties.resourceTypes = resourceTypes;
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedTargetTypeProperties;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilitiesClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilitiesClientImpl.java
index 40ab78721ad4f..4a986b0ee909b 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilitiesClientImpl.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilitiesClientImpl.java
@@ -907,9 +907,7 @@ public CapabilityInner createOrUpdate(String resourceGroupName, String parentPro
/**
* Get the next page of items.
*
- * @param nextLink The URL to get the next list of items
- *
- * The nextLink parameter.
+ * @param nextLink The URL to get the next list of items.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
@@ -935,9 +933,7 @@ private Mono> listNextSinglePageAsync(String next
/**
* Get the next page of items.
*
- * @param nextLink The URL to get the next list of items
- *
- * The nextLink parameter.
+ * @param nextLink The URL to get the next list of items.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesClientImpl.java
index b49dfa127debb..f9a5e16e973cf 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesClientImpl.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesClientImpl.java
@@ -395,9 +395,7 @@ public CapabilityTypeInner get(String locationName, String targetTypeName, Strin
/**
* Get the next page of items.
*
- * @param nextLink The URL to get the next list of items
- *
- * The nextLink parameter.
+ * @param nextLink The URL to get the next list of items.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
@@ -423,9 +421,7 @@ private Mono> listNextSinglePageAsync(String
/**
* Get the next page of items.
*
- * @param nextLink The URL to get the next list of items
- *
- * The nextLink parameter.
+ * @param nextLink The URL to get the next list of items.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientImpl.java
index 2c063237e18b5..27d1a8b81b6fa 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientImpl.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientImpl.java
@@ -5,6 +5,7 @@
package com.azure.resourcemanager.chaos.implementation;
import com.azure.core.annotation.ServiceClient;
+import com.azure.core.http.HttpHeaderName;
import com.azure.core.http.HttpHeaders;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpResponse;
@@ -355,7 +356,7 @@ public int getStatusCode() {
}
public String getHeaderValue(String s) {
- return httpHeaders.getValue(s);
+ return httpHeaders.getValue(HttpHeaderName.fromString(s));
}
public HttpHeaders getHeaders() {
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java
index 91bb521156901..b76583e4324e3 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java
@@ -2109,9 +2109,7 @@ public ExperimentExecutionDetailsInner executionDetails(String resourceGroupName
/**
* Get the next page of items.
*
- * @param nextLink The URL to get the next list of items
- *
- * The nextLink parameter.
+ * @param nextLink The URL to get the next list of items.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
@@ -2138,9 +2136,7 @@ private Mono> listAllNextSinglePageAsync(String n
/**
* Get the next page of items.
*
- * @param nextLink The URL to get the next list of items
- *
- * The nextLink parameter.
+ * @param nextLink The URL to get the next list of items.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
@@ -2167,9 +2163,7 @@ private Mono> listAllNextSinglePageAsync(String n
/**
* Get the next page of items.
*
- * @param nextLink The URL to get the next list of items
- *
- * The nextLink parameter.
+ * @param nextLink The URL to get the next list of items.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
@@ -2195,9 +2189,7 @@ private Mono> listNextSinglePageAsync(String next
/**
* Get the next page of items.
*
- * @param nextLink The URL to get the next list of items
- *
- * The nextLink parameter.
+ * @param nextLink The URL to get the next list of items.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
@@ -2224,9 +2216,7 @@ private Mono> listNextSinglePageAsync(String next
/**
* Get the next page of items.
*
- * @param nextLink The URL to get the next list of items
- *
- * The nextLink parameter.
+ * @param nextLink The URL to get the next list of items.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
@@ -2253,9 +2243,7 @@ private Mono> listAllExecutionsNextSingl
/**
* Get the next page of items.
*
- * @param nextLink The URL to get the next list of items
- *
- * The nextLink parameter.
+ * @param nextLink The URL to get the next list of items.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusImpl.java
index 09adcaaa1102d..fee127f5b564e 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusImpl.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusImpl.java
@@ -7,6 +7,7 @@
import com.azure.core.management.exception.ManagementError;
import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner;
import com.azure.resourcemanager.chaos.models.OperationStatus;
+import java.time.OffsetDateTime;
public final class OperationStatusImpl implements OperationStatus {
private OperationStatusInner innerObject;
@@ -26,11 +27,11 @@ public String name() {
return this.innerModel().name();
}
- public String startTime() {
+ public OffsetDateTime startTime() {
return this.innerModel().startTime();
}
- public String endTime() {
+ public OffsetDateTime endTime() {
return this.innerModel().endTime();
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsClientImpl.java
index 3f14079d2aab9..7c36795820d22 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsClientImpl.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsClientImpl.java
@@ -179,9 +179,7 @@ public PagedIterable listAll(Context context) {
/**
* Get the next page of items.
*
- * @param nextLink The URL to get the next list of items
- *
- * The nextLink parameter.
+ * @param nextLink The URL to get the next list of items.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
@@ -208,9 +206,7 @@ private Mono> listAllNextSinglePageAsync(String ne
/**
* Get the next page of items.
*
- * @param nextLink The URL to get the next list of items
- *
- * The nextLink parameter.
+ * @param nextLink The URL to get the next list of items.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ResourceManagerUtils.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ResourceManagerUtils.java
index 04312bfa92609..128fbddc5d7c5 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ResourceManagerUtils.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ResourceManagerUtils.java
@@ -41,7 +41,6 @@ static String getValueFromIdByName(String id, String name) {
}
}
return null;
-
}
static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) {
@@ -75,7 +74,6 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri
}
}
return null;
-
}
static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) {
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesClientImpl.java
index 1611957b7d981..3cf50d14e6229 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesClientImpl.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesClientImpl.java
@@ -354,9 +354,7 @@ public TargetTypeInner get(String locationName, String targetTypeName) {
/**
* Get the next page of items.
*
- * @param nextLink The URL to get the next list of items
- *
- * The nextLink parameter.
+ * @param nextLink The URL to get the next list of items.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
@@ -382,9 +380,7 @@ private Mono> listNextSinglePageAsync(String next
/**
* Get the next page of items.
*
- * @param nextLink The URL to get the next list of items
- *
- * The nextLink parameter.
+ * @param nextLink The URL to get the next list of items.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsClientImpl.java
index f3de7fe94bafd..9a34d44737459 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsClientImpl.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsClientImpl.java
@@ -847,9 +847,7 @@ public TargetInner createOrUpdate(String resourceGroupName, String parentProvide
/**
* Get the next page of items.
*
- * @param nextLink The URL to get the next list of items
- *
- * The nextLink parameter.
+ * @param nextLink The URL to get the next list of items.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
@@ -875,9 +873,7 @@ private Mono> listNextSinglePageAsync(String nextLink
/**
* Get the next page of items.
*
- * @param nextLink The URL to get the next list of items
- *
- * The nextLink parameter.
+ * @param nextLink The URL to get the next list of items.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ActionStatus.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ActionStatus.java
index 758773bc359f9..6aabfde70bc90 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ActionStatus.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ActionStatus.java
@@ -5,7 +5,12 @@
package com.azure.resourcemanager.chaos.models;
import com.azure.core.annotation.Immutable;
-import com.fasterxml.jackson.annotation.JsonProperty;
+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 java.io.IOException;
import java.time.OffsetDateTime;
import java.util.List;
@@ -13,41 +18,35 @@
* Model that represents the an action and its status.
*/
@Immutable
-public final class ActionStatus {
+public final class ActionStatus implements JsonSerializable {
/*
* The name of the action status.
*/
- @JsonProperty(value = "actionName", access = JsonProperty.Access.WRITE_ONLY)
private String actionName;
/*
* The id of the action status.
*/
- @JsonProperty(value = "actionId", access = JsonProperty.Access.WRITE_ONLY)
private String actionId;
/*
* The status of the action.
*/
- @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY)
private String status;
/*
* String that represents the start time of the action.
*/
- @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY)
private OffsetDateTime startTime;
/*
* String that represents the end time of the action.
*/
- @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY)
private OffsetDateTime endTime;
/*
* The array of targets.
*/
- @JsonProperty(value = "targets", access = JsonProperty.Access.WRITE_ONLY)
private List targets;
/**
@@ -120,4 +119,53 @@ public void validate() {
targets().forEach(e -> e.validate());
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ActionStatus from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ActionStatus 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 ActionStatus.
+ */
+ public static ActionStatus fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ActionStatus deserializedActionStatus = new ActionStatus();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("actionName".equals(fieldName)) {
+ deserializedActionStatus.actionName = reader.getString();
+ } else if ("actionId".equals(fieldName)) {
+ deserializedActionStatus.actionId = reader.getString();
+ } else if ("status".equals(fieldName)) {
+ deserializedActionStatus.status = reader.getString();
+ } else if ("startTime".equals(fieldName)) {
+ deserializedActionStatus.startTime = reader
+ .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
+ } else if ("endTime".equals(fieldName)) {
+ deserializedActionStatus.endTime = reader
+ .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
+ } else if ("targets".equals(fieldName)) {
+ List targets = reader
+ .readArray(reader1 -> ExperimentExecutionActionTargetDetailsProperties.fromJson(reader1));
+ deserializedActionStatus.targets = targets;
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedActionStatus;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ActionType.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ActionType.java
index b0e71ff86b99e..229ff3843a6b8 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ActionType.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ActionType.java
@@ -5,7 +5,6 @@
package com.azure.resourcemanager.chaos.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/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/BranchStatus.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/BranchStatus.java
index 46752e6e415b2..0af395c3610e0 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/BranchStatus.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/BranchStatus.java
@@ -5,36 +5,36 @@
package com.azure.resourcemanager.chaos.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;
import java.util.List;
/**
* Model that represents the a list of actions and action statuses.
*/
@Immutable
-public final class BranchStatus {
+public final class BranchStatus implements JsonSerializable {
/*
* The name of the branch status.
*/
- @JsonProperty(value = "branchName", access = JsonProperty.Access.WRITE_ONLY)
private String branchName;
/*
* The id of the branch status.
*/
- @JsonProperty(value = "branchId", access = JsonProperty.Access.WRITE_ONLY)
private String branchId;
/*
* The status of the branch.
*/
- @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY)
private String status;
/*
* The array of actions.
*/
- @JsonProperty(value = "actions", access = JsonProperty.Access.WRITE_ONLY)
private List actions;
/**
@@ -89,4 +89,46 @@ public void validate() {
actions().forEach(e -> e.validate());
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of BranchStatus from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of BranchStatus 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 BranchStatus.
+ */
+ public static BranchStatus fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ BranchStatus deserializedBranchStatus = new BranchStatus();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("branchName".equals(fieldName)) {
+ deserializedBranchStatus.branchName = reader.getString();
+ } else if ("branchId".equals(fieldName)) {
+ deserializedBranchStatus.branchId = reader.getString();
+ } else if ("status".equals(fieldName)) {
+ deserializedBranchStatus.status = reader.getString();
+ } else if ("actions".equals(fieldName)) {
+ List actions = reader.readArray(reader1 -> ActionStatus.fromJson(reader1));
+ deserializedBranchStatus.actions = actions;
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedBranchStatus;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityListResult.java
index 5a8f1a78f705e..9aa574ce758ba 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityListResult.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityListResult.java
@@ -5,25 +5,27 @@
package com.azure.resourcemanager.chaos.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.chaos.fluent.models.CapabilityInner;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.IOException;
import java.util.List;
/**
* Model that represents a list of Capability resources and a link for pagination.
*/
@Immutable
-public final class CapabilityListResult {
+public final class CapabilityListResult implements JsonSerializable {
/*
* List of Capability resources.
*/
- @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY)
private List value;
/*
* URL to retrieve the next page of Capability resources.
*/
- @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY)
private String nextLink;
/**
@@ -60,4 +62,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 CapabilityListResult from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of CapabilityListResult 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 CapabilityListResult.
+ */
+ public static CapabilityListResult fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ CapabilityListResult deserializedCapabilityListResult = new CapabilityListResult();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("value".equals(fieldName)) {
+ List value = reader.readArray(reader1 -> CapabilityInner.fromJson(reader1));
+ deserializedCapabilityListResult.value = value;
+ } else if ("nextLink".equals(fieldName)) {
+ deserializedCapabilityListResult.nextLink = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedCapabilityListResult;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypeListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypeListResult.java
index 39627dcd75350..791e7c926f1e9 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypeListResult.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypeListResult.java
@@ -5,25 +5,27 @@
package com.azure.resourcemanager.chaos.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.chaos.fluent.models.CapabilityTypeInner;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.IOException;
import java.util.List;
/**
* Model that represents a list of Capability Type resources and a link for pagination.
*/
@Immutable
-public final class CapabilityTypeListResult {
+public final class CapabilityTypeListResult implements JsonSerializable {
/*
* List of Capability Type resources.
*/
- @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY)
private List value;
/*
* URL to retrieve the next page of Capability Type resources.
*/
- @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY)
private String nextLink;
/**
@@ -60,4 +62,43 @@ 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 CapabilityTypeListResult from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of CapabilityTypeListResult 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 CapabilityTypeListResult.
+ */
+ public static CapabilityTypeListResult fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ CapabilityTypeListResult deserializedCapabilityTypeListResult = new CapabilityTypeListResult();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("value".equals(fieldName)) {
+ List value
+ = reader.readArray(reader1 -> CapabilityTypeInner.fromJson(reader1));
+ deserializedCapabilityTypeListResult.value = value;
+ } else if ("nextLink".equals(fieldName)) {
+ deserializedCapabilityTypeListResult.nextLink = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedCapabilityTypeListResult;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypePropertiesRuntimeProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypePropertiesRuntimeProperties.java
index 75b79cfeff2e3..9fb9432b83825 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypePropertiesRuntimeProperties.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypePropertiesRuntimeProperties.java
@@ -5,17 +5,21 @@
package com.azure.resourcemanager.chaos.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;
/**
* Runtime properties of this Capability Type.
*/
@Immutable
-public final class CapabilityTypePropertiesRuntimeProperties {
+public final class CapabilityTypePropertiesRuntimeProperties
+ implements JsonSerializable {
/*
* String of the kind of the resource's action type (continuous or discrete).
*/
- @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY)
private String kind;
/**
@@ -40,4 +44,40 @@ public String kind() {
*/
public void validate() {
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of CapabilityTypePropertiesRuntimeProperties from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of CapabilityTypePropertiesRuntimeProperties 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 CapabilityTypePropertiesRuntimeProperties.
+ */
+ public static CapabilityTypePropertiesRuntimeProperties fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ CapabilityTypePropertiesRuntimeProperties deserializedCapabilityTypePropertiesRuntimeProperties
+ = new CapabilityTypePropertiesRuntimeProperties();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("kind".equals(fieldName)) {
+ deserializedCapabilityTypePropertiesRuntimeProperties.kind = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedCapabilityTypePropertiesRuntimeProperties;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentAction.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentAction.java
index ca8fb8ed777b0..2ed9ea354644b 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentAction.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentAction.java
@@ -6,30 +6,25 @@
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonSubTypes;
-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;
/**
* Model that represents the base action model. 9 total per experiment.
*/
-@JsonTypeInfo(
- use = JsonTypeInfo.Id.NAME,
- include = JsonTypeInfo.As.PROPERTY,
- property = "type",
- defaultImpl = ChaosExperimentAction.class)
-@JsonTypeName("ChaosExperimentAction")
-@JsonSubTypes({
- @JsonSubTypes.Type(name = "delay", value = DelayAction.class),
- @JsonSubTypes.Type(name = "discrete", value = DiscreteAction.class),
- @JsonSubTypes.Type(name = "continuous", value = ContinuousAction.class) })
@Fluent
-public class ChaosExperimentAction {
+public class ChaosExperimentAction implements JsonSerializable {
+ /*
+ * Enum that discriminates between action models.
+ */
+ private String type = "ChaosExperimentAction";
+
/*
* String that represents a Capability URN.
*/
- @JsonProperty(value = "name", required = true)
private String name;
/**
@@ -38,6 +33,15 @@ public class ChaosExperimentAction {
public ChaosExperimentAction() {
}
+ /**
+ * Get the type property: Enum that discriminates between action models.
+ *
+ * @return the type value.
+ */
+ public String type() {
+ return this.type;
+ }
+
/**
* Get the name property: String that represents a Capability URN.
*
@@ -65,10 +69,79 @@ public ChaosExperimentAction withName(String name) {
*/
public void validate() {
if (name() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property name in model ChaosExperimentAction"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property name in model ChaosExperimentAction"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(ChaosExperimentAction.class);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("name", this.name);
+ jsonWriter.writeStringField("type", this.type);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ChaosExperimentAction from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ChaosExperimentAction 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 ChaosExperimentAction.
+ */
+ public static ChaosExperimentAction 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 ("delay".equals(discriminatorValue)) {
+ return DelayAction.fromJson(readerToUse.reset());
+ } else if ("discrete".equals(discriminatorValue)) {
+ return DiscreteAction.fromJson(readerToUse.reset());
+ } else if ("continuous".equals(discriminatorValue)) {
+ return ContinuousAction.fromJson(readerToUse.reset());
+ } else {
+ return fromJsonKnownDiscriminator(readerToUse.reset());
+ }
+ }
+ });
+ }
+
+ static ChaosExperimentAction fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ChaosExperimentAction deserializedChaosExperimentAction = new ChaosExperimentAction();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("name".equals(fieldName)) {
+ deserializedChaosExperimentAction.name = reader.getString();
+ } else if ("type".equals(fieldName)) {
+ deserializedChaosExperimentAction.type = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedChaosExperimentAction;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentBranch.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentBranch.java
index 03176b9cee2d5..77dcd53ce42e4 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentBranch.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentBranch.java
@@ -6,24 +6,26 @@
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;
import java.util.List;
/**
* Model that represents a branch in the step. 9 total per experiment.
*/
@Fluent
-public final class ChaosExperimentBranch {
+public final class ChaosExperimentBranch implements JsonSerializable {
/*
* String of the branch name.
*/
- @JsonProperty(value = "name", required = true)
private String name;
/*
* List of actions.
*/
- @JsonProperty(value = "actions", required = true)
private List actions;
/**
@@ -79,16 +81,58 @@ public ChaosExperimentBranch withActions(List actions) {
*/
public void validate() {
if (name() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property name in model ChaosExperimentBranch"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property name in model ChaosExperimentBranch"));
}
if (actions() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property actions in model ChaosExperimentBranch"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property actions in model ChaosExperimentBranch"));
} else {
actions().forEach(e -> e.validate());
}
}
private static final ClientLogger LOGGER = new ClientLogger(ChaosExperimentBranch.class);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("name", this.name);
+ jsonWriter.writeArrayField("actions", this.actions, (writer, element) -> writer.writeJson(element));
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ChaosExperimentBranch from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ChaosExperimentBranch 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 ChaosExperimentBranch.
+ */
+ public static ChaosExperimentBranch fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ChaosExperimentBranch deserializedChaosExperimentBranch = new ChaosExperimentBranch();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("name".equals(fieldName)) {
+ deserializedChaosExperimentBranch.name = reader.getString();
+ } else if ("actions".equals(fieldName)) {
+ List actions
+ = reader.readArray(reader1 -> ChaosExperimentAction.fromJson(reader1));
+ deserializedChaosExperimentBranch.actions = actions;
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedChaosExperimentBranch;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentStep.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentStep.java
index a217c09c74cdc..674b4abcfd4ec 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentStep.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentStep.java
@@ -6,24 +6,26 @@
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;
import java.util.List;
/**
* Model that represents a step in the Experiment resource.
*/
@Fluent
-public final class ChaosExperimentStep {
+public final class ChaosExperimentStep implements JsonSerializable {
/*
* String of the step name.
*/
- @JsonProperty(value = "name", required = true)
private String name;
/*
* List of branches.
*/
- @JsonProperty(value = "branches", required = true)
private List branches;
/**
@@ -79,16 +81,58 @@ public ChaosExperimentStep withBranches(List branches) {
*/
public void validate() {
if (name() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property name in model ChaosExperimentStep"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property name in model ChaosExperimentStep"));
}
if (branches() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property branches in model ChaosExperimentStep"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property branches in model ChaosExperimentStep"));
} else {
branches().forEach(e -> e.validate());
}
}
private static final ClientLogger LOGGER = new ClientLogger(ChaosExperimentStep.class);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("name", this.name);
+ jsonWriter.writeArrayField("branches", this.branches, (writer, element) -> writer.writeJson(element));
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ChaosExperimentStep from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ChaosExperimentStep 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 ChaosExperimentStep.
+ */
+ public static ChaosExperimentStep fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ChaosExperimentStep deserializedChaosExperimentStep = new ChaosExperimentStep();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("name".equals(fieldName)) {
+ deserializedChaosExperimentStep.name = reader.getString();
+ } else if ("branches".equals(fieldName)) {
+ List branches
+ = reader.readArray(reader1 -> ChaosExperimentBranch.fromJson(reader1));
+ deserializedChaosExperimentStep.branches = branches;
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedChaosExperimentStep;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetFilter.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetFilter.java
index e40af79c50930..dac752e529ce4 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetFilter.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetFilter.java
@@ -5,28 +5,37 @@
package com.azure.resourcemanager.chaos.models;
import com.azure.core.annotation.Immutable;
-import com.fasterxml.jackson.annotation.JsonSubTypes;
-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;
/**
* Model that represents available filter types that can be applied to a targets list.
*/
-@JsonTypeInfo(
- use = JsonTypeInfo.Id.NAME,
- include = JsonTypeInfo.As.PROPERTY,
- property = "type",
- defaultImpl = ChaosTargetFilter.class)
-@JsonTypeName("ChaosTargetFilter")
-@JsonSubTypes({ @JsonSubTypes.Type(name = "Simple", value = ChaosTargetSimpleFilter.class) })
@Immutable
-public class ChaosTargetFilter {
+public class ChaosTargetFilter implements JsonSerializable {
+ /*
+ * Enum that discriminates between filter types. Currently only `Simple` type is supported.
+ */
+ private FilterType type = FilterType.fromString("ChaosTargetFilter");
+
/**
* Creates an instance of ChaosTargetFilter class.
*/
public ChaosTargetFilter() {
}
+ /**
+ * Get the type property: Enum that discriminates between filter types. Currently only `Simple` type is supported.
+ *
+ * @return the type value.
+ */
+ public FilterType type() {
+ return this.type;
+ }
+
/**
* Validates the instance.
*
@@ -34,4 +43,65 @@ public ChaosTargetFilter() {
*/
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 ChaosTargetFilter from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ChaosTargetFilter 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 ChaosTargetFilter.
+ */
+ public static ChaosTargetFilter 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 ("Simple".equals(discriminatorValue)) {
+ return ChaosTargetSimpleFilter.fromJson(readerToUse.reset());
+ } else {
+ return fromJsonKnownDiscriminator(readerToUse.reset());
+ }
+ }
+ });
+ }
+
+ static ChaosTargetFilter fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ChaosTargetFilter deserializedChaosTargetFilter = new ChaosTargetFilter();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("type".equals(fieldName)) {
+ deserializedChaosTargetFilter.type = FilterType.fromString(reader.getString());
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedChaosTargetFilter;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetListSelector.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetListSelector.java
index 9a724295ecfc1..b71a4ff8ec245 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetListSelector.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetListSelector.java
@@ -6,22 +6,27 @@
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
-import com.fasterxml.jackson.annotation.JsonProperty;
-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;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
/**
* Model that represents a list selector.
*/
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
-@JsonTypeName("List")
@Fluent
public final class ChaosTargetListSelector extends ChaosTargetSelector {
+ /*
+ * Enum of the selector type.
+ */
+ private SelectorType type = SelectorType.LIST;
+
/*
* List of Target references.
*/
- @JsonProperty(value = "targets", required = true)
private List targets;
/**
@@ -30,6 +35,16 @@ public final class ChaosTargetListSelector extends ChaosTargetSelector {
public ChaosTargetListSelector() {
}
+ /**
+ * Get the type property: Enum of the selector type.
+ *
+ * @return the type value.
+ */
+ @Override
+ public SelectorType type() {
+ return this.type;
+ }
+
/**
* Get the targets property: List of Target references.
*
@@ -75,14 +90,79 @@ public ChaosTargetListSelector withFilter(ChaosTargetFilter filter) {
*/
@Override
public void validate() {
- super.validate();
if (targets() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property targets in model ChaosTargetListSelector"));
+ throw LOGGER.atError()
+ .log(
+ new IllegalArgumentException("Missing required property targets in model ChaosTargetListSelector"));
} else {
targets().forEach(e -> e.validate());
}
+ if (id() == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property id in model ChaosTargetListSelector"));
+ }
+ if (filter() != null) {
+ filter().validate();
+ }
}
private static final ClientLogger LOGGER = new ClientLogger(ChaosTargetListSelector.class);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("id", id());
+ jsonWriter.writeJsonField("filter", filter());
+ jsonWriter.writeArrayField("targets", this.targets, (writer, element) -> writer.writeJson(element));
+ jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
+ if (additionalProperties() != null) {
+ for (Map.Entry additionalProperty : additionalProperties().entrySet()) {
+ jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue());
+ }
+ }
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ChaosTargetListSelector from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ChaosTargetListSelector 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 ChaosTargetListSelector.
+ */
+ public static ChaosTargetListSelector fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ChaosTargetListSelector deserializedChaosTargetListSelector = new ChaosTargetListSelector();
+ Map additionalProperties = null;
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("id".equals(fieldName)) {
+ deserializedChaosTargetListSelector.withId(reader.getString());
+ } else if ("filter".equals(fieldName)) {
+ deserializedChaosTargetListSelector.withFilter(ChaosTargetFilter.fromJson(reader));
+ } else if ("targets".equals(fieldName)) {
+ List targets = reader.readArray(reader1 -> TargetReference.fromJson(reader1));
+ deserializedChaosTargetListSelector.targets = targets;
+ } else if ("type".equals(fieldName)) {
+ deserializedChaosTargetListSelector.type = SelectorType.fromString(reader.getString());
+ } else {
+ if (additionalProperties == null) {
+ additionalProperties = new LinkedHashMap<>();
+ }
+
+ additionalProperties.put(fieldName, reader.readUntyped());
+ }
+ }
+ deserializedChaosTargetListSelector.withAdditionalProperties(additionalProperties);
+
+ return deserializedChaosTargetListSelector;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetQuerySelector.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetQuerySelector.java
index 5e0aa3765518a..bef50b389be5b 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetQuerySelector.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetQuerySelector.java
@@ -6,28 +6,32 @@
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
-import com.fasterxml.jackson.annotation.JsonProperty;
-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;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
/**
* Model that represents a query selector.
*/
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
-@JsonTypeName("Query")
@Fluent
public final class ChaosTargetQuerySelector extends ChaosTargetSelector {
+ /*
+ * Enum of the selector type.
+ */
+ private SelectorType type = SelectorType.QUERY;
+
/*
* Azure Resource Graph (ARG) Query Language query for target resources.
*/
- @JsonProperty(value = "queryString", required = true)
private String queryString;
/*
* Subscription id list to scope resource query.
*/
- @JsonProperty(value = "subscriptionIds", required = true)
private List subscriptionIds;
/**
@@ -36,6 +40,16 @@ public final class ChaosTargetQuerySelector extends ChaosTargetSelector {
public ChaosTargetQuerySelector() {
}
+ /**
+ * Get the type property: Enum of the selector type.
+ *
+ * @return the type value.
+ */
+ @Override
+ public SelectorType type() {
+ return this.type;
+ }
+
/**
* Get the queryString property: Azure Resource Graph (ARG) Query Language query for target resources.
*
@@ -101,16 +115,86 @@ public ChaosTargetQuerySelector withFilter(ChaosTargetFilter filter) {
*/
@Override
public void validate() {
- super.validate();
if (queryString() == null) {
- throw LOGGER.logExceptionAsError(new IllegalArgumentException(
- "Missing required property queryString in model ChaosTargetQuerySelector"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException(
+ "Missing required property queryString in model ChaosTargetQuerySelector"));
}
if (subscriptionIds() == null) {
- throw LOGGER.logExceptionAsError(new IllegalArgumentException(
- "Missing required property subscriptionIds in model ChaosTargetQuerySelector"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException(
+ "Missing required property subscriptionIds in model ChaosTargetQuerySelector"));
+ }
+ if (id() == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property id in model ChaosTargetQuerySelector"));
+ }
+ if (filter() != null) {
+ filter().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(ChaosTargetQuerySelector.class);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("id", id());
+ jsonWriter.writeJsonField("filter", filter());
+ jsonWriter.writeStringField("queryString", this.queryString);
+ jsonWriter.writeArrayField("subscriptionIds", this.subscriptionIds,
+ (writer, element) -> writer.writeString(element));
+ jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
+ if (additionalProperties() != null) {
+ for (Map.Entry additionalProperty : additionalProperties().entrySet()) {
+ jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue());
+ }
+ }
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ChaosTargetQuerySelector from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ChaosTargetQuerySelector 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 ChaosTargetQuerySelector.
+ */
+ public static ChaosTargetQuerySelector fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ChaosTargetQuerySelector deserializedChaosTargetQuerySelector = new ChaosTargetQuerySelector();
+ Map additionalProperties = null;
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("id".equals(fieldName)) {
+ deserializedChaosTargetQuerySelector.withId(reader.getString());
+ } else if ("filter".equals(fieldName)) {
+ deserializedChaosTargetQuerySelector.withFilter(ChaosTargetFilter.fromJson(reader));
+ } else if ("queryString".equals(fieldName)) {
+ deserializedChaosTargetQuerySelector.queryString = reader.getString();
+ } else if ("subscriptionIds".equals(fieldName)) {
+ List subscriptionIds = reader.readArray(reader1 -> reader1.getString());
+ deserializedChaosTargetQuerySelector.subscriptionIds = subscriptionIds;
+ } else if ("type".equals(fieldName)) {
+ deserializedChaosTargetQuerySelector.type = SelectorType.fromString(reader.getString());
+ } else {
+ if (additionalProperties == null) {
+ additionalProperties = new LinkedHashMap<>();
+ }
+
+ additionalProperties.put(fieldName, reader.readUntyped());
+ }
+ }
+ deserializedChaosTargetQuerySelector.withAdditionalProperties(additionalProperties);
+
+ return deserializedChaosTargetQuerySelector;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSelector.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSelector.java
index 4d30f8cc29ad9..6a973a32224a4 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSelector.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSelector.java
@@ -6,46 +6,37 @@
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonSubTypes;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.fasterxml.jackson.annotation.JsonTypeName;
-import java.util.HashMap;
+import com.azure.json.JsonReader;
+import com.azure.json.JsonSerializable;
+import com.azure.json.JsonToken;
+import com.azure.json.JsonWriter;
+import java.io.IOException;
+import java.util.LinkedHashMap;
import java.util.Map;
/**
* Model that represents a selector in the Experiment resource.
*/
-@JsonTypeInfo(
- use = JsonTypeInfo.Id.NAME,
- include = JsonTypeInfo.As.PROPERTY,
- property = "type",
- defaultImpl = ChaosTargetSelector.class)
-@JsonTypeName("ChaosTargetSelector")
-@JsonSubTypes({
- @JsonSubTypes.Type(name = "List", value = ChaosTargetListSelector.class),
- @JsonSubTypes.Type(name = "Query", value = ChaosTargetQuerySelector.class) })
@Fluent
-public class ChaosTargetSelector {
+public class ChaosTargetSelector implements JsonSerializable {
+ /*
+ * Enum of the selector type.
+ */
+ private SelectorType type = SelectorType.fromString("ChaosTargetSelector");
+
/*
* String of the selector ID.
*/
- @JsonProperty(value = "id", required = true)
private String id;
/*
* Model that represents available filter types that can be applied to a targets list.
*/
- @JsonProperty(value = "filter")
private ChaosTargetFilter filter;
/*
* Model that represents a selector in the Experiment resource.
*/
- @JsonIgnore
private Map additionalProperties;
/**
@@ -54,6 +45,15 @@ public class ChaosTargetSelector {
public ChaosTargetSelector() {
}
+ /**
+ * Get the type property: Enum of the selector type.
+ *
+ * @return the type value.
+ */
+ public SelectorType type() {
+ return this.type;
+ }
+
/**
* Get the id property: String of the selector ID.
*
@@ -99,7 +99,6 @@ public ChaosTargetSelector withFilter(ChaosTargetFilter filter) {
*
* @return the additionalProperties value.
*/
- @JsonAnyGetter
public Map additionalProperties() {
return this.additionalProperties;
}
@@ -115,14 +114,6 @@ public ChaosTargetSelector withAdditionalProperties(Map addition
return this;
}
- @JsonAnySetter
- void withAdditionalProperties(String key, Object value) {
- if (additionalProperties == null) {
- additionalProperties = new HashMap<>();
- }
- additionalProperties.put(key, value);
- }
-
/**
* Validates the instance.
*
@@ -130,8 +121,8 @@ void withAdditionalProperties(String key, Object value) {
*/
public void validate() {
if (id() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property id in model ChaosTargetSelector"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property id in model ChaosTargetSelector"));
}
if (filter() != null) {
filter().validate();
@@ -139,4 +130,85 @@ public void validate() {
}
private static final ClientLogger LOGGER = new ClientLogger(ChaosTargetSelector.class);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("id", this.id);
+ jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
+ jsonWriter.writeJsonField("filter", this.filter);
+ if (additionalProperties != null) {
+ for (Map.Entry additionalProperty : additionalProperties.entrySet()) {
+ jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue());
+ }
+ }
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ChaosTargetSelector from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ChaosTargetSelector 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 ChaosTargetSelector.
+ */
+ public static ChaosTargetSelector 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 ("List".equals(discriminatorValue)) {
+ return ChaosTargetListSelector.fromJson(readerToUse.reset());
+ } else if ("Query".equals(discriminatorValue)) {
+ return ChaosTargetQuerySelector.fromJson(readerToUse.reset());
+ } else {
+ return fromJsonKnownDiscriminator(readerToUse.reset());
+ }
+ }
+ });
+ }
+
+ static ChaosTargetSelector fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ChaosTargetSelector deserializedChaosTargetSelector = new ChaosTargetSelector();
+ Map additionalProperties = null;
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("id".equals(fieldName)) {
+ deserializedChaosTargetSelector.id = reader.getString();
+ } else if ("type".equals(fieldName)) {
+ deserializedChaosTargetSelector.type = SelectorType.fromString(reader.getString());
+ } else if ("filter".equals(fieldName)) {
+ deserializedChaosTargetSelector.filter = ChaosTargetFilter.fromJson(reader);
+ } else {
+ if (additionalProperties == null) {
+ additionalProperties = new LinkedHashMap<>();
+ }
+
+ additionalProperties.put(fieldName, reader.readUntyped());
+ }
+ }
+ deserializedChaosTargetSelector.additionalProperties = additionalProperties;
+
+ return deserializedChaosTargetSelector;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilter.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilter.java
index d2a3e18b37d5a..33640442c7b18 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilter.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilter.java
@@ -5,21 +5,24 @@
package com.azure.resourcemanager.chaos.models;
import com.azure.core.annotation.Fluent;
-import com.fasterxml.jackson.annotation.JsonProperty;
-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;
/**
* Model that represents a simple target filter.
*/
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
-@JsonTypeName("Simple")
@Fluent
public final class ChaosTargetSimpleFilter extends ChaosTargetFilter {
+ /*
+ * Enum that discriminates between filter types. Currently only `Simple` type is supported.
+ */
+ private FilterType type = FilterType.SIMPLE;
+
/*
* Model that represents the Simple filter parameters.
*/
- @JsonProperty(value = "parameters")
private ChaosTargetSimpleFilterParameters parameters;
/**
@@ -28,6 +31,16 @@ public final class ChaosTargetSimpleFilter extends ChaosTargetFilter {
public ChaosTargetSimpleFilter() {
}
+ /**
+ * Get the type property: Enum that discriminates between filter types. Currently only `Simple` type is supported.
+ *
+ * @return the type value.
+ */
+ @Override
+ public FilterType type() {
+ return this.type;
+ }
+
/**
* Get the parameters property: Model that represents the Simple filter parameters.
*
@@ -55,9 +68,47 @@ public ChaosTargetSimpleFilter withParameters(ChaosTargetSimpleFilterParameters
*/
@Override
public void validate() {
- super.validate();
if (parameters() != null) {
parameters().validate();
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
+ jsonWriter.writeJsonField("parameters", this.parameters);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ChaosTargetSimpleFilter from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ChaosTargetSimpleFilter 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 ChaosTargetSimpleFilter.
+ */
+ public static ChaosTargetSimpleFilter fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ChaosTargetSimpleFilter deserializedChaosTargetSimpleFilter = new ChaosTargetSimpleFilter();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("type".equals(fieldName)) {
+ deserializedChaosTargetSimpleFilter.type = FilterType.fromString(reader.getString());
+ } else if ("parameters".equals(fieldName)) {
+ deserializedChaosTargetSimpleFilter.parameters = ChaosTargetSimpleFilterParameters.fromJson(reader);
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedChaosTargetSimpleFilter;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilterParameters.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilterParameters.java
index d0725941ad414..effc27fd245c0 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilterParameters.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilterParameters.java
@@ -5,18 +5,21 @@
package com.azure.resourcemanager.chaos.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;
import java.util.List;
/**
* Model that represents the Simple filter parameters.
*/
@Fluent
-public final class ChaosTargetSimpleFilterParameters {
+public final class ChaosTargetSimpleFilterParameters implements JsonSerializable {
/*
* List of Azure availability zones to filter targets by.
*/
- @JsonProperty(value = "zones")
private List zones;
/**
@@ -52,4 +55,42 @@ public ChaosTargetSimpleFilterParameters withZones(List zones) {
*/
public void validate() {
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeArrayField("zones", this.zones, (writer, element) -> writer.writeString(element));
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ChaosTargetSimpleFilterParameters from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ChaosTargetSimpleFilterParameters 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 ChaosTargetSimpleFilterParameters.
+ */
+ public static ChaosTargetSimpleFilterParameters fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ChaosTargetSimpleFilterParameters deserializedChaosTargetSimpleFilterParameters
+ = new ChaosTargetSimpleFilterParameters();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("zones".equals(fieldName)) {
+ List zones = reader.readArray(reader1 -> reader1.getString());
+ deserializedChaosTargetSimpleFilterParameters.zones = zones;
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedChaosTargetSimpleFilterParameters;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ContinuousAction.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ContinuousAction.java
index 3a2d7ed30bebb..98ae7bc884716 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ContinuousAction.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ContinuousAction.java
@@ -5,36 +5,38 @@
package com.azure.resourcemanager.chaos.models;
import com.azure.core.annotation.Fluent;
+import com.azure.core.util.CoreUtils;
import com.azure.core.util.logging.ClientLogger;
-import com.fasterxml.jackson.annotation.JsonProperty;
-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;
import java.time.Duration;
import java.util.List;
/**
* Model that represents a continuous action.
*/
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
-@JsonTypeName("continuous")
@Fluent
public final class ContinuousAction extends ChaosExperimentAction {
+ /*
+ * Enum that discriminates between action models.
+ */
+ private String type = "continuous";
+
/*
* ISO8601 formatted string that represents a duration.
*/
- @JsonProperty(value = "duration", required = true)
private Duration duration;
/*
* List of key value pairs.
*/
- @JsonProperty(value = "parameters", required = true)
private List parameters;
/*
* String that represents a selector.
*/
- @JsonProperty(value = "selectorId", required = true)
private String selectorId;
/**
@@ -43,6 +45,16 @@ public final class ContinuousAction extends ChaosExperimentAction {
public ContinuousAction() {
}
+ /**
+ * Get the type property: Enum that discriminates between action models.
+ *
+ * @return the type value.
+ */
+ @Override
+ public String type() {
+ return this.type;
+ }
+
/**
* Get the duration property: ISO8601 formatted string that represents a duration.
*
@@ -119,22 +131,76 @@ public ContinuousAction withName(String name) {
*/
@Override
public void validate() {
- super.validate();
if (duration() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property duration in model ContinuousAction"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property duration in model ContinuousAction"));
}
if (parameters() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property parameters in model ContinuousAction"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property parameters in model ContinuousAction"));
} else {
parameters().forEach(e -> e.validate());
}
if (selectorId() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property selectorId in model ContinuousAction"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property selectorId in model ContinuousAction"));
+ }
+ if (name() == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property name in model ContinuousAction"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(ContinuousAction.class);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("name", name());
+ jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration));
+ jsonWriter.writeArrayField("parameters", this.parameters, (writer, element) -> writer.writeJson(element));
+ jsonWriter.writeStringField("selectorId", this.selectorId);
+ jsonWriter.writeStringField("type", this.type);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ContinuousAction from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ContinuousAction 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 ContinuousAction.
+ */
+ public static ContinuousAction fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ContinuousAction deserializedContinuousAction = new ContinuousAction();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("name".equals(fieldName)) {
+ deserializedContinuousAction.withName(reader.getString());
+ } else if ("duration".equals(fieldName)) {
+ deserializedContinuousAction.duration
+ = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString()));
+ } else if ("parameters".equals(fieldName)) {
+ List parameters = reader.readArray(reader1 -> KeyValuePair.fromJson(reader1));
+ deserializedContinuousAction.parameters = parameters;
+ } else if ("selectorId".equals(fieldName)) {
+ deserializedContinuousAction.selectorId = reader.getString();
+ } else if ("type".equals(fieldName)) {
+ deserializedContinuousAction.type = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedContinuousAction;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DelayAction.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DelayAction.java
index 93a670931b6de..5b36dad819739 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DelayAction.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DelayAction.java
@@ -5,23 +5,27 @@
package com.azure.resourcemanager.chaos.models;
import com.azure.core.annotation.Fluent;
+import com.azure.core.util.CoreUtils;
import com.azure.core.util.logging.ClientLogger;
-import com.fasterxml.jackson.annotation.JsonProperty;
-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;
import java.time.Duration;
/**
* Model that represents a delay action.
*/
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
-@JsonTypeName("delay")
@Fluent
public final class DelayAction extends ChaosExperimentAction {
+ /*
+ * Enum that discriminates between action models.
+ */
+ private String type = "delay";
+
/*
* ISO8601 formatted string that represents a duration.
*/
- @JsonProperty(value = "duration", required = true)
private Duration duration;
/**
@@ -30,6 +34,16 @@ public final class DelayAction extends ChaosExperimentAction {
public DelayAction() {
}
+ /**
+ * Get the type property: Enum that discriminates between action models.
+ *
+ * @return the type value.
+ */
+ @Override
+ public String type() {
+ return this.type;
+ }
+
/**
* Get the duration property: ISO8601 formatted string that represents a duration.
*
@@ -66,12 +80,59 @@ public DelayAction withName(String name) {
*/
@Override
public void validate() {
- super.validate();
if (duration() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property duration in model DelayAction"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property duration in model DelayAction"));
+ }
+ if (name() == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property name in model DelayAction"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(DelayAction.class);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("name", name());
+ jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration));
+ jsonWriter.writeStringField("type", this.type);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of DelayAction from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of DelayAction 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 DelayAction.
+ */
+ public static DelayAction fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ DelayAction deserializedDelayAction = new DelayAction();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("name".equals(fieldName)) {
+ deserializedDelayAction.withName(reader.getString());
+ } else if ("duration".equals(fieldName)) {
+ deserializedDelayAction.duration
+ = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString()));
+ } else if ("type".equals(fieldName)) {
+ deserializedDelayAction.type = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedDelayAction;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DiscreteAction.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DiscreteAction.java
index ba456679176d0..3812406669d4e 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DiscreteAction.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DiscreteAction.java
@@ -6,28 +6,30 @@
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
-import com.fasterxml.jackson.annotation.JsonProperty;
-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;
import java.util.List;
/**
* Model that represents a discrete action.
*/
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
-@JsonTypeName("discrete")
@Fluent
public final class DiscreteAction extends ChaosExperimentAction {
+ /*
+ * Enum that discriminates between action models.
+ */
+ private String type = "discrete";
+
/*
* List of key value pairs.
*/
- @JsonProperty(value = "parameters", required = true)
private List parameters;
/*
* String that represents a selector.
*/
- @JsonProperty(value = "selectorId", required = true)
private String selectorId;
/**
@@ -36,6 +38,16 @@ public final class DiscreteAction extends ChaosExperimentAction {
public DiscreteAction() {
}
+ /**
+ * Get the type property: Enum that discriminates between action models.
+ *
+ * @return the type value.
+ */
+ @Override
+ public String type() {
+ return this.type;
+ }
+
/**
* Get the parameters property: List of key value pairs.
*
@@ -92,18 +104,68 @@ public DiscreteAction withName(String name) {
*/
@Override
public void validate() {
- super.validate();
if (parameters() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property parameters in model DiscreteAction"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property parameters in model DiscreteAction"));
} else {
parameters().forEach(e -> e.validate());
}
if (selectorId() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property selectorId in model DiscreteAction"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property selectorId in model DiscreteAction"));
+ }
+ if (name() == null) {
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property name in model DiscreteAction"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(DiscreteAction.class);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("name", name());
+ jsonWriter.writeArrayField("parameters", this.parameters, (writer, element) -> writer.writeJson(element));
+ jsonWriter.writeStringField("selectorId", this.selectorId);
+ jsonWriter.writeStringField("type", this.type);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of DiscreteAction from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of DiscreteAction 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 DiscreteAction.
+ */
+ public static DiscreteAction fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ DiscreteAction deserializedDiscreteAction = new DiscreteAction();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("name".equals(fieldName)) {
+ deserializedDiscreteAction.withName(reader.getString());
+ } else if ("parameters".equals(fieldName)) {
+ List parameters = reader.readArray(reader1 -> KeyValuePair.fromJson(reader1));
+ deserializedDiscreteAction.parameters = parameters;
+ } else if ("selectorId".equals(fieldName)) {
+ deserializedDiscreteAction.selectorId = reader.getString();
+ } else if ("type".equals(fieldName)) {
+ deserializedDiscreteAction.type = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedDiscreteAction;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsError.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsError.java
index 7dbf1ab4fd96f..6161bc8abf212 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsError.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsError.java
@@ -5,23 +5,26 @@
package com.azure.resourcemanager.chaos.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;
/**
* Model that represents the Experiment action target details error model.
*/
@Immutable
-public final class ExperimentExecutionActionTargetDetailsError {
+public final class ExperimentExecutionActionTargetDetailsError
+ implements JsonSerializable {
/*
* The error code.
*/
- @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY)
private String code;
/*
* The error message
*/
- @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY)
private String message;
/**
@@ -55,4 +58,42 @@ public String message() {
*/
public void validate() {
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ExperimentExecutionActionTargetDetailsError from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ExperimentExecutionActionTargetDetailsError 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 ExperimentExecutionActionTargetDetailsError.
+ */
+ public static ExperimentExecutionActionTargetDetailsError fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ExperimentExecutionActionTargetDetailsError deserializedExperimentExecutionActionTargetDetailsError
+ = new ExperimentExecutionActionTargetDetailsError();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("code".equals(fieldName)) {
+ deserializedExperimentExecutionActionTargetDetailsError.code = reader.getString();
+ } else if ("message".equals(fieldName)) {
+ deserializedExperimentExecutionActionTargetDetailsError.message = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedExperimentExecutionActionTargetDetailsError;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsProperties.java
index 9d46d9bd9c4e9..0da343558927a 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsProperties.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsProperties.java
@@ -5,42 +5,43 @@
package com.azure.resourcemanager.chaos.models;
import com.azure.core.annotation.Immutable;
-import com.fasterxml.jackson.annotation.JsonProperty;
+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 java.io.IOException;
import java.time.OffsetDateTime;
/**
* Model that represents the Experiment action target details properties model.
*/
@Immutable
-public final class ExperimentExecutionActionTargetDetailsProperties {
+public final class ExperimentExecutionActionTargetDetailsProperties
+ implements JsonSerializable {
/*
* The status of the execution.
*/
- @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY)
private String status;
/*
* The target for the action.
*/
- @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY)
private String target;
/*
* String that represents the failed date time.
*/
- @JsonProperty(value = "targetFailedTime", access = JsonProperty.Access.WRITE_ONLY)
private OffsetDateTime targetFailedTime;
/*
* String that represents the completed date time.
*/
- @JsonProperty(value = "targetCompletedTime", access = JsonProperty.Access.WRITE_ONLY)
private OffsetDateTime targetCompletedTime;
/*
* The error of the action.
*/
- @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY)
private ExperimentExecutionActionTargetDetailsError error;
/**
@@ -104,4 +105,51 @@ public void validate() {
error().validate();
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ExperimentExecutionActionTargetDetailsProperties from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ExperimentExecutionActionTargetDetailsProperties 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 ExperimentExecutionActionTargetDetailsProperties.
+ */
+ public static ExperimentExecutionActionTargetDetailsProperties fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ExperimentExecutionActionTargetDetailsProperties deserializedExperimentExecutionActionTargetDetailsProperties
+ = new ExperimentExecutionActionTargetDetailsProperties();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("status".equals(fieldName)) {
+ deserializedExperimentExecutionActionTargetDetailsProperties.status = reader.getString();
+ } else if ("target".equals(fieldName)) {
+ deserializedExperimentExecutionActionTargetDetailsProperties.target = reader.getString();
+ } else if ("targetFailedTime".equals(fieldName)) {
+ deserializedExperimentExecutionActionTargetDetailsProperties.targetFailedTime = reader
+ .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
+ } else if ("targetCompletedTime".equals(fieldName)) {
+ deserializedExperimentExecutionActionTargetDetailsProperties.targetCompletedTime = reader
+ .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
+ } else if ("error".equals(fieldName)) {
+ deserializedExperimentExecutionActionTargetDetailsProperties.error
+ = ExperimentExecutionActionTargetDetailsError.fromJson(reader);
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedExperimentExecutionActionTargetDetailsProperties;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsPropertiesRunInformation.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsPropertiesRunInformation.java
index 9dea24cb514fa..edb4a93079e9e 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsPropertiesRunInformation.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsPropertiesRunInformation.java
@@ -5,18 +5,22 @@
package com.azure.resourcemanager.chaos.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;
import java.util.List;
/**
* The information of the experiment run.
*/
@Immutable
-public final class ExperimentExecutionDetailsPropertiesRunInformation {
+public final class ExperimentExecutionDetailsPropertiesRunInformation
+ implements JsonSerializable {
/*
* The steps of the experiment run.
*/
- @JsonProperty(value = "steps", access = JsonProperty.Access.WRITE_ONLY)
private List steps;
/**
@@ -44,4 +48,42 @@ public void validate() {
steps().forEach(e -> e.validate());
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ExperimentExecutionDetailsPropertiesRunInformation from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ExperimentExecutionDetailsPropertiesRunInformation 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 ExperimentExecutionDetailsPropertiesRunInformation.
+ */
+ public static ExperimentExecutionDetailsPropertiesRunInformation fromJson(JsonReader jsonReader)
+ throws IOException {
+ return jsonReader.readObject(reader -> {
+ ExperimentExecutionDetailsPropertiesRunInformation deserializedExperimentExecutionDetailsPropertiesRunInformation
+ = new ExperimentExecutionDetailsPropertiesRunInformation();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("steps".equals(fieldName)) {
+ List steps = reader.readArray(reader1 -> StepStatus.fromJson(reader1));
+ deserializedExperimentExecutionDetailsPropertiesRunInformation.steps = steps;
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedExperimentExecutionDetailsPropertiesRunInformation;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionListResult.java
index d5a187706a501..660d83bb613fe 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionListResult.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionListResult.java
@@ -5,25 +5,27 @@
package com.azure.resourcemanager.chaos.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.chaos.fluent.models.ExperimentExecutionInner;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.IOException;
import java.util.List;
/**
* Model that represents a list of Experiment executions and a link for pagination.
*/
@Immutable
-public final class ExperimentExecutionListResult {
+public final class ExperimentExecutionListResult implements JsonSerializable {
/*
* List of Experiment executions.
*/
- @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY)
private List value;
/*
* URL to retrieve the next page of Experiment executions.
*/
- @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY)
private String nextLink;
/**
@@ -60,4 +62,44 @@ 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 ExperimentExecutionListResult from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ExperimentExecutionListResult 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 ExperimentExecutionListResult.
+ */
+ public static ExperimentExecutionListResult fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ExperimentExecutionListResult deserializedExperimentExecutionListResult
+ = new ExperimentExecutionListResult();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("value".equals(fieldName)) {
+ List value
+ = reader.readArray(reader1 -> ExperimentExecutionInner.fromJson(reader1));
+ deserializedExperimentExecutionListResult.value = value;
+ } else if ("nextLink".equals(fieldName)) {
+ deserializedExperimentExecutionListResult.nextLink = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedExperimentExecutionListResult;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentListResult.java
index 4865337f29486..8e27107020d01 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentListResult.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentListResult.java
@@ -5,25 +5,27 @@
package com.azure.resourcemanager.chaos.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.chaos.fluent.models.ExperimentInner;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.IOException;
import java.util.List;
/**
* Model that represents a list of Experiment resources and a link for pagination.
*/
@Immutable
-public final class ExperimentListResult {
+public final class ExperimentListResult implements JsonSerializable {
/*
* List of Experiment resources.
*/
- @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY)
private List value;
/*
* URL to retrieve the next page of Experiment resources.
*/
- @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY)
private String nextLink;
/**
@@ -60,4 +62,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 ExperimentListResult from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ExperimentListResult 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 ExperimentListResult.
+ */
+ public static ExperimentListResult fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ExperimentListResult deserializedExperimentListResult = new ExperimentListResult();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("value".equals(fieldName)) {
+ List value = reader.readArray(reader1 -> ExperimentInner.fromJson(reader1));
+ deserializedExperimentListResult.value = value;
+ } else if ("nextLink".equals(fieldName)) {
+ deserializedExperimentListResult.nextLink = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedExperimentListResult;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentUpdate.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentUpdate.java
index a58e286236650..6bcdfca6a62d3 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentUpdate.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentUpdate.java
@@ -5,26 +5,26 @@
package com.azure.resourcemanager.chaos.models;
import com.azure.core.annotation.Fluent;
-import com.fasterxml.jackson.annotation.JsonInclude;
-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;
import java.util.Map;
/**
* Describes an experiment update.
*/
@Fluent
-public final class ExperimentUpdate {
+public final class ExperimentUpdate implements JsonSerializable {
/*
* The identity of the experiment resource.
*/
- @JsonProperty(value = "identity")
private ResourceIdentity identity;
/*
* The tags of the experiment resource.
*/
- @JsonProperty(value = "tags")
- @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
private Map tags;
/**
@@ -83,4 +83,44 @@ public void validate() {
identity().validate();
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeJsonField("identity", this.identity);
+ jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element));
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ExperimentUpdate from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ExperimentUpdate 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 ExperimentUpdate.
+ */
+ public static ExperimentUpdate fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ExperimentUpdate deserializedExperimentUpdate = new ExperimentUpdate();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("identity".equals(fieldName)) {
+ deserializedExperimentUpdate.identity = ResourceIdentity.fromJson(reader);
+ } else if ("tags".equals(fieldName)) {
+ Map tags = reader.readMap(reader1 -> reader1.getString());
+ deserializedExperimentUpdate.tags = tags;
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedExperimentUpdate;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/FilterType.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/FilterType.java
index 403376e735372..cc1cf6978ac75 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/FilterType.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/FilterType.java
@@ -5,7 +5,6 @@
package com.azure.resourcemanager.chaos.models;
import com.azure.core.util.ExpandableStringEnum;
-import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.Collection;
/**
@@ -32,7 +31,6 @@ public FilterType() {
* @param name a name to look for.
* @return the corresponding FilterType.
*/
- @JsonCreator
public static FilterType fromString(String name) {
return fromString(name, FilterType.class);
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/KeyValuePair.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/KeyValuePair.java
index 2f235f21b6a61..218b3344351fe 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/KeyValuePair.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/KeyValuePair.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;
/**
* A map to describe the settings of an action.
*/
@Fluent
-public final class KeyValuePair {
+public final class KeyValuePair implements JsonSerializable {
/*
* The name of the setting for the action.
*/
- @JsonProperty(value = "key", required = true)
private String key;
/*
* The value of the setting for the action.
*/
- @JsonProperty(value = "value", required = true)
private String value;
/**
@@ -78,14 +80,54 @@ public KeyValuePair withValue(String value) {
*/
public void validate() {
if (key() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property key in model KeyValuePair"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property key in model KeyValuePair"));
}
if (value() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property value in model KeyValuePair"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property value in model KeyValuePair"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(KeyValuePair.class);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("key", this.key);
+ jsonWriter.writeStringField("value", this.value);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of KeyValuePair from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of KeyValuePair 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 KeyValuePair.
+ */
+ public static KeyValuePair fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ KeyValuePair deserializedKeyValuePair = new KeyValuePair();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("key".equals(fieldName)) {
+ deserializedKeyValuePair.key = reader.getString();
+ } else if ("value".equals(fieldName)) {
+ deserializedKeyValuePair.value = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedKeyValuePair;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationDisplay.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationDisplay.java
index fb7918a6873ac..618747f434e00 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationDisplay.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationDisplay.java
@@ -5,38 +5,38 @@
package com.azure.resourcemanager.chaos.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".
+ * 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".
+ * 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".
+ * 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/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationListResult.java
index 098f1446216e8..29958ae44eeda 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationListResult.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationListResult.java
@@ -5,26 +5,28 @@
package com.azure.resourcemanager.chaos.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.chaos.fluent.models.OperationInner;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.IOException;
import java.util.List;
/**
- * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set
- * of results.
+ * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of
+ * 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/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatus.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatus.java
index b1e094af9f5e2..e5269e5cbc2bc 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatus.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatus.java
@@ -6,6 +6,7 @@
import com.azure.core.management.exception.ManagementError;
import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner;
+import java.time.OffsetDateTime;
/**
* An immutable client-side representation of OperationStatus.
@@ -30,14 +31,14 @@ public interface OperationStatus {
*
* @return the startTime value.
*/
- String startTime();
+ OffsetDateTime startTime();
/**
* Gets the endTime property: The end time of the operation.
*
* @return the endTime value.
*/
- String endTime();
+ OffsetDateTime endTime();
/**
* Gets the status property: The status of the operation.
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Origin.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Origin.java
index 41a6ec69321b5..132f2e8631658 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Origin.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Origin.java
@@ -5,7 +5,6 @@
package com.azure.resourcemanager.chaos.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/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ProvisioningState.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ProvisioningState.java
index bd11aa2f6ec41..c36bfe167b045 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ProvisioningState.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ProvisioningState.java
@@ -5,7 +5,6 @@
package com.azure.resourcemanager.chaos.models;
import com.azure.core.util.ExpandableStringEnum;
-import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.Collection;
/**
@@ -57,7 +56,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/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentity.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentity.java
index 4a2268f6a8cdc..03a2b50fa7925 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentity.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentity.java
@@ -6,19 +6,21 @@
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
-import com.fasterxml.jackson.annotation.JsonInclude;
-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;
import java.util.Map;
/**
* The identity of a resource.
*/
@Fluent
-public final class ResourceIdentity {
+public final class ResourceIdentity implements JsonSerializable {
/*
* String of the resource identity type.
*/
- @JsonProperty(value = "type", required = true)
private ResourceIdentityType type;
/*
@@ -27,20 +29,16 @@ public final class ResourceIdentity {
* '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/
* userAssignedIdentities/{identityName}'.
*/
- @JsonProperty(value = "userAssignedIdentities")
- @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
private Map userAssignedIdentities;
/*
* GUID that represents the principal ID of this resource identity.
*/
- @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY)
private String principalId;
/*
* GUID that represents the tenant ID of this resource identity.
*/
- @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY)
private String tenantId;
/**
@@ -118,8 +116,8 @@ public String tenantId() {
*/
public void validate() {
if (type() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property type in model ResourceIdentity"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property type in model ResourceIdentity"));
}
if (userAssignedIdentities() != null) {
userAssignedIdentities().values().forEach(e -> {
@@ -131,4 +129,51 @@ public void validate() {
}
private static final ClientLogger LOGGER = new ClientLogger(ResourceIdentity.class);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
+ jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities,
+ (writer, element) -> writer.writeJson(element));
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ResourceIdentity from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ResourceIdentity 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 ResourceIdentity.
+ */
+ public static ResourceIdentity fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ResourceIdentity deserializedResourceIdentity = new ResourceIdentity();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("type".equals(fieldName)) {
+ deserializedResourceIdentity.type = ResourceIdentityType.fromString(reader.getString());
+ } else if ("userAssignedIdentities".equals(fieldName)) {
+ Map userAssignedIdentities
+ = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1));
+ deserializedResourceIdentity.userAssignedIdentities = userAssignedIdentities;
+ } else if ("principalId".equals(fieldName)) {
+ deserializedResourceIdentity.principalId = reader.getString();
+ } else if ("tenantId".equals(fieldName)) {
+ deserializedResourceIdentity.tenantId = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedResourceIdentity;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentityType.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentityType.java
index f8f9bb37b4c29..18904e0c93a40 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentityType.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentityType.java
@@ -4,9 +4,6 @@
package com.azure.resourcemanager.chaos.models;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonValue;
-
/**
* String of the resource identity type.
*/
@@ -41,7 +38,6 @@ public enum ResourceIdentityType {
* @param value the serialized value to parse.
* @return the parsed ResourceIdentityType object, or null if unable to parse.
*/
- @JsonCreator
public static ResourceIdentityType fromString(String value) {
if (value == null) {
return null;
@@ -58,7 +54,6 @@ public static ResourceIdentityType fromString(String value) {
/**
* {@inheritDoc}
*/
- @JsonValue
@Override
public String toString() {
return this.value;
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SelectorType.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SelectorType.java
index 1776fa6c7b616..3b5288da2a6d2 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SelectorType.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SelectorType.java
@@ -5,7 +5,6 @@
package com.azure.resourcemanager.chaos.models;
import com.azure.core.util.ExpandableStringEnum;
-import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.Collection;
/**
@@ -37,7 +36,6 @@ public SelectorType() {
* @param name a name to look for.
* @return the corresponding SelectorType.
*/
- @JsonCreator
public static SelectorType fromString(String name) {
return fromString(name, SelectorType.class);
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/StepStatus.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/StepStatus.java
index e615c194cedac..2695112b2e07d 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/StepStatus.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/StepStatus.java
@@ -5,36 +5,36 @@
package com.azure.resourcemanager.chaos.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;
import java.util.List;
/**
* Model that represents the a list of branches and branch statuses.
*/
@Immutable
-public final class StepStatus {
+public final class StepStatus implements JsonSerializable {
/*
* The name of the step.
*/
- @JsonProperty(value = "stepName", access = JsonProperty.Access.WRITE_ONLY)
private String stepName;
/*
* The id of the step.
*/
- @JsonProperty(value = "stepId", access = JsonProperty.Access.WRITE_ONLY)
private String stepId;
/*
* The value of the status of the step.
*/
- @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY)
private String status;
/*
* The array of branches.
*/
- @JsonProperty(value = "branches", access = JsonProperty.Access.WRITE_ONLY)
private List branches;
/**
@@ -89,4 +89,46 @@ public void validate() {
branches().forEach(e -> e.validate());
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of StepStatus from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of StepStatus 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 StepStatus.
+ */
+ public static StepStatus fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ StepStatus deserializedStepStatus = new StepStatus();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("stepName".equals(fieldName)) {
+ deserializedStepStatus.stepName = reader.getString();
+ } else if ("stepId".equals(fieldName)) {
+ deserializedStepStatus.stepId = reader.getString();
+ } else if ("status".equals(fieldName)) {
+ deserializedStepStatus.status = reader.getString();
+ } else if ("branches".equals(fieldName)) {
+ List branches = reader.readArray(reader1 -> BranchStatus.fromJson(reader1));
+ deserializedStepStatus.branches = branches;
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedStepStatus;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetListResult.java
index 6fe46f644dd77..86686d0a2d92d 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetListResult.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetListResult.java
@@ -5,25 +5,27 @@
package com.azure.resourcemanager.chaos.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.chaos.fluent.models.TargetInner;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.IOException;
import java.util.List;
/**
* Model that represents a list of Target resources and a link for pagination.
*/
@Immutable
-public final class TargetListResult {
+public final class TargetListResult implements JsonSerializable {
/*
* List of Target resources.
*/
- @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY)
private List value;
/*
* URL to retrieve the next page of Target resources.
*/
- @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY)
private String nextLink;
/**
@@ -60,4 +62,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 TargetListResult from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of TargetListResult 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 TargetListResult.
+ */
+ public static TargetListResult fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ TargetListResult deserializedTargetListResult = new TargetListResult();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("value".equals(fieldName)) {
+ List value = reader.readArray(reader1 -> TargetInner.fromJson(reader1));
+ deserializedTargetListResult.value = value;
+ } else if ("nextLink".equals(fieldName)) {
+ deserializedTargetListResult.nextLink = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedTargetListResult;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReference.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReference.java
index dfda7e9f14915..ce4f935b44050 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReference.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReference.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;
/**
* Model that represents a reference to a Target in the selector.
*/
@Fluent
-public final class TargetReference {
+public final class TargetReference implements JsonSerializable {
/*
* Enum of the Target reference type.
*/
- @JsonProperty(value = "type", required = true)
private TargetReferenceType type;
/*
* String of the resource ID of a Target resource.
*/
- @JsonProperty(value = "id", required = true)
private String id;
/**
@@ -78,14 +80,54 @@ public TargetReference withId(String id) {
*/
public void validate() {
if (type() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property type in model TargetReference"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property type in model TargetReference"));
}
if (id() == null) {
- throw LOGGER.logExceptionAsError(
- new IllegalArgumentException("Missing required property id in model TargetReference"));
+ throw LOGGER.atError()
+ .log(new IllegalArgumentException("Missing required property id in model TargetReference"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(TargetReference.class);
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
+ jsonWriter.writeStringField("id", this.id);
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of TargetReference from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of TargetReference 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 TargetReference.
+ */
+ public static TargetReference fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ TargetReference deserializedTargetReference = new TargetReference();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("type".equals(fieldName)) {
+ deserializedTargetReference.type = TargetReferenceType.fromString(reader.getString());
+ } else if ("id".equals(fieldName)) {
+ deserializedTargetReference.id = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedTargetReference;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReferenceType.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReferenceType.java
index 6e196ebcd7f12..daed565c181ee 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReferenceType.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReferenceType.java
@@ -5,7 +5,6 @@
package com.azure.resourcemanager.chaos.models;
import com.azure.core.util.ExpandableStringEnum;
-import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.Collection;
/**
@@ -32,7 +31,6 @@ public TargetReferenceType() {
* @param name a name to look for.
* @return the corresponding TargetReferenceType.
*/
- @JsonCreator
public static TargetReferenceType fromString(String name) {
return fromString(name, TargetReferenceType.class);
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypeListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypeListResult.java
index 1eca9e0228510..6ecb5da31c97a 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypeListResult.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypeListResult.java
@@ -5,25 +5,27 @@
package com.azure.resourcemanager.chaos.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.chaos.fluent.models.TargetTypeInner;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.IOException;
import java.util.List;
/**
* Model that represents a list of Target Type resources and a link for pagination.
*/
@Immutable
-public final class TargetTypeListResult {
+public final class TargetTypeListResult implements JsonSerializable {
/*
* List of Target Type resources.
*/
- @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY)
private List value;
/*
* URL to retrieve the next page of Target Type resources.
*/
- @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY)
private String nextLink;
/**
@@ -60,4 +62,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 TargetTypeListResult from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of TargetTypeListResult 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 TargetTypeListResult.
+ */
+ public static TargetTypeListResult fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ TargetTypeListResult deserializedTargetTypeListResult = new TargetTypeListResult();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("value".equals(fieldName)) {
+ List value = reader.readArray(reader1 -> TargetTypeInner.fromJson(reader1));
+ deserializedTargetTypeListResult.value = value;
+ } else if ("nextLink".equals(fieldName)) {
+ deserializedTargetTypeListResult.nextLink = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedTargetTypeListResult;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/UserAssignedIdentity.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/UserAssignedIdentity.java
index 7f8c9eba71ef9..6a9ef1fc7934a 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/UserAssignedIdentity.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/UserAssignedIdentity.java
@@ -5,24 +5,26 @@
package com.azure.resourcemanager.chaos.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;
import java.util.UUID;
/**
* User assigned identity properties.
*/
@Immutable
-public final class UserAssignedIdentity {
+public final class UserAssignedIdentity implements JsonSerializable {
/*
* The principal ID of the assigned identity.
*/
- @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY)
private UUID principalId;
/*
* The client ID of the assigned identity.
*/
- @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY)
private UUID clientId;
/**
@@ -56,4 +58,43 @@ public UUID clientId() {
*/
public void validate() {
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of UserAssignedIdentity from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of UserAssignedIdentity 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 UserAssignedIdentity.
+ */
+ public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("principalId".equals(fieldName)) {
+ deserializedUserAssignedIdentity.principalId
+ = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()));
+ } else if ("clientId".equals(fieldName)) {
+ deserializedUserAssignedIdentity.clientId
+ = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()));
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedUserAssignedIdentity;
+ });
+ }
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/module-info.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/module-info.java
index 3eee0d4e8ba9e..e40af38897a9e 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/module-info.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/module-info.java
@@ -10,6 +10,6 @@
exports com.azure.resourcemanager.chaos.fluent.models;
exports com.azure.resourcemanager.chaos.models;
- opens com.azure.resourcemanager.chaos.fluent.models to com.azure.core, com.fasterxml.jackson.databind;
- opens com.azure.resourcemanager.chaos.models to com.azure.core, com.fasterxml.jackson.databind;
+ opens com.azure.resourcemanager.chaos.fluent.models to com.azure.core;
+ opens com.azure.resourcemanager.chaos.models to com.azure.core;
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/proxy-config.json b/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/proxy-config.json
index f87b72c22e1d8..0a68244d3b7c1 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/proxy-config.json
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/proxy-config.json
@@ -1 +1 @@
-[ [ "com.azure.resourcemanager.chaos.implementation.CapabilitiesClientImpl$CapabilitiesService" ], [ "com.azure.resourcemanager.chaos.implementation.CapabilityTypesClientImpl$CapabilityTypesService" ], [ "com.azure.resourcemanager.chaos.implementation.ExperimentsClientImpl$ExperimentsService" ], [ "com.azure.resourcemanager.chaos.implementation.OperationStatusesClientImpl$OperationStatusesService" ], [ "com.azure.resourcemanager.chaos.implementation.OperationsClientImpl$OperationsService" ], [ "com.azure.resourcemanager.chaos.implementation.TargetTypesClientImpl$TargetTypesService" ], [ "com.azure.resourcemanager.chaos.implementation.TargetsClientImpl$TargetsService" ] ]
\ No newline at end of file
+[["com.azure.resourcemanager.chaos.implementation.CapabilitiesClientImpl$CapabilitiesService"],["com.azure.resourcemanager.chaos.implementation.CapabilityTypesClientImpl$CapabilityTypesService"],["com.azure.resourcemanager.chaos.implementation.ExperimentsClientImpl$ExperimentsService"],["com.azure.resourcemanager.chaos.implementation.OperationStatusesClientImpl$OperationStatusesService"],["com.azure.resourcemanager.chaos.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.chaos.implementation.TargetTypesClientImpl$TargetTypesService"],["com.azure.resourcemanager.chaos.implementation.TargetsClientImpl$TargetsService"]]
\ No newline at end of file
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/reflect-config.json b/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/reflect-config.json
index 2f448a3b7d62b..0faaad5435f39 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/reflect-config.json
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/reflect-config.json
@@ -1,271 +1 @@
-[ {
- "name" : "com.azure.resourcemanager.chaos.models.CapabilityListResult",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.fluent.models.CapabilityInner",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.fluent.models.CapabilityProperties",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.CapabilityTypeListResult",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeInner",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeProperties",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.CapabilityTypePropertiesRuntimeProperties",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ExperimentListResult",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentInner",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ResourceIdentity",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.UserAssignedIdentity",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentProperties",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ChaosExperimentStep",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ChaosExperimentBranch",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ChaosExperimentAction",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ChaosTargetSelector",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ChaosTargetFilter",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ExperimentUpdate",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ExperimentExecutionListResult",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionInner",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionProperties",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsProperties",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsPropertiesRunInformation",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.StepStatus",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.BranchStatus",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ActionStatus",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ExperimentExecutionActionTargetDetailsProperties",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ExperimentExecutionActionTargetDetailsError",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.OperationListResult",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.fluent.models.OperationInner",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.OperationDisplay",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.TargetTypeListResult",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.fluent.models.TargetTypeInner",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.fluent.models.TargetTypeProperties",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.TargetListResult",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.fluent.models.TargetInner",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.DelayAction",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.DiscreteAction",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.KeyValuePair",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ContinuousAction",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ChaosTargetListSelector",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.TargetReference",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ChaosTargetQuerySelector",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ChaosTargetSimpleFilter",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ChaosTargetSimpleFilterParameters",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ProvisioningState",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.SelectorType",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.FilterType",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.Origin",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ActionType",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.TargetReferenceType",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-}, {
- "name" : "com.azure.resourcemanager.chaos.models.ResourceIdentityType",
- "allDeclaredConstructors" : true,
- "allDeclaredFields" : true,
- "allDeclaredMethods" : true
-} ]
\ No newline at end of file
+[{"name":"com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner","allDeclaredConstructors":true,"allDeclaredFields":true,"allDeclaredMethods":true}]
\ No newline at end of file
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateSamples.java
index a1e390fbe238d..87a7b26706b17 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateSamples.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateSamples.java
@@ -21,8 +21,8 @@ public final class CapabilitiesCreateOrUpdateSamples {
*/
public static void createUpdateACapabilityThatExtendsAVirtualMachineTargetResource(
com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.capabilities().createOrUpdateWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines",
- "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.0", new CapabilityInner(),
- com.azure.core.util.Context.NONE);
+ manager.capabilities()
+ .createOrUpdateWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
+ "Microsoft-VirtualMachine", "Shutdown-1.0", new CapabilityInner(), com.azure.core.util.Context.NONE);
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteSamples.java
index e50d25508504d..31a365a1f845f 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteSamples.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteSamples.java
@@ -19,7 +19,8 @@ public final class CapabilitiesDeleteSamples {
*/
public static void deleteACapabilityThatExtendsAVirtualMachineTargetResource(
com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.capabilities().deleteWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
- "Microsoft-VirtualMachine", "Shutdown-1.0", com.azure.core.util.Context.NONE);
+ manager.capabilities()
+ .deleteWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
+ "Microsoft-VirtualMachine", "Shutdown-1.0", com.azure.core.util.Context.NONE);
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetSamples.java
index f551931ddaf07..b9b578205f4a4 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetSamples.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetSamples.java
@@ -19,7 +19,8 @@ public final class CapabilitiesGetSamples {
*/
public static void
getACapabilityThatExtendsAVirtualMachineTargetResource(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.capabilities().getWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
- "Microsoft-VirtualMachine", "Shutdown-1.0", com.azure.core.util.Context.NONE);
+ manager.capabilities()
+ .getWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
+ "Microsoft-VirtualMachine", "Shutdown-1.0", com.azure.core.util.Context.NONE);
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListSamples.java
index 8df30c20895ff..28e882bf01fc2 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListSamples.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListSamples.java
@@ -19,7 +19,8 @@ public final class CapabilitiesListSamples {
*/
public static void listAllCapabilitiesThatExtendAVirtualMachineTargetResource(
com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.capabilities().list("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
- "Microsoft-VirtualMachine", null, com.azure.core.util.Context.NONE);
+ manager.capabilities()
+ .list("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", null,
+ com.azure.core.util.Context.NONE);
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetSamples.java
index 2dfe563f27d7e..d072c0f49085c 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetSamples.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetSamples.java
@@ -19,7 +19,7 @@ public final class CapabilityTypesGetSamples {
*/
public static void getACapabilityTypeForAVirtualMachineTargetResourceOnWestus2Location(
com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.capabilityTypes().getWithResponse("westus2", "Microsoft-VirtualMachine", "Shutdown-1.0",
- com.azure.core.util.Context.NONE);
+ manager.capabilityTypes()
+ .getWithResponse("westus2", "Microsoft-VirtualMachine", "Shutdown-1.0", com.azure.core.util.Context.NONE);
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateSamples.java
index a1e01b8f4864b..448044593356e 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateSamples.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateSamples.java
@@ -30,7 +30,9 @@ public final class ExperimentsCreateOrUpdateSamples {
* @param manager Entry point to ChaosManager.
*/
public static void createUpdateAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.experiments().define("exampleExperiment").withRegion("eastus2euap")
+ manager.experiments()
+ .define("exampleExperiment")
+ .withRegion("eastus2euap")
.withExistingResourceGroup("exampleRG")
.withSteps(
Arrays.asList(new ChaosExperimentStep().withName("step1")
@@ -42,8 +44,10 @@ public static void createUpdateAExperimentInAResourceGroup(com.azure.resourceman
Arrays.asList(new KeyValuePair().withKey("fakeTokenPlaceholder").withValue("false")))
.withSelectorId("selector1")))))))
.withSelectors(Arrays.asList(new ChaosTargetListSelector().withId("selector1")
- .withTargets(Arrays.asList(new TargetReference().withType(TargetReferenceType.CHAOS_TARGET).withId(
- "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine")))))
- .withIdentity(new ResourceIdentity().withType(ResourceIdentityType.SYSTEM_ASSIGNED)).create();
+ .withTargets(Arrays.asList(new TargetReference().withType(TargetReferenceType.CHAOS_TARGET)
+ .withId(
+ "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine")))))
+ .withIdentity(new ResourceIdentity().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
+ .create();
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsExecutionDetailsSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsExecutionDetailsSamples.java
index b4b1018aeedaf..a0d7838018689 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsExecutionDetailsSamples.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsExecutionDetailsSamples.java
@@ -18,7 +18,8 @@ public final class ExperimentsExecutionDetailsSamples {
* @param manager Entry point to ChaosManager.
*/
public static void getExperimentExecutionDetails(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.experiments().executionDetailsWithResponse("exampleRG", "exampleExperiment",
- "f24500ad-744e-4a26-864b-b76199eac333", com.azure.core.util.Context.NONE);
+ manager.experiments()
+ .executionDetailsWithResponse("exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333",
+ com.azure.core.util.Context.NONE);
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupSamples.java
index bcff08a197cb5..a0d0fb37d8e44 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupSamples.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupSamples.java
@@ -18,7 +18,7 @@ public final class ExperimentsGetByResourceGroupSamples {
* @param manager Entry point to ChaosManager.
*/
public static void getAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.experiments().getByResourceGroupWithResponse("exampleRG", "exampleExperiment",
- com.azure.core.util.Context.NONE);
+ manager.experiments()
+ .getByResourceGroupWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE);
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionSamples.java
index 6c17f0dddf124..71e551a48ee22 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionSamples.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionSamples.java
@@ -18,7 +18,8 @@ public final class ExperimentsGetExecutionSamples {
* @param manager Entry point to ChaosManager.
*/
public static void getTheExecutionOfAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.experiments().getExecutionWithResponse("exampleRG", "exampleExperiment",
- "f24500ad-744e-4a26-864b-b76199eac333", com.azure.core.util.Context.NONE);
+ manager.experiments()
+ .getExecutionWithResponse("exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333",
+ com.azure.core.util.Context.NONE);
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsUpdateSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsUpdateSamples.java
index f53dce2d1c8ee..b0aa4a901a143 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsUpdateSamples.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsUpdateSamples.java
@@ -28,10 +28,12 @@ public static void updateAnExperimentInAResourceGroup(com.azure.resourcemanager.
Experiment resource = manager.experiments()
.getByResourceGroupWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE)
.getValue();
- resource.update().withTags(mapOf("key1", "fakeTokenPlaceholder", "key2", "fakeTokenPlaceholder")).withIdentity(
- new ResourceIdentity().withType(ResourceIdentityType.USER_ASSIGNED).withUserAssignedIdentities(mapOf(
- "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI",
- new UserAssignedIdentity())))
+ resource.update()
+ .withTags(mapOf("key1", "fakeTokenPlaceholder", "key2", "fakeTokenPlaceholder"))
+ .withIdentity(new ResourceIdentity().withType(ResourceIdentityType.USER_ASSIGNED)
+ .withUserAssignedIdentities(mapOf(
+ "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI",
+ new UserAssignedIdentity())))
.apply();
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/OperationStatusesGetSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/OperationStatusesGetSamples.java
index 29c02fa4fa086..2a4c7bf04480e 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/OperationStatusesGetSamples.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/OperationStatusesGetSamples.java
@@ -18,7 +18,7 @@ public final class OperationStatusesGetSamples {
* @param manager Entry point to ChaosManager.
*/
public static void getSpecificOperationStatus(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.operationStatuses().getWithResponse("West US", "713192d7-503f-477a-9cfe-4efc3ee2bd11",
- com.azure.core.util.Context.NONE);
+ manager.operationStatuses()
+ .getWithResponse("West US", "713192d7-503f-477a-9cfe-4efc3ee2bd11", com.azure.core.util.Context.NONE);
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateSamples.java
index 8dd1ca5cff4c9..8f41826b31372 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateSamples.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateSamples.java
@@ -26,13 +26,14 @@ public final class TargetsCreateOrUpdateSamples {
*/
public static void createUpdateATargetThatExtendsAVirtualMachineResource(
com.azure.resourcemanager.chaos.ChaosManager manager) throws IOException {
- manager.targets().createOrUpdateWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
- "Microsoft-Agent",
- new TargetInner().withProperties(mapOf("identities",
- SerializerFactory.createDefaultManagementSerializerAdapter().deserialize(
- "[{\"type\":\"CertificateSubjectIssuer\",\"subject\":\"CN=example.subject\"}]", Object.class,
- SerializerEncoding.JSON))),
- com.azure.core.util.Context.NONE);
+ manager.targets()
+ .createOrUpdateWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
+ "Microsoft-Agent",
+ new TargetInner().withProperties(mapOf("identities",
+ SerializerFactory.createDefaultManagementSerializerAdapter()
+ .deserialize("[{\"type\":\"CertificateSubjectIssuer\",\"subject\":\"CN=example.subject\"}]",
+ Object.class, SerializerEncoding.JSON))),
+ com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteSamples.java
index ebce9379ebfcf..be443d3a9ccd2 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteSamples.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteSamples.java
@@ -19,7 +19,8 @@ public final class TargetsDeleteSamples {
*/
public static void
deleteATargetThatExtendsAVirtualMachineResource(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.targets().deleteWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
- "Microsoft-Agent", com.azure.core.util.Context.NONE);
+ manager.targets()
+ .deleteWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent",
+ com.azure.core.util.Context.NONE);
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsGetSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsGetSamples.java
index 2a2a0ec5e3f5c..3b7fbf8323973 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsGetSamples.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsGetSamples.java
@@ -19,7 +19,8 @@ public final class TargetsGetSamples {
*/
public static void
getATargetThatExtendsAVirtualMachineResource(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.targets().getWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM",
- "Microsoft-Agent", com.azure.core.util.Context.NONE);
+ manager.targets()
+ .getWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent",
+ com.azure.core.util.Context.NONE);
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsListSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsListSamples.java
index 0bc677e2566ed..506a8eb6ea87f 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsListSamples.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsListSamples.java
@@ -19,7 +19,8 @@ public final class TargetsListSamples {
*/
public static void
listAllTargetsThatExtendAVirtualMachineResource(com.azure.resourcemanager.chaos.ChaosManager manager) {
- manager.targets().list("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", null,
- com.azure.core.util.Context.NONE);
+ manager.targets()
+ .list("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", null,
+ com.azure.core.util.Context.NONE);
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateWithResponseMockTests.java
index 4eb87b1914c3f..70c504ac1527c 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateWithResponseMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateWithResponseMockTests.java
@@ -6,51 +6,32 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner;
import com.azure.resourcemanager.chaos.models.Capability;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class CapabilitiesCreateOrUpdateWithResponseMockTests {
@Test
public void testCreateOrUpdateWithResponse() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr
- = "{\"properties\":{\"publisher\":\"kpzi\",\"targetType\":\"j\",\"description\":\"nlfzxiavrmbz\",\"parametersSchema\":\"okixrjqcir\",\"urn\":\"pfrlazsz\"},\"id\":\"nwoiind\",\"name\":\"pwp\",\"type\":\"ylwbtlhflsjcdhsz\"}";
-
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
+ = "{\"properties\":{\"publisher\":\"xi\",\"targetType\":\"rmbzo\",\"description\":\"kixrj\",\"parametersSchema\":\"irgzp\",\"urn\":\"lazszrn\"},\"id\":\"oiindfpwpjy\",\"name\":\"wbtlhflsjcdh\",\"type\":\"zfjvfbgofe\"}";
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
new AzureProfile("", "", AzureEnvironment.AZURE));
Capability response = manager.capabilities()
- .createOrUpdateWithResponse("sjabibs", "stawfsdjpvkv", "bjxbkzbzk", "vncjabudurgk", "kmokz", "jjklff",
+ .createOrUpdateWithResponse("jjklff", "mouwqlgzrfzeey", "bizikayuhq", "bjbsybb", "wrv", "ldgmfpgvmpip",
new CapabilityInner(), com.azure.core.util.Context.NONE)
.getValue();
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteWithResponseMockTests.java
index 491256d61d688..7ecfb5ff4f535 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteWithResponseMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteWithResponseMockTests.java
@@ -6,48 +6,29 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class CapabilitiesDeleteWithResponseMockTests {
@Test
public void testDeleteWithResponse() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr = "{}";
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
-
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
new AzureProfile("", "", AzureEnvironment.AZURE));
manager.capabilities()
- .deleteWithResponse("vfvpdbodaciz", "j", "lhkrribdeibqipqk", "hvxndzwmkrefajpj", "rwkq", "yhgbijtjivfx",
+ .deleteWithResponse("yhgbijtjivfx", "sjabibs", "stawfsdjpvkv", "bjxbkzbzk", "vncjabudurgk", "kmokz",
com.azure.core.util.Context.NONE);
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetWithResponseMockTests.java
index 331be18d2d1e6..e4994f209be84 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetWithResponseMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetWithResponseMockTests.java
@@ -6,50 +6,32 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
import com.azure.resourcemanager.chaos.models.Capability;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class CapabilitiesGetWithResponseMockTests {
@Test
public void testGetWithResponse() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr
- = "{\"properties\":{\"publisher\":\"fwpracstwi\",\"targetType\":\"khevxccedc\",\"description\":\"md\",\"parametersSchema\":\"dnwzxltjcvnhltiu\",\"urn\":\"xnavvwxq\"},\"id\":\"byqunyow\",\"name\":\"wlmdjrkv\",\"type\":\"g\"}";
-
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
+ = "{\"properties\":{\"publisher\":\"dyodnwzxltj\",\"targetType\":\"nhltiugcxn\",\"description\":\"vwxqibyqunyo\",\"parametersSchema\":\"wlmdjrkv\",\"urn\":\"bvfvpdbod\"},\"id\":\"cizsjqlhkrribdei\",\"name\":\"qipqkghvxndz\",\"type\":\"mkrefajpjorwkq\"}";
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
new AzureProfile("", "", AzureEnvironment.AZURE));
Capability response = manager.capabilities()
- .getWithResponse("lolp", "vk", "r", "qvujzraehtwdwrf", "swibyr", "dl", com.azure.core.util.Context.NONE)
+ .getWithResponse("fpel", "lppvksrpq", "ujzra", "htwdwrftswibyrcd", "bhshfwpracstwity", "hevxcced",
+ com.azure.core.util.Context.NONE)
.getValue();
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListMockTests.java
index 0e452f076aa78..d107dd5607412 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListMockTests.java
@@ -6,51 +6,32 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
import com.azure.resourcemanager.chaos.models.Capability;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class CapabilitiesListMockTests {
@Test
public void testList() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr
- = "{\"value\":[{\"properties\":{\"publisher\":\"ggicccnxqhue\",\"targetType\":\"ktt\",\"description\":\"tvlz\",\"parametersSchema\":\"emhzrncsdtc\",\"urn\":\"siypbs\"},\"id\":\"gytguslfead\",\"name\":\"ygqukyhejh\",\"type\":\"isxgfp\"}]}";
-
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
+ = "{\"value\":[{\"properties\":{\"publisher\":\"icccn\",\"targetType\":\"huexmk\",\"description\":\"lstvlzywe\",\"parametersSchema\":\"zrncsdt\",\"urn\":\"u\"},\"id\":\"iypbsfgytgusl\",\"name\":\"eadcygqukyhejhz\",\"type\":\"sx\"}]}";
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
new AzureProfile("", "", AzureEnvironment.AZURE));
PagedIterable response = manager.capabilities()
- .list("hxicslfaoqz", "iyylhalnswhccsp", "kaivwit", "scywuggwoluhc", "bwemhairs", "rgzdwmsweyp",
+ .list("iyylhalnswhccsp", "kaivwit", "scywuggwoluhc", "bwemhairs", "rgzdwmsweyp", "w",
com.azure.core.util.Context.NONE);
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetWithResponseMockTests.java
index 2d3887aff8446..4098a3ce7ef4d 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetWithResponseMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetWithResponseMockTests.java
@@ -6,53 +6,34 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
import com.azure.resourcemanager.chaos.models.CapabilityType;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class CapabilityTypesGetWithResponseMockTests {
@Test
public void testGetWithResponse() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr
- = "{\"location\":\"csnjvcdwxlpqekft\",\"properties\":{\"publisher\":\"tjsyin\",\"targetType\":\"fq\",\"displayName\":\"mtdh\",\"description\":\"dvypgikdgsz\",\"parametersSchema\":\"kbir\",\"urn\":\"uzhlhkjoqrv\",\"kind\":\"aatjinrvgoupmfi\",\"azureRbacActions\":[\"ggjioolvr\",\"x\",\"v\"],\"azureRbacDataActions\":[\"gllqwjy\"],\"runtimeProperties\":{\"kind\":\"ayvblmhvkzuhbx\"}},\"id\":\"vyhgs\",\"name\":\"pbyrqufegxu\",\"type\":\"wz\"}";
-
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
+ = "{\"location\":\"k\",\"properties\":{\"publisher\":\"pbqpcrfkbwccsn\",\"targetType\":\"cdwxlpq\",\"displayName\":\"ftnkhtj\",\"description\":\"i\",\"parametersSchema\":\"wfqatmtd\",\"urn\":\"mdvy\",\"kind\":\"ikdgszywkbir\",\"azureRbacActions\":[\"zh\",\"hkjoqr\",\"qqaatjinrvgou\"],\"azureRbacDataActions\":[\"iibfggj\",\"ool\",\"rwxkvtkkgl\",\"qwjygvja\"],\"runtimeProperties\":{\"kind\":\"lmhvkzuhbxv\"}},\"id\":\"yhgsopbyrqufe\",\"name\":\"xuvw\",\"type\":\"fbn\"}";
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
new AzureProfile("", "", AzureEnvironment.AZURE));
CapabilityType response = manager.capabilityTypes()
- .getWithResponse("vezrypqlmfeo", "erqwkyhkobopg", "edkowepbqpcrfk", com.azure.core.util.Context.NONE)
+ .getWithResponse("celve", "rypqlmfeo", "erqwkyhkobopg", com.azure.core.util.Context.NONE)
.getValue();
- Assertions.assertEquals("csnjvcdwxlpqekft", response.location());
+ Assertions.assertEquals("k", response.location());
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListMockTests.java
index 97628a3ce5ba9..853ccb58bb5e1 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListMockTests.java
@@ -6,53 +6,34 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
import com.azure.resourcemanager.chaos.models.CapabilityType;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class CapabilityTypesListMockTests {
@Test
public void testList() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr
- = "{\"value\":[{\"location\":\"sexso\",\"properties\":{\"publisher\":\"luqhhahhxv\",\"targetType\":\"mzkwpjg\",\"displayName\":\"spughftqsxhq\",\"description\":\"j\",\"parametersSchema\":\"kndxdigrjgu\",\"urn\":\"zdmsyqtfi\",\"kind\":\"hbotzingamvppho\",\"azureRbacActions\":[\"zudphqamvdkfw\",\"nwcvtbvkayhmtnv\"],\"azureRbacDataActions\":[\"atkzwpcnpw\",\"cjaesgvvs\",\"cyajguqf\"],\"runtimeProperties\":{\"kind\":\"gzlvdnkfxu\"}},\"id\":\"emdwzrmuhapfc\",\"name\":\"dpsqx\",\"type\":\"vpsvuoymgcce\"}]}";
-
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
+ = "{\"value\":[{\"location\":\"hahhxvrhmzkwpj\",\"properties\":{\"publisher\":\"spughftqsxhq\",\"targetType\":\"j\",\"displayName\":\"kndxdigrjgu\",\"description\":\"zdmsyqtfi\",\"parametersSchema\":\"hbotzingamvppho\",\"urn\":\"qzudphq\",\"kind\":\"vdkfwynwcvtbvk\",\"azureRbacActions\":[\"mtnvyq\",\"atkzwpcnpw\"],\"azureRbacDataActions\":[\"a\",\"sgvvsccyajguq\",\"hwyg\"],\"runtimeProperties\":{\"kind\":\"dnkfx\"}},\"id\":\"semdwzrmu\",\"name\":\"apfcqdpsq\",\"type\":\"qvpsvuoymg\"}]}";
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
new AzureProfile("", "", AzureEnvironment.AZURE));
PagedIterable response = manager.capabilityTypes()
- .list("jvfbgofelja", "rqmq", "ldvriiiojnalghfk", com.azure.core.util.Context.NONE);
+ .list("jagrqmqhldvr", "iiojnal", "hfkvtvsexsowuel", com.azure.core.util.Context.NONE);
- Assertions.assertEquals("sexso", response.iterator().next().location());
+ Assertions.assertEquals("hahhxvrhmzkwpj", response.iterator().next().location());
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetListSelectorTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetListSelectorTests.java
index a94b56301b422..1dedb95fec41e 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetListSelectorTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetListSelectorTests.java
@@ -16,25 +16,24 @@ public final class ChaosTargetListSelectorTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
ChaosTargetListSelector model = BinaryData.fromString(
- "{\"type\":\"List\",\"targets\":[{\"type\":\"ChaosTarget\",\"id\":\"puqujmqlgkfbtn\"},{\"type\":\"ChaosTarget\",\"id\":\"aongbj\"},{\"type\":\"ChaosTarget\",\"id\":\"tujitcjedft\"}],\"id\":\"waezkojvd\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"oxciqopidoamcio\":\"dataoqouicybxarzgszu\",\"zxkhnzbonlwnto\":\"datahkh\",\"zcmrvexztvb\":\"datagokdwbwhks\"}}")
+ "{\"type\":\"List\",\"targets\":[{\"type\":\"ChaosTarget\",\"id\":\"fbtndoaong\"},{\"type\":\"ChaosTarget\",\"id\":\"cn\"},{\"type\":\"ChaosTarget\",\"id\":\"jitcjedftwwaez\"}],\"id\":\"ojvdcpzfoqo\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"opidoamciodh\":\"databxarzgszufoxci\",\"khnzbonlw\":\"datahaz\",\"dwbwhkszzcmrvexz\":\"datatoego\"}}")
.toObject(ChaosTargetListSelector.class);
- Assertions.assertEquals("waezkojvd", model.id());
+ Assertions.assertEquals("ojvdcpzfoqo", model.id());
Assertions.assertEquals(TargetReferenceType.CHAOS_TARGET, model.targets().get(0).type());
- Assertions.assertEquals("puqujmqlgkfbtn", model.targets().get(0).id());
+ Assertions.assertEquals("fbtndoaong", model.targets().get(0).id());
}
@org.junit.jupiter.api.Test
public void testSerialize() throws Exception {
- ChaosTargetListSelector model
- = new ChaosTargetListSelector().withId("waezkojvd")
- .withFilter(new ChaosTargetFilter())
- .withTargets(Arrays.asList(
- new TargetReference().withType(TargetReferenceType.CHAOS_TARGET).withId("puqujmqlgkfbtn"),
- new TargetReference().withType(TargetReferenceType.CHAOS_TARGET).withId("aongbj"),
- new TargetReference().withType(TargetReferenceType.CHAOS_TARGET).withId("tujitcjedft")));
+ ChaosTargetListSelector model = new ChaosTargetListSelector().withId("ojvdcpzfoqo")
+ .withFilter(new ChaosTargetFilter())
+ .withTargets(
+ Arrays.asList(new TargetReference().withType(TargetReferenceType.CHAOS_TARGET).withId("fbtndoaong"),
+ new TargetReference().withType(TargetReferenceType.CHAOS_TARGET).withId("cn"),
+ new TargetReference().withType(TargetReferenceType.CHAOS_TARGET).withId("jitcjedftwwaez")));
model = BinaryData.fromObject(model).toObject(ChaosTargetListSelector.class);
- Assertions.assertEquals("waezkojvd", model.id());
+ Assertions.assertEquals("ojvdcpzfoqo", model.id());
Assertions.assertEquals(TargetReferenceType.CHAOS_TARGET, model.targets().get(0).type());
- Assertions.assertEquals("puqujmqlgkfbtn", model.targets().get(0).id());
+ Assertions.assertEquals("fbtndoaong", model.targets().get(0).id());
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetQuerySelectorTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetQuerySelectorTests.java
index 9d51d038d8605..4766f36441300 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetQuerySelectorTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetQuerySelectorTests.java
@@ -14,22 +14,22 @@ public final class ChaosTargetQuerySelectorTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
ChaosTargetQuerySelector model = BinaryData.fromString(
- "{\"type\":\"Query\",\"queryString\":\"lmnguxaw\",\"subscriptionIds\":[\"ldsyuuximerqfob\",\"yznkby\"],\"id\":\"utwpfhp\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"kdsnfdsdoakgtdl\":\"datar\",\"dlhewp\":\"datakkze\",\"bbejdcngqqm\":\"datasdsttwvog\"}}")
+ "{\"type\":\"Query\",\"queryString\":\"gsfraoyzkoow\",\"subscriptionIds\":[\"mnguxawqaldsyu\",\"ximerqfobwyznk\"],\"id\":\"ykutwpf\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"r\":\"datam\",\"kkze\":\"datakdsnfdsdoakgtdl\",\"sdsttwvog\":\"datadlhewp\",\"akufgmjz\":\"databbejdcngqqm\"}}")
.toObject(ChaosTargetQuerySelector.class);
- Assertions.assertEquals("utwpfhp", model.id());
- Assertions.assertEquals("lmnguxaw", model.queryString());
- Assertions.assertEquals("ldsyuuximerqfob", model.subscriptionIds().get(0));
+ Assertions.assertEquals("ykutwpf", model.id());
+ Assertions.assertEquals("gsfraoyzkoow", model.queryString());
+ Assertions.assertEquals("mnguxawqaldsyu", model.subscriptionIds().get(0));
}
@org.junit.jupiter.api.Test
public void testSerialize() throws Exception {
- ChaosTargetQuerySelector model = new ChaosTargetQuerySelector().withId("utwpfhp")
+ ChaosTargetQuerySelector model = new ChaosTargetQuerySelector().withId("ykutwpf")
.withFilter(new ChaosTargetFilter())
- .withQueryString("lmnguxaw")
- .withSubscriptionIds(Arrays.asList("ldsyuuximerqfob", "yznkby"));
+ .withQueryString("gsfraoyzkoow")
+ .withSubscriptionIds(Arrays.asList("mnguxawqaldsyu", "ximerqfobwyznk"));
model = BinaryData.fromObject(model).toObject(ChaosTargetQuerySelector.class);
- Assertions.assertEquals("utwpfhp", model.id());
- Assertions.assertEquals("lmnguxaw", model.queryString());
- Assertions.assertEquals("ldsyuuximerqfob", model.subscriptionIds().get(0));
+ Assertions.assertEquals("ykutwpf", model.id());
+ Assertions.assertEquals("gsfraoyzkoow", model.queryString());
+ Assertions.assertEquals("mnguxawqaldsyu", model.subscriptionIds().get(0));
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetSimpleFilterParametersTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetSimpleFilterParametersTests.java
index 4b83faaefc242..ab2b8f26f74e7 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetSimpleFilterParametersTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetSimpleFilterParametersTests.java
@@ -13,16 +13,16 @@ public final class ChaosTargetSimpleFilterParametersTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
ChaosTargetSimpleFilterParameters model
- = BinaryData.fromString("{\"zones\":[\"hhziuief\",\"zbhd\",\"smlmzqhoftrm\",\"equi\"]}")
+ = BinaryData.fromString("{\"zones\":[\"iuiefozbhdmsm\",\"mzqhoftrmaequi\",\"hxicslfaoqz\"]}")
.toObject(ChaosTargetSimpleFilterParameters.class);
- Assertions.assertEquals("hhziuief", model.zones().get(0));
+ Assertions.assertEquals("iuiefozbhdmsm", model.zones().get(0));
}
@org.junit.jupiter.api.Test
public void testSerialize() throws Exception {
ChaosTargetSimpleFilterParameters model = new ChaosTargetSimpleFilterParameters()
- .withZones(Arrays.asList("hhziuief", "zbhd", "smlmzqhoftrm", "equi"));
+ .withZones(Arrays.asList("iuiefozbhdmsm", "mzqhoftrmaequi", "hxicslfaoqz"));
model = BinaryData.fromObject(model).toObject(ChaosTargetSimpleFilterParameters.class);
- Assertions.assertEquals("hhziuief", model.zones().get(0));
+ Assertions.assertEquals("iuiefozbhdmsm", model.zones().get(0));
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetSimpleFilterTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetSimpleFilterTests.java
index 2362ff719dd6a..c3342cf46e964 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetSimpleFilterTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetSimpleFilterTests.java
@@ -14,16 +14,16 @@ public final class ChaosTargetSimpleFilterTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
ChaosTargetSimpleFilter model = BinaryData
- .fromString("{\"type\":\"Simple\",\"parameters\":{\"zones\":[\"fgmjzrwrdgrt\",\"aenuuz\",\"opbminrfdw\"]}}")
+ .fromString("{\"type\":\"Simple\",\"parameters\":{\"zones\":[\"grtwae\",\"u\",\"zkopb\",\"inrfdwoyu\"]}}")
.toObject(ChaosTargetSimpleFilter.class);
- Assertions.assertEquals("fgmjzrwrdgrt", model.parameters().zones().get(0));
+ Assertions.assertEquals("grtwae", model.parameters().zones().get(0));
}
@org.junit.jupiter.api.Test
public void testSerialize() throws Exception {
ChaosTargetSimpleFilter model = new ChaosTargetSimpleFilter().withParameters(
- new ChaosTargetSimpleFilterParameters().withZones(Arrays.asList("fgmjzrwrdgrt", "aenuuz", "opbminrfdw")));
+ new ChaosTargetSimpleFilterParameters().withZones(Arrays.asList("grtwae", "u", "zkopb", "inrfdwoyu")));
model = BinaryData.fromObject(model).toObject(ChaosTargetSimpleFilter.class);
- Assertions.assertEquals("fgmjzrwrdgrt", model.parameters().zones().get(0));
+ Assertions.assertEquals("grtwae", model.parameters().zones().get(0));
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/DelayActionTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/DelayActionTests.java
index f2a274939e8af..57169a3935a11 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/DelayActionTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/DelayActionTests.java
@@ -12,17 +12,17 @@
public final class DelayActionTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
- DelayAction model = BinaryData.fromString("{\"type\":\"delay\",\"duration\":\"PT185H37M50S\",\"name\":\"l\"}")
+ DelayAction model = BinaryData.fromString("{\"type\":\"delay\",\"duration\":\"PT67H42M31S\",\"name\":\"mz\"}")
.toObject(DelayAction.class);
- Assertions.assertEquals("l", model.name());
- Assertions.assertEquals(Duration.parse("PT185H37M50S"), model.duration());
+ Assertions.assertEquals("mz", model.name());
+ Assertions.assertEquals(Duration.parse("PT67H42M31S"), model.duration());
}
@org.junit.jupiter.api.Test
public void testSerialize() throws Exception {
- DelayAction model = new DelayAction().withName("l").withDuration(Duration.parse("PT185H37M50S"));
+ DelayAction model = new DelayAction().withName("mz").withDuration(Duration.parse("PT67H42M31S"));
model = BinaryData.fromObject(model).toObject(DelayAction.class);
- Assertions.assertEquals("l", model.name());
- Assertions.assertEquals(Duration.parse("PT185H37M50S"), model.duration());
+ Assertions.assertEquals("mz", model.name());
+ Assertions.assertEquals(Duration.parse("PT67H42M31S"), model.duration());
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentInnerTests.java
index 4bd2125e44b09..2fdfc8cf4d3ab 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentInnerTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentInnerTests.java
@@ -23,7 +23,7 @@ public final class ExperimentInnerTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
ExperimentInner model = BinaryData.fromString(
- "{\"identity\":{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"hagalpbuxwgipwh\":{\"principalId\":\"ab062eec-ed37-4f5c-aaa7-69e1f3d4edf6\",\"clientId\":\"6597e0c3-0aaa-46e2-a4cb-b9c75f83f580\"}},\"principalId\":\"ow\",\"tenantId\":\"shwankixzbinje\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"steps\":[{\"name\":\"mryw\",\"branches\":[{\"name\":\"zoqftiyqzrnkcqvy\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"whzlsicohoq\"}]},{\"name\":\"nwvlryavwhheunmm\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"gyxzk\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"noc\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"koklya\"}]}]},{\"name\":\"uconuqszfkbey\",\"branches\":[{\"name\":\"wrmjmwvvjektc\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"enhwlrs\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"frzpwvlqdqgb\"}]},{\"name\":\"qylihkaetckt\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"civfsnkymuctq\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"jf\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"ebrjcxe\"}]},{\"name\":\"fuwutttxf\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"rbirphxe\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"c\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"vahfn\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"jky\"}]},{\"name\":\"xjvuujqgidokg\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"jyoxgvclt\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"gsncghkjeszz\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"bijhtxfvgxbf\"}]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"xnehmpvec\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"ukgri\":\"dataebfqkkrbm\",\"fbxzpuzycisp\":\"dataflz\",\"y\":\"dataqzahmgkbrp\",\"rgvtqag\":\"datahibnuqqkpika\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"buynhijggm\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"zmhjrunmp\":\"dataiarbutrcvpna\",\"nkxmyskpbhenbtk\":\"datattdbhrbnl\",\"yxczfclh\":\"dataxywnytnrsynlqidy\"}}]},\"location\":\"axdbabph\",\"tags\":{\"cocmnyyaztt\":\"qlfktsths\",\"edckzywbiexzfey\":\"twwrqp\",\"ujwb\":\"eaxib\",\"zjancuxr\":\"qwalmuzyoxaepd\"},\"id\":\"d\",\"name\":\"bavxbniwdjswzt\",\"type\":\"dbpgnxytxhp\"}")
+ "{\"identity\":{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"hagalpbuxwgipwh\":{\"principalId\":\"8d1c83f6-bb6f-4afb-b698-ff6156fab49d\",\"clientId\":\"c4646ac2-ff91-4f5e-bb01-4bd0a0d8b768\"}},\"principalId\":\"ow\",\"tenantId\":\"shwankixzbinje\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"steps\":[{\"name\":\"mryw\",\"branches\":[{\"name\":\"zoqftiyqzrnkcqvy\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"whzlsicohoq\"}]},{\"name\":\"nwvlryavwhheunmm\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"gyxzk\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"noc\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"koklya\"}]}]},{\"name\":\"uconuqszfkbey\",\"branches\":[{\"name\":\"wrmjmwvvjektc\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"enhwlrs\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"frzpwvlqdqgb\"}]},{\"name\":\"qylihkaetckt\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"civfsnkymuctq\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"jf\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"ebrjcxe\"}]},{\"name\":\"fuwutttxf\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"rbirphxe\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"c\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"vahfn\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"jky\"}]},{\"name\":\"xjvuujqgidokg\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"jyoxgvclt\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"gsncghkjeszz\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"bijhtxfvgxbf\"}]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"xnehmpvec\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"ukgri\":\"dataebfqkkrbm\",\"fbxzpuzycisp\":\"dataflz\",\"y\":\"dataqzahmgkbrp\",\"rgvtqag\":\"datahibnuqqkpika\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"buynhijggm\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"zmhjrunmp\":\"dataiarbutrcvpna\",\"nkxmyskpbhenbtk\":\"datattdbhrbnl\",\"yxczfclh\":\"dataxywnytnrsynlqidy\"}}]},\"location\":\"axdbabph\",\"tags\":{\"cocmnyyaztt\":\"qlfktsths\",\"edckzywbiexzfey\":\"twwrqp\",\"ujwb\":\"eaxib\",\"zjancuxr\":\"qwalmuzyoxaepd\"},\"id\":\"d\",\"name\":\"bavxbniwdjswzt\",\"type\":\"dbpgnxytxhp\"}")
.toObject(ExperimentInner.class);
Assertions.assertEquals("axdbabph", model.location());
Assertions.assertEquals("qlfktsths", model.tags().get("cocmnyyaztt"));
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentListResultTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentListResultTests.java
index 0b4a18d4d4ec0..90576652d5797 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentListResultTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentListResultTests.java
@@ -11,7 +11,7 @@ public final class ExperimentListResultTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
ExperimentListResult model = BinaryData.fromString(
- "{\"value\":[{\"identity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"a\":{\"principalId\":\"255ed4c6-34ae-4c9b-a3f5-c479d3905fe3\",\"clientId\":\"149bf398-a7e2-4742-b0d3-79870042685b\"},\"fizuckyf\":{\"principalId\":\"d2cb8d1f-ac96-45cd-9a7b-324d79a7af90\",\"clientId\":\"0304c61b-354c-4833-be16-114eadb9bff5\"}},\"principalId\":\"rfidfvzwdz\",\"tenantId\":\"tymw\"},\"properties\":{\"provisioningState\":\"Updating\",\"steps\":[{\"name\":\"fthwxmnteiwa\",\"branches\":[{\"name\":\"vkmijcmmxdcuf\",\"actions\":[]},{\"name\":\"fsrpymzidnse\",\"actions\":[]},{\"name\":\"cxtbzsg\",\"actions\":[]},{\"name\":\"yc\",\"actions\":[]}]},{\"name\":\"sne\",\"branches\":[{\"name\":\"dwzjeiach\",\"actions\":[]},{\"name\":\"oosflnr\",\"actions\":[]},{\"name\":\"sfqpteehz\",\"actions\":[]},{\"name\":\"vypyqrimzinpv\",\"actions\":[]}]},{\"name\":\"wjdk\",\"branches\":[{\"name\":\"soodqxhcrmnoh\",\"actions\":[]},{\"name\":\"t\",\"actions\":[]},{\"name\":\"kwh\",\"actions\":[]},{\"name\":\"soifiyipjxsqw\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"rjb\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"mocpc\":\"datacjxvsnbyxqab\",\"c\":\"datashurzafbljjgpbto\",\"idtqajzyu\":\"datamkljavb\",\"jkrlkhbzhfepg\":\"datapku\"}}]},\"location\":\"gqexzlocxs\",\"tags\":{\"j\":\"ierhhbcsglummaj\",\"jionpimexgstxgc\":\"odxobnbdxkqpxok\"},\"id\":\"odgmaajrmvdjwz\",\"name\":\"lovmclwhijcoe\",\"type\":\"ctbzaq\"},{\"identity\":{\"type\":\"None\",\"userAssignedIdentities\":{\"fkgukdkexxppof\":{\"principalId\":\"59e13f26-36e1-4cbc-a8ba-0b141b28818d\",\"clientId\":\"628bbccf-25bc-45c3-b1e3-8af954a8f5a6\"},\"x\":{\"principalId\":\"5916b84d-cba8-488e-a8c7-42ef55e6d785\",\"clientId\":\"1fc26ffd-d13b-40f9-be22-45a429a4cae3\"},\"pg\":{\"principalId\":\"caf2753f-940f-4586-978d-1e94d28fd415\",\"clientId\":\"a9c34bb9-854e-48be-a3b6-863dd74dc2a5\"}},\"principalId\":\"toc\",\"tenantId\":\"xhvpmoue\"},\"properties\":{\"provisioningState\":\"Failed\",\"steps\":[{\"name\":\"xibqeojnx\",\"branches\":[{\"name\":\"zvddntwndeicbtwn\",\"actions\":[]}]},{\"name\":\"zao\",\"branches\":[{\"name\":\"uhrhcffcyddgl\",\"actions\":[]},{\"name\":\"jthjqkwpyei\",\"actions\":[]},{\"name\":\"xmqci\",\"actions\":[]},{\"name\":\"q\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"khixuigdtopbo\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"w\":\"datahm\",\"a\":\"dataa\"}}]},\"location\":\"hrzayvvtpgvdf\",\"tags\":{\"efgugnxk\":\"tkftutqxlngx\",\"hjybigehoqfbo\":\"xdqmidtthzrvqdra\",\"zlcuiywgqywgndrv\":\"skanyk\",\"ocpecfvmmco\":\"nhzgpphrcgyn\"},\"id\":\"fsxlzevgbmqjqa\",\"name\":\"c\",\"type\":\"pmivkwlzu\"},{\"identity\":{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"bacfionlebxetq\":{\"principalId\":\"7204d12f-5595-4a88-b5db-9d9ab62fc0b9\",\"clientId\":\"2f311a43-9660-4aa3-a9fb-d68e86572abd\"},\"xdpnqbqq\":{\"principalId\":\"54c91147-345a-4eef-8bbc-d8bbe6cd851d\",\"clientId\":\"27b9ee2d-21d3-4cb5-8213-3f515f3c4753\"},\"jfeallnwsub\":{\"principalId\":\"29d4915a-f7f4-4cca-8bfc-0599d98b75b3\",\"clientId\":\"bb083cf2-faa4-4e3f-bdcc-c6d19f24c6d7\"},\"jampmngnzscxaqw\":{\"principalId\":\"a07187c6-2083-4892-b8ff-9a573449a2a3\",\"clientId\":\"a2efa42d-9caa-4e0d-a837-3512dae0695e\"}},\"principalId\":\"chcbonqvpkvlrxnj\",\"tenantId\":\"seiphe\"},\"properties\":{\"provisioningState\":\"Creating\",\"steps\":[{\"name\":\"keyyi\",\"branches\":[{\"name\":\"jbdlwtgrhpdjpju\",\"actions\":[]}]},{\"name\":\"asxazjpqyegualhb\",\"branches\":[{\"name\":\"hejjz\",\"actions\":[]},{\"name\":\"v\",\"actions\":[]},{\"name\":\"udgwdslfho\",\"actions\":[]}]},{\"name\":\"wmc\",\"branches\":[{\"name\":\"pwlbjnpg\",\"actions\":[]},{\"name\":\"cftadeh\",\"actions\":[]},{\"name\":\"nltyfsoppusuesnz\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"ej\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"ndnvo\":\"datarxzdmohctbqvudwx\",\"lazjdyggdtjixhbk\":\"datagujjugwdkcglh\",\"fwhybcibvy\":\"dataofqweykhmenevfye\",\"ynnaam\":\"datadcsi\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"ectehf\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"hezrkgq\":\"datajeyp\"}}]},\"location\":\"c\",\"tags\":{\"jpkcattpng\":\"fovgmkqsleyyvxy\",\"czsqpjhvm\":\"cr\"},\"id\":\"ajvnysounqe\",\"name\":\"a\",\"type\":\"oaeupfhyhltrpmo\"},{\"identity\":{\"type\":\"None\",\"userAssignedIdentities\":{\"okth\":{\"principalId\":\"862b509f-e184-48e4-af87-86e9bfa46293\",\"clientId\":\"6687bec8-fcdb-421b-9ca8-75b8bec619c5\"},\"uaodsfcpk\":{\"principalId\":\"7227b047-d517-408e-a6f6-cfbfa1b4312f\",\"clientId\":\"7d3fd070-8fbf-4bdc-b01e-3fd2e27429b6\"},\"dpuozmyz\":{\"principalId\":\"533c94a5-73fd-4e78-9a83-bc7d98547436\",\"clientId\":\"9733cd6b-18a5-4bb6-ad2e-6adcfd916aa8\"}},\"principalId\":\"agfuaxbezyiu\",\"tenantId\":\"ktwh\"},\"properties\":{\"provisioningState\":\"Creating\",\"steps\":[{\"name\":\"zywqsmbsu\",\"branches\":[{\"name\":\"xim\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"yocf\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"kiiuxhqyudxor\":\"dataymddys\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"qn\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"llr\":\"datazvyifqrvkdvj\",\"xxbczwtr\":\"datavvdfwatkpnpul\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"wiqzbqjvsovmyo\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"obpxjmflbvvn\":\"datapkwlhz\",\"ciwwzjuqkhr\":\"datahrk\",\"oskg\":\"dataajiwkuo\",\"vxieduugidyj\":\"datasauuimj\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"rfbyaosvexcso\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"eggzfb\":\"datahocohslkev\",\"ithlvmezyvshxm\":\"datahfmvfaxkffe\",\"gigr\":\"datasbbzo\"}}]},\"location\":\"wburvjxxjnspydpt\",\"tags\":{\"udwtiukbl\":\"nkoukn\",\"o\":\"ngkpocipazy\",\"ntypmrbpizcdrqj\":\"gukgjnpiucgygevq\"},\"id\":\"dpydn\",\"name\":\"yhxdeoejzicwi\",\"type\":\"sjttgzfbish\"}],\"nextLink\":\"khaj\"}")
+ "{\"value\":[{\"identity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"a\":{\"principalId\":\"c3a7114c-7ae0-4582-8b6e-3f3120512029\",\"clientId\":\"50764e84-912c-4147-ab13-95a139e09223\"},\"fizuckyf\":{\"principalId\":\"b1c4a920-19fd-40ee-b9a3-380b06969a8d\",\"clientId\":\"1705dd63-ea27-4656-b92c-2d915603521f\"}},\"principalId\":\"rfidfvzwdz\",\"tenantId\":\"tymw\"},\"properties\":{\"provisioningState\":\"Updating\",\"steps\":[{\"name\":\"fthwxmnteiwa\",\"branches\":[{\"name\":\"vkmijcmmxdcuf\",\"actions\":[]},{\"name\":\"fsrpymzidnse\",\"actions\":[]},{\"name\":\"cxtbzsg\",\"actions\":[]},{\"name\":\"yc\",\"actions\":[]}]},{\"name\":\"sne\",\"branches\":[{\"name\":\"dwzjeiach\",\"actions\":[]},{\"name\":\"oosflnr\",\"actions\":[]},{\"name\":\"sfqpteehz\",\"actions\":[]},{\"name\":\"vypyqrimzinpv\",\"actions\":[]}]},{\"name\":\"wjdk\",\"branches\":[{\"name\":\"soodqxhcrmnoh\",\"actions\":[]},{\"name\":\"t\",\"actions\":[]},{\"name\":\"kwh\",\"actions\":[]},{\"name\":\"soifiyipjxsqw\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"rjb\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"mocpc\":\"datacjxvsnbyxqab\",\"c\":\"datashurzafbljjgpbto\",\"idtqajzyu\":\"datamkljavb\",\"jkrlkhbzhfepg\":\"datapku\"}}]},\"location\":\"gqexzlocxs\",\"tags\":{\"j\":\"ierhhbcsglummaj\",\"jionpimexgstxgc\":\"odxobnbdxkqpxok\"},\"id\":\"odgmaajrmvdjwz\",\"name\":\"lovmclwhijcoe\",\"type\":\"ctbzaq\"},{\"identity\":{\"type\":\"None\",\"userAssignedIdentities\":{\"fkgukdkexxppof\":{\"principalId\":\"5cb6679b-80f5-40d3-9384-1724d277ce29\",\"clientId\":\"de8786fc-868f-4f55-9d59-9294dfbca7b2\"},\"x\":{\"principalId\":\"217f5ebd-4903-4d31-8ebd-a295709aa94e\",\"clientId\":\"cfecce82-adc6-4d63-86a2-a836feac0c12\"},\"pg\":{\"principalId\":\"84363793-9918-4bfd-a709-9560de1bc77f\",\"clientId\":\"5489bffe-e788-4cd2-865e-f5d4387d69f7\"}},\"principalId\":\"toc\",\"tenantId\":\"xhvpmoue\"},\"properties\":{\"provisioningState\":\"Failed\",\"steps\":[{\"name\":\"xibqeojnx\",\"branches\":[{\"name\":\"zvddntwndeicbtwn\",\"actions\":[]}]},{\"name\":\"zao\",\"branches\":[{\"name\":\"uhrhcffcyddgl\",\"actions\":[]},{\"name\":\"jthjqkwpyei\",\"actions\":[]},{\"name\":\"xmqci\",\"actions\":[]},{\"name\":\"q\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"khixuigdtopbo\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"w\":\"datahm\",\"a\":\"dataa\"}}]},\"location\":\"hrzayvvtpgvdf\",\"tags\":{\"efgugnxk\":\"tkftutqxlngx\",\"hjybigehoqfbo\":\"xdqmidtthzrvqdra\",\"zlcuiywgqywgndrv\":\"skanyk\",\"ocpecfvmmco\":\"nhzgpphrcgyn\"},\"id\":\"fsxlzevgbmqjqa\",\"name\":\"c\",\"type\":\"pmivkwlzu\"},{\"identity\":{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"bacfionlebxetq\":{\"principalId\":\"06383709-1fd5-4c9b-9d4f-5f2543f80095\",\"clientId\":\"a33ddbbc-efab-4bca-8485-1da88928e998\"},\"xdpnqbqq\":{\"principalId\":\"fd10eea1-1e6d-4ea5-86a4-9fffd3177bb5\",\"clientId\":\"e81f1f7c-7a1b-4ca4-ae04-6a14c1e4e522\"},\"jfeallnwsub\":{\"principalId\":\"414c6587-d389-4295-a9d8-b4ddf4008fcf\",\"clientId\":\"7b7f11df-9231-4f95-902e-6df42ca3474e\"},\"jampmngnzscxaqw\":{\"principalId\":\"643ecd4b-0437-4c7e-963f-0562f40a3811\",\"clientId\":\"c74fe285-3408-4ee1-8d1f-eac7ea7f0d58\"}},\"principalId\":\"chcbonqvpkvlrxnj\",\"tenantId\":\"seiphe\"},\"properties\":{\"provisioningState\":\"Creating\",\"steps\":[{\"name\":\"keyyi\",\"branches\":[{\"name\":\"jbdlwtgrhpdjpju\",\"actions\":[]}]},{\"name\":\"asxazjpqyegualhb\",\"branches\":[{\"name\":\"hejjz\",\"actions\":[]},{\"name\":\"v\",\"actions\":[]},{\"name\":\"udgwdslfho\",\"actions\":[]}]},{\"name\":\"wmc\",\"branches\":[{\"name\":\"pwlbjnpg\",\"actions\":[]},{\"name\":\"cftadeh\",\"actions\":[]},{\"name\":\"nltyfsoppusuesnz\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"ej\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"ndnvo\":\"datarxzdmohctbqvudwx\",\"lazjdyggdtjixhbk\":\"datagujjugwdkcglh\",\"fwhybcibvy\":\"dataofqweykhmenevfye\",\"ynnaam\":\"datadcsi\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"ectehf\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"hezrkgq\":\"datajeyp\"}}]},\"location\":\"c\",\"tags\":{\"jpkcattpng\":\"fovgmkqsleyyvxy\",\"czsqpjhvm\":\"cr\"},\"id\":\"ajvnysounqe\",\"name\":\"a\",\"type\":\"oaeupfhyhltrpmo\"},{\"identity\":{\"type\":\"None\",\"userAssignedIdentities\":{\"okth\":{\"principalId\":\"9f34e36e-4140-40dc-860f-cdf6f37d3a09\",\"clientId\":\"a675aa57-a888-4bf9-a649-8722b2c35dbe\"},\"uaodsfcpk\":{\"principalId\":\"52f16056-26b0-494a-a1ac-a663e88e36cf\",\"clientId\":\"f8a09c06-3821-4fd8-8ca3-c2ded73a5fd6\"},\"dpuozmyz\":{\"principalId\":\"cd6a09b0-f7ed-49aa-8b6d-f7bf5dd0d6b9\",\"clientId\":\"4a4f173c-82f8-4edc-8def-a716231d30aa\"}},\"principalId\":\"agfuaxbezyiu\",\"tenantId\":\"ktwh\"},\"properties\":{\"provisioningState\":\"Creating\",\"steps\":[{\"name\":\"zywqsmbsu\",\"branches\":[{\"name\":\"xim\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"yocf\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"kiiuxhqyudxor\":\"dataymddys\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"qn\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"llr\":\"datazvyifqrvkdvj\",\"xxbczwtr\":\"datavvdfwatkpnpul\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"wiqzbqjvsovmyo\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"obpxjmflbvvn\":\"datapkwlhz\",\"ciwwzjuqkhr\":\"datahrk\",\"oskg\":\"dataajiwkuo\",\"vxieduugidyj\":\"datasauuimj\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"rfbyaosvexcso\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"eggzfb\":\"datahocohslkev\",\"ithlvmezyvshxm\":\"datahfmvfaxkffe\",\"gigr\":\"datasbbzo\"}}]},\"location\":\"wburvjxxjnspydpt\",\"tags\":{\"udwtiukbl\":\"nkoukn\",\"o\":\"ngkpocipazy\",\"ntypmrbpizcdrqj\":\"gukgjnpiucgygevq\"},\"id\":\"dpydn\",\"name\":\"yhxdeoejzicwi\",\"type\":\"sjttgzfbish\"}],\"nextLink\":\"khaj\"}")
.toObject(ExperimentListResult.class);
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentUpdateTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentUpdateTests.java
index 0308f43cc71fb..56869c32116b0 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentUpdateTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentUpdateTests.java
@@ -17,7 +17,7 @@ public final class ExperimentUpdateTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
ExperimentUpdate model = BinaryData.fromString(
- "{\"identity\":{\"type\":\"None\",\"userAssignedIdentities\":{\"veual\":{\"principalId\":\"2ab296ac-e81e-4690-b2e9-e8ca33e2c7f3\",\"clientId\":\"e2c93b86-0c6b-4a76-b205-8abd8405e73c\"},\"mkh\":{\"principalId\":\"a488b418-a1eb-433c-a43f-5fae44a0b576\",\"clientId\":\"6b698d05-0238-4471-9218-dbbad59580b9\"},\"bbcswsrtjri\":{\"principalId\":\"8116ceee-1e63-4d79-ad88-a3b1cf189c9d\",\"clientId\":\"7893fbc9-a3b8-4f3d-9909-b5051e6de38e\"},\"bpbewtghfgb\":{\"principalId\":\"d1b6d058-d12a-45b2-b1f0-0a6e04a0d8ff\",\"clientId\":\"2cb9b1c9-46cf-4f32-b1c0-888374c5f9e6\"}},\"principalId\":\"gw\",\"tenantId\":\"vlvqhjkbegi\"},\"tags\":{\"aloayqcgwrtzju\":\"mxiebw\",\"txon\":\"gwyzm\",\"rknftguvriuhprwm\":\"mtsavjcbpwxqp\",\"bexrmcq\":\"yvxqtayriwwroy\"}}")
+ "{\"identity\":{\"type\":\"None\",\"userAssignedIdentities\":{\"veual\":{\"principalId\":\"117247fc-eaf3-474e-8848-1154b475989b\",\"clientId\":\"7d125f3b-6eaf-4db5-8b18-0d9528cb79d3\"},\"mkh\":{\"principalId\":\"d9cd11da-7cf8-4b79-a5dd-a55dd1b59aaa\",\"clientId\":\"4521f587-2320-497f-9696-3e8b9dd62318\"},\"bbcswsrtjri\":{\"principalId\":\"1326097e-0a1e-42ef-bee6-6e6eb3e533dc\",\"clientId\":\"5e5adf5f-53f4-47fb-af7f-312917eacb92\"},\"bpbewtghfgb\":{\"principalId\":\"194d2f05-0d3a-4288-9e57-34dfec4b18f1\",\"clientId\":\"5f7a5c17-8833-411f-8c88-dfe1b43a4ce3\"}},\"principalId\":\"gw\",\"tenantId\":\"vlvqhjkbegi\"},\"tags\":{\"aloayqcgwrtzju\":\"mxiebw\",\"txon\":\"gwyzm\",\"rknftguvriuhprwm\":\"mtsavjcbpwxqp\",\"bexrmcq\":\"yvxqtayriwwroy\"}}")
.toObject(ExperimentUpdate.class);
Assertions.assertEquals(ResourceIdentityType.NONE, model.identity().type());
Assertions.assertEquals("mxiebw", model.tags().get("aloayqcgwrtzju"));
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateMockTests.java
index d5c7e89be9288..54e9feb0eaad3 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateMockTests.java
@@ -6,11 +6,9 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
import com.azure.resourcemanager.chaos.models.ChaosExperimentBranch;
import com.azure.resourcemanager.chaos.models.ChaosExperimentStep;
@@ -20,7 +18,6 @@
import com.azure.resourcemanager.chaos.models.ResourceIdentity;
import com.azure.resourcemanager.chaos.models.ResourceIdentityType;
import com.azure.resourcemanager.chaos.models.UserAssignedIdentity;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import java.util.Arrays;
@@ -28,32 +25,16 @@
import java.util.Map;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class ExperimentsCreateOrUpdateMockTests {
@Test
public void testCreateOrUpdate() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr
- = "{\"identity\":{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"ev\":{\"principalId\":\"6900a581-a089-4451-b294-0dccce9a7181\",\"clientId\":\"c0aab7de-0ad5-4a09-ad58-31e9defd8dd4\"},\"b\":{\"principalId\":\"25a877c7-39ff-46be-8058-0c1f8c6955e9\",\"clientId\":\"2986140d-b1b7-4329-a3f5-cb5f12d81712\"}},\"principalId\":\"rilbywdx\",\"tenantId\":\"icc\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"steps\":[{\"name\":\"scjfnyns\",\"branches\":[{\"name\":\"ujiz\",\"actions\":[]},{\"name\":\"voqyt\",\"actions\":[]}]},{\"name\":\"byowbblgyavutp\",\"branches\":[{\"name\":\"joxoism\",\"actions\":[]},{\"name\":\"ksbpimlqoljx\",\"actions\":[]}]},{\"name\":\"cgxxlxs\",\"branches\":[{\"name\":\"gcvizqzdwlvwlyou\",\"actions\":[]},{\"name\":\"fgfb\",\"actions\":[]}]},{\"name\":\"jub\",\"branches\":[{\"name\":\"hgkfmin\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"owzfttsttkt\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"gqqqxh\":\"dataqactxtgzukxitmmq\",\"rxcpjuisavo\":\"datan\",\"ajlkatnw\":\"dataqdzfvazivjlfrqtt\"}}]},\"location\":\"yiopi\",\"tags\":{\"ovibrxkp\":\"qfkuvscxkdmli\",\"bteoybf\":\"loazuruocbgoo\"},\"id\":\"jxakv\",\"name\":\"jgslordilmyww\",\"type\":\"kgkxn\"}";
-
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
+ = "{\"identity\":{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"ev\":{\"principalId\":\"196a22c5-3ca0-4d98-9a32-4f14564ee6c2\",\"clientId\":\"7268a1de-b3af-4a98-8e4e-fbc5b33a81be\"},\"b\":{\"principalId\":\"f5872c29-9455-487c-b047-3307bb4b4df6\",\"clientId\":\"7cb69611-9b91-41ea-aa48-d2bdcfd9d2a0\"}},\"principalId\":\"rilbywdx\",\"tenantId\":\"icc\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"steps\":[{\"name\":\"scjfnyns\",\"branches\":[{\"name\":\"ujiz\",\"actions\":[]},{\"name\":\"voqyt\",\"actions\":[]}]},{\"name\":\"byowbblgyavutp\",\"branches\":[{\"name\":\"joxoism\",\"actions\":[]},{\"name\":\"ksbpimlqoljx\",\"actions\":[]}]},{\"name\":\"cgxxlxs\",\"branches\":[{\"name\":\"gcvizqzdwlvwlyou\",\"actions\":[]},{\"name\":\"fgfb\",\"actions\":[]}]},{\"name\":\"jub\",\"branches\":[{\"name\":\"hgkfmin\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"owzfttsttkt\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"gqqqxh\":\"dataqactxtgzukxitmmq\",\"rxcpjuisavo\":\"datan\",\"ajlkatnw\":\"dataqdzfvazivjlfrqtt\"}}]},\"location\":\"yiopi\",\"tags\":{\"ovibrxkp\":\"qfkuvscxkdmli\",\"bteoybf\":\"loazuruocbgoo\"},\"id\":\"jxakv\",\"name\":\"jgslordilmyww\",\"type\":\"kgkxn\"}";
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsExecutionDetailsWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsExecutionDetailsWithResponseMockTests.java
index 747ce26c01907..ff03eab7eb0a9 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsExecutionDetailsWithResponseMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsExecutionDetailsWithResponseMockTests.java
@@ -6,43 +6,24 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetails;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class ExperimentsExecutionDetailsWithResponseMockTests {
@Test
public void testExecutionDetailsWithResponse() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr
= "{\"type\":\"qkdlw\",\"id\":\"fbumlkx\",\"name\":\"qjfsmlmbtxhw\",\"properties\":{\"failureReason\":\"srtawcoezbr\",\"lastActionAt\":\"2021-02-21T07:03:26Z\",\"runInformation\":{\"steps\":[{\"stepName\":\"dyg\",\"stepId\":\"okkqfqjbvleo\",\"status\":\"ml\",\"branches\":[{},{},{}]}]},\"status\":\"qzfavyv\",\"startedAt\":\"2021-03-05T04:35Z\",\"stoppedAt\":\"2021-05-23T06:21:06Z\"}}";
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
-
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupWithResponseMockTests.java
index aa15ea8819576..55a52b752e25f 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupWithResponseMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupWithResponseMockTests.java
@@ -6,45 +6,26 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
import com.azure.resourcemanager.chaos.models.Experiment;
import com.azure.resourcemanager.chaos.models.ResourceIdentityType;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class ExperimentsGetByResourceGroupWithResponseMockTests {
@Test
public void testGetByResourceGroupWithResponse() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr
- = "{\"identity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"opqgikyzirtxdyux\":{\"principalId\":\"ed9e294c-ba78-4a01-9758-19761ba750b0\",\"clientId\":\"a2543718-8588-4dfb-8eaf-4fea9e1ab6b7\"},\"ntps\":{\"principalId\":\"a1f707cd-b841-41f1-bc3c-af8593d08837\",\"clientId\":\"6f1bac67-d21a-4434-a85e-68a7413d937d\"},\"ioilqukrydxtq\":{\"principalId\":\"a97a125d-157d-4bae-a88a-69b9f437a6fc\",\"clientId\":\"1d2845f8-8e7b-4f78-a4d7-47a82dc40e67\"},\"ox\":{\"principalId\":\"c0b79486-4535-400a-af65-889b887410a8\",\"clientId\":\"2ed7a83d-db34-4f38-9790-6877bd60d579\"}},\"principalId\":\"ggufhyaomtb\",\"tenantId\":\"havgrvk\"},\"properties\":{\"provisioningState\":\"Creating\",\"steps\":[{\"name\":\"jzhpjbibgjmfx\",\"branches\":[{\"name\":\"vfcluyovwxnbkfe\",\"actions\":[]}]},{\"name\":\"zxscyhwzdgirujb\",\"branches\":[{\"name\":\"omvzzbtd\",\"actions\":[]},{\"name\":\"qvpn\",\"actions\":[]},{\"name\":\"yujviylwdshfssn\",\"actions\":[]}]},{\"name\":\"bgye\",\"branches\":[{\"name\":\"ymsgaojfmwnc\",\"actions\":[]},{\"name\":\"tmr\",\"actions\":[]},{\"name\":\"hirctymoxoftpipi\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"czuhxacpqjlihh\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"ucvpamrs\":\"dataskasdvlmfwdgzxu\",\"risjnhnytxifqjz\":\"dataeuzvx\",\"lw\":\"dataxmrhu\",\"woqhihe\":\"datacesutrgjupauut\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"qg\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"xjvfoimwksl\":\"datafqntcyp\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"rcizjxvyd\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"gdyftumrtwna\":\"datacvlhv\",\"wkojgcyztsfmzn\":\"datajslb\"}}]},\"location\":\"aeqphchqnr\",\"tags\":{\"huwrykqgaifm\":\"x\",\"jdz\":\"iklbydvkhb\",\"srhnjivo\":\"xcv\"},\"id\":\"v\",\"name\":\"novqfzge\",\"type\":\"jdftuljltd\"}";
-
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
+ = "{\"identity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"opqgikyzirtxdyux\":{\"principalId\":\"11bfccb8-091b-4396-ac7f-4a3661819ad9\",\"clientId\":\"03ce86b3-7836-4d0f-941d-a3636ee0f4db\"},\"ntps\":{\"principalId\":\"fc8311c3-9c68-4898-b7e7-d8389895dd54\",\"clientId\":\"f6a5722b-3a59-4fb7-a222-66619357a1fb\"},\"ioilqukrydxtq\":{\"principalId\":\"56d3852c-c618-4166-a4a3-9d23296b57b2\",\"clientId\":\"e5a56a23-cc84-4843-9824-8fe74201885c\"},\"ox\":{\"principalId\":\"844c5723-5023-42b4-ab08-72f752953f81\",\"clientId\":\"7586d2a0-ae2f-47a2-991e-d55823b33ddf\"}},\"principalId\":\"ggufhyaomtb\",\"tenantId\":\"havgrvk\"},\"properties\":{\"provisioningState\":\"Creating\",\"steps\":[{\"name\":\"jzhpjbibgjmfx\",\"branches\":[{\"name\":\"vfcluyovwxnbkfe\",\"actions\":[]}]},{\"name\":\"zxscyhwzdgirujb\",\"branches\":[{\"name\":\"omvzzbtd\",\"actions\":[]},{\"name\":\"qvpn\",\"actions\":[]},{\"name\":\"yujviylwdshfssn\",\"actions\":[]}]},{\"name\":\"bgye\",\"branches\":[{\"name\":\"ymsgaojfmwnc\",\"actions\":[]},{\"name\":\"tmr\",\"actions\":[]},{\"name\":\"hirctymoxoftpipi\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"czuhxacpqjlihh\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"ucvpamrs\":\"dataskasdvlmfwdgzxu\",\"risjnhnytxifqjz\":\"dataeuzvx\",\"lw\":\"dataxmrhu\",\"woqhihe\":\"datacesutrgjupauut\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"qg\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"xjvfoimwksl\":\"datafqntcyp\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"rcizjxvyd\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"gdyftumrtwna\":\"datacvlhv\",\"wkojgcyztsfmzn\":\"datajslb\"}}]},\"location\":\"aeqphchqnr\",\"tags\":{\"huwrykqgaifm\":\"x\",\"jdz\":\"iklbydvkhb\",\"srhnjivo\":\"xcv\"},\"id\":\"v\",\"name\":\"novqfzge\",\"type\":\"jdftuljltd\"}";
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionWithResponseMockTests.java
index bf0cec19c3074..d0bc0dd2502e3 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionWithResponseMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionWithResponseMockTests.java
@@ -6,43 +6,24 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
import com.azure.resourcemanager.chaos.models.ExperimentExecution;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class ExperimentsGetExecutionWithResponseMockTests {
@Test
public void testGetExecutionWithResponse() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr
= "{\"type\":\"ripltf\",\"id\":\"tbaxk\",\"name\":\"ywrckp\",\"properties\":{\"status\":\"yhpluodpvruudlgz\",\"startedAt\":\"2021-07-04T20:01:35Z\",\"stoppedAt\":\"2021-04-27T04:41:25Z\"}}";
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
-
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllExecutionsMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllExecutionsMockTests.java
index b0e9614123c46..74744b00341c7 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllExecutionsMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllExecutionsMockTests.java
@@ -6,44 +6,25 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
import com.azure.resourcemanager.chaos.models.ExperimentExecution;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class ExperimentsListAllExecutionsMockTests {
@Test
public void testListAllExecutions() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr
= "{\"value\":[{\"type\":\"jw\",\"id\":\"wqiok\",\"name\":\"sx\",\"properties\":{\"status\":\"msvpkjpr\",\"startedAt\":\"2021-06-29T04:33:46Z\",\"stoppedAt\":\"2021-06-26T08:15:06Z\"}}]}";
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
-
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupMockTests.java
index dd7f2ad471922..7701425428b01 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupMockTests.java
@@ -6,46 +6,27 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
import com.azure.resourcemanager.chaos.models.Experiment;
import com.azure.resourcemanager.chaos.models.ResourceIdentityType;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class ExperimentsListByResourceGroupMockTests {
@Test
public void testListByResourceGroup() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr
- = "{\"value\":[{\"identity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"qmt\":{\"principalId\":\"09cc1a83-7967-4a00-9444-c8273185c704\",\"clientId\":\"7dbf2abf-1c99-4e0d-a363-474476929b40\"},\"tmmjihyeozph\":{\"principalId\":\"80362830-f6b2-45e6-b2e9-67f951c7e6a6\",\"clientId\":\"ed3d11fa-d978-4743-a66f-061725d1cf92\"}},\"principalId\":\"auyqncygupkv\",\"tenantId\":\"mdscwxqupev\"},\"properties\":{\"provisioningState\":\"Deleting\",\"steps\":[{\"name\":\"totxhojujb\",\"branches\":[{\"name\":\"elmcuvhixbjxyfw\",\"actions\":[]},{\"name\":\"yl\",\"actions\":[]},{\"name\":\"coolsttpkiwkkb\",\"actions\":[]},{\"name\":\"ujrywvtyl\",\"actions\":[]}]},{\"name\":\"fpncurdo\",\"branches\":[{\"name\":\"iithtywu\",\"actions\":[]},{\"name\":\"xcbihw\",\"actions\":[]},{\"name\":\"knfd\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"wjchrdg\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"luudfdlwggytsb\":\"dataumwctondz\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"tov\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"ufxqknpirgnepttw\":\"dataeinqf\",\"mqnrojlpijnkr\":\"datamsniffc\",\"zronasxift\":\"datafrddhcrati\"}}]},\"location\":\"zq\",\"tags\":{\"wesgogczh\":\"f\",\"lgnyhmo\":\"nnxk\",\"h\":\"sxkkg\"},\"id\":\"rghxjb\",\"name\":\"hqxvcxgfrpdsofbs\",\"type\":\"rnsvbuswd\"}]}";
-
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
+ = "{\"value\":[{\"identity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"qmt\":{\"principalId\":\"8eaacbce-e5db-4f3c-b18c-ab43594f5a98\",\"clientId\":\"c3b4b2cb-021d-40d8-a438-6a9782710eb3\"},\"tmmjihyeozph\":{\"principalId\":\"bb509049-5400-4306-a7de-2dc85ed3eb45\",\"clientId\":\"68fe29b2-59cb-47c8-82d9-3e28f564e238\"}},\"principalId\":\"auyqncygupkv\",\"tenantId\":\"mdscwxqupev\"},\"properties\":{\"provisioningState\":\"Deleting\",\"steps\":[{\"name\":\"totxhojujb\",\"branches\":[{\"name\":\"elmcuvhixbjxyfw\",\"actions\":[]},{\"name\":\"yl\",\"actions\":[]},{\"name\":\"coolsttpkiwkkb\",\"actions\":[]},{\"name\":\"ujrywvtyl\",\"actions\":[]}]},{\"name\":\"fpncurdo\",\"branches\":[{\"name\":\"iithtywu\",\"actions\":[]},{\"name\":\"xcbihw\",\"actions\":[]},{\"name\":\"knfd\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"wjchrdg\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"luudfdlwggytsb\":\"dataumwctondz\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"tov\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"ufxqknpirgnepttw\":\"dataeinqf\",\"mqnrojlpijnkr\":\"datamsniffc\",\"zronasxift\":\"datafrddhcrati\"}}]},\"location\":\"zq\",\"tags\":{\"wesgogczh\":\"f\",\"lgnyhmo\":\"nnxk\",\"h\":\"sxkkg\"},\"id\":\"rghxjb\",\"name\":\"hqxvcxgfrpdsofbs\",\"type\":\"rnsvbuswd\"}]}";
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListMockTests.java
index db36dc7afeaa9..90cdbc49df091 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListMockTests.java
@@ -6,57 +6,38 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
import com.azure.resourcemanager.chaos.models.Experiment;
import com.azure.resourcemanager.chaos.models.ResourceIdentityType;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class ExperimentsListMockTests {
@Test
public void testList() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr
- = "{\"value\":[{\"identity\":{\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"ixkwmyijejveg\":{\"principalId\":\"cc1b7169-3ea9-4e3e-8e9c-9da325fbd6d6\",\"clientId\":\"283a5759-690d-4a2f-81b0-cf54f7f0038c\"},\"pna\":{\"principalId\":\"19de67e8-5fb5-4422-bcf4-f04b0ff13c34\",\"clientId\":\"f470ab26-71a1-4133-8067-4882dab06c7e\"},\"xccbdreaxhcex\":{\"principalId\":\"8f92162f-760d-47a9-9ab6-ffa73bfe34f0\",\"clientId\":\"f3d81987-4331-499d-9ad6-a7ab24671ed0\"},\"vqahqkghtpwi\":{\"principalId\":\"7c4bf370-3cff-4a7e-bfb7-df7ec7a5b8b9\",\"clientId\":\"58a5a2a5-a4c4-4336-a6d0-df2207854d28\"}},\"principalId\":\"hyjsvfycx\",\"tenantId\":\"fvoow\"},\"properties\":{\"provisioningState\":\"Creating\",\"steps\":[{\"name\":\"t\",\"branches\":[{\"name\":\"qp\",\"actions\":[]},{\"name\":\"y\",\"actions\":[]},{\"name\":\"s\",\"actions\":[]},{\"name\":\"ronzmyhgfip\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"xkmcwaekrrjre\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"lbqpvuzlmvfelf\":\"datasgumhjglikkxwsl\",\"crpw\":\"datatgp\"}}]},\"location\":\"xeznoi\",\"tags\":{\"qkagfhsxt\":\"njwmwkpnbsazejj\",\"dm\":\"augzxnfaazpxdtn\"},\"id\":\"qjjlwuen\",\"name\":\"rkpyouaibrebqaay\",\"type\":\"j\"}]}";
-
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
+ = "{\"value\":[{\"identity\":{\"type\":\"None\",\"userAssignedIdentities\":{\"wmyijejveg\":{\"principalId\":\"9e54ea8c-5cec-47ae-8024-3b0f05f1d411\",\"clientId\":\"458a26f5-d64a-4aa6-b0ba-13071327b158\"},\"pna\":{\"principalId\":\"73e1f3c9-3dbc-4e1c-bb06-45839ad00a31\",\"clientId\":\"45f1624b-2901-49fa-89a6-8f1396458ca9\"},\"xccbdreaxhcex\":{\"principalId\":\"b5c3a3f7-fdd6-4720-90ad-066968b4fc18\",\"clientId\":\"c808ff56-4a42-4549-9347-ea63f08b8aae\"},\"vqahqkghtpwi\":{\"principalId\":\"1b806910-c911-456c-a239-ac8eeda2c4f2\",\"clientId\":\"57779487-e8d4-4cff-9b28-1f0d552ce7a8\"}},\"principalId\":\"hyjsvfycx\",\"tenantId\":\"fvoow\"},\"properties\":{\"provisioningState\":\"Creating\",\"steps\":[{\"name\":\"t\",\"branches\":[{\"name\":\"qp\",\"actions\":[]},{\"name\":\"y\",\"actions\":[]},{\"name\":\"s\",\"actions\":[]},{\"name\":\"ronzmyhgfip\",\"actions\":[]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"xkmcwaekrrjre\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"lbqpvuzlmvfelf\":\"datasgumhjglikkxwsl\",\"crpw\":\"datatgp\"}}]},\"location\":\"xeznoi\",\"tags\":{\"qkagfhsxt\":\"njwmwkpnbsazejj\",\"dm\":\"augzxnfaazpxdtn\"},\"id\":\"qjjlwuen\",\"name\":\"rkpyouaibrebqaay\",\"type\":\"j\"}]}";
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
new AzureProfile("", "", AzureEnvironment.AZURE));
PagedIterable response
- = manager.experiments().list(false, "nhlmctlpdng", com.azure.core.util.Context.NONE);
+ = manager.experiments().list(false, "mctlpdngitv", com.azure.core.util.Context.NONE);
Assertions.assertEquals("xeznoi", response.iterator().next().location());
Assertions.assertEquals("njwmwkpnbsazejj", response.iterator().next().tags().get("qkagfhsxt"));
- Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, response.iterator().next().identity().type());
+ Assertions.assertEquals(ResourceIdentityType.NONE, response.iterator().next().identity().type());
Assertions.assertEquals("t", response.iterator().next().steps().get(0).name());
Assertions.assertEquals("qp", response.iterator().next().steps().get(0).branches().get(0).name());
Assertions.assertEquals("xkmcwaekrrjre", response.iterator().next().selectors().get(0).id());
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationDisplayTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationDisplayTests.java
index 75d0dc13da38c..97cc58c77086b 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationDisplayTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationDisplayTests.java
@@ -10,9 +10,8 @@
public final class OperationDisplayTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
- OperationDisplay model = BinaryData
- .fromString(
- "{\"provider\":\"k\",\"resource\":\"umiekkezzi\",\"operation\":\"ly\",\"description\":\"hdgqggeb\"}")
+ OperationDisplay model = BinaryData.fromString(
+ "{\"provider\":\"abfatkl\",\"resource\":\"xbjhwuaanozjosph\",\"operation\":\"ulpjr\",\"description\":\"ag\"}")
.toObject(OperationDisplay.class);
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationInnerTests.java
index 266bd595cc873..c6eabfc572e04 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationInnerTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationInnerTests.java
@@ -12,7 +12,7 @@ public final class OperationInnerTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
OperationInner model = BinaryData.fromString(
- "{\"name\":\"bfatklddxbjhwu\",\"isDataAction\":false,\"display\":{\"provider\":\"jos\",\"resource\":\"youlp\",\"operation\":\"v\",\"description\":\"glrvimjwosytxi\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}")
+ "{\"name\":\"qreyfkzi\",\"isDataAction\":false,\"display\":{\"provider\":\"n\",\"resource\":\"ivx\",\"operation\":\"zel\",\"description\":\"irels\"},\"origin\":\"user\",\"actionType\":\"Internal\"}")
.toObject(OperationInner.class);
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationListResultTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationListResultTests.java
index 11837150b953f..addaf911cdb89 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationListResultTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationListResultTests.java
@@ -11,7 +11,7 @@ public final class OperationListResultTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
OperationListResult model = BinaryData.fromString(
- "{\"value\":[{\"name\":\"z\",\"isDataAction\":true,\"display\":{\"provider\":\"c\",\"resource\":\"y\",\"operation\":\"yrnxxmueedn\",\"description\":\"dvstkw\"},\"origin\":\"user\",\"actionType\":\"Internal\"},{\"name\":\"alm\",\"isDataAction\":true,\"display\":{\"provider\":\"aygdvwvgpioh\",\"resource\":\"xrtfudxep\",\"operation\":\"yqagvrvm\",\"description\":\"k\"},\"origin\":\"user\",\"actionType\":\"Internal\"},{\"name\":\"dblx\",\"isDataAction\":true,\"display\":{\"provider\":\"njhf\",\"resource\":\"wmszkk\",\"operation\":\"qreyfkzi\",\"description\":\"jawneaiv\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}],\"nextLink\":\"pcirelsfeaen\"}")
+ "{\"value\":[{\"name\":\"wuipiccjzkzivg\",\"isDataAction\":false,\"display\":{\"provider\":\"y\",\"resource\":\"yrnxxmueedn\",\"operation\":\"dvstkw\",\"description\":\"tchealmf\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"gdv\",\"isDataAction\":true,\"display\":{\"provider\":\"ohgwxrtfudxepxg\",\"resource\":\"agvrvmnpkuk\",\"operation\":\"i\",\"description\":\"blxgwimf\"},\"origin\":\"system\",\"actionType\":\"Internal\"}],\"nextLink\":\"wmszkk\"}")
.toObject(OperationListResult.class);
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationStatusInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationStatusInnerTests.java
deleted file mode 100644
index 8c8840ed8c081..0000000000000
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationStatusInnerTests.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-// Code generated by Microsoft (R) AutoRest Code Generator.
-
-package com.azure.resourcemanager.chaos.generated;
-
-import com.azure.core.util.BinaryData;
-import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner;
-import org.junit.jupiter.api.Assertions;
-
-public final class OperationStatusInnerTests {
- @org.junit.jupiter.api.Test
- public void testDeserialize() throws Exception {
- OperationStatusInner model = BinaryData.fromString(
- "{\"id\":\"ocrkvcikh\",\"name\":\"p\",\"startTime\":\"qgxqquezikyw\",\"endTime\":\"xkalla\",\"status\":\"elwuipi\"}")
- .toObject(OperationStatusInner.class);
- Assertions.assertEquals("ocrkvcikh", model.id());
- Assertions.assertEquals("p", model.name());
- Assertions.assertEquals("qgxqquezikyw", model.startTime());
- Assertions.assertEquals("xkalla", model.endTime());
- Assertions.assertEquals("elwuipi", model.status());
- }
-
- @org.junit.jupiter.api.Test
- public void testSerialize() throws Exception {
- OperationStatusInner model = new OperationStatusInner().withId("ocrkvcikh")
- .withName("p")
- .withStartTime("qgxqquezikyw")
- .withEndTime("xkalla")
- .withStatus("elwuipi");
- model = BinaryData.fromObject(model).toObject(OperationStatusInner.class);
- Assertions.assertEquals("ocrkvcikh", model.id());
- Assertions.assertEquals("p", model.name());
- Assertions.assertEquals("qgxqquezikyw", model.startTime());
- Assertions.assertEquals("xkalla", model.endTime());
- Assertions.assertEquals("elwuipi", model.status());
- }
-}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationStatusesGetWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationStatusesGetWithResponseMockTests.java
deleted file mode 100644
index f324b8cd40e6c..0000000000000
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationStatusesGetWithResponseMockTests.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-// Code generated by Microsoft (R) AutoRest Code Generator.
-
-package com.azure.resourcemanager.chaos.generated;
-
-import com.azure.core.credential.AccessToken;
-import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
-import com.azure.core.management.AzureEnvironment;
-import com.azure.core.management.profile.AzureProfile;
-import com.azure.resourcemanager.chaos.ChaosManager;
-import com.azure.resourcemanager.chaos.models.OperationStatus;
-import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
-import java.time.OffsetDateTime;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
-
-public final class OperationStatusesGetWithResponseMockTests {
- @Test
- public void testGetWithResponse() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
- String responseStr
- = "{\"id\":\"xccybvpa\",\"name\":\"kkudzp\",\"startTime\":\"wjplma\",\"endTime\":\"tcyohpfkyrk\",\"status\":\"dg\"}";
-
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
-
- ChaosManager manager = ChaosManager.configure()
- .withHttpClient(httpClient)
- .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
- new AzureProfile("", "", AzureEnvironment.AZURE));
-
- OperationStatus response = manager.operationStatuses()
- .getWithResponse("edabgyvudtjue", "bcihxuuwhc", com.azure.core.util.Context.NONE)
- .getValue();
-
- Assertions.assertEquals("xccybvpa", response.id());
- Assertions.assertEquals("kkudzp", response.name());
- Assertions.assertEquals("wjplma", response.startTime());
- Assertions.assertEquals("tcyohpfkyrk", response.endTime());
- Assertions.assertEquals("dg", response.status());
- }
-}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ResourceIdentityTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ResourceIdentityTests.java
index 9a55512823f94..98b106319a142 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ResourceIdentityTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ResourceIdentityTests.java
@@ -16,7 +16,7 @@ public final class ResourceIdentityTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
ResourceIdentity model = BinaryData.fromString(
- "{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"zabglcuhxwt\":{\"principalId\":\"b6530509-94c7-4e0d-95ac-1e4e78448f71\",\"clientId\":\"c48be21d-ce83-40e4-a49c-ae0060c973e9\"},\"qik\":{\"principalId\":\"64799503-0174-4da8-9b23-9124b8c6506d\",\"clientId\":\"23a7338f-5f5b-4819-9023-acec91c1bd3f\"},\"ovplw\":{\"principalId\":\"6826292f-a310-47eb-8590-89dd0506f502\",\"clientId\":\"3146ab84-69f6-46e1-af4c-2125972011a4\"}},\"principalId\":\"hvgyuguosvmk\",\"tenantId\":\"sxqu\"}")
+ "{\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"zabglcuhxwt\":{\"principalId\":\"23b4e7ab-bed4-48d5-b835-33db915ab81c\",\"clientId\":\"93ab5b70-2990-4fdc-8f04-1ad6db474dea\"},\"qik\":{\"principalId\":\"a4be7bfb-e769-4665-9b64-2c3ffd045676\",\"clientId\":\"dce9e292-c0f6-46a8-b565-0da60edeeadd\"},\"ovplw\":{\"principalId\":\"c6576fa6-c26f-4f66-92a6-7fed8fc5128b\",\"clientId\":\"4f733958-d169-4fb6-8848-8cca54998b91\"}},\"principalId\":\"hvgyuguosvmk\",\"tenantId\":\"sxqu\"}")
.toObject(ResourceIdentity.class);
Assertions.assertEquals(ResourceIdentityType.USER_ASSIGNED, model.type());
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetInnerTests.java
index 5b2a5d7669efa..b8771d85c1e3d 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetInnerTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetInnerTests.java
@@ -14,17 +14,17 @@ public final class TargetInnerTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
TargetInner model = BinaryData.fromString(
- "{\"location\":\"knnqvsaznq\",\"properties\":{\"mkycgra\":\"dataorudsgsa\"},\"id\":\"wjue\",\"name\":\"aeburuvdmo\",\"type\":\"s\"}")
+ "{\"location\":\"tvcof\",\"properties\":{\"vkg\":\"dataf\",\"gdknnqv\":\"datau\"},\"id\":\"aznqntoru\",\"name\":\"sgsahmkycgr\",\"type\":\"uwjuetaeburuvdmo\"}")
.toObject(TargetInner.class);
- Assertions.assertEquals("knnqvsaznq", model.location());
+ Assertions.assertEquals("tvcof", model.location());
}
@org.junit.jupiter.api.Test
public void testSerialize() throws Exception {
TargetInner model
- = new TargetInner().withLocation("knnqvsaznq").withProperties(mapOf("mkycgra", "dataorudsgsa"));
+ = new TargetInner().withLocation("tvcof").withProperties(mapOf("vkg", "dataf", "gdknnqv", "datau"));
model = BinaryData.fromObject(model).toObject(TargetInner.class);
- Assertions.assertEquals("knnqvsaznq", model.location());
+ Assertions.assertEquals("tvcof", model.location());
}
// Use "Map.of" if available
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetListResultTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetListResultTests.java
index 503cdf7830640..9b8b508085c73 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetListResultTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetListResultTests.java
@@ -11,7 +11,7 @@ public final class TargetListResultTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
TargetListResult model = BinaryData.fromString(
- "{\"value\":[{\"location\":\"nuj\",\"properties\":{\"wj\":\"datammsbvdkcrodtjin\",\"f\":\"datafltkacjv\",\"gaowpulpqblylsyx\":\"datadlfoakggkfp\"},\"id\":\"qjnsjervtia\",\"name\":\"xsdszuempsb\",\"type\":\"kfzbeyvpnqicvi\"},{\"location\":\"jjxd\",\"properties\":{\"paztzpofncck\":\"databuukzclewyhml\",\"qa\":\"datayfzqwhxxbu\",\"lxorjaltolmncws\":\"datazfeqztppri\",\"ucqdpfuvglsb\":\"databqwcsdbnwdcf\"},\"id\":\"jcanvxbvtvudut\",\"name\":\"cormr\",\"type\":\"xqtvcofu\"}],\"nextLink\":\"lvkgju\"}")
+ "{\"value\":[{\"location\":\"vti\",\"properties\":{\"kfzbeyvpnqicvi\":\"dataxsdszuempsb\",\"jjxd\":\"datav\"},\"id\":\"rbuukzclewyhmlwp\",\"name\":\"ztzp\",\"type\":\"fn\"},{\"location\":\"wyfzqwhxxbuyqa\",\"properties\":{\"or\":\"datafeqztppriol\",\"ncwsob\":\"dataaltol\",\"pfuvglsbjjca\":\"datawcsdbnwdcfhucq\"},\"id\":\"vxb\",\"name\":\"t\",\"type\":\"udutnco\"}],\"nextLink\":\"r\"}")
.toObject(TargetListResult.class);
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetReferenceTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetReferenceTests.java
index d233e4c6b5094..f42a44ac9e009 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetReferenceTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetReferenceTests.java
@@ -12,17 +12,17 @@
public final class TargetReferenceTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
- TargetReference model = BinaryData.fromString("{\"type\":\"ChaosTarget\",\"id\":\"gsfraoyzkoow\"}")
- .toObject(TargetReference.class);
+ TargetReference model
+ = BinaryData.fromString("{\"type\":\"ChaosTarget\",\"id\":\"bt\"}").toObject(TargetReference.class);
Assertions.assertEquals(TargetReferenceType.CHAOS_TARGET, model.type());
- Assertions.assertEquals("gsfraoyzkoow", model.id());
+ Assertions.assertEquals("bt", model.id());
}
@org.junit.jupiter.api.Test
public void testSerialize() throws Exception {
- TargetReference model = new TargetReference().withType(TargetReferenceType.CHAOS_TARGET).withId("gsfraoyzkoow");
+ TargetReference model = new TargetReference().withType(TargetReferenceType.CHAOS_TARGET).withId("bt");
model = BinaryData.fromObject(model).toObject(TargetReference.class);
Assertions.assertEquals(TargetReferenceType.CHAOS_TARGET, model.type());
- Assertions.assertEquals("gsfraoyzkoow", model.id());
+ Assertions.assertEquals("bt", model.id());
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeInnerTests.java
index 585b05d7d3758..3f07e53901663 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeInnerTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeInnerTests.java
@@ -12,15 +12,15 @@ public final class TargetTypeInnerTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
TargetTypeInner model = BinaryData.fromString(
- "{\"location\":\"fimrzrtuzqogse\",\"properties\":{\"displayName\":\"evfdnwnwm\",\"description\":\"zsyyceuzso\",\"propertiesSchema\":\"judpfrxt\",\"resourceTypes\":[\"zvaytdwkqbr\"]},\"id\":\"ubpaxhe\",\"name\":\"iilivpdtiirqtd\",\"type\":\"oaxoruzfgsqu\"}")
+ "{\"location\":\"dpfrxtrthzvaytdw\",\"properties\":{\"displayName\":\"brqubp\",\"description\":\"h\",\"propertiesSchema\":\"iilivpdtiirqtd\",\"resourceTypes\":[\"xoruzfgsquyfxrx\",\"l\",\"ptramxj\"]},\"id\":\"zwl\",\"name\":\"nwxuqlcvydyp\",\"type\":\"tdooaoj\"}")
.toObject(TargetTypeInner.class);
- Assertions.assertEquals("fimrzrtuzqogse", model.location());
+ Assertions.assertEquals("dpfrxtrthzvaytdw", model.location());
}
@org.junit.jupiter.api.Test
public void testSerialize() throws Exception {
- TargetTypeInner model = new TargetTypeInner().withLocation("fimrzrtuzqogse");
+ TargetTypeInner model = new TargetTypeInner().withLocation("dpfrxtrthzvaytdw");
model = BinaryData.fromObject(model).toObject(TargetTypeInner.class);
- Assertions.assertEquals("fimrzrtuzqogse", model.location());
+ Assertions.assertEquals("dpfrxtrthzvaytdw", model.location());
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeListResultTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeListResultTests.java
index dc526578822a7..57bcae75c317c 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeListResultTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeListResultTests.java
@@ -11,7 +11,7 @@ public final class TargetTypeListResultTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
TargetTypeListResult model = BinaryData.fromString(
- "{\"value\":[{\"location\":\"aeqidbqfatpxll\",\"properties\":{\"displayName\":\"cyjmoadsuvarmy\",\"description\":\"mjsjqb\",\"propertiesSchema\":\"hyxxrwlycoduhpk\",\"resourceTypes\":[\"ymareqnajxqugj\",\"ky\"]},\"id\":\"ubeddg\",\"name\":\"sofwqmzqalkrmnji\",\"type\":\"pxacqqudfn\"}],\"nextLink\":\"xbaaabjyv\"}")
+ "{\"value\":[{\"location\":\"jwosytxitcskfck\",\"properties\":{\"displayName\":\"umiekkezzi\",\"description\":\"ly\",\"propertiesSchema\":\"hdgqggeb\",\"resourceTypes\":[\"ygaeqidbqfatpxl\"]},\"id\":\"rxcyjmoad\",\"name\":\"uvarmywdmjsjq\",\"type\":\"jhhyxxrwlycoduhp\"},{\"location\":\"gymare\",\"properties\":{\"displayName\":\"ajxq\",\"description\":\"jhkycub\",\"propertiesSchema\":\"dgssofwqmzqal\",\"resourceTypes\":[\"njijpxacqqudf\",\"byxbaaabjy\",\"ayffim\",\"zrtuzq\"]},\"id\":\"gsexne\",\"name\":\"fdnw\",\"type\":\"wmewzsyy\"}],\"nextLink\":\"uzsoi\"}")
.toObject(TargetTypeListResult.class);
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypePropertiesTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypePropertiesTests.java
index 7b5100b2d9329..77f878a50c55e 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypePropertiesTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypePropertiesTests.java
@@ -11,7 +11,7 @@ public final class TargetTypePropertiesTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
TargetTypeProperties model = BinaryData.fromString(
- "{\"displayName\":\"xrxxlep\",\"description\":\"amxjezwlw\",\"propertiesSchema\":\"xuqlcvydypat\",\"resourceTypes\":[\"aojkniodk\"]}")
+ "{\"displayName\":\"iodkooebwnujhem\",\"description\":\"bvdkcrodtjin\",\"propertiesSchema\":\"jlfltkacjvefkdlf\",\"resourceTypes\":[\"ggkfpagaowpul\",\"qblylsyxkqj\"]}")
.toObject(TargetTypeProperties.class);
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetWithResponseMockTests.java
index d112af34f7cb5..7f2f8f9293817 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetWithResponseMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetWithResponseMockTests.java
@@ -6,53 +6,34 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
import com.azure.resourcemanager.chaos.models.TargetType;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class TargetTypesGetWithResponseMockTests {
@Test
public void testGetWithResponse() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr
- = "{\"location\":\"ddrihpf\",\"properties\":{\"displayName\":\"qcaaewdaomdjvl\",\"description\":\"x\",\"propertiesSchema\":\"zb\",\"resourceTypes\":[\"geivsiykzkdncj\",\"xonbzoggculapz\"]},\"id\":\"y\",\"name\":\"pgogtqxepny\",\"type\":\"b\"}";
-
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
+ = "{\"location\":\"vlp\",\"properties\":{\"displayName\":\"xkzb\",\"description\":\"sgeivsiy\",\"propertiesSchema\":\"kdncj\",\"resourceTypes\":[\"nbzoggcu\",\"apzwyrpgog\",\"qxepnylbfuaj\",\"yjt\"]},\"id\":\"vofqzhvfc\",\"name\":\"byfmowuxr\",\"type\":\"jpvd\"}";
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
new AzureProfile("", "", AzureEnvironment.AZURE));
TargetType response = manager.targetTypes()
- .getWithResponse("qbmfpjbabwidf", "xsspuunnoxyhk", com.azure.core.util.Context.NONE)
+ .getWithResponse("qddrihpfhoqcaae", "dao", com.azure.core.util.Context.NONE)
.getValue();
- Assertions.assertEquals("ddrihpf", response.location());
+ Assertions.assertEquals("vlp", response.location());
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesListMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesListMockTests.java
index 43bef962fa2c1..e2e22ff7a30d9 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesListMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesListMockTests.java
@@ -6,53 +6,34 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
import com.azure.resourcemanager.chaos.models.TargetType;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class TargetTypesListMockTests {
@Test
public void testList() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr
- = "{\"value\":[{\"location\":\"aiy\",\"properties\":{\"displayName\":\"d\",\"description\":\"acegfnmntf\",\"propertiesSchema\":\"vm\",\"resourceTypes\":[\"nczdwvv\",\"alxlllchp\",\"db\"]},\"id\":\"evwrdnhfuk\",\"name\":\"vsjcswsmystuluqy\",\"type\":\"fcvlerch\"}]}";
-
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
+ = "{\"value\":[{\"location\":\"tfpmvmemfnczdw\",\"properties\":{\"displayName\":\"b\",\"description\":\"xlllchp\",\"propertiesSchema\":\"bzevwrd\",\"resourceTypes\":[\"ukuv\",\"jcswsmys\",\"uluqypfc\",\"lerchpq\"]},\"id\":\"mfpjbabw\",\"name\":\"dfc\",\"type\":\"sspuunnoxyhkx\"}]}";
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
new AzureProfile("", "", AzureEnvironment.AZURE));
PagedIterable response
- = manager.targetTypes().list("gsj", "mnwqj", com.azure.core.util.Context.NONE);
+ = manager.targetTypes().list("jkmnwq", "nobaiyhddviacegf", com.azure.core.util.Context.NONE);
- Assertions.assertEquals("aiy", response.iterator().next().location());
+ Assertions.assertEquals("tfpmvmemfnczdw", response.iterator().next().location());
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateWithResponseMockTests.java
index 8c32a74fc391c..e90bf7bc1e0a8 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateWithResponseMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateWithResponseMockTests.java
@@ -6,60 +6,42 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
import com.azure.resourcemanager.chaos.fluent.models.TargetInner;
import com.azure.resourcemanager.chaos.models.Target;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class TargetsCreateOrUpdateWithResponseMockTests {
@Test
public void testCreateOrUpdateWithResponse() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr
- = "{\"location\":\"ocxvdfffwafqr\",\"properties\":{\"unzo\":\"datadaspavehhrvk\",\"cxgkmoyxcdyui\":\"dataud\",\"aeoisrvh\":\"datahmfdnbzydvfvfcj\"},\"id\":\"gorf\",\"name\":\"ukiscvwmzhw\",\"type\":\"lefaxvxilcbtgn\"}";
-
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
+ = "{\"location\":\"udaspavehh\",\"properties\":{\"dhcxgkmoy\":\"datakbunzoz\",\"f\":\"datacdyuibhmfdnbzyd\",\"fukiscvwmzhw\":\"datafcjnaeoisrvhmgor\"},\"id\":\"lefaxvxilcbtgn\",\"name\":\"nzeyqxtjj\",\"type\":\"zqlqhyc\"}";
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
new AzureProfile("", "", AzureEnvironment.AZURE));
Target response = manager.targets()
- .createOrUpdateWithResponse("vluwmncsttij", "y", "vpo", "krsgsgb", "huzqgn",
- new TargetInner().withLocation("kynscliqhzv")
- .withProperties(mapOf("mtk", "datank", "ppnvdxz", "databo", "hlfkqojpy", "datahihfrbbcevqagtlt")),
+ .createOrUpdateWithResponse("a", "ysdzhez", "wva", "qyuvvfonkp", "hqyikvy",
+ new TargetInner().withLocation("yavluwmncstt")
+ .withProperties(mapOf("sgsgbdhu", "datafybvpoek", "hzvhxnkomtkubo", "dataqgnjdgkynscli",
+ "hihfrbbcevqagtlt", "datappnvdxz", "vgtrdcnifmzzs", "datahlfkqojpy")),
com.azure.core.util.Context.NONE)
.getValue();
- Assertions.assertEquals("ocxvdfffwafqr", response.location());
+ Assertions.assertEquals("udaspavehh", response.location());
}
// Use "Map.of" if available
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteWithResponseMockTests.java
index a870ee4717107..8a0e6764ea52e 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteWithResponseMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteWithResponseMockTests.java
@@ -6,48 +6,29 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class TargetsDeleteWithResponseMockTests {
@Test
public void testDeleteWithResponse() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr = "{}";
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
-
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
new AzureProfile("", "", AzureEnvironment.AZURE));
manager.targets()
- .deleteWithResponse("auzzptjazysd", "hezwwvaiq", "uvvfonkp", "hqyikvy", "auy",
+ .deleteWithResponse("wf", "jlb", "xqvkjlmxhomdyn", "dwdigumb", "raauzzpt",
com.azure.core.util.Context.NONE);
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsGetWithResponseMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsGetWithResponseMockTests.java
index 6a1eb6a6e8bed..59bab4e21bd8f 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsGetWithResponseMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsGetWithResponseMockTests.java
@@ -6,54 +6,35 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
import com.azure.resourcemanager.chaos.models.Target;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class TargetsGetWithResponseMockTests {
@Test
public void testGetWithResponse() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr
- = "{\"location\":\"mldgxobfirc\",\"properties\":{\"ayzri\":\"datapkc\"},\"id\":\"khyawfvjlboxqv\",\"name\":\"jlmxhomdynhd\",\"type\":\"digumbnr\"}";
-
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
+ = "{\"location\":\"ecxn\",\"properties\":{\"mlqtmldgxob\":\"dataicokpv\"},\"id\":\"irclnpk\",\"name\":\"iayz\",\"type\":\"iykhy\"}";
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
new AzureProfile("", "", AzureEnvironment.AZURE));
Target response = manager.targets()
- .getWithResponse("vtoepryutnw", "tpzdmovzvfvaawzq", "dflgzuri", "laecxndticok", "vzm",
+ .getWithResponse("zrrjvpgly", "zgkrvqe", "vtoepryutnw", "tpzdmovzvfvaawzq", "dflgzuri",
com.azure.core.util.Context.NONE)
.getValue();
- Assertions.assertEquals("mldgxobfirc", response.location());
+ Assertions.assertEquals("ecxn", response.location());
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsListMockTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsListMockTests.java
index 08af6d3894aa1..a247427faa881 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsListMockTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsListMockTests.java
@@ -6,53 +6,34 @@
import com.azure.core.credential.AccessToken;
import com.azure.core.http.HttpClient;
-import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpRequest;
-import com.azure.core.http.HttpResponse;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.profile.AzureProfile;
+import com.azure.core.test.http.MockHttpResponse;
import com.azure.resourcemanager.chaos.ChaosManager;
import com.azure.resourcemanager.chaos.models.Target;
-import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mockito;
-import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public final class TargetsListMockTests {
@Test
public void testList() throws Exception {
- HttpClient httpClient = Mockito.mock(HttpClient.class);
- HttpResponse httpResponse = Mockito.mock(HttpResponse.class);
- ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class);
-
String responseStr
- = "{\"value\":[{\"location\":\"ambtrnegvm\",\"properties\":{\"dspastjbkkdmfl\":\"datauqeqv\",\"jlxr\":\"dataest\",\"wk\":\"datailozapeewchpxlk\",\"yhjtqedcgzu\":\"dataziycslevufuztck\"},\"id\":\"wmmrq\",\"name\":\"zrrjvpgly\",\"type\":\"zgkrvqe\"}]}";
-
- Mockito.when(httpResponse.getStatusCode()).thenReturn(200);
- Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders());
- Mockito.when(httpResponse.getBody())
- .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8))));
- Mockito.when(httpResponse.getBodyAsByteArray())
- .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8)));
- Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> {
- Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue());
- return Mono.just(httpResponse);
- }));
+ = "{\"value\":[{\"location\":\"kdmflvestmjlx\",\"properties\":{\"wk\":\"datailozapeewchpxlk\"},\"id\":\"ziycslevufuztck\",\"name\":\"yhjtqedcgzu\",\"type\":\"wmmrq\"}]}";
+ HttpClient httpClient
+ = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8)));
ChaosManager manager = ChaosManager.configure()
.withHttpClient(httpClient)
.authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)),
new AzureProfile("", "", AzureEnvironment.AZURE));
PagedIterable response = manager.targets()
- .list("uajlyj", "lvofqzhvfcibyfmo", "uxrkjp", "dwxf", "wiivwzjbhyzsx", com.azure.core.util.Context.NONE);
+ .list("xfzwi", "vwzjbhyz", "xjrk", "mbtrnegvmnvu", "eqvldspast", com.azure.core.util.Context.NONE);
- Assertions.assertEquals("ambtrnegvm", response.iterator().next().location());
+ Assertions.assertEquals("kdmflvestmjlx", response.iterator().next().location());
}
}
diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/UserAssignedIdentityTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/UserAssignedIdentityTests.java
index b1fe4b0049d73..64bb17c199301 100644
--- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/UserAssignedIdentityTests.java
+++ b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/UserAssignedIdentityTests.java
@@ -11,7 +11,7 @@ public final class UserAssignedIdentityTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
UserAssignedIdentity model = BinaryData.fromString(
- "{\"principalId\":\"928a78b2-4f92-47c1-a5ee-1b78249ce92d\",\"clientId\":\"ff7e318d-8f6e-4d3f-b755-1092969d4109\"}")
+ "{\"principalId\":\"6d0dd435-596a-45a4-bf17-70a9cb0fc500\",\"clientId\":\"fc0c94e3-ae1a-4ec2-ba47-360e4827ce7e\"}")
.toObject(UserAssignedIdentity.class);
}