diff --git a/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md b/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md index ce03fbe3ff670..7d8dc0d373ceb 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md +++ b/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md @@ -1,14 +1,400 @@ # Release History -## 1.2.0-beta.1 (Unreleased) +## 1.0.0-beta.1 (2024-11-16) -### 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-2025-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 +#### `models.ResourceIdentity` was removed + +#### `models.ResourceIdentityType` was removed + +#### `models.OperationStatus` was removed + +#### `models.OperationStatuses` was removed + +#### `models.Experiment$DefinitionStages` was modified + +* `withSteps(java.util.List)` was removed in stage 3 + +#### `models.TargetType` was modified + +* `description()` was removed +* `location()` was removed +* `displayName()` was removed +* `resourceTypes()` was removed +* `propertiesSchema()` was removed + +#### `models.ExperimentExecutionDetails` was modified + +* `lastActionAt()` was removed +* `status()` was removed +* `failureReason()` was removed +* `startedAt()` was removed +* `stoppedAt()` was removed +* `runInformation()` was removed + +#### `models.Experiments` was modified + +* `getExecution(java.lang.String,java.lang.String,java.lang.String)` was removed +* `void cancel(java.lang.String,java.lang.String,com.azure.core.util.Context)` -> `models.PostActionResponse cancel(java.lang.String,java.lang.String,com.azure.core.util.Context)` +* `executionDetails(java.lang.String,java.lang.String,java.lang.String)` was removed +* `void start(java.lang.String,java.lang.String)` -> `models.PostActionResponse start(java.lang.String,java.lang.String)` +* `listAllExecutions(java.lang.String,java.lang.String,com.azure.core.util.Context)` was removed +* `listAllExecutions(java.lang.String,java.lang.String)` was removed +* `void cancel(java.lang.String,java.lang.String)` -> `models.PostActionResponse cancel(java.lang.String,java.lang.String)` +* `getExecutionWithResponse(java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.Context)` was removed +* `executionDetailsWithResponse(java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.Context)` was removed +* `void start(java.lang.String,java.lang.String,com.azure.core.util.Context)` -> `models.PostActionResponse start(java.lang.String,java.lang.String,com.azure.core.util.Context)` + +#### `models.CapabilityType` was modified + +* `runtimeProperties()` was removed +* `kind()` was removed +* `location()` was removed +* `targetType()` was removed +* `publisher()` was removed +* `description()` was removed +* `urn()` was removed +* `azureRbacActions()` was removed +* `azureRbacDataActions()` was removed +* `displayName()` was removed +* `parametersSchema()` was removed + +#### `models.ExperimentExecution` was modified + +* `status()` was removed +* `startedAt()` was removed +* `stoppedAt()` was removed + +#### `models.Capabilities` was modified + +* `get(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)` was removed +* `list(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.Context)` was removed +* `getWithResponse(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.Context)` was removed +* `createOrUpdate(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,fluent.models.CapabilityInner)` was removed +* `deleteWithResponse(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.Context)` was removed +* `list(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)` was removed +* `delete(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)` was removed +* `createOrUpdateWithResponse(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,fluent.models.CapabilityInner,com.azure.core.util.Context)` was removed + +#### `models.Operations` was modified + +* `listAll()` was removed +* `listAll(com.azure.core.util.Context)` was removed + +#### `models.Experiment$Definition` was modified + +* `withSteps(java.util.List)` was removed +* `withSelectors(java.util.List)` was removed +* `withIdentity(models.ResourceIdentity)` was removed + +#### `models.Experiment` was modified + +* `models.ResourceIdentity identity()` -> `models.ManagedServiceIdentity identity()` +* `void start()` -> `models.PostActionResponse start()` +* `void start(com.azure.core.util.Context)` -> `models.PostActionResponse start(com.azure.core.util.Context)` +* `void cancel(com.azure.core.util.Context)` -> `models.PostActionResponse cancel(com.azure.core.util.Context)` +* `void cancel()` -> `models.PostActionResponse cancel()` +* `provisioningState()` was removed +* `steps()` was removed +* `selectors()` was removed + +#### `models.Capability` was modified + +* `publisher()` was removed +* `description()` was removed +* `targetType()` was removed +* `parametersSchema()` was removed +* `urn()` was removed + +#### `ChaosManager` was modified + +* `operationStatuses()` was removed + +#### `models.ExperimentUpdate` was modified + +* `models.ResourceIdentity identity()` -> `models.ManagedServiceIdentityUpdate identity()` +* `withIdentity(models.ResourceIdentity)` was removed + +#### `models.Experiment$Update` was modified + +* `withIdentity(models.ResourceIdentity)` was removed + +### Features Added + +* `models.ManagedServiceIdentityUpdate` was added + +* `models.UserAssignedIdentities` was added + +* `models.ExperimentActionType` was added + +* `models.ExperimentExecutions` was added + +* `models.ExperimentExecutionDetailsProperties` was added + +* `models.Capability$UpdateStages` was added + +* `models.ManagedServiceIdentityType` was added + +* `models.Capability$Definition` was added + +* `models.Capability$DefinitionStages` was added + +* `models.TargetTypeProperties` was added + +* `models.PostActionResponse` was added + +* `models.ExperimentExecutionProperties` was added + +* `models.Capability$Update` was added + +* `models.ExperimentProperties` was added + +* `models.ManagedServiceIdentity` was added + +* `models.CapabilityTypeProperties` was added + +* `models.CapabilityProperties` was added + +#### `models.TargetListResult` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `withNextLink(java.lang.String)` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `withValue(java.util.List)` was added + +#### `models.ChaosTargetListSelector` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `type()` was added + +#### `models.OperationDisplay` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.TargetType` was modified + +* `properties()` was added + +#### `models.ChaosTargetSimpleFilterParameters` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.UserAssignedIdentity` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ExperimentExecutionDetails` was modified + +* `properties()` was added + +#### `models.DelayAction` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `type()` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.OperationListResult` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.CapabilityTypeListResult` was modified + +* `withNextLink(java.lang.String)` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `withValue(java.util.List)` was added + +#### `models.ChaosTargetQuerySelector` was modified + +* `type()` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ExperimentExecutionDetailsPropertiesRunInformation` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.StepStatus` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ContinuousAction` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `type()` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.CapabilityTypePropertiesRuntimeProperties` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ExperimentExecutionActionTargetDetailsError` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ExperimentListResult` was modified + +* `withNextLink(java.lang.String)` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `withValue(java.util.List)` was added + +#### `models.CapabilityType` was modified + +* `properties()` was added + +#### `models.ExperimentExecutionListResult` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `withValue(java.util.List)` was added +* `withNextLink(java.lang.String)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ExperimentExecution` was modified + +* `systemData()` was added +* `properties()` was added + +#### `models.ChaosExperimentBranch` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.KeyValuePair` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ChaosTargetFilter` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `type()` was added + +#### `models.ChaosTargetSimpleFilter` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `type()` was added + +#### `models.Capabilities` was modified + +* `deleteWithResponse(java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.Context)` was added +* `getWithResponse(java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.Context)` was added +* `delete(java.lang.String,java.lang.String,java.lang.String)` was added +* `get(java.lang.String,java.lang.String,java.lang.String)` was added +* `deleteByIdWithResponse(java.lang.String,com.azure.core.util.Context)` was added +* `define(java.lang.String)` was added +* `getByIdWithResponse(java.lang.String,com.azure.core.util.Context)` was added +* `getById(java.lang.String)` was added +* `deleteById(java.lang.String)` was added +* `list(java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.Context)` was added +* `list(java.lang.String,java.lang.String)` was added + +#### `models.Operations` was modified + +* `list()` was added +* `list(com.azure.core.util.Context)` was added + +#### `models.Experiment$Definition` was modified + +* `withIdentity(models.ManagedServiceIdentity)` was added +* `withProperties(models.ExperimentProperties)` was added + +#### `models.ChaosExperimentStep` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ChaosExperimentAction` was modified + +* `type()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.BranchStatus` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.TargetTypeListResult` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `withValue(java.util.List)` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `withNextLink(java.lang.String)` was added + +#### `models.Experiment` was modified + +* `properties()` was added + +#### `models.DiscreteAction` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `type()` was added + +#### `models.Capability` was modified + +* `update()` was added +* `resourceGroupName()` was added +* `refresh(com.azure.core.util.Context)` was added +* `properties()` was added +* `refresh()` was added + +#### `models.ActionStatus` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ChaosTargetSelector` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `type()` was added + +#### `ChaosManager` was modified + +* `experimentExecutions()` was added + +#### `models.CapabilityListResult` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `withValue(java.util.List)` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `withNextLink(java.lang.String)` was added + +#### `models.ExperimentExecutionActionTargetDetailsProperties` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ExperimentUpdate` was modified + +* `withIdentity(models.ManagedServiceIdentityUpdate)` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.TargetReference` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.Experiment$Update` was modified -### Other Changes +* `withIdentity(models.ManagedServiceIdentityUpdate)` 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..9e1f009448386 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/README.md +++ b/sdk/chaos/azure-resourcemanager-chaos/README.md @@ -2,7 +2,7 @@ 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). +This package contains Microsoft Azure SDK for Chaos Management SDK. Chaos Management Client. Package tag package-2025-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-chaos - 1.1.0 + 1.2.0-beta.1 ``` [//]: # ({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..6e399a1f0a1fd 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md +++ b/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md @@ -13,24 +13,23 @@ - [Get](#capabilitytypes_get) - [List](#capabilitytypes_list) +## ExperimentExecutions + +- [Get](#experimentexecutions_get) +- [GetExecutionDetails](#experimentexecutions_getexecutiondetails) +- [List](#experimentexecutions_list) + ## Experiments - [Cancel](#experiments_cancel) - [CreateOrUpdate](#experiments_createorupdate) - [Delete](#experiments_delete) -- [ExecutionDetails](#experiments_executiondetails) - [GetByResourceGroup](#experiments_getbyresourcegroup) -- [GetExecution](#experiments_getexecution) - [List](#experiments_list) -- [ListAllExecutions](#experiments_listallexecutions) - [ListByResourceGroup](#experiments_listbyresourcegroup) - [Start](#experiments_start) - [Update](#experiments_update) -## OperationStatuses - -- [Get](#operationstatuses_get) - ## TargetTypes - [Get](#targettypes_get) @@ -45,7 +44,7 @@ ### Capabilities_CreateOrUpdate ```java -import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; +import com.azure.resourcemanager.chaos.models.CapabilityProperties; /** * Samples for Capabilities CreateOrUpdate. @@ -53,7 +52,7 @@ import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; public final class CapabilitiesCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CreateUpdateCapability.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Capabilities_CreateOrUpdate.json */ /** * Sample code: Create/update a Capability that extends a virtual machine Target resource. @@ -62,9 +61,11 @@ 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() + .define("Shutdown-1.0") + .withExistingTarget("exampleRG", "Microsoft-VirtualMachine") + .withProperties(new CapabilityProperties()) + .create(); } } ``` @@ -78,7 +79,7 @@ public final class CapabilitiesCreateOrUpdateSamples { public final class CapabilitiesDeleteSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteCapability.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Capabilities_Delete.json */ /** * Sample code: Delete a Capability that extends a virtual machine Target resource. @@ -87,8 +88,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-VirtualMachine", "Shutdown-1.0", + com.azure.core.util.Context.NONE); } } ``` @@ -102,7 +104,7 @@ public final class CapabilitiesDeleteSamples { public final class CapabilitiesGetSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetCapability.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Capabilities_Get.json */ /** * Sample code: Get a Capability that extends a virtual machine Target resource. @@ -111,8 +113,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-VirtualMachine", "Shutdown-1.0", com.azure.core.util.Context.NONE); } } ``` @@ -126,7 +128,7 @@ public final class CapabilitiesGetSamples { public final class CapabilitiesListSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListCapabilities.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Capabilities_List.json */ /** * Sample code: List all Capabilities that extend a virtual machine Target resource. @@ -135,8 +137,7 @@ 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-VirtualMachine", null, com.azure.core.util.Context.NONE); } } ``` @@ -150,7 +151,7 @@ public final class CapabilitiesListSamples { public final class CapabilityTypesGetSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetCapabilityType.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/CapabilityTypes_Get.json */ /** * Sample code: Get a Capability Type for a virtual machine Target resource on westus2 location. @@ -159,8 +160,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); } } ``` @@ -174,7 +175,7 @@ public final class CapabilityTypesGetSamples { public final class CapabilityTypesListSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListCapabilityTypes.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/CapabilityTypes_List.json */ /** * Sample code: List all Capability Types for a virtual machine Target resource on westus2 location. @@ -188,208 +189,232 @@ public final class CapabilityTypesListSamples { } ``` -### Experiments_Cancel +### ExperimentExecutions_Get ```java /** - * Samples for Experiments Cancel. + * Samples for ExperimentExecutions Get. */ -public final class ExperimentsCancelSamples { +public final class ExperimentExecutionsGetSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CancelExperiment.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/ExperimentExecutions_Get.json */ /** - * Sample code: Cancel a running Experiment. + * Sample code: Get the execution of a Experiment. * * @param manager Entry point to ChaosManager. */ - public static void cancelARunningExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().cancel("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + public static void getTheExecutionOfAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experimentExecutions() + .getWithResponse("exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333", + com.azure.core.util.Context.NONE); } } ``` -### Experiments_CreateOrUpdate +### ExperimentExecutions_GetExecutionDetails ```java -import com.azure.resourcemanager.chaos.models.ChaosExperimentBranch; -import com.azure.resourcemanager.chaos.models.ChaosExperimentStep; -import com.azure.resourcemanager.chaos.models.ChaosTargetListSelector; -import com.azure.resourcemanager.chaos.models.ContinuousAction; -import com.azure.resourcemanager.chaos.models.KeyValuePair; -import com.azure.resourcemanager.chaos.models.ResourceIdentity; -import com.azure.resourcemanager.chaos.models.ResourceIdentityType; -import com.azure.resourcemanager.chaos.models.TargetReference; -import com.azure.resourcemanager.chaos.models.TargetReferenceType; -import java.time.Duration; -import java.util.Arrays; - /** - * Samples for Experiments CreateOrUpdate. + * Samples for ExperimentExecutions GetExecutionDetails. */ -public final class ExperimentsCreateOrUpdateSamples { +public final class ExperimentExecutionsGetExecutionDetailsSamples { /* - * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CreateUpdateExperiment.json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/ + * ExperimentExecutions_GetExecutionDetails.json */ /** - * Sample code: Create/update a Experiment in a resource group. + * Sample code: Get experiment execution details. * * @param manager Entry point to ChaosManager. */ - public static void createUpdateAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().define("exampleExperiment").withRegion("eastus2euap") - .withExistingResourceGroup("exampleRG") - .withSteps( - Arrays.asList(new ChaosExperimentStep().withName("step1") - .withBranches(Arrays.asList(new ChaosExperimentBranch().withName("branch1") - .withActions(Arrays.asList(new ContinuousAction() - .withName("urn:csci:microsoft:virtualMachine:shutdown/1.0") - .withDuration(Duration.parse("PT10M")) - .withParameters( - 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(); + public static void getExperimentExecutionDetails(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experimentExecutions() + .getExecutionDetailsWithResponse("exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333", + com.azure.core.util.Context.NONE); } } ``` -### Experiments_Delete +### ExperimentExecutions_List ```java /** - * Samples for Experiments Delete. + * Samples for ExperimentExecutions List. */ -public final class ExperimentsDeleteSamples { +public final class ExperimentExecutionsListSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteExperiment.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/ExperimentExecutions_List.json */ /** - * Sample code: Delete a Experiment in a resource group. + * Sample code: List all executions of an Experiment. * * @param manager Entry point to ChaosManager. */ - public static void deleteAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().delete("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + public static void listAllExecutionsOfAnExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experimentExecutions().list("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); } } ``` -### Experiments_ExecutionDetails +### Experiments_Cancel ```java /** - * Samples for Experiments ExecutionDetails. + * Samples for Experiments Cancel. */ -public final class ExperimentsExecutionDetailsSamples { +public final class ExperimentsCancelSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DetailsExperiment.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Experiments_Cancel.json */ /** - * Sample code: Get experiment execution details. + * Sample code: Cancel a running Experiment. * * @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); + public static void cancelARunningExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments().cancel("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); } } ``` -### Experiments_GetByResourceGroup +### Experiments_CreateOrUpdate ```java +import com.azure.resourcemanager.chaos.models.ChaosExperimentBranch; +import com.azure.resourcemanager.chaos.models.ChaosExperimentStep; +import com.azure.resourcemanager.chaos.models.ChaosTargetListSelector; +import com.azure.resourcemanager.chaos.models.ContinuousAction; +import com.azure.resourcemanager.chaos.models.ExperimentProperties; +import com.azure.resourcemanager.chaos.models.KeyValuePair; +import com.azure.resourcemanager.chaos.models.ManagedServiceIdentity; +import com.azure.resourcemanager.chaos.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.chaos.models.TargetReference; +import com.azure.resourcemanager.chaos.models.TargetReferenceType; +import java.time.Duration; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + /** - * Samples for Experiments GetByResourceGroup. + * Samples for Experiments CreateOrUpdate. */ -public final class ExperimentsGetByResourceGroupSamples { +public final class ExperimentsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperiment.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Experiments_CreateOrUpdate.json */ /** - * Sample code: Get a Experiment in a resource group. + * Sample code: Create/update a Experiment in a resource group. * * @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); + public static void createUpdateAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments() + .define("exampleExperiment") + .withRegion("eastus2euap") + .withExistingResourceGroup("exampleRG") + .withProperties( + new ExperimentProperties() + .withSteps(Arrays.asList(new ChaosExperimentStep().withName("step1") + .withBranches(Arrays.asList(new ChaosExperimentBranch().withName("branch1") + .withActions(Arrays.asList( + new ContinuousAction().withName("urn:csci:microsoft:virtualMachine:shutdown/1.0") + .withDuration(Duration.parse("PT10M")) + .withParameters(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")))))) + .withTags(mapOf("key2138", "fakeTokenPlaceholder", "key7131", "fakeTokenPlaceholder")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; } } ``` -### Experiments_GetExecution +### Experiments_Delete ```java /** - * Samples for Experiments GetExecution. + * Samples for Experiments Delete. */ -public final class ExperimentsGetExecutionSamples { +public final class ExperimentsDeleteSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperimentExecution.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Experiments_Delete.json */ /** - * Sample code: Get the execution of a Experiment. + * Sample code: Delete a Experiment in a resource group. * * @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); + public static void deleteAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments().delete("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); } } ``` -### Experiments_List +### Experiments_GetByResourceGroup ```java /** - * Samples for Experiments List. + * Samples for Experiments GetByResourceGroup. */ -public final class ExperimentsListSamples { +public final class ExperimentsGetByResourceGroupSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInASubscription. - * json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Experiments_Get.json */ /** - * Sample code: List all Experiments in a subscription. + * Sample code: Get a Experiment in a resource group. * * @param manager Entry point to ChaosManager. */ - public static void listAllExperimentsInASubscription(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().list(null, null, com.azure.core.util.Context.NONE); + public static void getAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments() + .getByResourceGroupWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); } } ``` -### Experiments_ListAllExecutions +### Experiments_List ```java /** - * Samples for Experiments ListAllExecutions. + * Samples for Experiments List. */ -public final class ExperimentsListAllExecutionsSamples { +public final class ExperimentsListSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentExecutions.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Experiments_ListBySubscription. + * json */ /** - * Sample code: List all executions of an Experiment. + * Sample code: List all Experiments in a subscription. * * @param manager Entry point to ChaosManager. */ - public static void listAllExecutionsOfAnExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().listAllExecutions("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + public static void listAllExperimentsInASubscription(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments().list(null, null, com.azure.core.util.Context.NONE); } } ``` @@ -403,7 +428,7 @@ public final class ExperimentsListAllExecutionsSamples { public final class ExperimentsListByResourceGroupSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInAResourceGroup. + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Experiments_ListByResourceGroup. * json */ /** @@ -426,7 +451,7 @@ public final class ExperimentsListByResourceGroupSamples { public final class ExperimentsStartSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/StartExperiment.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Experiments_Start.json */ /** * Sample code: Start a Experiment. @@ -443,11 +468,6 @@ public final class ExperimentsStartSamples { ```java import com.azure.resourcemanager.chaos.models.Experiment; -import com.azure.resourcemanager.chaos.models.ResourceIdentity; -import com.azure.resourcemanager.chaos.models.ResourceIdentityType; -import com.azure.resourcemanager.chaos.models.UserAssignedIdentity; -import java.util.HashMap; -import java.util.Map; /** * Samples for Experiments Update. @@ -455,57 +475,18 @@ import java.util.Map; public final class ExperimentsUpdateSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/UpdateExperiment.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Experiments_Update.json */ /** - * Sample code: Update an Experiment in a resource group. + * Sample code: Update an Experiment. * * @param manager Entry point to ChaosManager. */ - public static void updateAnExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + public static void updateAnExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { 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()))) - .apply(); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} -``` - -### OperationStatuses_Get - -```java -/** - * Samples for OperationStatuses Get. - */ -public final class OperationStatusesGetSamples { - /* - * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetOperationStatus.json - */ - /** - * Sample code: Get specific operation status. - * - * @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); + resource.update().apply(); } } ``` @@ -519,7 +500,7 @@ public final class OperationStatusesGetSamples { public final class TargetTypesGetSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetTargetType.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/TargetTypes_Get.json */ /** * Sample code: Get a Target Type for westus2 location. @@ -541,7 +522,7 @@ public final class TargetTypesGetSamples { public final class TargetTypesListSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListTargetTypes.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/TargetTypes_List.json */ /** * Sample code: List all Target Types for westus2 location. @@ -557,12 +538,6 @@ public final class TargetTypesListSamples { ### Targets_CreateOrUpdate ```java -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerEncoding; -import com.azure.resourcemanager.chaos.fluent.models.TargetInner; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; /** * Samples for Targets CreateOrUpdate. @@ -570,34 +545,18 @@ import java.util.Map; public final class TargetsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CreateUpdateTarget.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Targets_CreateOrUpdate.json */ /** * Sample code: Create/update a Target that extends a virtual machine resource. * * @param manager Entry point to ChaosManager. */ - 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); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; + public static void + createUpdateATargetThatExtendsAVirtualMachineResource(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.targets() + .createOrUpdateWithResponse("exampleRG", "Microsoft-Agent", "Microsoft.Compute", "virtualMachines", + "exampleVM", null, com.azure.core.util.Context.NONE); } } ``` @@ -611,7 +570,7 @@ public final class TargetsCreateOrUpdateSamples { public final class TargetsDeleteSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteTarget.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Targets_Delete.json */ /** * Sample code: Delete a Target that extends a virtual machine resource. @@ -620,8 +579,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-Agent", "Microsoft.Compute", "virtualMachines", "exampleVM", + com.azure.core.util.Context.NONE); } } ``` @@ -635,7 +595,7 @@ public final class TargetsDeleteSamples { public final class TargetsGetSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetTarget.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Targets_Get.json */ /** * Sample code: Get a Target that extends a virtual machine resource. @@ -644,8 +604,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-Agent", "Microsoft.Compute", "virtualMachines", "exampleVM", + com.azure.core.util.Context.NONE); } } ``` @@ -659,7 +620,7 @@ public final class TargetsGetSamples { public final class TargetsListSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListTargets.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Targets_List.json */ /** * Sample code: List all Targets that extend a virtual machine resource. @@ -668,8 +629,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 f022ae455d2e5..0860718842b8a 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/pom.xml +++ b/sdk/chaos/azure-resourcemanager-chaos/pom.xml @@ -18,7 +18,7 @@ jar Microsoft Azure SDK for Chaos Management - This package contains Microsoft Azure SDK for Chaos Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Chaos Management Client. Package tag package-2024-01. + This package contains Microsoft Azure SDK for Chaos Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Chaos Management Client. Package tag package-2025-01. https://github.com/Azure/azure-sdk-for-java @@ -45,6 +45,8 @@ UTF-8 0 0 + true + false 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..9a8eff8b37026 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; @@ -27,15 +27,15 @@ import com.azure.resourcemanager.chaos.implementation.CapabilitiesImpl; import com.azure.resourcemanager.chaos.implementation.CapabilityTypesImpl; import com.azure.resourcemanager.chaos.implementation.ChaosManagementClientBuilder; +import com.azure.resourcemanager.chaos.implementation.ExperimentExecutionsImpl; import com.azure.resourcemanager.chaos.implementation.ExperimentsImpl; -import com.azure.resourcemanager.chaos.implementation.OperationStatusesImpl; import com.azure.resourcemanager.chaos.implementation.OperationsImpl; import com.azure.resourcemanager.chaos.implementation.TargetTypesImpl; import com.azure.resourcemanager.chaos.implementation.TargetsImpl; import com.azure.resourcemanager.chaos.models.Capabilities; import com.azure.resourcemanager.chaos.models.CapabilityTypes; +import com.azure.resourcemanager.chaos.models.ExperimentExecutions; import com.azure.resourcemanager.chaos.models.Experiments; -import com.azure.resourcemanager.chaos.models.OperationStatuses; import com.azure.resourcemanager.chaos.models.Operations; import com.azure.resourcemanager.chaos.models.TargetTypes; import com.azure.resourcemanager.chaos.models.Targets; @@ -51,20 +51,20 @@ * Chaos Management Client. */ public final class ChaosManager { - private Capabilities capabilities; - - private CapabilityTypes capabilityTypes; + private Operations operations; private Experiments experiments; - private OperationStatuses operationStatuses; - - private Operations operations; - private TargetTypes targetTypes; + private CapabilityTypes capabilityTypes; + private Targets targets; + private ExperimentExecutions experimentExecutions; + + private Capabilities capabilities; + private final ChaosManagementClient clientObject; private ChaosManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -229,7 +229,7 @@ public ChaosManager authenticate(TokenCredential credential, AzureProfile profil .append("-") .append("com.azure.resourcemanager.chaos") .append("/") - .append("1.1.0"); + .append("1.0.0-beta.1"); 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())); @@ -276,27 +276,15 @@ public ChaosManager authenticate(TokenCredential credential, AzureProfile profil } /** - * Gets the resource collection API of Capabilities. - * - * @return Resource collection API of Capabilities. - */ - public Capabilities capabilities() { - if (this.capabilities == null) { - this.capabilities = new CapabilitiesImpl(clientObject.getCapabilities(), this); - } - return capabilities; - } - - /** - * Gets the resource collection API of CapabilityTypes. + * Gets the resource collection API of Operations. * - * @return Resource collection API of CapabilityTypes. + * @return Resource collection API of Operations. */ - public CapabilityTypes capabilityTypes() { - if (this.capabilityTypes == null) { - this.capabilityTypes = new CapabilityTypesImpl(clientObject.getCapabilityTypes(), this); + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); } - return capabilityTypes; + return operations; } /** @@ -311,30 +299,6 @@ public Experiments experiments() { return experiments; } - /** - * Gets the resource collection API of OperationStatuses. - * - * @return Resource collection API of OperationStatuses. - */ - public OperationStatuses operationStatuses() { - if (this.operationStatuses == null) { - this.operationStatuses = new OperationStatusesImpl(clientObject.getOperationStatuses(), this); - } - return operationStatuses; - } - - /** - * Gets the resource collection API of Operations. - * - * @return Resource collection API of Operations. - */ - public Operations operations() { - if (this.operations == null) { - this.operations = new OperationsImpl(clientObject.getOperations(), this); - } - return operations; - } - /** * Gets the resource collection API of TargetTypes. * @@ -347,6 +311,18 @@ public TargetTypes targetTypes() { return targetTypes; } + /** + * Gets the resource collection API of CapabilityTypes. + * + * @return Resource collection API of CapabilityTypes. + */ + public CapabilityTypes capabilityTypes() { + if (this.capabilityTypes == null) { + this.capabilityTypes = new CapabilityTypesImpl(clientObject.getCapabilityTypes(), this); + } + return capabilityTypes; + } + /** * Gets the resource collection API of Targets. * @@ -359,6 +335,30 @@ public Targets targets() { return targets; } + /** + * Gets the resource collection API of ExperimentExecutions. + * + * @return Resource collection API of ExperimentExecutions. + */ + public ExperimentExecutions experimentExecutions() { + if (this.experimentExecutions == null) { + this.experimentExecutions = new ExperimentExecutionsImpl(clientObject.getExperimentExecutions(), this); + } + return experimentExecutions; + } + + /** + * Gets the resource collection API of Capabilities. It manages Capability. + * + * @return Resource collection API of Capabilities. + */ + public Capabilities capabilities() { + if (this.capabilities == null) { + this.capabilities = new CapabilitiesImpl(clientObject.getCapabilities(), this); + } + return capabilities; + } + /** * Gets wrapped service client ChaosManagementClient providing direct access to the underlying auto-generated API * implementation, based on Azure REST API. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/CapabilitiesClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/CapabilitiesClient.java index 711876aab678d..0e2e422b4a65c 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/CapabilitiesClient.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/CapabilitiesClient.java @@ -18,10 +18,7 @@ public interface CapabilitiesClient { /** * Get a list of Capability resources that extend a Target resource.. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -30,16 +27,12 @@ public interface CapabilitiesClient { * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName); + PagedIterable list(String resourceGroupName, String targetName); /** * Get a list of Capability resources that extend a Target resource.. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. @@ -50,17 +43,13 @@ PagedIterable list(String resourceGroupName, String parentProvi * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String continuationToken, + PagedIterable list(String resourceGroupName, String targetName, String continuationToken, Context context); /** * Get a Capability resource that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. * @param context The context to associate with this operation. @@ -70,17 +59,13 @@ PagedIterable list(String resourceGroupName, String parentProvi * @return a Capability resource that extends a Target resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String capabilityName, + Response getWithResponse(String resourceGroupName, String targetName, String capabilityName, Context context); /** * Get a Capability resource that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -89,83 +74,67 @@ Response getWithResponse(String resourceGroupName, String paren * @return a Capability resource that extends a Target resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - CapabilityInner get(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName, String capabilityName); + CapabilityInner get(String resourceGroupName, String targetName, String capabilityName); /** - * Delete a Capability that extends a Target resource. + * Create or update a Capability resource that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. + * @param resource Capability resource to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. + * @return model that represents a Capability resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String capabilityName, - Context context); + Response createOrUpdateWithResponse(String resourceGroupName, String targetName, + String capabilityName, CapabilityInner resource, Context context); /** - * Delete a Capability that extends a Target resource. + * Create or update a Capability resource that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. + * @param resource Capability resource to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Capability resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName, String capabilityName); + CapabilityInner createOrUpdate(String resourceGroupName, String targetName, String capabilityName, + CapabilityInner resource); /** - * Create or update a Capability resource that extends a Target resource. + * Delete a Capability that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. - * @param capability Capability resource to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a Capability resource along with {@link Response}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response createOrUpdateWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String capabilityName, - CapabilityInner capability, Context context); + Response deleteWithResponse(String resourceGroupName, String targetName, String capabilityName, + Context context); /** - * Create or update a Capability resource that extends a Target resource. + * Delete a Capability that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. - * @param capability Capability resource to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a Capability resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - CapabilityInner createOrUpdate(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName, String capabilityName, CapabilityInner capability); + void delete(String resourceGroupName, String targetName, String capabilityName); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/CapabilityTypesClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/CapabilityTypesClient.java index 723d735439ac3..659e98011b2c9 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/CapabilityTypesClient.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/CapabilityTypesClient.java @@ -18,7 +18,7 @@ public interface CapabilityTypesClient { /** * Get a list of Capability Type resources for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -27,12 +27,12 @@ public interface CapabilityTypesClient { * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String locationName, String targetTypeName); + PagedIterable list(String location, String targetTypeName); /** * Get a list of Capability Type resources for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. @@ -43,13 +43,13 @@ public interface CapabilityTypesClient { * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String locationName, String targetTypeName, String continuationToken, + PagedIterable list(String location, String targetTypeName, String continuationToken, Context context); /** * Get a Capability Type resource for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param capabilityTypeName String that represents a Capability Type resource name. * @param context The context to associate with this operation. @@ -59,13 +59,13 @@ PagedIterable list(String locationName, String targetTypeNa * @return a Capability Type resource for given Target Type and location along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String locationName, String targetTypeName, String capabilityTypeName, + Response getWithResponse(String location, String targetTypeName, String capabilityTypeName, Context context); /** * Get a Capability Type resource for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param capabilityTypeName String that represents a Capability Type resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -74,5 +74,5 @@ Response getWithResponse(String locationName, String target * @return a Capability Type resource for given Target Type and location. */ @ServiceMethod(returns = ReturnType.SINGLE) - CapabilityTypeInner get(String locationName, String targetTypeName, String capabilityTypeName); + CapabilityTypeInner get(String location, String targetTypeName, String capabilityTypeName); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ChaosManagementClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ChaosManagementClient.java index 0957af884ce84..73855613c3a5d 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ChaosManagementClient.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ChaosManagementClient.java @@ -12,7 +12,7 @@ */ public interface ChaosManagementClient { /** - * Gets GUID that represents an Azure subscription ID. + * Gets The ID of the target subscription. The value must be an UUID. * * @return the subscriptionId value. */ @@ -47,51 +47,51 @@ public interface ChaosManagementClient { Duration getDefaultPollInterval(); /** - * Gets the CapabilitiesClient object to access its operations. + * Gets the OperationsClient object to access its operations. * - * @return the CapabilitiesClient object. + * @return the OperationsClient object. */ - CapabilitiesClient getCapabilities(); + OperationsClient getOperations(); /** - * Gets the CapabilityTypesClient object to access its operations. + * Gets the ExperimentsClient object to access its operations. * - * @return the CapabilityTypesClient object. + * @return the ExperimentsClient object. */ - CapabilityTypesClient getCapabilityTypes(); + ExperimentsClient getExperiments(); /** - * Gets the ExperimentsClient object to access its operations. + * Gets the TargetTypesClient object to access its operations. * - * @return the ExperimentsClient object. + * @return the TargetTypesClient object. */ - ExperimentsClient getExperiments(); + TargetTypesClient getTargetTypes(); /** - * Gets the OperationStatusesClient object to access its operations. + * Gets the CapabilityTypesClient object to access its operations. * - * @return the OperationStatusesClient object. + * @return the CapabilityTypesClient object. */ - OperationStatusesClient getOperationStatuses(); + CapabilityTypesClient getCapabilityTypes(); /** - * Gets the OperationsClient object to access its operations. + * Gets the TargetsClient object to access its operations. * - * @return the OperationsClient object. + * @return the TargetsClient object. */ - OperationsClient getOperations(); + TargetsClient getTargets(); /** - * Gets the TargetTypesClient object to access its operations. + * Gets the ExperimentExecutionsClient object to access its operations. * - * @return the TargetTypesClient object. + * @return the ExperimentExecutionsClient object. */ - TargetTypesClient getTargetTypes(); + ExperimentExecutionsClient getExperimentExecutions(); /** - * Gets the TargetsClient object to access its operations. + * Gets the CapabilitiesClient object to access its operations. * - * @return the TargetsClient object. + * @return the CapabilitiesClient object. */ - TargetsClient getTargets(); + CapabilitiesClient getCapabilities(); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ExperimentExecutionsClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ExperimentExecutionsClient.java new file mode 100644 index 0000000000000..d2525b03ce706 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ExperimentExecutionsClient.java @@ -0,0 +1,106 @@ +// 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.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionInner; + +/** + * An instance of this class provides access to all the operations defined in ExperimentExecutionsClient. + */ +public interface ExperimentExecutionsClient { + /** + * Get a list of executions of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String experimentName); + + /** + * Get a list of executions of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String experimentName, Context context); + + /** + * Get an execution of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of an Experiment resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String experimentName, + String executionId, Context context); + + /** + * Get an execution of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of an Experiment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExperimentExecutionInner get(String resourceGroupName, String experimentName, String executionId); + + /** + * Execution details of an experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the execution details of an Experiment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getExecutionDetailsWithResponse(String resourceGroupName, + String experimentName, String executionId, Context context); + + /** + * Execution details of an experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the execution details of an Experiment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExperimentExecutionDetailsInner getExecutionDetails(String resourceGroupName, String experimentName, + String executionId); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ExperimentsClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ExperimentsClient.java index 266e6c4ba7ea1..afc8c715fde56 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ExperimentsClient.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ExperimentsClient.java @@ -11,9 +11,8 @@ import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionInner; import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner; +import com.azure.resourcemanager.chaos.fluent.models.PostActionResponseInner; import com.azure.resourcemanager.chaos.models.ExperimentUpdate; /** @@ -48,7 +47,7 @@ public interface ExperimentsClient { /** * Get a list of Experiment resources in a resource group. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -60,7 +59,7 @@ public interface ExperimentsClient { /** * Get a list of Experiment resources in a resource group. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param running Optional value that indicates whether to filter results based on if the Experiment is currently * running. If null, then the results will not be filtered. * @param continuationToken String that sets the continuation token. @@ -74,62 +73,10 @@ public interface ExperimentsClient { PagedIterable listByResourceGroup(String resourceGroupName, Boolean running, String continuationToken, Context context); - /** - * Delete a Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceGroupName, String experimentName); - - /** - * Delete a Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceGroupName, String experimentName, Context context); - - /** - * Delete a Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String experimentName); - - /** - * Delete a Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String experimentName, Context context); - /** * Get a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -144,7 +91,7 @@ Response getByResourceGroupWithResponse(String resourceGroupNam /** * Get a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -157,9 +104,9 @@ Response getByResourceGroupWithResponse(String resourceGroupNam /** * Create or update a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. + * @param resource Experiment resource to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -167,14 +114,14 @@ Response getByResourceGroupWithResponse(String resourceGroupNam */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ExperimentInner> beginCreateOrUpdate(String resourceGroupName, - String experimentName, ExperimentInner experiment); + String experimentName, ExperimentInner resource); /** * Create or update a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. + * @param resource Experiment resource to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -183,28 +130,28 @@ SyncPoller, ExperimentInner> beginCreateOrUpdate(Str */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ExperimentInner> beginCreateOrUpdate(String resourceGroupName, - String experimentName, ExperimentInner experiment, Context context); + String experimentName, ExperimentInner resource, Context context); /** * Create or update a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. + * @param resource Experiment resource to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return model that represents a Experiment resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - ExperimentInner createOrUpdate(String resourceGroupName, String experimentName, ExperimentInner experiment); + ExperimentInner createOrUpdate(String resourceGroupName, String experimentName, ExperimentInner resource); /** * Create or update a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. + * @param resource Experiment resource to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -212,15 +159,15 @@ SyncPoller, ExperimentInner> beginCreateOrUpdate(Str * @return model that represents a Experiment resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - ExperimentInner createOrUpdate(String resourceGroupName, String experimentName, ExperimentInner experiment, + ExperimentInner createOrUpdate(String resourceGroupName, String experimentName, ExperimentInner resource, Context context); /** * The operation to update an experiment. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. + * @param properties Parameters supplied to the Update experiment operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -228,14 +175,14 @@ ExperimentInner createOrUpdate(String resourceGroupName, String experimentName, */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ExperimentInner> beginUpdate(String resourceGroupName, - String experimentName, ExperimentUpdate experiment); + String experimentName, ExperimentUpdate properties); /** * The operation to update an experiment. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. + * @param properties Parameters supplied to the Update experiment operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -244,28 +191,28 @@ SyncPoller, ExperimentInner> beginUpdate(String reso */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ExperimentInner> beginUpdate(String resourceGroupName, - String experimentName, ExperimentUpdate experiment, Context context); + String experimentName, ExperimentUpdate properties, Context context); /** * The operation to update an experiment. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. + * @param properties Parameters supplied to the Update experiment operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return model that represents a Experiment resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - ExperimentInner update(String resourceGroupName, String experimentName, ExperimentUpdate experiment); + ExperimentInner update(String resourceGroupName, String experimentName, ExperimentUpdate properties); /** * The operation to update an experiment. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. + * @param properties Parameters supplied to the Update experiment operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -273,13 +220,13 @@ SyncPoller, ExperimentInner> beginUpdate(String reso * @return model that represents a Experiment resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - ExperimentInner update(String resourceGroupName, String experimentName, ExperimentUpdate experiment, + ExperimentInner update(String resourceGroupName, String experimentName, ExperimentUpdate properties, Context context); /** - * Cancel a running Experiment resource. + * Delete a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -287,12 +234,12 @@ ExperimentInner update(String resourceGroupName, String experimentName, Experime * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginCancel(String resourceGroupName, String experimentName); + SyncPoller, Void> beginDelete(String resourceGroupName, String experimentName); /** - * Cancel a running Experiment resource. + * Delete a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -301,24 +248,24 @@ ExperimentInner update(String resourceGroupName, String experimentName, Experime * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginCancel(String resourceGroupName, String experimentName, Context context); + SyncPoller, Void> beginDelete(String resourceGroupName, String experimentName, Context context); /** - * Cancel a running Experiment resource. + * Delete a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - void cancel(String resourceGroupName, String experimentName); + void delete(String resourceGroupName, String experimentName); /** - * Cancel a running Experiment resource. + * Delete a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -326,146 +273,117 @@ ExperimentInner update(String resourceGroupName, String experimentName, Experime * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - void cancel(String resourceGroupName, String experimentName, Context context); + void delete(String resourceGroupName, String experimentName, Context context); /** - * Start a Experiment resource. + * Cancel a running Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. + * @return the {@link SyncPoller} for polling of model that represents the post action response. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginStart(String resourceGroupName, String experimentName); + SyncPoller, PostActionResponseInner> beginCancel(String resourceGroupName, + String experimentName); /** - * Start a Experiment resource. + * Cancel a running Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. + * @return the {@link SyncPoller} for polling of model that represents the post action response. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginStart(String resourceGroupName, String experimentName, Context context); + SyncPoller, PostActionResponseInner> beginCancel(String resourceGroupName, + String experimentName, Context context); /** - * Start a Experiment resource. + * Cancel a running Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the post action response. */ @ServiceMethod(returns = ReturnType.SINGLE) - void start(String resourceGroupName, String experimentName); + PostActionResponseInner cancel(String resourceGroupName, String experimentName); /** - * Start a Experiment resource. + * Cancel a running Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the post action response. */ @ServiceMethod(returns = ReturnType.SINGLE) - void start(String resourceGroupName, String experimentName, Context context); + PostActionResponseInner cancel(String resourceGroupName, String experimentName, Context context); /** - * Get a list of executions of an Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listAllExecutions(String resourceGroupName, String experimentName); - - /** - * Get a list of executions of an Experiment resource. + * Start a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. + * @return the {@link SyncPoller} for polling of model that represents the post action response. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listAllExecutions(String resourceGroupName, String experimentName, - Context context); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PostActionResponseInner> beginStart(String resourceGroupName, + String experimentName); /** - * Get an execution of an Experiment resource. + * Start a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an execution of an Experiment resource along with {@link Response}. + * @return the {@link SyncPoller} for polling of model that represents the post action response. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getExecutionWithResponse(String resourceGroupName, String experimentName, - String executionId, Context context); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PostActionResponseInner> beginStart(String resourceGroupName, + String experimentName, Context context); /** - * Get an execution of an Experiment resource. + * Start a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an execution of an Experiment resource. + * @return model that represents the post action response. */ @ServiceMethod(returns = ReturnType.SINGLE) - ExperimentExecutionInner getExecution(String resourceGroupName, String experimentName, String executionId); + PostActionResponseInner start(String resourceGroupName, String experimentName); /** - * Execution details of an experiment resource. + * Start a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents the execution details of an Experiment along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response executionDetailsWithResponse(String resourceGroupName, - String experimentName, String executionId, Context context); - - /** - * Execution details of an experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents the execution details of an Experiment. + * @return model that represents the post action response. */ @ServiceMethod(returns = ReturnType.SINGLE) - ExperimentExecutionDetailsInner executionDetails(String resourceGroupName, String experimentName, - String executionId); + PostActionResponseInner start(String resourceGroupName, String experimentName, Context context); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/OperationStatusesClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/OperationStatusesClient.java deleted file mode 100644 index 87083b88e1ee8..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/OperationStatusesClient.java +++ /dev/null @@ -1,43 +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.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner; - -/** - * An instance of this class provides access to all the operations defined in OperationStatusesClient. - */ -public interface OperationStatusesClient { - /** - * Get the status of a long running azure asynchronous operation. - * - * @param location The name of the Azure region. - * @param asyncOperationId The operation Id. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the status of a long running azure asynchronous operation along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String location, String asyncOperationId, Context context); - - /** - * Get the status of a long running azure asynchronous operation. - * - * @param location The name of the Azure region. - * @param asyncOperationId The operation Id. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the status of a long running azure asynchronous operation. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - OperationStatusInner get(String location, String asyncOperationId); -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/OperationsClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/OperationsClient.java index 6be2ec3d60b24..bfae884ffd6e2 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/OperationsClient.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/OperationsClient.java @@ -15,24 +15,26 @@ */ public interface OperationsClient { /** - * Get a list all available Operations. + * List the operations for the provider. * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list all available Operations as paginated response with {@link PagedIterable}. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listAll(); + PagedIterable list(); /** - * Get a list all available Operations. + * List the operations for the provider. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list all available Operations as paginated response with {@link PagedIterable}. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listAll(Context context); + PagedIterable list(Context context); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/TargetTypesClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/TargetTypesClient.java index 92e8fb223c8f3..01639c997d894 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/TargetTypesClient.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/TargetTypesClient.java @@ -18,19 +18,19 @@ public interface TargetTypesClient { /** * Get a list of Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of Target Type resources for given location as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String locationName); + PagedIterable list(String location); /** * Get a list of Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -39,12 +39,12 @@ public interface TargetTypesClient { * @return a list of Target Type resources for given location as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String locationName, String continuationToken, Context context); + PagedIterable list(String location, String continuationToken, Context context); /** * Get a Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -53,12 +53,12 @@ public interface TargetTypesClient { * @return a Target Type resources for given location along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String locationName, String targetTypeName, Context context); + Response getWithResponse(String location, String targetTypeName, Context context); /** * Get a Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -66,5 +66,5 @@ public interface TargetTypesClient { * @return a Target Type resources for given location. */ @ServiceMethod(returns = ReturnType.SINGLE) - TargetTypeInner get(String locationName, String targetTypeName); + TargetTypeInner get(String location, String targetTypeName); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/TargetsClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/TargetsClient.java index 0caf92afda5df..74af0ccf3ba78 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/TargetsClient.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/TargetsClient.java @@ -18,10 +18,10 @@ public interface TargetsClient { /** * Get a list of Target resources that extend a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -35,10 +35,10 @@ PagedIterable list(String resourceGroupName, String parentProviderN /** * Get a list of Target resources that extend a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -54,11 +54,11 @@ PagedIterable list(String resourceGroupName, String parentProviderN /** * Get a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -66,94 +66,95 @@ PagedIterable list(String resourceGroupName, String parentProviderN * @return a Target resource that extends a tracked regional resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, Context context); + Response getWithResponse(String resourceGroupName, String targetName, String parentProviderNamespace, + String parentResourceType, String parentResourceName, Context context); /** * Get a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a Target resource that extends a tracked regional resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - TargetInner get(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName); + TargetInner get(String resourceGroupName, String targetName, String parentProviderNamespace, + String parentResourceType, String parentResourceName); /** - * Delete a Target resource that extends a tracked regional resource. + * Create or update a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. + * @param resource Target resource to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. + * @return model that represents a Target resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, Context context); + Response createOrUpdateWithResponse(String resourceGroupName, String targetName, + String parentProviderNamespace, String parentResourceType, String parentResourceName, TargetInner resource, + Context context); /** - * Delete a Target resource that extends a tracked regional resource. + * Create or update a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. + * @param resource Target resource to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Target resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName); + TargetInner createOrUpdate(String resourceGroupName, String targetName, String parentProviderNamespace, + String parentResourceType, String parentResourceName, TargetInner resource); /** - * Create or update a Target resource that extends a tracked regional resource. + * Delete a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. - * @param target Target resource to be created or updated. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a Target resource along with {@link Response}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response createOrUpdateWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, TargetInner target, Context context); + Response deleteWithResponse(String resourceGroupName, String targetName, String parentProviderNamespace, + String parentResourceType, String parentResourceName, Context context); /** - * Create or update a Target resource that extends a tracked regional resource. + * Delete a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. - * @param target Target resource to be created or updated. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a Target resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - TargetInner createOrUpdate(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName, TargetInner target); + void delete(String resourceGroupName, String targetName, String parentProviderNamespace, String parentResourceType, + String parentResourceName); } 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..a2c782693593a 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 @@ -4,27 +4,44 @@ package com.azure.resourcemanager.chaos.fluent.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; 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 com.azure.resourcemanager.chaos.models.CapabilityProperties; +import java.io.IOException; /** * Model that represents a Capability resource. */ -@Immutable +@Fluent public final class CapabilityInner extends ProxyResource { /* - * The standard system metadata of a resource type. + * The properties of a capability resource. + */ + private CapabilityProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* - * The properties of a capability resource. + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. */ - @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) - private CapabilityProperties innerProperties; + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; /** * Creates an instance of CapabilityInner class. @@ -33,76 +50,117 @@ public CapabilityInner() { } /** - * Get the systemData property: The standard system metadata of a resource type. + * Get the properties property: The properties of a capability resource. * - * @return the systemData value. + * @return the properties value. */ - public SystemData systemData() { - return this.systemData; + public CapabilityProperties properties() { + return this.properties; } /** - * Get the innerProperties property: The properties of a capability resource. + * Set the properties property: The properties of a capability resource. * - * @return the innerProperties value. + * @param properties the properties value to set. + * @return the CapabilityInner object itself. */ - private CapabilityProperties innerProperties() { - return this.innerProperties; + public CapabilityInner withProperties(CapabilityProperties properties) { + this.properties = properties; + return this; } /** - * Get the publisher property: String of the Publisher that this Capability extends. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the publisher value. + * @return the systemData value. */ - public String publisher() { - return this.innerProperties() == null ? null : this.innerProperties().publisher(); + public SystemData systemData() { + return this.systemData; } /** - * Get the targetType property: String of the Target Type that this Capability extends. + * Get the type property: The type of the resource. * - * @return the targetType value. + * @return the type value. */ - public String targetType() { - return this.innerProperties() == null ? null : this.innerProperties().targetType(); + @Override + public String type() { + return this.type; } /** - * Get the description property: Localized string of the description. + * Get the name property: The name of the resource. * - * @return the description value. + * @return the name value. */ - public String description() { - return this.innerProperties() == null ? null : this.innerProperties().description(); + @Override + public String name() { + return this.name; } /** - * Get the parametersSchema property: URL to retrieve JSON schema of the Capability parameters. + * Get the id property: Fully qualified resource Id for the resource. * - * @return the parametersSchema value. + * @return the id value. */ - public String parametersSchema() { - return this.innerProperties() == null ? null : this.innerProperties().parametersSchema(); + @Override + public String id() { + return this.id; } /** - * Get the urn property: String of the URN for this Capability Type. + * Validates the instance. * - * @return the urn value. + * @throws IllegalArgumentException thrown if the instance is not valid. */ - public String urn() { - return this.innerProperties() == null ? null : this.innerProperties().urn(); + public void validate() { + if (properties() != null) { + properties().validate(); + } } /** - * Validates the instance. + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CapabilityInner from the JsonReader. * - * @throws IllegalArgumentException thrown if the instance is not valid. + * @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 void validate() { - if (innerProperties() != null) { - innerProperties().validate(); - } + 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 ("properties".equals(fieldName)) { + deserializedCapabilityInner.properties = CapabilityProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCapabilityInner.systemData = SystemData.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 deleted file mode 100644 index 2380ddf8be90a..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityProperties.java +++ /dev/null @@ -1,103 +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.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Model that represents the Capability properties model. - */ -@Immutable -public final class CapabilityProperties { - /* - * 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; - - /** - * Creates an instance of CapabilityProperties class. - */ - public CapabilityProperties() { - } - - /** - * Get the publisher property: String of the Publisher that this Capability extends. - * - * @return the publisher value. - */ - public String publisher() { - return this.publisher; - } - - /** - * Get the targetType property: String of the Target Type that this Capability extends. - * - * @return the targetType value. - */ - public String targetType() { - return this.targetType; - } - - /** - * Get the description property: Localized string of the description. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * Get the parametersSchema property: URL to retrieve JSON schema of the Capability parameters. - * - * @return the parametersSchema value. - */ - public String parametersSchema() { - return this.parametersSchema; - } - - /** - * Get the urn property: String of the URN for this Capability Type. - * - * @return the urn value. - */ - public String urn() { - return this.urn; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} 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..769a03ea7547e 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,9 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; -import com.azure.resourcemanager.chaos.models.CapabilityTypePropertiesRuntimeProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.chaos.models.CapabilityTypeProperties; +import java.io.IOException; /** * Model that represents a Capability Type resource. @@ -17,207 +19,148 @@ @Fluent public final class CapabilityTypeInner extends ProxyResource { /* - * The system metadata properties of the capability type resource. + * The properties of the capability type resource. + */ + private CapabilityTypeProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* - * Location of the Capability Type resource. + * The type of the resource. */ - @JsonProperty(value = "location") - private String location; + private String type; /* - * The properties of the capability type resource. + * The name of the resource. */ - @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) - private CapabilityTypeProperties innerProperties; + private String name; - /** - * Creates an instance of CapabilityTypeInner class. + /* + * Fully qualified resource Id for the resource. */ - public CapabilityTypeInner() { - } + private String id; /** - * Get the systemData property: The system metadata properties of the capability type resource. - * - * @return the systemData value. + * Creates an instance of CapabilityTypeInner class. */ - public SystemData systemData() { - return this.systemData; + public CapabilityTypeInner() { } /** - * Get the location property: Location of the Capability Type resource. + * Get the properties property: The properties of the capability type resource. * - * @return the location value. + * @return the properties value. */ - public String location() { - return this.location; + public CapabilityTypeProperties properties() { + return this.properties; } /** - * Set the location property: Location of the Capability Type resource. + * Set the properties property: The properties of the capability type resource. * - * @param location the location value to set. + * @param properties the properties value to set. * @return the CapabilityTypeInner object itself. */ - public CapabilityTypeInner withLocation(String location) { - this.location = location; + public CapabilityTypeInner withProperties(CapabilityTypeProperties properties) { + this.properties = properties; return this; } /** - * Get the innerProperties property: The properties of the capability type resource. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the innerProperties value. - */ - private CapabilityTypeProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the publisher property: String of the Publisher that this Capability Type extends. - * - * @return the publisher value. - */ - public String publisher() { - return this.innerProperties() == null ? null : this.innerProperties().publisher(); - } - - /** - * Get the targetType property: String of the Target Type that this Capability Type extends. - * - * @return the targetType value. - */ - public String targetType() { - return this.innerProperties() == null ? null : this.innerProperties().targetType(); - } - - /** - * Get the displayName property: Localized string of the display name. - * - * @return the displayName value. - */ - public String displayName() { - return this.innerProperties() == null ? null : this.innerProperties().displayName(); - } - - /** - * Get the description property: Localized string of the description. - * - * @return the description value. - */ - public String description() { - return this.innerProperties() == null ? null : this.innerProperties().description(); - } - - /** - * Get the parametersSchema property: URL to retrieve JSON schema of the Capability Type parameters. - * - * @return the parametersSchema value. + * @return the systemData value. */ - public String parametersSchema() { - return this.innerProperties() == null ? null : this.innerProperties().parametersSchema(); + public SystemData systemData() { + return this.systemData; } /** - * Get the urn property: String of the URN for this Capability Type. + * Get the type property: The type of the resource. * - * @return the urn value. + * @return the type value. */ - public String urn() { - return this.innerProperties() == null ? null : this.innerProperties().urn(); + @Override + public String type() { + return this.type; } /** - * Get the kind property: String of the kind of this Capability Type. + * Get the name property: The name of the resource. * - * @return the kind value. + * @return the name value. */ - public String kind() { - return this.innerProperties() == null ? null : this.innerProperties().kind(); + @Override + public String name() { + return this.name; } /** - * Get the azureRbacActions property: Control plane actions necessary to execute capability type. + * Get the id property: Fully qualified resource Id for the resource. * - * @return the azureRbacActions value. + * @return the id value. */ - public List azureRbacActions() { - return this.innerProperties() == null ? null : this.innerProperties().azureRbacActions(); + @Override + public String id() { + return this.id; } /** - * Set the azureRbacActions property: Control plane actions necessary to execute capability type. + * Validates the instance. * - * @param azureRbacActions the azureRbacActions value to set. - * @return the CapabilityTypeInner object itself. + * @throws IllegalArgumentException thrown if the instance is not valid. */ - public CapabilityTypeInner withAzureRbacActions(List azureRbacActions) { - if (this.innerProperties() == null) { - this.innerProperties = new CapabilityTypeProperties(); + public void validate() { + if (properties() != null) { + properties().validate(); } - this.innerProperties().withAzureRbacActions(azureRbacActions); - return this; } /** - * Get the azureRbacDataActions property: Data plane actions necessary to execute capability type. - * - * @return the azureRbacDataActions value. - */ - public List azureRbacDataActions() { - return this.innerProperties() == null ? null : this.innerProperties().azureRbacDataActions(); - } - - /** - * Set the azureRbacDataActions property: Data plane actions necessary to execute capability type. - * - * @param azureRbacDataActions the azureRbacDataActions value to set. - * @return the CapabilityTypeInner object itself. + * {@inheritDoc} */ - public CapabilityTypeInner withAzureRbacDataActions(List azureRbacDataActions) { - if (this.innerProperties() == null) { - this.innerProperties = new CapabilityTypeProperties(); - } - this.innerProperties().withAzureRbacDataActions(azureRbacDataActions); - return this; + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); } /** - * Get the runtimeProperties property: Runtime properties of this Capability Type. + * Reads an instance of CapabilityTypeInner from the JsonReader. * - * @return the runtimeProperties value. + * @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 CapabilityTypePropertiesRuntimeProperties runtimeProperties() { - return this.innerProperties() == null ? null : this.innerProperties().runtimeProperties(); - } + 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(); - /** - * Set the runtimeProperties property: Runtime properties of this Capability Type. - * - * @param runtimeProperties the runtimeProperties value to set. - * @return the CapabilityTypeInner object itself. - */ - public CapabilityTypeInner withRuntimeProperties(CapabilityTypePropertiesRuntimeProperties runtimeProperties) { - if (this.innerProperties() == null) { - this.innerProperties = new CapabilityTypeProperties(); - } - this.innerProperties().withRuntimeProperties(runtimeProperties); - return this; - } + 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 ("properties".equals(fieldName)) { + deserializedCapabilityTypeInner.properties = CapabilityTypeProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCapabilityTypeInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerProperties() != null) { - innerProperties().validate(); - } + return deserializedCapabilityTypeInner; + }); } } 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..a7f261d5c42db 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,38 +5,37 @@ package com.azure.resourcemanager.chaos.fluent.models; import com.azure.core.annotation.Immutable; -import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsPropertiesRunInformation; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; +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.ExperimentExecutionDetailsProperties; +import java.io.IOException; /** * 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; + private ExperimentExecutionDetailsProperties properties; /** * Creates an instance of ExperimentExecutionDetailsInner class. @@ -72,76 +71,65 @@ public String name() { } /** - * Get the innerProperties property: The properties of the experiment execution details. + * Get the properties property: The properties of the experiment execution details. * - * @return the innerProperties value. + * @return the properties value. */ - private ExperimentExecutionDetailsProperties innerProperties() { - return this.innerProperties; + public ExperimentExecutionDetailsProperties properties() { + return this.properties; } /** - * Get the failureReason property: The reason why the execution failed. - * - * @return the failureReason value. - */ - public String failureReason() { - return this.innerProperties() == null ? null : this.innerProperties().failureReason(); - } - - /** - * Get the lastActionAt property: String that represents the last action date time. - * - * @return the lastActionAt value. - */ - public OffsetDateTime lastActionAt() { - return this.innerProperties() == null ? null : this.innerProperties().lastActionAt(); - } - - /** - * Get the runInformation property: The information of the experiment run. - * - * @return the runInformation value. - */ - public ExperimentExecutionDetailsPropertiesRunInformation runInformation() { - return this.innerProperties() == null ? null : this.innerProperties().runInformation(); - } - - /** - * Get the status property: The status of the execution. - * - * @return the status value. - */ - public String status() { - return this.innerProperties() == null ? null : this.innerProperties().status(); - } - - /** - * Get the startedAt property: String that represents the start date time. + * Validates the instance. * - * @return the startedAt value. + * @throws IllegalArgumentException thrown if the instance is not valid. */ - public OffsetDateTime startedAt() { - return this.innerProperties() == null ? null : this.innerProperties().startedAt(); + public void validate() { + if (properties() != null) { + properties().validate(); + } } /** - * Get the stoppedAt property: String that represents the stop date time. - * - * @return the stoppedAt value. + * {@inheritDoc} */ - public OffsetDateTime stoppedAt() { - return this.innerProperties() == null ? null : this.innerProperties().stoppedAt(); + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); } /** - * Validates the instance. + * Reads an instance of ExperimentExecutionDetailsInner from the JsonReader. * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerProperties() != null) { - innerProperties().validate(); - } + * @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.properties + = 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 deleted file mode 100644 index d8094e07050fb..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsProperties.java +++ /dev/null @@ -1,80 +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.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsPropertiesRunInformation; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; - -/** - * Model that represents the extended properties of an experiment execution. - */ -@Immutable -public final class ExperimentExecutionDetailsProperties extends ExperimentExecutionProperties { - /* - * 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; - - /** - * Creates an instance of ExperimentExecutionDetailsProperties class. - */ - public ExperimentExecutionDetailsProperties() { - } - - /** - * Get the failureReason property: The reason why the execution failed. - * - * @return the failureReason value. - */ - public String failureReason() { - return this.failureReason; - } - - /** - * Get the lastActionAt property: String that represents the last action date time. - * - * @return the lastActionAt value. - */ - public OffsetDateTime lastActionAt() { - return this.lastActionAt; - } - - /** - * Get the runInformation property: The information of the experiment run. - * - * @return the runInformation value. - */ - public ExperimentExecutionDetailsPropertiesRunInformation runInformation() { - return this.runInformation; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void validate() { - super.validate(); - if (runInformation() != null) { - runInformation().validate(); - } - } -} 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..773f1cb4717b0 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 @@ -4,38 +4,44 @@ package com.azure.resourcemanager.chaos.fluent.models; -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; +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.ExperimentExecutionProperties; +import java.io.IOException; /** - * Model that represents the execution of a Experiment. + * Model that represents the execution of an Experiment. */ -@Immutable -public final class ExperimentExecutionInner { +@Fluent +public final class ExperimentExecutionInner extends ProxyResource { /* - * String of the resource type. + * The properties of experiment execution status. */ - @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) - private String type; + private ExperimentExecutionProperties properties; /* - * String of the fully qualified resource ID. + * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) - private String id; + private SystemData systemData; /* - * String of the resource name. + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) private String name; /* - * The properties of experiment execution status. + * Fully qualified resource Id for the resource. */ - @JsonProperty(value = "properties") - private ExperimentExecutionProperties innerProperties; + private String id; /** * Creates an instance of ExperimentExecutionInner class. @@ -44,76 +50,117 @@ public ExperimentExecutionInner() { } /** - * Get the type property: String of the resource type. + * Get the properties property: The properties of experiment execution status. * - * @return the type value. + * @return the properties value. */ - public String type() { - return this.type; + public ExperimentExecutionProperties properties() { + return this.properties; } /** - * Get the id property: String of the fully qualified resource ID. + * Set the properties property: The properties of experiment execution status. * - * @return the id value. + * @param properties the properties value to set. + * @return the ExperimentExecutionInner object itself. */ - public String id() { - return this.id; + public ExperimentExecutionInner withProperties(ExperimentExecutionProperties properties) { + this.properties = properties; + return this; } /** - * Get the name property: String of the resource name. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the name value. + * @return the systemData value. */ - public String name() { - return this.name; + public SystemData systemData() { + return this.systemData; } /** - * Get the innerProperties property: The properties of experiment execution status. + * Get the type property: The type of the resource. * - * @return the innerProperties value. + * @return the type value. */ - private ExperimentExecutionProperties innerProperties() { - return this.innerProperties; + @Override + public String type() { + return this.type; } /** - * Get the status property: The status of the execution. + * Get the name property: The name of the resource. * - * @return the status value. + * @return the name value. */ - public String status() { - return this.innerProperties() == null ? null : this.innerProperties().status(); + @Override + public String name() { + return this.name; } /** - * Get the startedAt property: String that represents the start date time. + * Get the id property: Fully qualified resource Id for the resource. * - * @return the startedAt value. + * @return the id value. */ - public OffsetDateTime startedAt() { - return this.innerProperties() == null ? null : this.innerProperties().startedAt(); + @Override + public String id() { + return this.id; } /** - * Get the stoppedAt property: String that represents the stop date time. + * Validates the instance. * - * @return the stoppedAt value. + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} */ - public OffsetDateTime stoppedAt() { - return this.innerProperties() == null ? null : this.innerProperties().stoppedAt(); + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); } /** - * Validates the instance. + * Reads an instance of ExperimentExecutionInner from the JsonReader. * - * @throws IllegalArgumentException thrown if the instance is not valid. + * @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 IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExperimentExecutionInner. */ - public void validate() { - if (innerProperties() != null) { - innerProperties().validate(); - } + 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 ("id".equals(fieldName)) { + deserializedExperimentExecutionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedExperimentExecutionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedExperimentExecutionInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedExperimentExecutionInner.properties = ExperimentExecutionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedExperimentExecutionInner.systemData = SystemData.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 deleted file mode 100644 index 0338e23a53bbf..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionProperties.java +++ /dev/null @@ -1,74 +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.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; - -/** - * Model that represents the execution properties of an Experiment. - */ -@Immutable -public class ExperimentExecutionProperties { - /* - * 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; - - /** - * Creates an instance of ExperimentExecutionProperties class. - */ - public ExperimentExecutionProperties() { - } - - /** - * Get the status property: The status of the execution. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Get the startedAt property: String that represents the start date time. - * - * @return the startedAt value. - */ - public OffsetDateTime startedAt() { - return this.startedAt; - } - - /** - * Get the stoppedAt property: String that represents the stop date time. - * - * @return the stoppedAt value. - */ - public OffsetDateTime stoppedAt() { - return this.stoppedAt; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} 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..c52f1e6f9318f 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,12 +8,12 @@ import com.azure.core.management.Resource; import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; -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.util.List; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.chaos.models.ExperimentProperties; +import com.azure.resourcemanager.chaos.models.ManagedServiceIdentity; +import java.io.IOException; import java.util.Map; /** @@ -22,22 +22,34 @@ @Fluent public final class ExperimentInner extends Resource { /* - * The system metadata of the experiment resource. + * The properties of the experiment resource. + */ + private ExperimentProperties properties; + + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* - * The identity of the experiment resource. + * The type of the resource. */ - @JsonProperty(value = "identity") - private ResourceIdentity identity; + private String type; /* - * The properties of the experiment resource. + * The name of the resource. */ - @JsonProperty(value = "properties", required = true) - private ExperimentProperties innerProperties = new ExperimentProperties(); + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; /** * Creates an instance of ExperimentInner class. @@ -46,113 +58,99 @@ public ExperimentInner() { } /** - * Get the systemData property: The system metadata of the experiment resource. + * Get the properties property: The properties of the experiment resource. * - * @return the systemData value. + * @return the properties value. */ - public SystemData systemData() { - return this.systemData; + public ExperimentProperties properties() { + return this.properties; } /** - * Get the identity property: The identity of the experiment resource. + * Set the properties property: The properties of the experiment resource. + * + * @param properties the properties value to set. + * @return the ExperimentInner object itself. + */ + public ExperimentInner withProperties(ExperimentProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. * * @return the identity value. */ - public ResourceIdentity identity() { + public ManagedServiceIdentity identity() { return this.identity; } /** - * Set the identity property: The identity of the experiment resource. + * Set the identity property: The managed service identities assigned to this resource. * * @param identity the identity value to set. * @return the ExperimentInner object itself. */ - public ExperimentInner withIdentity(ResourceIdentity identity) { + public ExperimentInner withIdentity(ManagedServiceIdentity identity) { this.identity = identity; return this; } /** - * Get the innerProperties property: The properties of the experiment resource. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the innerProperties value. + * @return the systemData value. */ - private ExperimentProperties innerProperties() { - return this.innerProperties; + public SystemData systemData() { + return this.systemData; } /** - * {@inheritDoc} + * Get the type property: The type of the resource. + * + * @return the type value. */ @Override - public ExperimentInner withLocation(String location) { - super.withLocation(location); - return this; + public String type() { + return this.type; } /** - * {@inheritDoc} - */ - @Override - public ExperimentInner withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * Get the provisioningState property: Most recent provisioning state for the given experiment resource. + * Get the name property: The name of the resource. * - * @return the provisioningState value. + * @return the name value. */ - public ProvisioningState provisioningState() { - return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + @Override + public String name() { + return this.name; } /** - * Get the steps property: List of steps. + * Get the id property: Fully qualified resource Id for the resource. * - * @return the steps value. + * @return the id value. */ - public List steps() { - return this.innerProperties() == null ? null : this.innerProperties().steps(); + @Override + public String id() { + return this.id; } /** - * Set the steps property: List of steps. - * - * @param steps the steps value to set. - * @return the ExperimentInner object itself. + * {@inheritDoc} */ - public ExperimentInner withSteps(List steps) { - if (this.innerProperties() == null) { - this.innerProperties = new ExperimentProperties(); - } - this.innerProperties().withSteps(steps); + @Override + public ExperimentInner withLocation(String location) { + super.withLocation(location); return this; } /** - * Get the selectors property: List of selectors. - * - * @return the selectors value. - */ - public List selectors() { - return this.innerProperties() == null ? null : this.innerProperties().selectors(); - } - - /** - * Set the selectors property: List of selectors. - * - * @param selectors the selectors value to set. - * @return the ExperimentInner object itself. + * {@inheritDoc} */ - public ExperimentInner withSelectors(List selectors) { - if (this.innerProperties() == null) { - this.innerProperties = new ExperimentProperties(); - } - this.innerProperties().withSelectors(selectors); + @Override + public ExperimentInner withTags(Map tags) { + super.withTags(tags); return this; } @@ -162,16 +160,71 @@ public ExperimentInner withSelectors(List selectors) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (properties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property properties in model ExperimentInner")); + } else { + properties().validate(); + } if (identity() != null) { identity().validate(); } - if (innerProperties() == null) { - throw LOGGER.logExceptionAsError( - 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.properties); + 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.properties = ExperimentProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedExperimentInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedExperimentInner.systemData = SystemData.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 deleted file mode 100644 index bb1445fe5dc11..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentProperties.java +++ /dev/null @@ -1,114 +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.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -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.util.List; - -/** - * Model that represents the Experiment properties model. - */ -@Fluent -public final class ExperimentProperties { - /* - * 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; - - /** - * Creates an instance of ExperimentProperties class. - */ - public ExperimentProperties() { - } - - /** - * Get the provisioningState property: Most recent provisioning state for the given experiment resource. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * Get the steps property: List of steps. - * - * @return the steps value. - */ - public List steps() { - return this.steps; - } - - /** - * Set the steps property: List of steps. - * - * @param steps the steps value to set. - * @return the ExperimentProperties object itself. - */ - public ExperimentProperties withSteps(List steps) { - this.steps = steps; - return this; - } - - /** - * Get the selectors property: List of selectors. - * - * @return the selectors value. - */ - public List selectors() { - return this.selectors; - } - - /** - * Set the selectors property: List of selectors. - * - * @param selectors the selectors value to set. - * @return the ExperimentProperties object itself. - */ - public ExperimentProperties withSelectors(List selectors) { - this.selectors = selectors; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (steps() == null) { - throw LOGGER.logExceptionAsError( - 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")); - } else { - selectors().forEach(e -> e.validate()); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ExperimentProperties.class); -} 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 deleted file mode 100644 index 24456ee1cf196..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationStatusInner.java +++ /dev/null @@ -1,185 +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.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.management.exception.ManagementError; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * The status of operation. - */ -@Fluent -public final class OperationStatusInner { - /* - * 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; - - /* - * The end time of the operation. - */ - @JsonProperty(value = "endTime") - private String endTime; - - /* - * The status of the operation. - */ - @JsonProperty(value = "status") - private String status; - - /* - * The error object. - */ - @JsonProperty(value = "error") - private ManagementError error; - - /** - * Creates an instance of OperationStatusInner class. - */ - public OperationStatusInner() { - } - - /** - * Get the id property: The operation Id. - * - * @return the id value. - */ - public String id() { - return this.id; - } - - /** - * Set the id property: The operation Id. - * - * @param id the id value to set. - * @return the OperationStatusInner object itself. - */ - public OperationStatusInner withId(String id) { - this.id = id; - return this; - } - - /** - * Get the name property: The operation name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: The operation name. - * - * @param name the name value to set. - * @return the OperationStatusInner object itself. - */ - public OperationStatusInner withName(String name) { - this.name = name; - return this; - } - - /** - * Get the startTime property: The start time of the operation. - * - * @return the startTime value. - */ - public String 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() { - 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. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Set the status property: The status of the operation. - * - * @param status the status value to set. - * @return the OperationStatusInner object itself. - */ - public OperationStatusInner withStatus(String status) { - this.status = status; - return this; - } - - /** - * Get the error property: The error object. - * - * @return the error value. - */ - public ManagementError error() { - return this.error; - } - - /** - * Set the error property: The error object. - * - * @param error the error value to set. - * @return the OperationStatusInner object itself. - */ - public OperationStatusInner withError(ManagementError error) { - this.error = error; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/PostActionResponseInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/PostActionResponseInner.java new file mode 100644 index 0000000000000..49e2f2ae4a5e4 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/PostActionResponseInner.java @@ -0,0 +1,97 @@ +// 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.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 java.io.IOException; + +/** + * Model that represents the post action response. + */ +@Immutable +public final class PostActionResponseInner implements JsonSerializable { + /* + * The name of the resource. + */ + private String name; + + /* + * The statusUrl of the post action. + */ + private String statusUrl; + + /** + * Creates an instance of PostActionResponseInner class. + */ + public PostActionResponseInner() { + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the statusUrl property: The statusUrl of the post action. + * + * @return the statusUrl value. + */ + public String statusUrl() { + return this.statusUrl; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PostActionResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PostActionResponseInner 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 PostActionResponseInner. + */ + public static PostActionResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PostActionResponseInner deserializedPostActionResponseInner = new PostActionResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedPostActionResponseInner.name = reader.getString(); + } else if ("statusUrl".equals(fieldName)) { + deserializedPostActionResponseInner.statusUrl = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPostActionResponseInner; + }); + } +} 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..3fcfa41ec3d00 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 @@ -7,9 +7,10 @@ import com.azure.core.annotation.Fluent; 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; /** @@ -18,23 +19,34 @@ @Fluent public final class TargetInner extends ProxyResource { /* - * The system metadata of the target resource. + * The properties of the target resource. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; + private Map properties; /* - * Location of the target resource. + * Azure resource location. */ - @JsonProperty(value = "location") private String location; /* - * The properties of the target resource. + * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "properties", required = true) - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) - private Map properties; + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; /** * Creates an instance of TargetInner class. @@ -43,16 +55,27 @@ public TargetInner() { } /** - * Get the systemData property: The system metadata of the target resource. + * Get the properties property: The properties of the target resource. * - * @return the systemData value. + * @return the properties value. */ - public SystemData systemData() { - return this.systemData; + public Map properties() { + return this.properties; } /** - * Get the location property: Location of the target resource. + * Set the properties property: The properties of the target resource. + * + * @param properties the properties value to set. + * @return the TargetInner object itself. + */ + public TargetInner withProperties(Map properties) { + this.properties = properties; + return this; + } + + /** + * Get the location property: Azure resource location. * * @return the location value. */ @@ -61,34 +84,42 @@ public String location() { } /** - * Set the location property: Location of the target resource. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @param location the location value to set. - * @return the TargetInner object itself. + * @return the systemData value. */ - public TargetInner withLocation(String location) { - this.location = location; - return this; + public SystemData systemData() { + return this.systemData; } /** - * Get the properties property: The properties of the target resource. + * Get the type property: The type of the resource. * - * @return the properties value. + * @return the type value. */ - public Map properties() { - return this.properties; + @Override + public String type() { + return this.type; } /** - * Set the properties property: The properties of the target resource. + * Get the name property: The name of the resource. * - * @param properties the properties value to set. - * @return the TargetInner object itself. + * @return the name value. */ - public TargetInner withProperties(Map properties) { - this.properties = properties; - return this; + @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; } /** @@ -97,11 +128,53 @@ public TargetInner withProperties(Map properties) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (properties() == null) { - throw LOGGER.logExceptionAsError( - 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)); + 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 ("location".equals(fieldName)) { + deserializedTargetInner.location = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedTargetInner.systemData = SystemData.fromJson(reader); + } 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..036a70b7bde10 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,8 +8,11 @@ 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 java.util.List; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.chaos.models.TargetTypeProperties; +import java.io.IOException; /** * Model that represents a Target Type resource. @@ -17,101 +20,93 @@ @Fluent public final class TargetTypeInner extends ProxyResource { /* - * The system metadata properties of the target type resource. + * The properties of the target type resource. + */ + private TargetTypeProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* - * Location of the Target Type resource. + * The type of the resource. */ - @JsonProperty(value = "location") - private String location; + private String type; /* - * The properties of the target type resource. + * The name of the resource. */ - @JsonProperty(value = "properties", required = true) - private TargetTypeProperties innerProperties = new TargetTypeProperties(); + private String name; - /** - * Creates an instance of TargetTypeInner class. + /* + * Fully qualified resource Id for the resource. */ - public TargetTypeInner() { - } + private String id; /** - * Get the systemData property: The system metadata properties of the target type resource. - * - * @return the systemData value. + * Creates an instance of TargetTypeInner class. */ - public SystemData systemData() { - return this.systemData; + public TargetTypeInner() { } /** - * Get the location property: Location of the Target Type resource. + * Get the properties property: The properties of the target type resource. * - * @return the location value. + * @return the properties value. */ - public String location() { - return this.location; + public TargetTypeProperties properties() { + return this.properties; } /** - * Set the location property: Location of the Target Type resource. + * Set the properties property: The properties of the target type resource. * - * @param location the location value to set. + * @param properties the properties value to set. * @return the TargetTypeInner object itself. */ - public TargetTypeInner withLocation(String location) { - this.location = location; + public TargetTypeInner withProperties(TargetTypeProperties properties) { + this.properties = properties; return this; } /** - * Get the innerProperties property: The properties of the target type resource. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the innerProperties value. - */ - private TargetTypeProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the displayName property: Localized string of the display name. - * - * @return the displayName value. + * @return the systemData value. */ - public String displayName() { - return this.innerProperties() == null ? null : this.innerProperties().displayName(); + public SystemData systemData() { + return this.systemData; } /** - * Get the description property: Localized string of the description. + * Get the type property: The type of the resource. * - * @return the description value. + * @return the type value. */ - public String description() { - return this.innerProperties() == null ? null : this.innerProperties().description(); + @Override + public String type() { + return this.type; } /** - * Get the propertiesSchema property: URL to retrieve JSON schema of the Target Type properties. + * Get the name property: The name of the resource. * - * @return the propertiesSchema value. + * @return the name value. */ - public String propertiesSchema() { - return this.innerProperties() == null ? null : this.innerProperties().propertiesSchema(); + @Override + public String name() { + return this.name; } /** - * Get the resourceTypes property: List of resource types this Target Type can extend. + * Get the id property: Fully qualified resource Id for the resource. * - * @return the resourceTypes value. + * @return the id value. */ - public List resourceTypes() { - return this.innerProperties() == null ? null : this.innerProperties().resourceTypes(); + @Override + public String id() { + return this.id; } /** @@ -120,13 +115,58 @@ public List resourceTypes() { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (innerProperties() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property innerProperties in model TargetTypeInner")); + if (properties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property properties in model TargetTypeInner")); } else { - innerProperties().validate(); + properties().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.properties); + 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.properties = TargetTypeProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedTargetTypeInner.systemData = SystemData.fromJson(reader); + } 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 deleted file mode 100644 index 56be5f6e63786..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeProperties.java +++ /dev/null @@ -1,89 +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.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** - * Model that represents the base Target Type properties model. - */ -@Immutable -public final class TargetTypeProperties { - /* - * 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; - - /** - * Creates an instance of TargetTypeProperties class. - */ - public TargetTypeProperties() { - } - - /** - * Get the displayName property: Localized string of the display name. - * - * @return the displayName value. - */ - public String displayName() { - return this.displayName; - } - - /** - * Get the description property: Localized string of the description. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * Get the propertiesSchema property: URL to retrieve JSON schema of the Target Type properties. - * - * @return the propertiesSchema value. - */ - public String propertiesSchema() { - return this.propertiesSchema; - } - - /** - * Get the resourceTypes property: List of resource types this Target Type can extend. - * - * @return the resourceTypes value. - */ - public List resourceTypes() { - return this.resourceTypes; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} 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..0d650a67b2948 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 @@ -66,56 +66,43 @@ public final class CapabilitiesClientImpl implements CapabilitiesClient { @ServiceInterface(name = "ChaosManagementClien") public interface CapabilitiesService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("parentProviderNamespace") String parentProviderNamespace, - @PathParam("parentResourceType") String parentResourceType, - @PathParam("parentResourceName") String parentResourceName, @PathParam("targetName") String targetName, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("targetName") String targetName, @QueryParam("continuationToken") String continuationToken, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("parentProviderNamespace") String parentProviderNamespace, - @PathParam("parentResourceType") String parentResourceType, - @PathParam("parentResourceName") String parentResourceName, @PathParam("targetName") String targetName, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("targetName") String targetName, @PathParam("capabilityName") String capabilityName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}") + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("targetName") String targetName, + @PathParam("capabilityName") String capabilityName, @BodyParam("application/json") CapabilityInner resource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}") @ExpectedResponses({ 200, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("parentProviderNamespace") String parentProviderNamespace, - @PathParam("parentResourceType") String parentResourceType, - @PathParam("parentResourceName") String parentResourceName, @PathParam("targetName") String targetName, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("targetName") String targetName, @PathParam("capabilityName") String capabilityName, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("parentProviderNamespace") String parentProviderNamespace, - @PathParam("parentResourceType") String parentResourceType, - @PathParam("parentResourceName") String parentResourceName, @PathParam("targetName") String targetName, - @PathParam("capabilityName") String capabilityName, - @BodyParam("application/json") CapabilityInner capability, @HeaderParam("Accept") String accept, - Context context); - @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -127,10 +114,7 @@ Mono> listNext(@PathParam(value = "nextLink", enc /** * Get a list of Capability resources that extend a Target resource.. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param continuationToken String that sets the continuation token. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -140,8 +124,7 @@ Mono> listNext(@PathParam(value = "nextLink", enc * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String resourceGroupName, - String parentProviderNamespace, String parentResourceType, String parentResourceName, String targetName, + private Mono> listSinglePageAsync(String resourceGroupName, String targetName, String continuationToken) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -155,26 +138,13 @@ private Mono> listSinglePageAsync(String resource return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - if (parentProviderNamespace == null) { - return Mono.error( - new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); - } - if (parentResourceType == null) { - return Mono - .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); - } - if (parentResourceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); - } if (targetName == null) { return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, continuationToken, accept, context)) + this.client.getSubscriptionId(), resourceGroupName, targetName, continuationToken, accept, context)) .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); @@ -183,10 +153,7 @@ private Mono> listSinglePageAsync(String resource /** * Get a list of Capability resources that extend a Target resource.. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. @@ -197,8 +164,7 @@ private Mono> listSinglePageAsync(String resource * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String resourceGroupName, - String parentProviderNamespace, String parentResourceType, String parentResourceName, String targetName, + private Mono> listSinglePageAsync(String resourceGroupName, String targetName, String continuationToken, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -212,18 +178,6 @@ private Mono> listSinglePageAsync(String resource return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - if (parentProviderNamespace == null) { - return Mono.error( - new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); - } - if (parentResourceType == null) { - return Mono - .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); - } - if (parentResourceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); - } if (targetName == null) { return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); } @@ -231,8 +185,7 @@ private Mono> listSinglePageAsync(String resource context = this.client.mergeContext(context); return service .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName, - continuationToken, accept, context) + resourceGroupName, targetName, continuationToken, accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } @@ -240,10 +193,7 @@ private Mono> listSinglePageAsync(String resource /** * Get a list of Capability resources that extend a Target resource.. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param continuationToken String that sets the continuation token. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -253,19 +203,16 @@ private Mono> listSinglePageAsync(String resource * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String continuationToken) { - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, continuationToken), nextLink -> listNextSinglePageAsync(nextLink)); + private PagedFlux listAsync(String resourceGroupName, String targetName, + String continuationToken) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, targetName, continuationToken), + nextLink -> listNextSinglePageAsync(nextLink)); } /** * Get a list of Capability resources that extend a Target resource.. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -274,20 +221,16 @@ private PagedFlux listAsync(String resourceGroupName, String pa * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName) { + private PagedFlux listAsync(String resourceGroupName, String targetName) { final String continuationToken = null; - return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, continuationToken), nextLink -> listNextSinglePageAsync(nextLink)); + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, targetName, continuationToken), + nextLink -> listNextSinglePageAsync(nextLink)); } /** * Get a list of Capability resources that extend a Target resource.. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. @@ -298,22 +241,16 @@ private PagedFlux listAsync(String resourceGroupName, String pa * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String continuationToken, + private PagedFlux listAsync(String resourceGroupName, String targetName, String continuationToken, Context context) { - return new PagedFlux<>( - () -> listSinglePageAsync(resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, continuationToken, context), + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, targetName, continuationToken, context), nextLink -> listNextSinglePageAsync(nextLink, context)); } /** * Get a list of Capability resources that extend a Target resource.. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -322,20 +259,15 @@ private PagedFlux listAsync(String resourceGroupName, String pa * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName) { + public PagedIterable list(String resourceGroupName, String targetName) { final String continuationToken = null; - return new PagedIterable<>(listAsync(resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, continuationToken)); + return new PagedIterable<>(listAsync(resourceGroupName, targetName, continuationToken)); } /** * Get a list of Capability resources that extend a Target resource.. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. @@ -346,20 +278,15 @@ public PagedIterable list(String resourceGroupName, String pare * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String continuationToken, + public PagedIterable list(String resourceGroupName, String targetName, String continuationToken, Context context) { - return new PagedIterable<>(listAsync(resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, continuationToken, context)); + return new PagedIterable<>(listAsync(resourceGroupName, targetName, continuationToken, context)); } /** * Get a Capability resource that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -369,8 +296,7 @@ public PagedIterable list(String resourceGroupName, String pare * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String parentProviderNamespace, String parentResourceType, String parentResourceName, String targetName, + private Mono> getWithResponseAsync(String resourceGroupName, String targetName, String capabilityName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -384,18 +310,6 @@ private Mono> getWithResponseAsync(String resourceGrou return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - if (parentProviderNamespace == null) { - return Mono.error( - new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); - } - if (parentResourceType == null) { - return Mono - .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); - } - if (parentResourceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); - } if (targetName == null) { return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); } @@ -405,18 +319,14 @@ private Mono> getWithResponseAsync(String resourceGrou final String accept = "application/json"; return FluxUtil .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, capabilityName, accept, context)) + this.client.getSubscriptionId(), resourceGroupName, targetName, capabilityName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get a Capability resource that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. * @param context The context to associate with this operation. @@ -427,8 +337,7 @@ private Mono> getWithResponseAsync(String resourceGrou * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String parentProviderNamespace, String parentResourceType, String parentResourceName, String targetName, + private Mono> getWithResponseAsync(String resourceGroupName, String targetName, String capabilityName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -442,18 +351,6 @@ private Mono> getWithResponseAsync(String resourceGrou return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - if (parentProviderNamespace == null) { - return Mono.error( - new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); - } - if (parentResourceType == null) { - return Mono - .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); - } - if (parentResourceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); - } if (targetName == null) { return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); } @@ -463,17 +360,13 @@ private Mono> getWithResponseAsync(String resourceGrou final String accept = "application/json"; context = this.client.mergeContext(context); return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName, - capabilityName, accept, context); + resourceGroupName, targetName, capabilityName, accept, context); } /** * Get a Capability resource that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -482,19 +375,15 @@ private Mono> getWithResponseAsync(String resourceGrou * @return a Capability resource that extends a Target resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String capabilityName) { - return getWithResponseAsync(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, - targetName, capabilityName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono getAsync(String resourceGroupName, String targetName, String capabilityName) { + return getWithResponseAsync(resourceGroupName, targetName, capabilityName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Get a Capability resource that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. * @param context The context to associate with this operation. @@ -504,20 +393,15 @@ private Mono getAsync(String resourceGroupName, String parentPr * @return a Capability resource that extends a Target resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String capabilityName, + public Response getWithResponse(String resourceGroupName, String targetName, String capabilityName, Context context) { - return getWithResponseAsync(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, - targetName, capabilityName, context).block(); + return getWithResponseAsync(resourceGroupName, targetName, capabilityName, context).block(); } /** * Get a Capability resource that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -526,29 +410,26 @@ public Response getWithResponse(String resourceGroupName, Strin * @return a Capability resource that extends a Target resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public CapabilityInner get(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName, String capabilityName) { - return getWithResponse(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, - targetName, capabilityName, Context.NONE).getValue(); + public CapabilityInner get(String resourceGroupName, String targetName, String capabilityName) { + return getWithResponse(resourceGroupName, targetName, capabilityName, Context.NONE).getValue(); } /** - * Delete a Capability that extends a Target resource. + * Create or update a Capability resource that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. + * @param resource Capability resource to be created or updated. * @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. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return model that represents a Capability resource along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String capabilityName) { + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, String targetName, + String capabilityName, CapabilityInner resource) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -561,51 +442,42 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - if (parentProviderNamespace == null) { - return Mono.error( - new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); - } - if (parentResourceType == null) { - return Mono - .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); - } - if (parentResourceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); - } if (targetName == null) { return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); } if (capabilityName == null) { return Mono.error(new IllegalArgumentException("Parameter capabilityName is required and cannot be null.")); } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, capabilityName, accept, context)) + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, targetName, capabilityName, resource, accept, + context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Delete a Capability that extends a Target resource. + * Create or update a Capability resource that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. + * @param resource Capability resource to be created or updated. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return model that represents a Capability resource along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String capabilityName, - Context context) { + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, String targetName, + String capabilityName, CapabilityInner resource, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -618,115 +490,95 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - if (parentProviderNamespace == null) { - return Mono.error( - new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); - } - if (parentResourceType == null) { - return Mono - .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); - } - if (parentResourceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); - } if (targetName == null) { return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); } if (capabilityName == null) { return Mono.error(new IllegalArgumentException("Parameter capabilityName is required and cannot be null.")); } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName, - capabilityName, accept, context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, targetName, capabilityName, resource, accept, context); } /** - * Delete a Capability that extends a Target resource. + * Create or update a Capability resource that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. + * @param resource Capability resource to be created or updated. * @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. - * @return A {@link Mono} that completes when a successful response is received. + * @return model that represents a Capability resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName, String capabilityName) { - return deleteWithResponseAsync(resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, capabilityName).flatMap(ignored -> Mono.empty()); + private Mono createOrUpdateAsync(String resourceGroupName, String targetName, + String capabilityName, CapabilityInner resource) { + return createOrUpdateWithResponseAsync(resourceGroupName, targetName, capabilityName, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Delete a Capability that extends a Target resource. + * Create or update a Capability resource that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. + * @param resource Capability resource to be created or updated. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. + * @return model that represents a Capability resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String capabilityName, - Context context) { - return deleteWithResponseAsync(resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, capabilityName, context).block(); + public Response createOrUpdateWithResponse(String resourceGroupName, String targetName, + String capabilityName, CapabilityInner resource, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, targetName, capabilityName, resource, context) + .block(); } /** - * Delete a Capability that extends a Target resource. + * Create or update a Capability resource that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. + * @param resource Capability resource to be created or updated. * @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. + * @return model that represents a Capability resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName, String capabilityName) { - deleteWithResponse(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, - targetName, capabilityName, Context.NONE); + public CapabilityInner createOrUpdate(String resourceGroupName, String targetName, String capabilityName, + CapabilityInner resource) { + return createOrUpdateWithResponse(resourceGroupName, targetName, capabilityName, resource, Context.NONE) + .getValue(); } /** - * Create or update a Capability resource that extends a Target resource. + * Delete a Capability that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. - * @param capability Capability resource to be created or updated. * @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. - * @return model that represents a Capability resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String parentProviderNamespace, String parentResourceType, String parentResourceName, String targetName, - String capabilityName, CapabilityInner capability) { + private Mono> deleteWithResponseAsync(String resourceGroupName, String targetName, + String capabilityName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -739,58 +591,34 @@ private Mono> createOrUpdateWithResponseAsync(String r return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - if (parentProviderNamespace == null) { - return Mono.error( - new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); - } - if (parentResourceType == null) { - return Mono - .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); - } - if (parentResourceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); - } if (targetName == null) { return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); } if (capabilityName == null) { return Mono.error(new IllegalArgumentException("Parameter capabilityName is required and cannot be null.")); } - if (capability == null) { - return Mono.error(new IllegalArgumentException("Parameter capability is required and cannot be null.")); - } else { - capability.validate(); - } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, capabilityName, capability, accept, context)) + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, targetName, capabilityName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Create or update a Capability resource that extends a Target resource. + * Delete a Capability that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. - * @param capability Capability resource to be created or updated. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a Capability resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String parentProviderNamespace, String parentResourceType, String parentResourceName, String targetName, - String capabilityName, CapabilityInner capability, Context context) { + private Mono> deleteWithResponseAsync(String resourceGroupName, String targetName, + String capabilityName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -803,113 +631,71 @@ private Mono> createOrUpdateWithResponseAsync(String r return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - if (parentProviderNamespace == null) { - return Mono.error( - new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); - } - if (parentResourceType == null) { - return Mono - .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); - } - if (parentResourceName == null) { - return Mono - .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); - } if (targetName == null) { return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); } if (capabilityName == null) { return Mono.error(new IllegalArgumentException("Parameter capabilityName is required and cannot be null.")); } - if (capability == null) { - return Mono.error(new IllegalArgumentException("Parameter capability is required and cannot be null.")); - } else { - capability.validate(); - } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, capabilityName, capability, accept, context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, targetName, capabilityName, accept, context); } /** - * Create or update a Capability resource that extends a Target resource. + * Delete a Capability that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. - * @param capability Capability resource to be created or updated. * @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. - * @return model that represents a Capability resource on successful completion of {@link Mono}. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String capabilityName, - CapabilityInner capability) { - return createOrUpdateWithResponseAsync(resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, capabilityName, capability) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono deleteAsync(String resourceGroupName, String targetName, String capabilityName) { + return deleteWithResponseAsync(resourceGroupName, targetName, capabilityName).flatMap(ignored -> Mono.empty()); } /** - * Create or update a Capability resource that extends a Target resource. + * Delete a Capability that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. - * @param capability Capability resource to be created or updated. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a Capability resource along with {@link Response}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateWithResponse(String resourceGroupName, - String parentProviderNamespace, String parentResourceType, String parentResourceName, String targetName, - String capabilityName, CapabilityInner capability, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, capabilityName, capability, context).block(); + public Response deleteWithResponse(String resourceGroupName, String targetName, String capabilityName, + Context context) { + return deleteWithResponseAsync(resourceGroupName, targetName, capabilityName, context).block(); } /** - * Create or update a Capability resource that extends a Target resource. + * Delete a Capability that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. - * @param capability Capability resource to be created or updated. * @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. - * @return model that represents a Capability resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public CapabilityInner createOrUpdate(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String capabilityName, - CapabilityInner capability) { - return createOrUpdateWithResponse(resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, capabilityName, capability, Context.NONE).getValue(); + public void delete(String resourceGroupName, String targetName, String capabilityName) { + deleteWithResponse(resourceGroupName, targetName, capabilityName, Context.NONE); } /** * 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 +721,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/CapabilitiesImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilitiesImpl.java index b3eff31ef35e6..b4f25e0986070 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilitiesImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilitiesImpl.java @@ -27,28 +27,22 @@ public CapabilitiesImpl(CapabilitiesClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable list(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName) { - PagedIterable inner = this.serviceClient() - .list(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName); + public PagedIterable list(String resourceGroupName, String targetName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, targetName); return ResourceManagerUtils.mapPage(inner, inner1 -> new CapabilityImpl(inner1, this.manager())); } - public PagedIterable list(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String continuationToken, + public PagedIterable list(String resourceGroupName, String targetName, String continuationToken, Context context) { - PagedIterable inner = this.serviceClient() - .list(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName, - continuationToken, context); + PagedIterable inner + = this.serviceClient().list(resourceGroupName, targetName, continuationToken, context); return ResourceManagerUtils.mapPage(inner, inner1 -> new CapabilityImpl(inner1, this.manager())); } - public Response getWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String capabilityName, + public Response getWithResponse(String resourceGroupName, String targetName, String capabilityName, Context context) { - Response inner = this.serviceClient() - .getWithResponse(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, - targetName, capabilityName, context); + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, targetName, capabilityName, context); if (inner != null) { return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), new CapabilityImpl(inner.getValue(), this.manager())); @@ -57,11 +51,8 @@ public Response getWithResponse(String resourceGroupName, String par } } - public Capability get(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName, String capabilityName) { - CapabilityInner inner = this.serviceClient() - .get(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName, - capabilityName); + public Capability get(String resourceGroupName, String targetName, String capabilityName) { + CapabilityInner inner = this.serviceClient().get(resourceGroupName, targetName, capabilityName); if (inner != null) { return new CapabilityImpl(inner, this.manager()); } else { @@ -69,46 +60,89 @@ public Capability get(String resourceGroupName, String parentProviderNamespace, } } - public Response deleteWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String capabilityName, + public Response deleteWithResponse(String resourceGroupName, String targetName, String capabilityName, Context context) { - return this.serviceClient() - .deleteWithResponse(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, - targetName, capabilityName, context); + return this.serviceClient().deleteWithResponse(resourceGroupName, targetName, capabilityName, context); } - public void delete(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName, String capabilityName) { - this.serviceClient() - .delete(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName, - capabilityName); + public void delete(String resourceGroupName, String targetName, String capabilityName) { + this.serviceClient().delete(resourceGroupName, targetName, capabilityName); } - public Response createOrUpdateWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String capabilityName, - CapabilityInner capability, Context context) { - Response inner = this.serviceClient() - .createOrUpdateWithResponse(resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, capabilityName, capability, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new CapabilityImpl(inner.getValue(), this.manager())); - } else { - return null; + public Capability getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String targetName = ResourceManagerUtils.getValueFromIdByName(id, "targets"); + if (targetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'targets'.", id))); + } + String capabilityName = ResourceManagerUtils.getValueFromIdByName(id, "capabilities"); + if (capabilityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'capabilities'.", id))); } + return this.getWithResponse(resourceGroupName, targetName, capabilityName, Context.NONE).getValue(); } - public Capability createOrUpdate(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String capabilityName, - CapabilityInner capability) { - CapabilityInner inner = this.serviceClient() - .createOrUpdate(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, - targetName, capabilityName, capability); - if (inner != null) { - return new CapabilityImpl(inner, this.manager()); - } else { - return null; + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String targetName = ResourceManagerUtils.getValueFromIdByName(id, "targets"); + if (targetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'targets'.", id))); + } + String capabilityName = ResourceManagerUtils.getValueFromIdByName(id, "capabilities"); + if (capabilityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'capabilities'.", id))); } + return this.getWithResponse(resourceGroupName, targetName, capabilityName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String targetName = ResourceManagerUtils.getValueFromIdByName(id, "targets"); + if (targetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'targets'.", id))); + } + String capabilityName = ResourceManagerUtils.getValueFromIdByName(id, "capabilities"); + if (capabilityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'capabilities'.", id))); + } + this.deleteWithResponse(resourceGroupName, targetName, capabilityName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String targetName = ResourceManagerUtils.getValueFromIdByName(id, "targets"); + if (targetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'targets'.", id))); + } + String capabilityName = ResourceManagerUtils.getValueFromIdByName(id, "capabilities"); + if (capabilityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'capabilities'.", id))); + } + return this.deleteWithResponse(resourceGroupName, targetName, capabilityName, context); } private CapabilitiesClient serviceClient() { @@ -118,4 +152,8 @@ private CapabilitiesClient serviceClient() { private com.azure.resourcemanager.chaos.ChaosManager manager() { return this.serviceManager; } + + public CapabilityImpl define(String name) { + return new CapabilityImpl(name, this.manager()); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityImpl.java index 1fae5a86f13a8..f1c92ff863817 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityImpl.java @@ -5,19 +5,16 @@ package com.azure.resourcemanager.chaos.implementation; import com.azure.core.management.SystemData; +import com.azure.core.util.Context; import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; import com.azure.resourcemanager.chaos.models.Capability; +import com.azure.resourcemanager.chaos.models.CapabilityProperties; -public final class CapabilityImpl implements Capability { +public final class CapabilityImpl implements Capability, Capability.Definition, Capability.Update { private CapabilityInner innerObject; private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; - CapabilityImpl(CapabilityInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - public String id() { return this.innerModel().id(); } @@ -30,35 +27,106 @@ public String type() { return this.innerModel().type(); } + public CapabilityProperties properties() { + return this.innerModel().properties(); + } + public SystemData systemData() { return this.innerModel().systemData(); } - public String publisher() { - return this.innerModel().publisher(); + public String resourceGroupName() { + return resourceGroupName; } - public String targetType() { - return this.innerModel().targetType(); + public CapabilityInner innerModel() { + return this.innerObject; } - public String description() { - return this.innerModel().description(); + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; } - public String parametersSchema() { - return this.innerModel().parametersSchema(); + private String resourceGroupName; + + private String targetName; + + private String capabilityName; + + public CapabilityImpl withExistingTarget(String resourceGroupName, String targetName) { + this.resourceGroupName = resourceGroupName; + this.targetName = targetName; + return this; } - public String urn() { - return this.innerModel().urn(); + public Capability create() { + this.innerObject = serviceManager.serviceClient() + .getCapabilities() + .createOrUpdateWithResponse(resourceGroupName, targetName, capabilityName, this.innerModel(), Context.NONE) + .getValue(); + return this; } - public CapabilityInner innerModel() { - return this.innerObject; + public Capability create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCapabilities() + .createOrUpdateWithResponse(resourceGroupName, targetName, capabilityName, this.innerModel(), context) + .getValue(); + return this; } - private com.azure.resourcemanager.chaos.ChaosManager manager() { - return this.serviceManager; + CapabilityImpl(String name, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerObject = new CapabilityInner(); + this.serviceManager = serviceManager; + this.capabilityName = name; + } + + public CapabilityImpl update() { + return this; + } + + public Capability apply() { + this.innerObject = serviceManager.serviceClient() + .getCapabilities() + .createOrUpdateWithResponse(resourceGroupName, targetName, capabilityName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Capability apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCapabilities() + .createOrUpdateWithResponse(resourceGroupName, targetName, capabilityName, this.innerModel(), context) + .getValue(); + return this; + } + + CapabilityImpl(CapabilityInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.targetName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "targets"); + this.capabilityName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "capabilities"); + } + + public Capability refresh() { + this.innerObject = serviceManager.serviceClient() + .getCapabilities() + .getWithResponse(resourceGroupName, targetName, capabilityName, Context.NONE) + .getValue(); + return this; + } + + public Capability refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCapabilities() + .getWithResponse(resourceGroupName, targetName, capabilityName, context) + .getValue(); + return this; + } + + public CapabilityImpl withProperties(CapabilityProperties properties) { + this.innerModel().withProperties(properties); + return this; } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypeImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypeImpl.java index c6076205a25af..5d7924e20c621 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypeImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypeImpl.java @@ -7,9 +7,7 @@ import com.azure.core.management.SystemData; import com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeInner; import com.azure.resourcemanager.chaos.models.CapabilityType; -import com.azure.resourcemanager.chaos.models.CapabilityTypePropertiesRuntimeProperties; -import java.util.Collections; -import java.util.List; +import com.azure.resourcemanager.chaos.models.CapabilityTypeProperties; public final class CapabilityTypeImpl implements CapabilityType { private CapabilityTypeInner innerObject; @@ -33,62 +31,12 @@ public String type() { return this.innerModel().type(); } - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public String location() { - return this.innerModel().location(); - } - - public String publisher() { - return this.innerModel().publisher(); - } - - public String targetType() { - return this.innerModel().targetType(); - } - - public String displayName() { - return this.innerModel().displayName(); - } - - public String description() { - return this.innerModel().description(); + public CapabilityTypeProperties properties() { + return this.innerModel().properties(); } - public String parametersSchema() { - return this.innerModel().parametersSchema(); - } - - public String urn() { - return this.innerModel().urn(); - } - - public String kind() { - return this.innerModel().kind(); - } - - public List azureRbacActions() { - List inner = this.innerModel().azureRbacActions(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public List azureRbacDataActions() { - List inner = this.innerModel().azureRbacDataActions(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public CapabilityTypePropertiesRuntimeProperties runtimeProperties() { - return this.innerModel().runtimeProperties(); + public SystemData systemData() { + return this.innerModel().systemData(); } public CapabilityTypeInner innerModel() { 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..4c5c047b972ba 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 @@ -63,22 +63,22 @@ public final class CapabilityTypesClientImpl implements CapabilityTypesClient { @ServiceInterface(name = "ChaosManagementClien") public interface CapabilityTypesService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes/{targetTypeName}/capabilityTypes") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("locationName") String locationName, @PathParam("targetTypeName") String targetTypeName, + @PathParam("location") String location, @PathParam("targetTypeName") String targetTypeName, @QueryParam("continuationToken") String continuationToken, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName}") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("locationName") String locationName, @PathParam("targetTypeName") String targetTypeName, + @PathParam("location") String location, @PathParam("targetTypeName") String targetTypeName, @PathParam("capabilityTypeName") String capabilityTypeName, @HeaderParam("Accept") String accept, Context context); @@ -94,7 +94,7 @@ Mono> listNext( /** * Get a list of Capability Type resources for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param continuationToken String that sets the continuation token. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -104,7 +104,7 @@ Mono> listNext( * on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String locationName, String targetTypeName, + private Mono> listSinglePageAsync(String location, String targetTypeName, String continuationToken) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -114,8 +114,8 @@ private Mono> listSinglePageAsync(String loca return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - if (locationName == null) { - return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); } if (targetTypeName == null) { return Mono.error(new IllegalArgumentException("Parameter targetTypeName is required and cannot be null.")); @@ -123,7 +123,7 @@ private Mono> listSinglePageAsync(String loca final String accept = "application/json"; return FluxUtil .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), locationName, targetTypeName, continuationToken, accept, context)) + this.client.getSubscriptionId(), location, targetTypeName, continuationToken, accept, context)) .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); @@ -132,7 +132,7 @@ private Mono> listSinglePageAsync(String loca /** * Get a list of Capability Type resources for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. @@ -143,7 +143,7 @@ private Mono> listSinglePageAsync(String loca * on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String locationName, String targetTypeName, + private Mono> listSinglePageAsync(String location, String targetTypeName, String continuationToken, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -153,8 +153,8 @@ private Mono> listSinglePageAsync(String loca return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - if (locationName == null) { - return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); } if (targetTypeName == null) { return Mono.error(new IllegalArgumentException("Parameter targetTypeName is required and cannot be null.")); @@ -162,7 +162,7 @@ private Mono> listSinglePageAsync(String loca final String accept = "application/json"; context = this.client.mergeContext(context); return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), locationName, + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), location, targetTypeName, continuationToken, accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); @@ -171,7 +171,7 @@ private Mono> listSinglePageAsync(String loca /** * Get a list of Capability Type resources for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param continuationToken String that sets the continuation token. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -181,16 +181,15 @@ private Mono> listSinglePageAsync(String loca * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String locationName, String targetTypeName, - String continuationToken) { - return new PagedFlux<>(() -> listSinglePageAsync(locationName, targetTypeName, continuationToken), + private PagedFlux listAsync(String location, String targetTypeName, String continuationToken) { + return new PagedFlux<>(() -> listSinglePageAsync(location, targetTypeName, continuationToken), nextLink -> listNextSinglePageAsync(nextLink)); } /** * Get a list of Capability Type resources for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -199,16 +198,16 @@ private PagedFlux listAsync(String locationName, String tar * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String locationName, String targetTypeName) { + private PagedFlux listAsync(String location, String targetTypeName) { final String continuationToken = null; - return new PagedFlux<>(() -> listSinglePageAsync(locationName, targetTypeName, continuationToken), + return new PagedFlux<>(() -> listSinglePageAsync(location, targetTypeName, continuationToken), nextLink -> listNextSinglePageAsync(nextLink)); } /** * Get a list of Capability Type resources for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. @@ -219,16 +218,16 @@ private PagedFlux listAsync(String locationName, String tar * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String locationName, String targetTypeName, - String continuationToken, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(locationName, targetTypeName, continuationToken, context), + private PagedFlux listAsync(String location, String targetTypeName, String continuationToken, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(location, targetTypeName, continuationToken, context), nextLink -> listNextSinglePageAsync(nextLink, context)); } /** * Get a list of Capability Type resources for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -237,15 +236,15 @@ private PagedFlux listAsync(String locationName, String tar * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String locationName, String targetTypeName) { + public PagedIterable list(String location, String targetTypeName) { final String continuationToken = null; - return new PagedIterable<>(listAsync(locationName, targetTypeName, continuationToken)); + return new PagedIterable<>(listAsync(location, targetTypeName, continuationToken)); } /** * Get a list of Capability Type resources for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. @@ -256,15 +255,15 @@ public PagedIterable list(String locationName, String targe * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String locationName, String targetTypeName, String continuationToken, + public PagedIterable list(String location, String targetTypeName, String continuationToken, Context context) { - return new PagedIterable<>(listAsync(locationName, targetTypeName, continuationToken, context)); + return new PagedIterable<>(listAsync(location, targetTypeName, continuationToken, context)); } /** * Get a Capability Type resource for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param capabilityTypeName String that represents a Capability Type resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -274,7 +273,7 @@ public PagedIterable list(String locationName, String targe * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String locationName, String targetTypeName, + private Mono> getWithResponseAsync(String location, String targetTypeName, String capabilityTypeName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -284,8 +283,8 @@ private Mono> getWithResponseAsync(String location return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - if (locationName == null) { - return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); } if (targetTypeName == null) { return Mono.error(new IllegalArgumentException("Parameter targetTypeName is required and cannot be null.")); @@ -297,14 +296,14 @@ private Mono> getWithResponseAsync(String location final String accept = "application/json"; return FluxUtil .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), locationName, targetTypeName, capabilityTypeName, accept, context)) + this.client.getSubscriptionId(), location, targetTypeName, capabilityTypeName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get a Capability Type resource for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param capabilityTypeName String that represents a Capability Type resource name. * @param context The context to associate with this operation. @@ -315,7 +314,7 @@ private Mono> getWithResponseAsync(String location * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String locationName, String targetTypeName, + private Mono> getWithResponseAsync(String location, String targetTypeName, String capabilityTypeName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -325,8 +324,8 @@ private Mono> getWithResponseAsync(String location return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - if (locationName == null) { - return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); } if (targetTypeName == null) { return Mono.error(new IllegalArgumentException("Parameter targetTypeName is required and cannot be null.")); @@ -338,13 +337,13 @@ private Mono> getWithResponseAsync(String location final String accept = "application/json"; context = this.client.mergeContext(context); return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - locationName, targetTypeName, capabilityTypeName, accept, context); + location, targetTypeName, capabilityTypeName, accept, context); } /** * Get a Capability Type resource for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param capabilityTypeName String that represents a Capability Type resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -353,15 +352,15 @@ private Mono> getWithResponseAsync(String location * @return a Capability Type resource for given Target Type and location on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String locationName, String targetTypeName, String capabilityTypeName) { - return getWithResponseAsync(locationName, targetTypeName, capabilityTypeName) + private Mono getAsync(String location, String targetTypeName, String capabilityTypeName) { + return getWithResponseAsync(location, targetTypeName, capabilityTypeName) .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Get a Capability Type resource for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param capabilityTypeName String that represents a Capability Type resource name. * @param context The context to associate with this operation. @@ -371,15 +370,15 @@ private Mono getAsync(String locationName, String targetTyp * @return a Capability Type resource for given Target Type and location along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String locationName, String targetTypeName, + public Response getWithResponse(String location, String targetTypeName, String capabilityTypeName, Context context) { - return getWithResponseAsync(locationName, targetTypeName, capabilityTypeName, context).block(); + return getWithResponseAsync(location, targetTypeName, capabilityTypeName, context).block(); } /** * Get a Capability Type resource for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param capabilityTypeName String that represents a Capability Type resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -388,16 +387,14 @@ public Response getWithResponse(String locationName, String * @return a Capability Type resource for given Target Type and location. */ @ServiceMethod(returns = ReturnType.SINGLE) - public CapabilityTypeInner get(String locationName, String targetTypeName, String capabilityTypeName) { - return getWithResponse(locationName, targetTypeName, capabilityTypeName, Context.NONE).getValue(); + public CapabilityTypeInner get(String location, String targetTypeName, String capabilityTypeName) { + return getWithResponse(location, targetTypeName, capabilityTypeName, Context.NONE).getValue(); } /** * 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 +420,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/CapabilityTypesImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesImpl.java index 6a206147b5583..8d31c9d59a333 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesImpl.java @@ -27,22 +27,22 @@ public CapabilityTypesImpl(CapabilityTypesClient innerClient, this.serviceManager = serviceManager; } - public PagedIterable list(String locationName, String targetTypeName) { - PagedIterable inner = this.serviceClient().list(locationName, targetTypeName); + public PagedIterable list(String location, String targetTypeName) { + PagedIterable inner = this.serviceClient().list(location, targetTypeName); return ResourceManagerUtils.mapPage(inner, inner1 -> new CapabilityTypeImpl(inner1, this.manager())); } - public PagedIterable list(String locationName, String targetTypeName, String continuationToken, + public PagedIterable list(String location, String targetTypeName, String continuationToken, Context context) { PagedIterable inner - = this.serviceClient().list(locationName, targetTypeName, continuationToken, context); + = this.serviceClient().list(location, targetTypeName, continuationToken, context); return ResourceManagerUtils.mapPage(inner, inner1 -> new CapabilityTypeImpl(inner1, this.manager())); } - public Response getWithResponse(String locationName, String targetTypeName, - String capabilityTypeName, Context context) { + public Response getWithResponse(String location, String targetTypeName, String capabilityTypeName, + Context context) { Response inner - = this.serviceClient().getWithResponse(locationName, targetTypeName, capabilityTypeName, context); + = this.serviceClient().getWithResponse(location, targetTypeName, capabilityTypeName, context); if (inner != null) { return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), new CapabilityTypeImpl(inner.getValue(), this.manager())); @@ -51,8 +51,8 @@ public Response getWithResponse(String locationName, String targ } } - public CapabilityType get(String locationName, String targetTypeName, String capabilityTypeName) { - CapabilityTypeInner inner = this.serviceClient().get(locationName, targetTypeName, capabilityTypeName); + public CapabilityType get(String location, String targetTypeName, String capabilityTypeName) { + CapabilityTypeInner inner = this.serviceClient().get(location, targetTypeName, capabilityTypeName); if (inner != null) { return new CapabilityTypeImpl(inner, this.manager()); } else { diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientBuilder.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientBuilder.java index c892e3f2aaca4..4d3d5ef4d5009 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientBuilder.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientBuilder.java @@ -20,12 +20,12 @@ @ServiceClientBuilder(serviceClients = { ChaosManagementClientImpl.class }) public final class ChaosManagementClientBuilder { /* - * GUID that represents an Azure subscription ID. + * The ID of the target subscription. The value must be an UUID. */ private String subscriptionId; /** - * Sets GUID that represents an Azure subscription ID. + * Sets The ID of the target subscription. The value must be an UUID. * * @param subscriptionId the subscriptionId value. * @return the ChaosManagementClientBuilder. 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..d819c243550f5 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; @@ -25,8 +26,8 @@ import com.azure.resourcemanager.chaos.fluent.CapabilitiesClient; import com.azure.resourcemanager.chaos.fluent.CapabilityTypesClient; import com.azure.resourcemanager.chaos.fluent.ChaosManagementClient; +import com.azure.resourcemanager.chaos.fluent.ExperimentExecutionsClient; import com.azure.resourcemanager.chaos.fluent.ExperimentsClient; -import com.azure.resourcemanager.chaos.fluent.OperationStatusesClient; import com.azure.resourcemanager.chaos.fluent.OperationsClient; import com.azure.resourcemanager.chaos.fluent.TargetTypesClient; import com.azure.resourcemanager.chaos.fluent.TargetsClient; @@ -45,12 +46,12 @@ @ServiceClient(builder = ChaosManagementClientBuilder.class) public final class ChaosManagementClientImpl implements ChaosManagementClient { /** - * GUID that represents an Azure subscription ID. + * The ID of the target subscription. The value must be an UUID. */ private final String subscriptionId; /** - * Gets GUID that represents an Azure subscription ID. + * Gets The ID of the target subscription. The value must be an UUID. * * @return the subscriptionId value. */ @@ -129,101 +130,101 @@ public Duration getDefaultPollInterval() { } /** - * The CapabilitiesClient object to access its operations. + * The OperationsClient object to access its operations. */ - private final CapabilitiesClient capabilities; + private final OperationsClient operations; /** - * Gets the CapabilitiesClient object to access its operations. + * Gets the OperationsClient object to access its operations. * - * @return the CapabilitiesClient object. + * @return the OperationsClient object. */ - public CapabilitiesClient getCapabilities() { - return this.capabilities; + public OperationsClient getOperations() { + return this.operations; } /** - * The CapabilityTypesClient object to access its operations. + * The ExperimentsClient object to access its operations. */ - private final CapabilityTypesClient capabilityTypes; + private final ExperimentsClient experiments; /** - * Gets the CapabilityTypesClient object to access its operations. + * Gets the ExperimentsClient object to access its operations. * - * @return the CapabilityTypesClient object. + * @return the ExperimentsClient object. */ - public CapabilityTypesClient getCapabilityTypes() { - return this.capabilityTypes; + public ExperimentsClient getExperiments() { + return this.experiments; } /** - * The ExperimentsClient object to access its operations. + * The TargetTypesClient object to access its operations. */ - private final ExperimentsClient experiments; + private final TargetTypesClient targetTypes; /** - * Gets the ExperimentsClient object to access its operations. + * Gets the TargetTypesClient object to access its operations. * - * @return the ExperimentsClient object. + * @return the TargetTypesClient object. */ - public ExperimentsClient getExperiments() { - return this.experiments; + public TargetTypesClient getTargetTypes() { + return this.targetTypes; } /** - * The OperationStatusesClient object to access its operations. + * The CapabilityTypesClient object to access its operations. */ - private final OperationStatusesClient operationStatuses; + private final CapabilityTypesClient capabilityTypes; /** - * Gets the OperationStatusesClient object to access its operations. + * Gets the CapabilityTypesClient object to access its operations. * - * @return the OperationStatusesClient object. + * @return the CapabilityTypesClient object. */ - public OperationStatusesClient getOperationStatuses() { - return this.operationStatuses; + public CapabilityTypesClient getCapabilityTypes() { + return this.capabilityTypes; } /** - * The OperationsClient object to access its operations. + * The TargetsClient object to access its operations. */ - private final OperationsClient operations; + private final TargetsClient targets; /** - * Gets the OperationsClient object to access its operations. + * Gets the TargetsClient object to access its operations. * - * @return the OperationsClient object. + * @return the TargetsClient object. */ - public OperationsClient getOperations() { - return this.operations; + public TargetsClient getTargets() { + return this.targets; } /** - * The TargetTypesClient object to access its operations. + * The ExperimentExecutionsClient object to access its operations. */ - private final TargetTypesClient targetTypes; + private final ExperimentExecutionsClient experimentExecutions; /** - * Gets the TargetTypesClient object to access its operations. + * Gets the ExperimentExecutionsClient object to access its operations. * - * @return the TargetTypesClient object. + * @return the ExperimentExecutionsClient object. */ - public TargetTypesClient getTargetTypes() { - return this.targetTypes; + public ExperimentExecutionsClient getExperimentExecutions() { + return this.experimentExecutions; } /** - * The TargetsClient object to access its operations. + * The CapabilitiesClient object to access its operations. */ - private final TargetsClient targets; + private final CapabilitiesClient capabilities; /** - * Gets the TargetsClient object to access its operations. + * Gets the CapabilitiesClient object to access its operations. * - * @return the TargetsClient object. + * @return the CapabilitiesClient object. */ - public TargetsClient getTargets() { - return this.targets; + public CapabilitiesClient getCapabilities() { + return this.capabilities; } /** @@ -233,7 +234,7 @@ public TargetsClient getTargets() { * @param serializerAdapter The serializer to serialize an object into a string. * @param defaultPollInterval The default poll interval for long-running operation. * @param environment The Azure environment. - * @param subscriptionId GUID that represents an Azure subscription ID. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. * @param endpoint server parameter. */ ChaosManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, @@ -243,14 +244,14 @@ public TargetsClient getTargets() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2024-01-01"; - this.capabilities = new CapabilitiesClientImpl(this); - this.capabilityTypes = new CapabilityTypesClientImpl(this); - this.experiments = new ExperimentsClientImpl(this); - this.operationStatuses = new OperationStatusesClientImpl(this); + this.apiVersion = "2025-01-01"; this.operations = new OperationsClientImpl(this); + this.experiments = new ExperimentsClientImpl(this); this.targetTypes = new TargetTypesClientImpl(this); + this.capabilityTypes = new CapabilityTypesClientImpl(this); this.targets = new TargetsClientImpl(this); + this.experimentExecutions = new ExperimentExecutionsClientImpl(this); + this.capabilities = new CapabilitiesClientImpl(this); } /** @@ -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/ExperimentExecutionDetailsImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionDetailsImpl.java index f8574189f0640..c45c88d31ae4a 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionDetailsImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionDetailsImpl.java @@ -6,8 +6,7 @@ import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetails; -import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsPropertiesRunInformation; -import java.time.OffsetDateTime; +import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsProperties; public final class ExperimentExecutionDetailsImpl implements ExperimentExecutionDetails { private ExperimentExecutionDetailsInner innerObject; @@ -32,28 +31,8 @@ public String name() { return this.innerModel().name(); } - public String failureReason() { - return this.innerModel().failureReason(); - } - - public OffsetDateTime lastActionAt() { - return this.innerModel().lastActionAt(); - } - - public ExperimentExecutionDetailsPropertiesRunInformation runInformation() { - return this.innerModel().runInformation(); - } - - public String status() { - return this.innerModel().status(); - } - - public OffsetDateTime startedAt() { - return this.innerModel().startedAt(); - } - - public OffsetDateTime stoppedAt() { - return this.innerModel().stoppedAt(); + public ExperimentExecutionDetailsProperties properties() { + return this.innerModel().properties(); } public ExperimentExecutionDetailsInner innerModel() { diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionImpl.java index 5e188019d810a..83bd123a1bf16 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionImpl.java @@ -4,9 +4,10 @@ package com.azure.resourcemanager.chaos.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionInner; import com.azure.resourcemanager.chaos.models.ExperimentExecution; -import java.time.OffsetDateTime; +import com.azure.resourcemanager.chaos.models.ExperimentExecutionProperties; public final class ExperimentExecutionImpl implements ExperimentExecution { private ExperimentExecutionInner innerObject; @@ -19,10 +20,6 @@ public final class ExperimentExecutionImpl implements ExperimentExecution { this.serviceManager = serviceManager; } - public String type() { - return this.innerModel().type(); - } - public String id() { return this.innerModel().id(); } @@ -31,16 +28,16 @@ public String name() { return this.innerModel().name(); } - public String status() { - return this.innerModel().status(); + public String type() { + return this.innerModel().type(); } - public OffsetDateTime startedAt() { - return this.innerModel().startedAt(); + public ExperimentExecutionProperties properties() { + return this.innerModel().properties(); } - public OffsetDateTime stoppedAt() { - return this.innerModel().stoppedAt(); + public SystemData systemData() { + return this.innerModel().systemData(); } public ExperimentExecutionInner innerModel() { diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionsClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionsClientImpl.java new file mode 100644 index 0000000000000..8d22712483ee4 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionsClientImpl.java @@ -0,0 +1,565 @@ +// 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.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.chaos.fluent.ExperimentExecutionsClient; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionInner; +import com.azure.resourcemanager.chaos.models.ExperimentExecutionListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExperimentExecutionsClient. + */ +public final class ExperimentExecutionsClientImpl implements ExperimentExecutionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ExperimentExecutionsService service; + + /** + * The service client containing this operation class. + */ + private final ChaosManagementClientImpl client; + + /** + * Initializes an instance of ExperimentExecutionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExperimentExecutionsClientImpl(ChaosManagementClientImpl client) { + this.service = RestProxy.create(ExperimentExecutionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ChaosManagementClientExperimentExecutions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ChaosManagementClien") + public interface ExperimentExecutionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("experimentName") String experimentName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("experimentName") String experimentName, @PathParam("executionId") String executionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}/getExecutionDetails") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getExecutionDetails(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("experimentName") String experimentName, @PathParam("executionId") String executionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a list of executions of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @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. + * @return a list of executions of an Experiment resource along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String experimentName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, experimentName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of executions of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of executions of an Experiment resource along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String experimentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, experimentName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get a list of executions of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @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. + * @return a list of executions of an Experiment resource as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String experimentName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, experimentName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of executions of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of executions of an Experiment resource as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String experimentName, + Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, experimentName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of executions of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @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. + * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String experimentName) { + return new PagedIterable<>(listAsync(resourceGroupName, experimentName)); + } + + /** + * Get a list of executions of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String experimentName, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, experimentName, context)); + } + + /** + * Get an execution of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @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. + * @return an execution of an Experiment resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String experimentName, String executionId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + if (executionId == null) { + return Mono.error(new IllegalArgumentException("Parameter executionId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, experimentName, executionId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get an execution of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of an Experiment resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String experimentName, String executionId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + if (executionId == null) { + return Mono.error(new IllegalArgumentException("Parameter executionId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, experimentName, executionId, accept, context); + } + + /** + * Get an execution of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @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. + * @return an execution of an Experiment resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String experimentName, + String executionId) { + return getWithResponseAsync(resourceGroupName, experimentName, executionId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get an execution of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of an Experiment resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String experimentName, + String executionId, Context context) { + return getWithResponseAsync(resourceGroupName, experimentName, executionId, context).block(); + } + + /** + * Get an execution of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @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. + * @return an execution of an Experiment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExperimentExecutionInner get(String resourceGroupName, String experimentName, String executionId) { + return getWithResponse(resourceGroupName, experimentName, executionId, Context.NONE).getValue(); + } + + /** + * Execution details of an experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @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. + * @return model that represents the execution details of an Experiment along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getExecutionDetailsWithResponseAsync(String resourceGroupName, String experimentName, String executionId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + if (executionId == null) { + return Mono.error(new IllegalArgumentException("Parameter executionId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getExecutionDetails(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, experimentName, executionId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Execution details of an experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the execution details of an Experiment along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getExecutionDetailsWithResponseAsync( + String resourceGroupName, String experimentName, String executionId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + if (executionId == null) { + return Mono.error(new IllegalArgumentException("Parameter executionId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getExecutionDetails(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, experimentName, executionId, accept, context); + } + + /** + * Execution details of an experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @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. + * @return model that represents the execution details of an Experiment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getExecutionDetailsAsync(String resourceGroupName, + String experimentName, String executionId) { + return getExecutionDetailsWithResponseAsync(resourceGroupName, experimentName, executionId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Execution details of an experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the execution details of an Experiment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getExecutionDetailsWithResponse(String resourceGroupName, + String experimentName, String executionId, Context context) { + return getExecutionDetailsWithResponseAsync(resourceGroupName, experimentName, executionId, context).block(); + } + + /** + * Execution details of an experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @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. + * @return model that represents the execution details of an Experiment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExperimentExecutionDetailsInner getExecutionDetails(String resourceGroupName, String experimentName, + String executionId) { + return getExecutionDetailsWithResponse(resourceGroupName, experimentName, executionId, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @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. + * @return model that represents a list of Experiment executions and a link for pagination along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a list of Experiment executions and a link for pagination along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionsImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionsImpl.java new file mode 100644 index 0000000000000..e527f6877b4b9 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionsImpl.java @@ -0,0 +1,94 @@ +// 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.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.chaos.fluent.ExperimentExecutionsClient; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionInner; +import com.azure.resourcemanager.chaos.models.ExperimentExecution; +import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetails; +import com.azure.resourcemanager.chaos.models.ExperimentExecutions; + +public final class ExperimentExecutionsImpl implements ExperimentExecutions { + private static final ClientLogger LOGGER = new ClientLogger(ExperimentExecutionsImpl.class); + + private final ExperimentExecutionsClient innerClient; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + public ExperimentExecutionsImpl(ExperimentExecutionsClient innerClient, + com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String experimentName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, experimentName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ExperimentExecutionImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String experimentName, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, experimentName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ExperimentExecutionImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String experimentName, + String executionId, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, experimentName, executionId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ExperimentExecutionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ExperimentExecution get(String resourceGroupName, String experimentName, String executionId) { + ExperimentExecutionInner inner = this.serviceClient().get(resourceGroupName, experimentName, executionId); + if (inner != null) { + return new ExperimentExecutionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getExecutionDetailsWithResponse(String resourceGroupName, + String experimentName, String executionId, Context context) { + Response inner = this.serviceClient() + .getExecutionDetailsWithResponse(resourceGroupName, experimentName, executionId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ExperimentExecutionDetailsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ExperimentExecutionDetails getExecutionDetails(String resourceGroupName, String experimentName, + String executionId) { + ExperimentExecutionDetailsInner inner + = this.serviceClient().getExecutionDetails(resourceGroupName, experimentName, executionId); + if (inner != null) { + return new ExperimentExecutionDetailsImpl(inner, this.manager()); + } else { + return null; + } + } + + private ExperimentExecutionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentImpl.java index 105b47e7f110e..297f9b6fdeb22 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentImpl.java @@ -8,14 +8,13 @@ import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner; -import com.azure.resourcemanager.chaos.models.ChaosExperimentStep; -import com.azure.resourcemanager.chaos.models.ChaosTargetSelector; import com.azure.resourcemanager.chaos.models.Experiment; +import com.azure.resourcemanager.chaos.models.ExperimentProperties; import com.azure.resourcemanager.chaos.models.ExperimentUpdate; -import com.azure.resourcemanager.chaos.models.ProvisioningState; -import com.azure.resourcemanager.chaos.models.ResourceIdentity; +import com.azure.resourcemanager.chaos.models.ManagedServiceIdentity; +import com.azure.resourcemanager.chaos.models.ManagedServiceIdentityUpdate; +import com.azure.resourcemanager.chaos.models.PostActionResponse; import java.util.Collections; -import java.util.List; import java.util.Map; public final class ExperimentImpl implements Experiment, Experiment.Definition, Experiment.Update { @@ -48,34 +47,16 @@ public Map tags() { } } - public SystemData systemData() { - return this.innerModel().systemData(); + public ExperimentProperties properties() { + return this.innerModel().properties(); } - public ResourceIdentity identity() { + public ManagedServiceIdentity identity() { return this.innerModel().identity(); } - public ProvisioningState provisioningState() { - return this.innerModel().provisioningState(); - } - - public List steps() { - List inner = this.innerModel().steps(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public List selectors() { - List inner = this.innerModel().selectors(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } + public SystemData systemData() { + return this.innerModel().systemData(); } public Region region() { @@ -102,7 +83,7 @@ private com.azure.resourcemanager.chaos.ChaosManager manager() { private String experimentName; - private ExperimentUpdate updateExperiment; + private ExperimentUpdate updateProperties; public ExperimentImpl withExistingResourceGroup(String resourceGroupName) { this.resourceGroupName = resourceGroupName; @@ -130,21 +111,21 @@ public Experiment create(Context context) { } public ExperimentImpl update() { - this.updateExperiment = new ExperimentUpdate(); + this.updateProperties = new ExperimentUpdate(); return this; } public Experiment apply() { this.innerObject = serviceManager.serviceClient() .getExperiments() - .update(resourceGroupName, experimentName, updateExperiment, Context.NONE); + .update(resourceGroupName, experimentName, updateProperties, Context.NONE); return this; } public Experiment apply(Context context) { this.innerObject = serviceManager.serviceClient() .getExperiments() - .update(resourceGroupName, experimentName, updateExperiment, context); + .update(resourceGroupName, experimentName, updateProperties, context); return this; } @@ -171,20 +152,20 @@ public Experiment refresh(Context context) { return this; } - public void cancel() { - serviceManager.experiments().cancel(resourceGroupName, experimentName); + public PostActionResponse cancel() { + return serviceManager.experiments().cancel(resourceGroupName, experimentName); } - public void cancel(Context context) { - serviceManager.experiments().cancel(resourceGroupName, experimentName, context); + public PostActionResponse cancel(Context context) { + return serviceManager.experiments().cancel(resourceGroupName, experimentName, context); } - public void start() { - serviceManager.experiments().start(resourceGroupName, experimentName); + public PostActionResponse start() { + return serviceManager.experiments().start(resourceGroupName, experimentName); } - public void start(Context context) { - serviceManager.experiments().start(resourceGroupName, experimentName, context); + public PostActionResponse start(Context context) { + return serviceManager.experiments().start(resourceGroupName, experimentName, context); } public ExperimentImpl withRegion(Region location) { @@ -197,13 +178,8 @@ public ExperimentImpl withRegion(String location) { return this; } - public ExperimentImpl withSteps(List steps) { - this.innerModel().withSteps(steps); - return this; - } - - public ExperimentImpl withSelectors(List selectors) { - this.innerModel().withSelectors(selectors); + public ExperimentImpl withProperties(ExperimentProperties properties) { + this.innerModel().withProperties(properties); return this; } @@ -212,19 +188,19 @@ public ExperimentImpl withTags(Map tags) { this.innerModel().withTags(tags); return this; } else { - this.updateExperiment.withTags(tags); + this.updateProperties.withTags(tags); return this; } } - public ExperimentImpl withIdentity(ResourceIdentity identity) { - if (isInCreateMode()) { - this.innerModel().withIdentity(identity); - return this; - } else { - this.updateExperiment.withIdentity(identity); - return this; - } + public ExperimentImpl withIdentity(ManagedServiceIdentity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public ExperimentImpl withIdentity(ManagedServiceIdentityUpdate identity) { + this.updateProperties.withIdentity(identity); + return this; } private boolean isInCreateMode() { 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..d3f73fbd10e87 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 @@ -34,10 +34,8 @@ import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.chaos.fluent.ExperimentsClient; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionInner; import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner; -import com.azure.resourcemanager.chaos.models.ExperimentExecutionListResult; +import com.azure.resourcemanager.chaos.fluent.models.PostActionResponseInner; import com.azure.resourcemanager.chaos.models.ExperimentListResult; import com.azure.resourcemanager.chaos.models.ExperimentUpdate; import java.nio.ByteBuffer; @@ -95,15 +93,6 @@ Mono> listByResourceGroup(@HostParam("$host") Str @QueryParam("continuationToken") String continuationToken, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> delete(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("experimentName") String experimentName, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}") @ExpectedResponses({ 200 }) @@ -120,87 +109,60 @@ Mono> getByResourceGroup(@HostParam("$host") String en Mono>> createOrUpdate(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("experimentName") String experimentName, - @BodyParam("application/json") ExperimentInner experiment, @HeaderParam("Accept") String accept, - Context context); + @PathParam("experimentName") String experimentName, @BodyParam("application/json") ExperimentInner resource, + @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}") - @ExpectedResponses({ 202 }) + @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> update(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("experimentName") String experimentName, - @BodyParam("application/json") ExperimentUpdate experiment, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ExperimentUpdate properties, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel") - @ExpectedResponses({ 202 }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}") + @ExpectedResponses({ 202, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> cancel(@HostParam("$host") String endpoint, + Mono>> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("experimentName") String experimentName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start") - @ExpectedResponses({ 202 }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel") + @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> start(@HostParam("$host") String endpoint, + Mono>> cancel(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("experimentName") String experimentName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions") - @ExpectedResponses({ 200 }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start") + @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listAllExecutions(@HostParam("$host") String endpoint, + Mono>> start(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("experimentName") String experimentName, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getExecution(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("experimentName") String experimentName, @PathParam("executionId") String executionId, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}/getExecutionDetails") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> executionDetails(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("experimentName") String experimentName, @PathParam("executionId") String executionId, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listAllNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listAllExecutionsNext( + Mono> listByResourceGroupNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } @@ -283,7 +245,7 @@ private Mono> listSinglePageAsync(Boolean running @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(Boolean running, String continuationToken) { return new PagedFlux<>(() -> listSinglePageAsync(running, continuationToken), - nextLink -> listAllNextSinglePageAsync(nextLink)); + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); } /** @@ -298,7 +260,7 @@ private PagedFlux listAsync() { final Boolean running = null; final String continuationToken = null; return new PagedFlux<>(() -> listSinglePageAsync(running, continuationToken), - nextLink -> listAllNextSinglePageAsync(nextLink)); + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); } /** @@ -316,7 +278,7 @@ private PagedFlux listAsync() { @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(Boolean running, String continuationToken, Context context) { return new PagedFlux<>(() -> listSinglePageAsync(running, continuationToken, context), - nextLink -> listAllNextSinglePageAsync(nextLink, context)); + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); } /** @@ -353,7 +315,7 @@ public PagedIterable list(Boolean running, String continuationT /** * Get a list of Experiment resources in a resource group. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param running Optional value that indicates whether to filter results based on if the Experiment is currently * running. If null, then the results will not be filtered. * @param continuationToken String that sets the continuation token. @@ -390,7 +352,7 @@ private Mono> listByResourceGroupSinglePageAsync( /** * Get a list of Experiment resources in a resource group. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param running Optional value that indicates whether to filter results based on if the Experiment is currently * running. If null, then the results will not be filtered. * @param continuationToken String that sets the continuation token. @@ -428,7 +390,7 @@ private Mono> listByResourceGroupSinglePageAsync( /** * Get a list of Experiment resources in a resource group. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param running Optional value that indicates whether to filter results based on if the Experiment is currently * running. If null, then the results will not be filtered. * @param continuationToken String that sets the continuation token. @@ -441,13 +403,13 @@ private Mono> listByResourceGroupSinglePageAsync( private PagedFlux listByResourceGroupAsync(String resourceGroupName, Boolean running, String continuationToken) { return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, running, continuationToken), - nextLink -> listNextSinglePageAsync(nextLink)); + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** * Get a list of Experiment resources in a resource group. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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. @@ -458,13 +420,13 @@ private PagedFlux listByResourceGroupAsync(String resourceGroup final Boolean running = null; final String continuationToken = null; return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, running, continuationToken), - nextLink -> listNextSinglePageAsync(nextLink)); + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** * Get a list of Experiment resources in a resource group. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param running Optional value that indicates whether to filter results based on if the Experiment is currently * running. If null, then the results will not be filtered. * @param continuationToken String that sets the continuation token. @@ -479,13 +441,13 @@ private PagedFlux listByResourceGroupAsync(String resourceGroup String continuationToken, Context context) { return new PagedFlux<>( () -> listByResourceGroupSinglePageAsync(resourceGroupName, running, continuationToken, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); } /** * Get a list of Experiment resources in a resource group. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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. @@ -501,7 +463,7 @@ public PagedIterable listByResourceGroup(String resourceGroupNa /** * Get a list of Experiment resources in a resource group. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param running Optional value that indicates whether to filter results based on if the Experiment is currently * running. If null, then the results will not be filtered. * @param continuationToken String that sets the continuation token. @@ -517,210 +479,10 @@ public PagedIterable listByResourceGroup(String resourceGroupNa return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, running, continuationToken, context)); } - /** - * Delete a Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @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. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, String experimentName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (experimentName == null) { - return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, experimentName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @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. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, String experimentName, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (experimentName == null) { - return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, experimentName, accept, context); - } - - /** - * Delete a Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @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. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String experimentName) { - Mono>> mono = deleteWithResponseAsync(resourceGroupName, experimentName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); - } - - /** - * Delete a Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @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. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String experimentName, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono = deleteWithResponseAsync(resourceGroupName, experimentName, context); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); - } - - /** - * Delete a Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @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. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, String experimentName) { - return this.beginDeleteAsync(resourceGroupName, experimentName).getSyncPoller(); - } - - /** - * Delete a Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @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. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, String experimentName, - Context context) { - return this.beginDeleteAsync(resourceGroupName, experimentName, context).getSyncPoller(); - } - - /** - * Delete a Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @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. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String experimentName) { - return beginDeleteAsync(resourceGroupName, experimentName).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Delete a Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @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. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String experimentName, Context context) { - return beginDeleteAsync(resourceGroupName, experimentName, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Delete a Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String experimentName) { - deleteAsync(resourceGroupName, experimentName).block(); - } - - /** - * Delete a Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @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. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String experimentName, Context context) { - deleteAsync(resourceGroupName, experimentName, context).block(); - } - /** * Get a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -755,7 +517,7 @@ private Mono> getByResourceGroupWithResponseAsync(Stri /** * Get a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -790,7 +552,7 @@ private Mono> getByResourceGroupWithResponseAsync(Stri /** * Get a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -806,7 +568,7 @@ private Mono getByResourceGroupAsync(String resourceGroupName, /** * Get a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -823,7 +585,7 @@ public Response getByResourceGroupWithResponse(String resourceG /** * Get a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -838,9 +600,9 @@ public ExperimentInner getByResourceGroup(String resourceGroupName, String exper /** * Create or update a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. + * @param resource Experiment resource to be created or updated. * @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. @@ -849,7 +611,7 @@ public ExperimentInner getByResourceGroup(String resourceGroupName, String exper */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String experimentName, ExperimentInner experiment) { + String experimentName, ExperimentInner resource) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -865,24 +627,24 @@ private Mono>> createOrUpdateWithResponseAsync(String if (experimentName == null) { return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); } - if (experiment == null) { - return Mono.error(new IllegalArgumentException("Parameter experiment is required and cannot be null.")); + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); } else { - experiment.validate(); + resource.validate(); } final String accept = "application/json"; return FluxUtil .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, experimentName, experiment, accept, context)) + this.client.getSubscriptionId(), resourceGroupName, experimentName, resource, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Create or update a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. + * @param resource Experiment resource to be created or updated. * @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. @@ -892,7 +654,7 @@ private Mono>> createOrUpdateWithResponseAsync(String */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String experimentName, ExperimentInner experiment, Context context) { + String experimentName, ExperimentInner resource, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -908,23 +670,23 @@ private Mono>> createOrUpdateWithResponseAsync(String if (experimentName == null) { return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); } - if (experiment == null) { - return Mono.error(new IllegalArgumentException("Parameter experiment is required and cannot be null.")); + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); } else { - experiment.validate(); + resource.validate(); } final String accept = "application/json"; context = this.client.mergeContext(context); return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, experimentName, experiment, accept, context); + this.client.getSubscriptionId(), resourceGroupName, experimentName, resource, accept, context); } /** * Create or update a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. + * @param resource Experiment resource to be created or updated. * @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. @@ -932,9 +694,9 @@ private Mono>> createOrUpdateWithResponseAsync(String */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ExperimentInner> beginCreateOrUpdateAsync(String resourceGroupName, - String experimentName, ExperimentInner experiment) { + String experimentName, ExperimentInner resource) { Mono>> mono - = createOrUpdateWithResponseAsync(resourceGroupName, experimentName, experiment); + = createOrUpdateWithResponseAsync(resourceGroupName, experimentName, resource); return this.client.getLroResult(mono, this.client.getHttpPipeline(), ExperimentInner.class, ExperimentInner.class, this.client.getContext()); } @@ -942,9 +704,9 @@ private PollerFlux, ExperimentInner> beginCreateOrUp /** * Create or update a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. + * @param resource Experiment resource to be created or updated. * @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. @@ -953,10 +715,10 @@ private PollerFlux, ExperimentInner> beginCreateOrUp */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ExperimentInner> beginCreateOrUpdateAsync(String resourceGroupName, - String experimentName, ExperimentInner experiment, Context context) { + String experimentName, ExperimentInner resource, Context context) { context = this.client.mergeContext(context); Mono>> mono - = createOrUpdateWithResponseAsync(resourceGroupName, experimentName, experiment, context); + = createOrUpdateWithResponseAsync(resourceGroupName, experimentName, resource, context); return this.client.getLroResult(mono, this.client.getHttpPipeline(), ExperimentInner.class, ExperimentInner.class, context); } @@ -964,9 +726,9 @@ private PollerFlux, ExperimentInner> beginCreateOrUp /** * Create or update a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. + * @param resource Experiment resource to be created or updated. * @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. @@ -974,16 +736,16 @@ private PollerFlux, ExperimentInner> beginCreateOrUp */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ExperimentInner> beginCreateOrUpdate(String resourceGroupName, - String experimentName, ExperimentInner experiment) { - return this.beginCreateOrUpdateAsync(resourceGroupName, experimentName, experiment).getSyncPoller(); + String experimentName, ExperimentInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, experimentName, resource).getSyncPoller(); } /** * Create or update a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. + * @param resource Experiment resource to be created or updated. * @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. @@ -992,16 +754,16 @@ public SyncPoller, ExperimentInner> beginCreateOrUpd */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ExperimentInner> beginCreateOrUpdate(String resourceGroupName, - String experimentName, ExperimentInner experiment, Context context) { - return this.beginCreateOrUpdateAsync(resourceGroupName, experimentName, experiment, context).getSyncPoller(); + String experimentName, ExperimentInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, experimentName, resource, context).getSyncPoller(); } /** * Create or update a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. + * @param resource Experiment resource to be created or updated. * @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. @@ -1009,17 +771,17 @@ public SyncPoller, ExperimentInner> beginCreateOrUpd */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync(String resourceGroupName, String experimentName, - ExperimentInner experiment) { - return beginCreateOrUpdateAsync(resourceGroupName, experimentName, experiment).last() + ExperimentInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, experimentName, resource).last() .flatMap(this.client::getLroFinalResultOrError); } /** * Create or update a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. + * @param resource Experiment resource to be created or updated. * @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. @@ -1028,33 +790,33 @@ private Mono createOrUpdateAsync(String resourceGroupName, Stri */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync(String resourceGroupName, String experimentName, - ExperimentInner experiment, Context context) { - return beginCreateOrUpdateAsync(resourceGroupName, experimentName, experiment, context).last() + ExperimentInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, experimentName, resource, context).last() .flatMap(this.client::getLroFinalResultOrError); } /** * Create or update a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. + * @param resource Experiment resource to be created or updated. * @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. * @return model that represents a Experiment resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ExperimentInner createOrUpdate(String resourceGroupName, String experimentName, ExperimentInner experiment) { - return createOrUpdateAsync(resourceGroupName, experimentName, experiment).block(); + public ExperimentInner createOrUpdate(String resourceGroupName, String experimentName, ExperimentInner resource) { + return createOrUpdateAsync(resourceGroupName, experimentName, resource).block(); } /** * Create or update a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Experiment resource to be created or updated. + * @param resource Experiment resource to be created or updated. * @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. @@ -1062,17 +824,17 @@ public ExperimentInner createOrUpdate(String resourceGroupName, String experimen * @return model that represents a Experiment resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ExperimentInner createOrUpdate(String resourceGroupName, String experimentName, ExperimentInner experiment, + public ExperimentInner createOrUpdate(String resourceGroupName, String experimentName, ExperimentInner resource, Context context) { - return createOrUpdateAsync(resourceGroupName, experimentName, experiment, context).block(); + return createOrUpdateAsync(resourceGroupName, experimentName, resource, context).block(); } /** * The operation to update an experiment. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. + * @param properties Parameters supplied to the Update experiment operation. * @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. @@ -1081,7 +843,7 @@ public ExperimentInner createOrUpdate(String resourceGroupName, String experimen */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> updateWithResponseAsync(String resourceGroupName, String experimentName, - ExperimentUpdate experiment) { + ExperimentUpdate properties) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1097,24 +859,24 @@ private Mono>> updateWithResponseAsync(String resource if (experimentName == null) { return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); } - if (experiment == null) { - return Mono.error(new IllegalArgumentException("Parameter experiment is required and cannot be null.")); + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); } else { - experiment.validate(); + properties.validate(); } final String accept = "application/json"; return FluxUtil .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, experimentName, experiment, accept, context)) + this.client.getSubscriptionId(), resourceGroupName, experimentName, properties, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * The operation to update an experiment. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. + * @param properties Parameters supplied to the Update experiment operation. * @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. @@ -1124,7 +886,7 @@ private Mono>> updateWithResponseAsync(String resource */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> updateWithResponseAsync(String resourceGroupName, String experimentName, - ExperimentUpdate experiment, Context context) { + ExperimentUpdate properties, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1140,23 +902,23 @@ private Mono>> updateWithResponseAsync(String resource if (experimentName == null) { return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); } - if (experiment == null) { - return Mono.error(new IllegalArgumentException("Parameter experiment is required and cannot be null.")); + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); } else { - experiment.validate(); + properties.validate(); } final String accept = "application/json"; context = this.client.mergeContext(context); return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, experimentName, experiment, accept, context); + resourceGroupName, experimentName, properties, accept, context); } /** * The operation to update an experiment. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. + * @param properties Parameters supplied to the Update experiment operation. * @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. @@ -1164,8 +926,8 @@ private Mono>> updateWithResponseAsync(String resource */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ExperimentInner> beginUpdateAsync(String resourceGroupName, - String experimentName, ExperimentUpdate experiment) { - Mono>> mono = updateWithResponseAsync(resourceGroupName, experimentName, experiment); + String experimentName, ExperimentUpdate properties) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, experimentName, properties); return this.client.getLroResult(mono, this.client.getHttpPipeline(), ExperimentInner.class, ExperimentInner.class, this.client.getContext()); } @@ -1173,9 +935,9 @@ private PollerFlux, ExperimentInner> beginUpdateAsyn /** * The operation to update an experiment. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. + * @param properties Parameters supplied to the Update experiment operation. * @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. @@ -1184,10 +946,10 @@ private PollerFlux, ExperimentInner> beginUpdateAsyn */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ExperimentInner> beginUpdateAsync(String resourceGroupName, - String experimentName, ExperimentUpdate experiment, Context context) { + String experimentName, ExperimentUpdate properties, Context context) { context = this.client.mergeContext(context); Mono>> mono - = updateWithResponseAsync(resourceGroupName, experimentName, experiment, context); + = updateWithResponseAsync(resourceGroupName, experimentName, properties, context); return this.client.getLroResult(mono, this.client.getHttpPipeline(), ExperimentInner.class, ExperimentInner.class, context); } @@ -1195,9 +957,9 @@ private PollerFlux, ExperimentInner> beginUpdateAsyn /** * The operation to update an experiment. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. + * @param properties Parameters supplied to the Update experiment operation. * @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. @@ -1205,16 +967,16 @@ private PollerFlux, ExperimentInner> beginUpdateAsyn */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ExperimentInner> beginUpdate(String resourceGroupName, - String experimentName, ExperimentUpdate experiment) { - return this.beginUpdateAsync(resourceGroupName, experimentName, experiment).getSyncPoller(); + String experimentName, ExperimentUpdate properties) { + return this.beginUpdateAsync(resourceGroupName, experimentName, properties).getSyncPoller(); } /** * The operation to update an experiment. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. + * @param properties Parameters supplied to the Update experiment operation. * @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. @@ -1223,16 +985,16 @@ public SyncPoller, ExperimentInner> beginUpdate(Stri */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ExperimentInner> beginUpdate(String resourceGroupName, - String experimentName, ExperimentUpdate experiment, Context context) { - return this.beginUpdateAsync(resourceGroupName, experimentName, experiment, context).getSyncPoller(); + String experimentName, ExperimentUpdate properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, experimentName, properties, context).getSyncPoller(); } /** * The operation to update an experiment. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. + * @param properties Parameters supplied to the Update experiment operation. * @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. @@ -1240,17 +1002,17 @@ public SyncPoller, ExperimentInner> beginUpdate(Stri */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono updateAsync(String resourceGroupName, String experimentName, - ExperimentUpdate experiment) { - return beginUpdateAsync(resourceGroupName, experimentName, experiment).last() + ExperimentUpdate properties) { + return beginUpdateAsync(resourceGroupName, experimentName, properties).last() .flatMap(this.client::getLroFinalResultOrError); } /** * The operation to update an experiment. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. + * @param properties Parameters supplied to the Update experiment operation. * @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. @@ -1259,33 +1021,33 @@ private Mono updateAsync(String resourceGroupName, String exper */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono updateAsync(String resourceGroupName, String experimentName, - ExperimentUpdate experiment, Context context) { - return beginUpdateAsync(resourceGroupName, experimentName, experiment, context).last() + ExperimentUpdate properties, Context context) { + return beginUpdateAsync(resourceGroupName, experimentName, properties, context).last() .flatMap(this.client::getLroFinalResultOrError); } /** * The operation to update an experiment. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. + * @param properties Parameters supplied to the Update experiment operation. * @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. * @return model that represents a Experiment resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ExperimentInner update(String resourceGroupName, String experimentName, ExperimentUpdate experiment) { - return updateAsync(resourceGroupName, experimentName, experiment).block(); + public ExperimentInner update(String resourceGroupName, String experimentName, ExperimentUpdate properties) { + return updateAsync(resourceGroupName, experimentName, properties).block(); } /** * The operation to update an experiment. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param experiment Parameters supplied to the Update experiment operation. + * @param properties Parameters supplied to the Update experiment operation. * @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. @@ -1293,15 +1055,15 @@ public ExperimentInner update(String resourceGroupName, String experimentName, E * @return model that represents a Experiment resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ExperimentInner update(String resourceGroupName, String experimentName, ExperimentUpdate experiment, + public ExperimentInner update(String resourceGroupName, String experimentName, ExperimentUpdate properties, Context context) { - return updateAsync(resourceGroupName, experimentName, experiment, context).block(); + return updateAsync(resourceGroupName, experimentName, properties, context).block(); } /** - * Cancel a running Experiment resource. + * Delete a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1309,7 +1071,7 @@ public ExperimentInner update(String resourceGroupName, String experimentName, E * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> cancelWithResponseAsync(String resourceGroupName, String experimentName) { + private Mono>> deleteWithResponseAsync(String resourceGroupName, String experimentName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1327,15 +1089,15 @@ private Mono>> cancelWithResponseAsync(String resource } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.cancel(this.client.getEndpoint(), this.client.getApiVersion(), + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, experimentName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Cancel a running Experiment resource. + * Delete a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1344,7 +1106,7 @@ private Mono>> cancelWithResponseAsync(String resource * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> cancelWithResponseAsync(String resourceGroupName, String experimentName, + private Mono>> deleteWithResponseAsync(String resourceGroupName, String experimentName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -1363,14 +1125,14 @@ private Mono>> cancelWithResponseAsync(String resource } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.cancel(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, experimentName, accept, context); } /** - * Cancel a running Experiment resource. + * Delete a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1378,16 +1140,16 @@ private Mono>> cancelWithResponseAsync(String resource * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginCancelAsync(String resourceGroupName, String experimentName) { - Mono>> mono = cancelWithResponseAsync(resourceGroupName, experimentName); + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String experimentName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, experimentName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); } /** - * Cancel a running Experiment resource. + * Delete a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1396,18 +1158,18 @@ private PollerFlux, Void> beginCancelAsync(String resourceGroup * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginCancelAsync(String resourceGroupName, String experimentName, + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String experimentName, Context context) { context = this.client.mergeContext(context); - Mono>> mono = cancelWithResponseAsync(resourceGroupName, experimentName, context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, experimentName, context); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); } /** - * Cancel a running Experiment resource. + * Delete a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1415,14 +1177,14 @@ private PollerFlux, Void> beginCancelAsync(String resourceGroup * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginCancel(String resourceGroupName, String experimentName) { - return this.beginCancelAsync(resourceGroupName, experimentName).getSyncPoller(); + public SyncPoller, Void> beginDelete(String resourceGroupName, String experimentName) { + return this.beginDeleteAsync(resourceGroupName, experimentName).getSyncPoller(); } /** - * Cancel a running Experiment resource. + * Delete a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1431,15 +1193,15 @@ public SyncPoller, Void> beginCancel(String resourceGroupName, * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginCancel(String resourceGroupName, String experimentName, + public SyncPoller, Void> beginDelete(String resourceGroupName, String experimentName, Context context) { - return this.beginCancelAsync(resourceGroupName, experimentName, context).getSyncPoller(); + return this.beginDeleteAsync(resourceGroupName, experimentName, context).getSyncPoller(); } /** - * Cancel a running Experiment resource. + * Delete a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1447,15 +1209,15 @@ public SyncPoller, Void> beginCancel(String resourceGroupName, * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono cancelAsync(String resourceGroupName, String experimentName) { - return beginCancelAsync(resourceGroupName, experimentName).last() + private Mono deleteAsync(String resourceGroupName, String experimentName) { + return beginDeleteAsync(resourceGroupName, experimentName).last() .flatMap(this.client::getLroFinalResultOrError); } /** - * Cancel a running Experiment resource. + * Delete a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1464,29 +1226,29 @@ private Mono cancelAsync(String resourceGroupName, String experimentName) * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono cancelAsync(String resourceGroupName, String experimentName, Context context) { - return beginCancelAsync(resourceGroupName, experimentName, context).last() + private Mono deleteAsync(String resourceGroupName, String experimentName, Context context) { + return beginDeleteAsync(resourceGroupName, experimentName, context).last() .flatMap(this.client::getLroFinalResultOrError); } /** - * Cancel a running Experiment resource. + * Delete a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @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. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void cancel(String resourceGroupName, String experimentName) { - cancelAsync(resourceGroupName, experimentName).block(); + public void delete(String resourceGroupName, String experimentName) { + deleteAsync(resourceGroupName, experimentName).block(); } /** - * Cancel a running Experiment resource. + * Delete a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1494,22 +1256,23 @@ public void cancel(String resourceGroupName, String experimentName) { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void cancel(String resourceGroupName, String experimentName, Context context) { - cancelAsync(resourceGroupName, experimentName, context).block(); + public void delete(String resourceGroupName, String experimentName, Context context) { + deleteAsync(resourceGroupName, experimentName, context).block(); } /** - * Start a Experiment resource. + * Cancel a running Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @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. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return model that represents the post action response along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> startWithResponseAsync(String resourceGroupName, String experimentName) { + private Mono>> cancelWithResponseAsync(String resourceGroupName, String experimentName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1527,24 +1290,25 @@ private Mono>> startWithResponseAsync(String resourceG } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.start(this.client.getEndpoint(), this.client.getApiVersion(), + .withContext(context -> service.cancel(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, experimentName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Start a Experiment resource. + * Cancel a running Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return model that represents the post action response along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> startWithResponseAsync(String resourceGroupName, String experimentName, + private Mono>> cancelWithResponseAsync(String resourceGroupName, String experimentName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -1563,154 +1327,160 @@ private Mono>> startWithResponseAsync(String resourceG } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.start(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + return service.cancel(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, experimentName, accept, context); } /** - * Start a Experiment resource. + * Cancel a running Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @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. - * @return the {@link PollerFlux} for polling of long-running operation. + * @return the {@link PollerFlux} for polling of model that represents the post action response. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginStartAsync(String resourceGroupName, String experimentName) { - Mono>> mono = startWithResponseAsync(resourceGroupName, experimentName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + private PollerFlux, PostActionResponseInner> + beginCancelAsync(String resourceGroupName, String experimentName) { + Mono>> mono = cancelWithResponseAsync(resourceGroupName, experimentName); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), PostActionResponseInner.class, PostActionResponseInner.class, this.client.getContext()); } /** - * Start a Experiment resource. + * Cancel a running Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. + * @return the {@link PollerFlux} for polling of model that represents the post action response. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginStartAsync(String resourceGroupName, String experimentName, - Context context) { + private PollerFlux, PostActionResponseInner> + beginCancelAsync(String resourceGroupName, String experimentName, Context context) { context = this.client.mergeContext(context); - Mono>> mono = startWithResponseAsync(resourceGroupName, experimentName, context); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + Mono>> mono = cancelWithResponseAsync(resourceGroupName, experimentName, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), PostActionResponseInner.class, PostActionResponseInner.class, context); } /** - * Start a Experiment resource. + * Cancel a running Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @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. - * @return the {@link SyncPoller} for polling of long-running operation. + * @return the {@link SyncPoller} for polling of model that represents the post action response. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginStart(String resourceGroupName, String experimentName) { - return this.beginStartAsync(resourceGroupName, experimentName).getSyncPoller(); + public SyncPoller, PostActionResponseInner> + beginCancel(String resourceGroupName, String experimentName) { + return this.beginCancelAsync(resourceGroupName, experimentName).getSyncPoller(); } /** - * Start a Experiment resource. + * Cancel a running Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. + * @return the {@link SyncPoller} for polling of model that represents the post action response. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginStart(String resourceGroupName, String experimentName, - Context context) { - return this.beginStartAsync(resourceGroupName, experimentName, context).getSyncPoller(); + public SyncPoller, PostActionResponseInner> + beginCancel(String resourceGroupName, String experimentName, Context context) { + return this.beginCancelAsync(resourceGroupName, experimentName, context).getSyncPoller(); } /** - * Start a Experiment resource. + * Cancel a running Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @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. - * @return A {@link Mono} that completes when a successful response is received. + * @return model that represents the post action response on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono startAsync(String resourceGroupName, String experimentName) { - return beginStartAsync(resourceGroupName, experimentName).last().flatMap(this.client::getLroFinalResultOrError); + private Mono cancelAsync(String resourceGroupName, String experimentName) { + return beginCancelAsync(resourceGroupName, experimentName).last() + .flatMap(this.client::getLroFinalResultOrError); } /** - * Start a Experiment resource. + * Cancel a running Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. + * @return model that represents the post action response on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono startAsync(String resourceGroupName, String experimentName, Context context) { - return beginStartAsync(resourceGroupName, experimentName, context).last() + private Mono cancelAsync(String resourceGroupName, String experimentName, + Context context) { + return beginCancelAsync(resourceGroupName, experimentName, context).last() .flatMap(this.client::getLroFinalResultOrError); } /** - * Start a Experiment resource. + * Cancel a running Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @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. + * @return model that represents the post action response. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void start(String resourceGroupName, String experimentName) { - startAsync(resourceGroupName, experimentName).block(); + public PostActionResponseInner cancel(String resourceGroupName, String experimentName) { + return cancelAsync(resourceGroupName, experimentName).block(); } /** - * Start a Experiment resource. + * Cancel a running Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the post action response. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void start(String resourceGroupName, String experimentName, Context context) { - startAsync(resourceGroupName, experimentName, context).block(); + public PostActionResponseInner cancel(String resourceGroupName, String experimentName, Context context) { + return cancelAsync(resourceGroupName, experimentName, context).block(); } /** - * Get a list of executions of an Experiment resource. + * Start a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @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. - * @return a list of executions of an Experiment resource along with {@link PagedResponse} on successful completion - * of {@link Mono}. + * @return model that represents the post action response along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAllExecutionsSinglePageAsync(String resourceGroupName, - String experimentName) { + private Mono>> startWithResponseAsync(String resourceGroupName, String experimentName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1728,28 +1498,26 @@ private Mono> listAllExecutionsSinglePag } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listAllExecutions(this.client.getEndpoint(), this.client.getApiVersion(), + .withContext(context -> service.start(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, experimentName, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get a list of executions of an Experiment resource. + * Start a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of executions of an Experiment resource along with {@link PagedResponse} on successful completion - * of {@link Mono}. + * @return model that represents the post action response along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAllExecutionsSinglePageAsync(String resourceGroupName, - String experimentName, Context context) { + private Mono>> startWithResponseAsync(String resourceGroupName, String experimentName, + Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1767,351 +1535,149 @@ private Mono> listAllExecutionsSinglePag } final String accept = "application/json"; context = this.client.mergeContext(context); - return service - .listAllExecutions(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, experimentName, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Get a list of executions of an Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @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. - * @return a list of executions of an Experiment resource as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAllExecutionsAsync(String resourceGroupName, - String experimentName) { - return new PagedFlux<>(() -> listAllExecutionsSinglePageAsync(resourceGroupName, experimentName), - nextLink -> listAllExecutionsNextSinglePageAsync(nextLink)); - } - - /** - * Get a list of executions of an Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @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. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of executions of an Experiment resource as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAllExecutionsAsync(String resourceGroupName, String experimentName, - Context context) { - return new PagedFlux<>(() -> listAllExecutionsSinglePageAsync(resourceGroupName, experimentName, context), - nextLink -> listAllExecutionsNextSinglePageAsync(nextLink, context)); - } - - /** - * Get a list of executions of an Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @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. - * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listAllExecutions(String resourceGroupName, String experimentName) { - return new PagedIterable<>(listAllExecutionsAsync(resourceGroupName, experimentName)); - } - - /** - * Get a list of executions of an Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @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. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listAllExecutions(String resourceGroupName, String experimentName, - Context context) { - return new PagedIterable<>(listAllExecutionsAsync(resourceGroupName, experimentName, context)); + return service.start(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, experimentName, accept, context); } /** - * Get an execution of an Experiment resource. + * Start a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. * @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. - * @return an execution of an Experiment resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return the {@link PollerFlux} for polling of model that represents the post action response. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getExecutionWithResponseAsync(String resourceGroupName, - String experimentName, String executionId) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (experimentName == null) { - return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); - } - if (executionId == null) { - return Mono.error(new IllegalArgumentException("Parameter executionId is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getExecution(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, experimentName, executionId, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PostActionResponseInner> + beginStartAsync(String resourceGroupName, String experimentName) { + Mono>> mono = startWithResponseAsync(resourceGroupName, experimentName); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), PostActionResponseInner.class, PostActionResponseInner.class, + this.client.getContext()); } /** - * Get an execution of an Experiment resource. + * Start a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an execution of an Experiment resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return the {@link PollerFlux} for polling of model that represents the post action response. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getExecutionWithResponseAsync(String resourceGroupName, - String experimentName, String executionId, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (experimentName == null) { - return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); - } - if (executionId == null) { - return Mono.error(new IllegalArgumentException("Parameter executionId is required and cannot be null.")); - } - final String accept = "application/json"; + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PostActionResponseInner> + beginStartAsync(String resourceGroupName, String experimentName, Context context) { context = this.client.mergeContext(context); - return service.getExecution(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, experimentName, executionId, accept, context); + Mono>> mono = startWithResponseAsync(resourceGroupName, experimentName, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), PostActionResponseInner.class, PostActionResponseInner.class, context); } /** - * Get an execution of an Experiment resource. + * Start a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. * @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. - * @return an execution of an Experiment resource on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of model that represents the post action response. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getExecutionAsync(String resourceGroupName, String experimentName, - String executionId) { - return getExecutionWithResponseAsync(resourceGroupName, experimentName, executionId) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PostActionResponseInner> beginStart(String resourceGroupName, + String experimentName) { + return this.beginStartAsync(resourceGroupName, experimentName).getSyncPoller(); } /** - * Get an execution of an Experiment resource. + * Start a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an execution of an Experiment resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getExecutionWithResponse(String resourceGroupName, String experimentName, - String executionId, Context context) { - return getExecutionWithResponseAsync(resourceGroupName, experimentName, executionId, context).block(); - } - - /** - * Get an execution of an Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. - * @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. - * @return an execution of an Experiment resource. + * @return the {@link SyncPoller} for polling of model that represents the post action response. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ExperimentExecutionInner getExecution(String resourceGroupName, String experimentName, String executionId) { - return getExecutionWithResponse(resourceGroupName, experimentName, executionId, Context.NONE).getValue(); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PostActionResponseInner> beginStart(String resourceGroupName, + String experimentName, Context context) { + return this.beginStartAsync(resourceGroupName, experimentName, context).getSyncPoller(); } /** - * Execution details of an experiment resource. + * Start a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. * @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. - * @return model that represents the execution details of an Experiment along with {@link Response} on successful - * completion of {@link Mono}. + * @return model that represents the post action response on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executionDetailsWithResponseAsync(String resourceGroupName, - String experimentName, String executionId) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (experimentName == null) { - return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); - } - if (executionId == null) { - return Mono.error(new IllegalArgumentException("Parameter executionId is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.executionDetails(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, experimentName, executionId, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + private Mono startAsync(String resourceGroupName, String experimentName) { + return beginStartAsync(resourceGroupName, experimentName).last().flatMap(this.client::getLroFinalResultOrError); } /** - * Execution details of an experiment resource. + * Start a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents the execution details of an Experiment along with {@link Response} on successful - * completion of {@link Mono}. + * @return model that represents the post action response on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executionDetailsWithResponseAsync(String resourceGroupName, - String experimentName, String executionId, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (experimentName == null) { - return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); - } - if (executionId == null) { - return Mono.error(new IllegalArgumentException("Parameter executionId is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.executionDetails(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, experimentName, executionId, accept, context); + private Mono startAsync(String resourceGroupName, String experimentName, Context context) { + return beginStartAsync(resourceGroupName, experimentName, context).last() + .flatMap(this.client::getLroFinalResultOrError); } /** - * Execution details of an experiment resource. + * Start a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. * @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. - * @return model that represents the execution details of an Experiment on successful completion of {@link Mono}. + * @return model that represents the post action response. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono executionDetailsAsync(String resourceGroupName, String experimentName, - String executionId) { - return executionDetailsWithResponseAsync(resourceGroupName, experimentName, executionId) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + public PostActionResponseInner start(String resourceGroupName, String experimentName) { + return startAsync(resourceGroupName, experimentName).block(); } /** - * Execution details of an experiment resource. + * Start a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents the execution details of an Experiment along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response executionDetailsWithResponse(String resourceGroupName, - String experimentName, String executionId, Context context) { - return executionDetailsWithResponseAsync(resourceGroupName, experimentName, executionId, context).block(); - } - - /** - * Execution details of an experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. - * @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. - * @return model that represents the execution details of an Experiment. + * @return model that represents the post action response. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ExperimentExecutionDetailsInner executionDetails(String resourceGroupName, String experimentName, - String executionId) { - return executionDetailsWithResponse(resourceGroupName, experimentName, executionId, Context.NONE).getValue(); + public PostActionResponseInner start(String resourceGroupName, String experimentName, Context context) { + return startAsync(resourceGroupName, experimentName, context).block(); } /** * 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. @@ -2119,7 +1685,7 @@ public ExperimentExecutionDetailsInner executionDetails(String resourceGroupName * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAllNextSinglePageAsync(String nextLink) { + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -2129,7 +1695,8 @@ private Mono> listAllNextSinglePageAsync(String n } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.listAllNext(nextLink, this.client.getEndpoint(), accept, context)) + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); @@ -2138,9 +1705,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. @@ -2149,7 +1714,8 @@ private Mono> listAllNextSinglePageAsync(String n * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAllNextSinglePageAsync(String nextLink, Context context) { + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -2159,7 +1725,7 @@ private Mono> listAllNextSinglePageAsync(String n } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listAllNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } @@ -2167,9 +1733,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. @@ -2177,7 +1741,7 @@ private Mono> listAllNextSinglePageAsync(String n * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -2186,7 +1750,9 @@ private Mono> listNextSinglePageAsync(String next new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); @@ -2195,9 +1761,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. @@ -2206,65 +1770,7 @@ private Mono> listNextSinglePageAsync(String next * {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. - * @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. - * @return model that represents a list of Experiment executions and a link for pagination along with - * {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAllExecutionsNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listAllExecutionsNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. - * @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. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a list of Experiment executions and a link for pagination along with - * {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAllExecutionsNextSinglePageAsync(String nextLink, + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); @@ -2275,7 +1781,7 @@ private Mono> listAllExecutionsNextSingl } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listAllExecutionsNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsImpl.java index 86e0c55e9cafe..68fefb494d630 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsImpl.java @@ -10,13 +10,11 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.chaos.fluent.ExperimentsClient; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; -import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionInner; import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner; +import com.azure.resourcemanager.chaos.fluent.models.PostActionResponseInner; import com.azure.resourcemanager.chaos.models.Experiment; -import com.azure.resourcemanager.chaos.models.ExperimentExecution; -import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetails; import com.azure.resourcemanager.chaos.models.Experiments; +import com.azure.resourcemanager.chaos.models.PostActionResponse; public final class ExperimentsImpl implements Experiments { private static final ClientLogger LOGGER = new ClientLogger(ExperimentsImpl.class); @@ -52,14 +50,6 @@ public PagedIterable listByResourceGroup(String resourceGroupName, B return ResourceManagerUtils.mapPage(inner, inner1 -> new ExperimentImpl(inner1, this.manager())); } - public void deleteByResourceGroup(String resourceGroupName, String experimentName) { - this.serviceClient().delete(resourceGroupName, experimentName); - } - - public void delete(String resourceGroupName, String experimentName, Context context) { - this.serviceClient().delete(resourceGroupName, experimentName, context); - } - public Response getByResourceGroupWithResponse(String resourceGroupName, String experimentName, Context context) { Response inner @@ -81,75 +71,45 @@ public Experiment getByResourceGroup(String resourceGroupName, String experiment } } - public void cancel(String resourceGroupName, String experimentName) { - this.serviceClient().cancel(resourceGroupName, experimentName); - } - - public void cancel(String resourceGroupName, String experimentName, Context context) { - this.serviceClient().cancel(resourceGroupName, experimentName, context); - } - - public void start(String resourceGroupName, String experimentName) { - this.serviceClient().start(resourceGroupName, experimentName); - } - - public void start(String resourceGroupName, String experimentName, Context context) { - this.serviceClient().start(resourceGroupName, experimentName, context); - } - - public PagedIterable listAllExecutions(String resourceGroupName, String experimentName) { - PagedIterable inner - = this.serviceClient().listAllExecutions(resourceGroupName, experimentName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ExperimentExecutionImpl(inner1, this.manager())); + public void deleteByResourceGroup(String resourceGroupName, String experimentName) { + this.serviceClient().delete(resourceGroupName, experimentName); } - public PagedIterable listAllExecutions(String resourceGroupName, String experimentName, - Context context) { - PagedIterable inner - = this.serviceClient().listAllExecutions(resourceGroupName, experimentName, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ExperimentExecutionImpl(inner1, this.manager())); + public void delete(String resourceGroupName, String experimentName, Context context) { + this.serviceClient().delete(resourceGroupName, experimentName, context); } - public Response getExecutionWithResponse(String resourceGroupName, String experimentName, - String executionId, Context context) { - Response inner - = this.serviceClient().getExecutionWithResponse(resourceGroupName, experimentName, executionId, context); + public PostActionResponse cancel(String resourceGroupName, String experimentName) { + PostActionResponseInner inner = this.serviceClient().cancel(resourceGroupName, experimentName); if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ExperimentExecutionImpl(inner.getValue(), this.manager())); + return new PostActionResponseImpl(inner, this.manager()); } else { return null; } } - public ExperimentExecution getExecution(String resourceGroupName, String experimentName, String executionId) { - ExperimentExecutionInner inner - = this.serviceClient().getExecution(resourceGroupName, experimentName, executionId); + public PostActionResponse cancel(String resourceGroupName, String experimentName, Context context) { + PostActionResponseInner inner = this.serviceClient().cancel(resourceGroupName, experimentName, context); if (inner != null) { - return new ExperimentExecutionImpl(inner, this.manager()); + return new PostActionResponseImpl(inner, this.manager()); } else { return null; } } - public Response executionDetailsWithResponse(String resourceGroupName, - String experimentName, String executionId, Context context) { - Response inner = this.serviceClient() - .executionDetailsWithResponse(resourceGroupName, experimentName, executionId, context); + public PostActionResponse start(String resourceGroupName, String experimentName) { + PostActionResponseInner inner = this.serviceClient().start(resourceGroupName, experimentName); if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ExperimentExecutionDetailsImpl(inner.getValue(), this.manager())); + return new PostActionResponseImpl(inner, this.manager()); } else { return null; } } - public ExperimentExecutionDetails executionDetails(String resourceGroupName, String experimentName, - String executionId) { - ExperimentExecutionDetailsInner inner - = this.serviceClient().executionDetails(resourceGroupName, experimentName, executionId); + public PostActionResponse start(String resourceGroupName, String experimentName, Context context) { + PostActionResponseInner inner = this.serviceClient().start(resourceGroupName, experimentName, context); if (inner != null) { - return new ExperimentExecutionDetailsImpl(inner, this.manager()); + return new PostActionResponseImpl(inner, this.manager()); } else { return null; } 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 deleted file mode 100644 index 09adcaaa1102d..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusImpl.java +++ /dev/null @@ -1,52 +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.implementation; - -import com.azure.core.management.exception.ManagementError; -import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner; -import com.azure.resourcemanager.chaos.models.OperationStatus; - -public final class OperationStatusImpl implements OperationStatus { - private OperationStatusInner innerObject; - - private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; - - OperationStatusImpl(OperationStatusInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String startTime() { - return this.innerModel().startTime(); - } - - public String endTime() { - return this.innerModel().endTime(); - } - - public String status() { - return this.innerModel().status(); - } - - public ManagementError error() { - return this.innerModel().error(); - } - - public OperationStatusInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.chaos.ChaosManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesClientImpl.java deleted file mode 100644 index a163e34ece0fc..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesClientImpl.java +++ /dev/null @@ -1,186 +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.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.resourcemanager.chaos.fluent.OperationStatusesClient; -import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in OperationStatusesClient. - */ -public final class OperationStatusesClientImpl implements OperationStatusesClient { - /** - * The proxy service used to perform REST calls. - */ - private final OperationStatusesService service; - - /** - * The service client containing this operation class. - */ - private final ChaosManagementClientImpl client; - - /** - * Initializes an instance of OperationStatusesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - OperationStatusesClientImpl(ChaosManagementClientImpl client) { - this.service - = RestProxy.create(OperationStatusesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ChaosManagementClientOperationStatuses to be used by the proxy - * service to perform REST calls. - */ - @Host("{$host}") - @ServiceInterface(name = "ChaosManagementClien") - public interface OperationStatusesService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/operationStatuses/{asyncOperationId}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, - @PathParam("location") String location, @PathParam("asyncOperationId") String asyncOperationId, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, Context context); - } - - /** - * Get the status of a long running azure asynchronous operation. - * - * @param location The name of the Azure region. - * @param asyncOperationId The operation Id. - * @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. - * @return the status of a long running azure asynchronous operation along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String location, String asyncOperationId) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (location == null) { - return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); - } - if (asyncOperationId == null) { - return Mono - .error(new IllegalArgumentException("Parameter asyncOperationId is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), location, asyncOperationId, - this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the status of a long running azure asynchronous operation. - * - * @param location The name of the Azure region. - * @param asyncOperationId The operation Id. - * @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. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the status of a long running azure asynchronous operation along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String location, String asyncOperationId, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (location == null) { - return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); - } - if (asyncOperationId == null) { - return Mono - .error(new IllegalArgumentException("Parameter asyncOperationId is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), location, asyncOperationId, this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, context); - } - - /** - * Get the status of a long running azure asynchronous operation. - * - * @param location The name of the Azure region. - * @param asyncOperationId The operation Id. - * @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. - * @return the status of a long running azure asynchronous operation on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String location, String asyncOperationId) { - return getWithResponseAsync(location, asyncOperationId).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get the status of a long running azure asynchronous operation. - * - * @param location The name of the Azure region. - * @param asyncOperationId The operation Id. - * @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. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the status of a long running azure asynchronous operation along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String location, String asyncOperationId, Context context) { - return getWithResponseAsync(location, asyncOperationId, context).block(); - } - - /** - * Get the status of a long running azure asynchronous operation. - * - * @param location The name of the Azure region. - * @param asyncOperationId The operation Id. - * @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. - * @return the status of a long running azure asynchronous operation. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public OperationStatusInner get(String location, String asyncOperationId) { - return getWithResponse(location, asyncOperationId, Context.NONE).getValue(); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesImpl.java deleted file mode 100644 index af94c1a0556e8..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusesImpl.java +++ /dev/null @@ -1,56 +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.implementation; - -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.chaos.fluent.OperationStatusesClient; -import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner; -import com.azure.resourcemanager.chaos.models.OperationStatus; -import com.azure.resourcemanager.chaos.models.OperationStatuses; - -public final class OperationStatusesImpl implements OperationStatuses { - private static final ClientLogger LOGGER = new ClientLogger(OperationStatusesImpl.class); - - private final OperationStatusesClient innerClient; - - private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; - - public OperationStatusesImpl(OperationStatusesClient innerClient, - com.azure.resourcemanager.chaos.ChaosManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getWithResponse(String location, String asyncOperationId, Context context) { - Response inner - = this.serviceClient().getWithResponse(location, asyncOperationId, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new OperationStatusImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public OperationStatus get(String location, String asyncOperationId) { - OperationStatusInner inner = this.serviceClient().get(location, asyncOperationId); - if (inner != null) { - return new OperationStatusImpl(inner, this.manager()); - } else { - return null; - } - } - - private OperationStatusesClient serviceClient() { - return this.innerClient; - } - - private com.azure.resourcemanager.chaos.ChaosManager manager() { - return this.serviceManager; - } -} 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..82f92051fee44 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 @@ -66,27 +66,27 @@ public interface OperationsService { @Get("/providers/Microsoft.Chaos/operations") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listAll(@HostParam("$host") String endpoint, + Mono> list(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listAllNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * Get a list all available Operations. + * List the operations for the provider. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list all available Operations along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAllSinglePageAsync() { + private Mono> listSinglePageAsync() { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -94,94 +94,96 @@ private Mono> listAllSinglePageAsync() { final String accept = "application/json"; return FluxUtil .withContext( - context -> service.listAll(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get a list all available Operations. + * List the operations for the provider. * * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list all available Operations along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAllSinglePageAsync(Context context) { + private Mono> listSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listAll(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } /** - * Get a list all available Operations. + * List the operations for the provider. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list all available Operations as paginated response with {@link PagedFlux}. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAllAsync() { - return new PagedFlux<>(() -> listAllSinglePageAsync(), nextLink -> listAllNextSinglePageAsync(nextLink)); + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** - * Get a list all available Operations. + * List the operations for the provider. * * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list all available Operations as paginated response with {@link PagedFlux}. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAllAsync(Context context) { - return new PagedFlux<>(() -> listAllSinglePageAsync(context), - nextLink -> listAllNextSinglePageAsync(nextLink, context)); + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); } /** - * Get a list all available Operations. + * List the operations for the provider. * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list all available Operations as paginated response with {@link PagedIterable}. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listAll() { - return new PagedIterable<>(listAllAsync()); + public PagedIterable list() { + return new PagedIterable<>(listAsync()); } /** - * Get a list all available Operations. + * List the operations for the provider. * * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list all available Operations as paginated response with {@link PagedIterable}. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listAll(Context context) { - return new PagedIterable<>(listAllAsync(context)); + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(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. @@ -189,7 +191,7 @@ public PagedIterable listAll(Context context) { * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAllNextSinglePageAsync(String nextLink) { + private Mono> listNextSinglePageAsync(String nextLink) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -198,8 +200,7 @@ private Mono> listAllNextSinglePageAsync(String ne new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listAllNext(nextLink, this.client.getEndpoint(), accept, context)) + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); @@ -208,9 +209,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. @@ -219,7 +218,7 @@ private Mono> listAllNextSinglePageAsync(String ne * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listAllNextSinglePageAsync(String nextLink, Context context) { + private Mono> listNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } @@ -229,7 +228,7 @@ private Mono> listAllNextSinglePageAsync(String ne } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.listAllNext(nextLink, this.client.getEndpoint(), accept, context) + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsImpl.java index 39da64444c055..55e3dfad98944 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsImpl.java @@ -24,13 +24,13 @@ public OperationsImpl(OperationsClient innerClient, com.azure.resourcemanager.ch this.serviceManager = serviceManager; } - public PagedIterable listAll() { - PagedIterable inner = this.serviceClient().listAll(); + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); } - public PagedIterable listAll(Context context) { - PagedIterable inner = this.serviceClient().listAll(context); + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/PostActionResponseImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/PostActionResponseImpl.java new file mode 100644 index 0000000000000..87642cf33582e --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/PostActionResponseImpl.java @@ -0,0 +1,36 @@ +// 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.implementation; + +import com.azure.resourcemanager.chaos.fluent.models.PostActionResponseInner; +import com.azure.resourcemanager.chaos.models.PostActionResponse; + +public final class PostActionResponseImpl implements PostActionResponse { + private PostActionResponseInner innerObject; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + PostActionResponseImpl(PostActionResponseInner innerObject, + com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String statusUrl() { + return this.innerModel().statusUrl(); + } + + public PostActionResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} 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/TargetImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetImpl.java index ef8433375132c..0dd0f86a71d6d 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetImpl.java @@ -32,14 +32,6 @@ public String type() { return this.innerModel().type(); } - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public String location() { - return this.innerModel().location(); - } - public Map properties() { Map inner = this.innerModel().properties(); if (inner != null) { @@ -49,6 +41,14 @@ public Map properties() { } } + public String location() { + return this.innerModel().location(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + public TargetInner innerModel() { return this.innerObject; } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypeImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypeImpl.java index 4d823d32c2b8f..0b54e5b61c280 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypeImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypeImpl.java @@ -7,8 +7,7 @@ import com.azure.core.management.SystemData; import com.azure.resourcemanager.chaos.fluent.models.TargetTypeInner; import com.azure.resourcemanager.chaos.models.TargetType; -import java.util.Collections; -import java.util.List; +import com.azure.resourcemanager.chaos.models.TargetTypeProperties; public final class TargetTypeImpl implements TargetType { private TargetTypeInner innerObject; @@ -32,33 +31,12 @@ public String type() { return this.innerModel().type(); } - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public String location() { - return this.innerModel().location(); - } - - public String displayName() { - return this.innerModel().displayName(); + public TargetTypeProperties properties() { + return this.innerModel().properties(); } - public String description() { - return this.innerModel().description(); - } - - public String propertiesSchema() { - return this.innerModel().propertiesSchema(); - } - - public List resourceTypes() { - List inner = this.innerModel().resourceTypes(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } + public SystemData systemData() { + return this.innerModel().systemData(); } public TargetTypeInner innerModel() { 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..e00a1effa9ada 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 @@ -63,21 +63,21 @@ public final class TargetTypesClientImpl implements TargetTypesClient { @ServiceInterface(name = "ChaosManagementClien") public interface TargetTypesService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("locationName") String locationName, @QueryParam("continuationToken") String continuationToken, + @PathParam("location") String location, @QueryParam("continuationToken") String continuationToken, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes/{targetTypeName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("locationName") String locationName, @PathParam("targetTypeName") String targetTypeName, + @PathParam("location") String location, @PathParam("targetTypeName") String targetTypeName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -91,7 +91,7 @@ Mono> listNext(@PathParam(value = "nextLink", enc /** * Get a list of Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param continuationToken String that sets the continuation token. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -100,7 +100,7 @@ Mono> listNext(@PathParam(value = "nextLink", enc * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String locationName, String continuationToken) { + private Mono> listSinglePageAsync(String location, String continuationToken) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -109,13 +109,13 @@ private Mono> listSinglePageAsync(String location return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - if (locationName == null) { - return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), locationName, continuationToken, accept, context)) + this.client.getSubscriptionId(), location, continuationToken, accept, context)) .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); @@ -124,7 +124,7 @@ private Mono> listSinglePageAsync(String location /** * Get a list of Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -134,7 +134,7 @@ private Mono> listSinglePageAsync(String location * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String locationName, String continuationToken, + private Mono> listSinglePageAsync(String location, String continuationToken, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -144,13 +144,13 @@ private Mono> listSinglePageAsync(String location return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - if (locationName == null) { - return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), locationName, + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), location, continuationToken, accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); @@ -159,7 +159,7 @@ private Mono> listSinglePageAsync(String location /** * Get a list of Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param continuationToken String that sets the continuation token. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -167,31 +167,31 @@ private Mono> listSinglePageAsync(String location * @return a list of Target Type resources for given location as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String locationName, String continuationToken) { - return new PagedFlux<>(() -> listSinglePageAsync(locationName, continuationToken), + private PagedFlux listAsync(String location, String continuationToken) { + return new PagedFlux<>(() -> listSinglePageAsync(location, continuationToken), nextLink -> listNextSinglePageAsync(nextLink)); } /** * Get a list of Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @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. * @return a list of Target Type resources for given location as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String locationName) { + private PagedFlux listAsync(String location) { final String continuationToken = null; - return new PagedFlux<>(() -> listSinglePageAsync(locationName, continuationToken), + return new PagedFlux<>(() -> listSinglePageAsync(location, continuationToken), nextLink -> listNextSinglePageAsync(nextLink)); } /** * Get a list of Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -200,30 +200,30 @@ private PagedFlux listAsync(String locationName) { * @return a list of Target Type resources for given location as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String locationName, String continuationToken, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(locationName, continuationToken, context), + private PagedFlux listAsync(String location, String continuationToken, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(location, continuationToken, context), nextLink -> listNextSinglePageAsync(nextLink, context)); } /** * Get a list of Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @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. * @return a list of Target Type resources for given location as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String locationName) { + public PagedIterable list(String location) { final String continuationToken = null; - return new PagedIterable<>(listAsync(locationName, continuationToken)); + return new PagedIterable<>(listAsync(location, continuationToken)); } /** * Get a list of Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -232,14 +232,14 @@ public PagedIterable list(String locationName) { * @return a list of Target Type resources for given location as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String locationName, String continuationToken, Context context) { - return new PagedIterable<>(listAsync(locationName, continuationToken, context)); + public PagedIterable list(String location, String continuationToken, Context context) { + return new PagedIterable<>(listAsync(location, continuationToken, context)); } /** * Get a Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -248,7 +248,7 @@ public PagedIterable list(String locationName, String continuat * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String locationName, String targetTypeName) { + private Mono> getWithResponseAsync(String location, String targetTypeName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -257,8 +257,8 @@ private Mono> getWithResponseAsync(String locationName return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - if (locationName == null) { - return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); } if (targetTypeName == null) { return Mono.error(new IllegalArgumentException("Parameter targetTypeName is required and cannot be null.")); @@ -266,14 +266,14 @@ private Mono> getWithResponseAsync(String locationName final String accept = "application/json"; return FluxUtil .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), locationName, targetTypeName, accept, context)) + this.client.getSubscriptionId(), location, targetTypeName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get a Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -283,7 +283,7 @@ private Mono> getWithResponseAsync(String locationName * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String locationName, String targetTypeName, + private Mono> getWithResponseAsync(String location, String targetTypeName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -293,8 +293,8 @@ private Mono> getWithResponseAsync(String locationName return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - if (locationName == null) { - return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); } if (targetTypeName == null) { return Mono.error(new IllegalArgumentException("Parameter targetTypeName is required and cannot be null.")); @@ -302,13 +302,13 @@ private Mono> getWithResponseAsync(String locationName final String accept = "application/json"; context = this.client.mergeContext(context); return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - locationName, targetTypeName, accept, context); + location, targetTypeName, accept, context); } /** * Get a Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -316,14 +316,14 @@ private Mono> getWithResponseAsync(String locationName * @return a Target Type resources for given location on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String locationName, String targetTypeName) { - return getWithResponseAsync(locationName, targetTypeName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono getAsync(String location, String targetTypeName) { + return getWithResponseAsync(location, targetTypeName).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Get a Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -332,14 +332,14 @@ private Mono getAsync(String locationName, String targetTypeNam * @return a Target Type resources for given location along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String locationName, String targetTypeName, Context context) { - return getWithResponseAsync(locationName, targetTypeName, context).block(); + public Response getWithResponse(String location, String targetTypeName, Context context) { + return getWithResponseAsync(location, targetTypeName, context).block(); } /** * Get a Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -347,16 +347,14 @@ public Response getWithResponse(String locationName, String tar * @return a Target Type resources for given location. */ @ServiceMethod(returns = ReturnType.SINGLE) - public TargetTypeInner get(String locationName, String targetTypeName) { - return getWithResponse(locationName, targetTypeName, Context.NONE).getValue(); + public TargetTypeInner get(String location, String targetTypeName) { + return getWithResponse(location, targetTypeName, Context.NONE).getValue(); } /** * 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/TargetTypesImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesImpl.java index 81dc5edb19063..bcaa9c037da3b 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesImpl.java @@ -26,18 +26,18 @@ public TargetTypesImpl(TargetTypesClient innerClient, com.azure.resourcemanager. this.serviceManager = serviceManager; } - public PagedIterable list(String locationName) { - PagedIterable inner = this.serviceClient().list(locationName); + public PagedIterable list(String location) { + PagedIterable inner = this.serviceClient().list(location); return ResourceManagerUtils.mapPage(inner, inner1 -> new TargetTypeImpl(inner1, this.manager())); } - public PagedIterable list(String locationName, String continuationToken, Context context) { - PagedIterable inner = this.serviceClient().list(locationName, continuationToken, context); + public PagedIterable list(String location, String continuationToken, Context context) { + PagedIterable inner = this.serviceClient().list(location, continuationToken, context); return ResourceManagerUtils.mapPage(inner, inner1 -> new TargetTypeImpl(inner1, this.manager())); } - public Response getWithResponse(String locationName, String targetTypeName, Context context) { - Response inner = this.serviceClient().getWithResponse(locationName, targetTypeName, context); + public Response getWithResponse(String location, String targetTypeName, Context context) { + Response inner = this.serviceClient().getWithResponse(location, targetTypeName, context); if (inner != null) { return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), new TargetTypeImpl(inner.getValue(), this.manager())); @@ -46,8 +46,8 @@ public Response getWithResponse(String locationName, String targetTy } } - public TargetType get(String locationName, String targetTypeName) { - TargetTypeInner inner = this.serviceClient().get(locationName, targetTypeName); + public TargetType get(String location, String targetTypeName) { + TargetTypeInner inner = this.serviceClient().get(location, targetTypeName); if (inner != null) { return new TargetTypeImpl(inner, this.manager()); } else { 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..d74ba36dec427 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 @@ -65,53 +65,53 @@ public final class TargetsClientImpl implements TargetsClient { @ServiceInterface(name = "ChaosManagementClien") public interface TargetsService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/targets") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("continuationToken") String continuationToken, @PathParam("parentProviderNamespace") String parentProviderNamespace, @PathParam("parentResourceType") String parentResourceType, - @PathParam("parentResourceName") String parentResourceName, - @QueryParam("continuationToken") String continuationToken, @HeaderParam("Accept") String accept, + @PathParam("parentResourceName") String parentResourceName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/targets/{targetName}/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("targetName") String targetName, @PathParam("parentProviderNamespace") String parentProviderNamespace, @PathParam("parentResourceType") String parentResourceType, - @PathParam("parentResourceName") String parentResourceName, @PathParam("targetName") String targetName, - @HeaderParam("Accept") String accept, Context context); + @PathParam("parentResourceName") String parentResourceName, @HeaderParam("Accept") String accept, + Context context); @Headers({ "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}") - @ExpectedResponses({ 200, 204 }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/targets/{targetName}/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}") + @ExpectedResponses({ 200, 201 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("targetName") String targetName, @PathParam("parentProviderNamespace") String parentProviderNamespace, @PathParam("parentResourceType") String parentResourceType, - @PathParam("parentResourceName") String parentResourceName, @PathParam("targetName") String targetName, - @HeaderParam("Accept") String accept, Context context); + @PathParam("parentResourceName") String parentResourceName, + @BodyParam("application/json") TargetInner resource, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}") - @ExpectedResponses({ 200 }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/targets/{targetName}/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}") + @ExpectedResponses({ 200, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("targetName") String targetName, @PathParam("parentProviderNamespace") String parentProviderNamespace, @PathParam("parentResourceType") String parentResourceType, - @PathParam("parentResourceName") String parentResourceName, @PathParam("targetName") String targetName, - @BodyParam("application/json") TargetInner target, @HeaderParam("Accept") String accept, Context context); + @PathParam("parentResourceName") String parentResourceName, @HeaderParam("Accept") String accept, + Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @@ -124,10 +124,10 @@ Mono> listNext(@PathParam(value = "nextLink", encoded /** * Get a list of Target resources that extend a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @param continuationToken String that sets the continuation token. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -166,8 +166,8 @@ private Mono> listSinglePageAsync(String resourceGrou final String accept = "application/json"; return FluxUtil .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, continuationToken, accept, context)) + this.client.getSubscriptionId(), resourceGroupName, continuationToken, parentProviderNamespace, + parentResourceType, parentResourceName, accept, context)) .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); @@ -176,10 +176,10 @@ private Mono> listSinglePageAsync(String resourceGrou /** * Get a list of Target resources that extend a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -220,7 +220,7 @@ private Mono> listSinglePageAsync(String resourceGrou context = this.client.mergeContext(context); return service .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, continuationToken, + resourceGroupName, continuationToken, parentProviderNamespace, parentResourceType, parentResourceName, accept, context) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); @@ -229,10 +229,10 @@ private Mono> listSinglePageAsync(String resourceGrou /** * Get a list of Target resources that extend a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @param continuationToken String that sets the continuation token. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -250,10 +250,10 @@ private PagedFlux listAsync(String resourceGroupName, String parent /** * Get a list of Target resources that extend a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @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. @@ -271,10 +271,10 @@ private PagedFlux listAsync(String resourceGroupName, String parent /** * Get a list of Target resources that extend a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -295,10 +295,10 @@ private PagedFlux listAsync(String resourceGroupName, String parent /** * Get a list of Target resources that extend a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @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. @@ -316,10 +316,10 @@ public PagedIterable list(String resourceGroupName, String parentPr /** * Get a list of Target resources that extend a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -338,11 +338,11 @@ public PagedIterable list(String resourceGroupName, String parentPr /** * Get a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @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. @@ -350,8 +350,8 @@ public PagedIterable list(String resourceGroupName, String parentPr * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName) { + private Mono> getWithResponseAsync(String resourceGroupName, String targetName, + String parentProviderNamespace, String parentResourceType, String parentResourceName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -364,6 +364,9 @@ private Mono> getWithResponseAsync(String resourceGroupNam return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } if (parentProviderNamespace == null) { return Mono.error( new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); @@ -376,25 +379,22 @@ private Mono> getWithResponseAsync(String resourceGroupNam return Mono .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); } - if (targetName == null) { - return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); - } final String accept = "application/json"; return FluxUtil .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, accept, context)) + this.client.getSubscriptionId(), resourceGroupName, targetName, parentProviderNamespace, + parentResourceType, parentResourceName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Get a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @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. @@ -403,8 +403,8 @@ private Mono> getWithResponseAsync(String resourceGroupNam * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, Context context) { + private Mono> getWithResponseAsync(String resourceGroupName, String targetName, + String parentProviderNamespace, String parentResourceType, String parentResourceName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -417,6 +417,9 @@ private Mono> getWithResponseAsync(String resourceGroupNam return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } if (parentProviderNamespace == null) { return Mono.error( new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); @@ -429,44 +432,41 @@ private Mono> getWithResponseAsync(String resourceGroupNam return Mono .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); } - if (targetName == null) { - return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); - } final String accept = "application/json"; context = this.client.mergeContext(context); return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName, accept, + resourceGroupName, targetName, parentProviderNamespace, parentResourceType, parentResourceName, accept, context); } /** * Get a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @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. * @return a Target resource that extends a tracked regional resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName) { - return getWithResponseAsync(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, - targetName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono getAsync(String resourceGroupName, String targetName, String parentProviderNamespace, + String parentResourceType, String parentResourceName) { + return getWithResponseAsync(resourceGroupName, targetName, parentProviderNamespace, parentResourceType, + parentResourceName).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Get a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @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. @@ -474,48 +474,50 @@ private Mono getAsync(String resourceGroupName, String parentProvid * @return a Target resource that extends a tracked regional resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, Context context) { - return getWithResponseAsync(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, - targetName, context).block(); + public Response getWithResponse(String resourceGroupName, String targetName, + String parentProviderNamespace, String parentResourceType, String parentResourceName, Context context) { + return getWithResponseAsync(resourceGroupName, targetName, parentProviderNamespace, parentResourceType, + parentResourceName, context).block(); } /** * Get a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @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. * @return a Target resource that extends a tracked regional resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public TargetInner get(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName) { - return getWithResponse(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, - targetName, Context.NONE).getValue(); + public TargetInner get(String resourceGroupName, String targetName, String parentProviderNamespace, + String parentResourceType, String parentResourceName) { + return getWithResponse(resourceGroupName, targetName, parentProviderNamespace, parentResourceType, + parentResourceName, Context.NONE).getValue(); } /** - * Delete a Target resource that extends a tracked regional resource. + * Create or update a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. + * @param resource Target resource to be created or updated. * @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. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return model that represents a Target resource along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName) { + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, String targetName, + String parentProviderNamespace, String parentResourceType, String parentResourceName, TargetInner resource) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -528,6 +530,9 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } if (parentProviderNamespace == null) { return Mono.error( new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); @@ -540,34 +545,39 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S return Mono .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); } - if (targetName == null) { - return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, accept, context)) + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, targetName, parentProviderNamespace, + parentResourceType, parentResourceName, resource, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Delete a Target resource that extends a tracked regional resource. + * Create or update a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. + * @param resource Target resource to be created or updated. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return model that represents a Target resource along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, Context context) { + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, String targetName, + String parentProviderNamespace, String parentResourceType, String parentResourceName, TargetInner resource, + Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -580,6 +590,9 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } if (parentProviderNamespace == null) { return Mono.error( new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); @@ -592,95 +605,99 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S return Mono .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); } - if (targetName == null) { - return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName, accept, - context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, targetName, parentProviderNamespace, parentResourceType, + parentResourceName, resource, accept, context); } /** - * Delete a Target resource that extends a tracked regional resource. + * Create or update a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. + * @param resource Target resource to be created or updated. * @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. - * @return A {@link Mono} that completes when a successful response is received. + * @return model that represents a Target resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName) { - return deleteWithResponseAsync(resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName).flatMap(ignored -> Mono.empty()); + private Mono createOrUpdateAsync(String resourceGroupName, String targetName, + String parentProviderNamespace, String parentResourceType, String parentResourceName, TargetInner resource) { + return createOrUpdateWithResponseAsync(resourceGroupName, targetName, parentProviderNamespace, + parentResourceType, parentResourceName, resource).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** - * Delete a Target resource that extends a tracked regional resource. + * Create or update a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. + * @param resource Target resource to be created or updated. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. + * @return model that represents a Target resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, Context context) { - return deleteWithResponseAsync(resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, context).block(); + public Response createOrUpdateWithResponse(String resourceGroupName, String targetName, + String parentProviderNamespace, String parentResourceType, String parentResourceName, TargetInner resource, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, targetName, parentProviderNamespace, + parentResourceType, parentResourceName, resource, context).block(); } /** - * Delete a Target resource that extends a tracked regional resource. + * Create or update a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. + * @param resource Target resource to be created or updated. * @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. + * @return model that represents a Target resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName) { - deleteWithResponse(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, - targetName, Context.NONE); + public TargetInner createOrUpdate(String resourceGroupName, String targetName, String parentProviderNamespace, + String parentResourceType, String parentResourceName, TargetInner resource) { + return createOrUpdateWithResponse(resourceGroupName, targetName, parentProviderNamespace, parentResourceType, + parentResourceName, resource, Context.NONE).getValue(); } /** - * Create or update a Target resource that extends a tracked regional resource. + * Delete a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. - * @param target Target resource to be created or updated. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @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. - * @return model that represents a Target resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String parentProviderNamespace, String parentResourceType, String parentResourceName, String targetName, - TargetInner target) { + private Mono> deleteWithResponseAsync(String resourceGroupName, String targetName, + String parentProviderNamespace, String parentResourceType, String parentResourceName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -693,6 +710,9 @@ private Mono> createOrUpdateWithResponseAsync(String resou return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } if (parentProviderNamespace == null) { return Mono.error( new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); @@ -705,42 +725,31 @@ private Mono> createOrUpdateWithResponseAsync(String resou return Mono .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); } - if (targetName == null) { - return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); - } - if (target == null) { - return Mono.error(new IllegalArgumentException("Parameter target is required and cannot be null.")); - } else { - target.validate(); - } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, target, accept, context)) + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, targetName, parentProviderNamespace, + parentResourceType, parentResourceName, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Create or update a Target resource that extends a tracked regional resource. + * Delete a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. - * @param target Target resource to be created or updated. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a Target resource along with {@link Response} on successful completion of - * {@link Mono}. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, - String parentProviderNamespace, String parentResourceType, String parentResourceName, String targetName, - TargetInner target, Context context) { + private Mono> deleteWithResponseAsync(String resourceGroupName, String targetName, + String parentProviderNamespace, String parentResourceType, String parentResourceName, Context context) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -753,6 +762,9 @@ private Mono> createOrUpdateWithResponseAsync(String resou return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } if (parentProviderNamespace == null) { return Mono.error( new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); @@ -765,91 +777,77 @@ private Mono> createOrUpdateWithResponseAsync(String resou return Mono .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); } - if (targetName == null) { - return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); - } - if (target == null) { - return Mono.error(new IllegalArgumentException("Parameter target is required and cannot be null.")); - } else { - target.validate(); - } final String accept = "application/json"; context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, target, accept, context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, targetName, parentProviderNamespace, parentResourceType, parentResourceName, accept, + context); } /** - * Create or update a Target resource that extends a tracked regional resource. + * Delete a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. - * @param target Target resource to be created or updated. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @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. - * @return model that represents a Target resource on successful completion of {@link Mono}. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, TargetInner target) { - return createOrUpdateWithResponseAsync(resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, target).flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono deleteAsync(String resourceGroupName, String targetName, String parentProviderNamespace, + String parentResourceType, String parentResourceName) { + return deleteWithResponseAsync(resourceGroupName, targetName, parentProviderNamespace, parentResourceType, + parentResourceName).flatMap(ignored -> Mono.empty()); } /** - * Create or update a Target resource that extends a tracked regional resource. + * Delete a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. - * @param target Target resource to be created or updated. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a Target resource along with {@link Response}. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, TargetInner target, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, target, context).block(); + public Response deleteWithResponse(String resourceGroupName, String targetName, + String parentProviderNamespace, String parentResourceType, String parentResourceName, Context context) { + return deleteWithResponseAsync(resourceGroupName, targetName, parentProviderNamespace, parentResourceType, + parentResourceName, context).block(); } /** - * Create or update a Target resource that extends a tracked regional resource. + * Delete a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. - * @param target Target resource to be created or updated. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @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. - * @return model that represents a Target resource. */ @ServiceMethod(returns = ReturnType.SINGLE) - public TargetInner createOrUpdate(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, TargetInner target) { - return createOrUpdateWithResponse(resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, target, Context.NONE).getValue(); + public void delete(String resourceGroupName, String targetName, String parentProviderNamespace, + String parentResourceType, String parentResourceName) { + deleteWithResponse(resourceGroupName, targetName, parentProviderNamespace, parentResourceType, + parentResourceName, Context.NONE); } /** * 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/implementation/TargetsImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsImpl.java index 2e1f215320816..342e4a19b4c12 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsImpl.java @@ -41,11 +41,11 @@ public PagedIterable list(String resourceGroupName, String parentProvide return ResourceManagerUtils.mapPage(inner, inner1 -> new TargetImpl(inner1, this.manager())); } - public Response getWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, Context context) { + public Response getWithResponse(String resourceGroupName, String targetName, String parentProviderNamespace, + String parentResourceType, String parentResourceName, Context context) { Response inner = this.serviceClient() - .getWithResponse(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, - targetName, context); + .getWithResponse(resourceGroupName, targetName, parentProviderNamespace, parentResourceType, + parentResourceName, context); if (inner != null) { return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), new TargetImpl(inner.getValue(), this.manager())); @@ -54,10 +54,10 @@ public Response getWithResponse(String resourceGroupName, String parentP } } - public Target get(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName) { + public Target get(String resourceGroupName, String targetName, String parentProviderNamespace, + String parentResourceType, String parentResourceName) { TargetInner inner = this.serviceClient() - .get(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName); + .get(resourceGroupName, targetName, parentProviderNamespace, parentResourceType, parentResourceName); if (inner != null) { return new TargetImpl(inner, this.manager()); } else { @@ -65,24 +65,12 @@ public Target get(String resourceGroupName, String parentProviderNamespace, Stri } } - public Response deleteWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, Context context) { - return this.serviceClient() - .deleteWithResponse(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, - targetName, context); - } - - public void delete(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName) { - this.serviceClient() - .delete(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName); - } - - public Response createOrUpdateWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, TargetInner target, Context context) { + public Response createOrUpdateWithResponse(String resourceGroupName, String targetName, + String parentProviderNamespace, String parentResourceType, String parentResourceName, TargetInner resource, + Context context) { Response inner = this.serviceClient() - .createOrUpdateWithResponse(resourceGroupName, parentProviderNamespace, parentResourceType, - parentResourceName, targetName, target, context); + .createOrUpdateWithResponse(resourceGroupName, targetName, parentProviderNamespace, parentResourceType, + parentResourceName, resource, context); if (inner != null) { return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), new TargetImpl(inner.getValue(), this.manager())); @@ -91,11 +79,11 @@ public Response createOrUpdateWithResponse(String resourceGroupName, Str } } - public Target createOrUpdate(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName, TargetInner target) { + public Target createOrUpdate(String resourceGroupName, String targetName, String parentProviderNamespace, + String parentResourceType, String parentResourceName, TargetInner resource) { TargetInner inner = this.serviceClient() - .createOrUpdate(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, - targetName, target); + .createOrUpdate(resourceGroupName, targetName, parentProviderNamespace, parentResourceType, + parentResourceName, resource); if (inner != null) { return new TargetImpl(inner, this.manager()); } else { @@ -103,6 +91,19 @@ public Target createOrUpdate(String resourceGroupName, String parentProviderName } } + public Response deleteWithResponse(String resourceGroupName, String targetName, + String parentProviderNamespace, String parentResourceType, String parentResourceName, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, targetName, parentProviderNamespace, parentResourceType, + parentResourceName, context); + } + + public void delete(String resourceGroupName, String targetName, String parentProviderNamespace, + String parentResourceType, String parentResourceName) { + this.serviceClient() + .delete(resourceGroupName, targetName, parentProviderNamespace, parentResourceType, parentResourceName); + } + private TargetsClient serviceClient() { return this.innerClient; } 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/Capabilities.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Capabilities.java index 86ae2c843c9e5..c584544ae0ae0 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Capabilities.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Capabilities.java @@ -7,7 +7,6 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; /** * Resource collection API of Capabilities. @@ -16,10 +15,7 @@ public interface Capabilities { /** * Get a list of Capability resources that extend a Target resource.. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -27,16 +23,12 @@ public interface Capabilities { * @return a list of Capability resources that extend a Target resource. as paginated response with * {@link PagedIterable}. */ - PagedIterable list(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName); + PagedIterable list(String resourceGroupName, String targetName); /** * Get a list of Capability resources that extend a Target resource.. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. @@ -46,16 +38,13 @@ PagedIterable list(String resourceGroupName, String parentProviderNa * @return a list of Capability resources that extend a Target resource. as paginated response with * {@link PagedIterable}. */ - PagedIterable list(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName, String continuationToken, Context context); + PagedIterable list(String resourceGroupName, String targetName, String continuationToken, + Context context); /** * Get a Capability resource that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. * @param context The context to associate with this operation. @@ -64,17 +53,13 @@ PagedIterable list(String resourceGroupName, String parentProviderNa * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a Capability resource that extends a Target resource along with {@link Response}. */ - Response getWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String capabilityName, + Response getWithResponse(String resourceGroupName, String targetName, String capabilityName, Context context); /** * Get a Capability resource that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -82,16 +67,12 @@ Response getWithResponse(String resourceGroupName, String parentProv * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a Capability resource that extends a Target resource. */ - Capability get(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName, String capabilityName); + Capability get(String resourceGroupName, String targetName, String capabilityName); /** * Delete a Capability that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. * @param context The context to associate with this operation. @@ -100,61 +81,71 @@ Capability get(String resourceGroupName, String parentProviderNamespace, String * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response}. */ - Response deleteWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String capabilityName, + Response deleteWithResponse(String resourceGroupName, String targetName, String capabilityName, Context context); /** * Delete a Capability that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. * @param capabilityName String that represents a Capability resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ - void delete(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName, String capabilityName); + void delete(String resourceGroupName, String targetName, String capabilityName); /** - * Create or update a Capability resource that extends a Target resource. + * Get a Capability resource that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param capabilityName String that represents a Capability resource name. - * @param capability Capability resource to be created or updated. + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability resource that extends a Target resource along with {@link Response}. + */ + Capability getById(String id); + + /** + * Get a Capability resource that extends a Target resource. + * + * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a Capability resource along with {@link Response}. + * @return a Capability resource that extends a Target resource along with {@link Response}. */ - Response createOrUpdateWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, String capabilityName, - CapabilityInner capability, Context context); + Response getByIdWithResponse(String id, Context context); /** - * Create or update a Capability resource that extends a Target resource. + * Delete a Capability that extends a Target resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. - * @param targetName String that represents a Target resource name. - * @param capabilityName String that represents a Capability resource name. - * @param capability Capability resource to be created or updated. + * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a Capability resource. */ - Capability createOrUpdate(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName, String capabilityName, CapabilityInner capability); + void deleteById(String id); + + /** + * Delete a Capability that extends a Target resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Capability resource. + * + * @param name resource name. + * @return the first stage of the new Capability definition. + */ + Capability.DefinitionStages.Blank define(String name); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Capability.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Capability.java index c5e258f3cbdb3..dea66dc968eed 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Capability.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Capability.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.management.SystemData; +import com.azure.core.util.Context; import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; /** @@ -33,51 +34,156 @@ public interface Capability { String type(); /** - * Gets the systemData property: The standard system metadata of a resource type. + * Gets the properties property: The properties of a capability resource. + * + * @return the properties value. + */ + CapabilityProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * * @return the systemData value. */ SystemData systemData(); /** - * Gets the publisher property: String of the Publisher that this Capability extends. + * Gets the name of the resource group. * - * @return the publisher value. + * @return the name of the resource group. */ - String publisher(); + String resourceGroupName(); /** - * Gets the targetType property: String of the Target Type that this Capability extends. + * Gets the inner com.azure.resourcemanager.chaos.fluent.models.CapabilityInner object. * - * @return the targetType value. + * @return the inner object. */ - String targetType(); + CapabilityInner innerModel(); /** - * Gets the description property: Localized string of the description. - * - * @return the description value. + * The entirety of the Capability definition. */ - String description(); + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } /** - * Gets the parametersSchema property: URL to retrieve JSON schema of the Capability parameters. + * The Capability definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Capability definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the Capability definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, targetName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param targetName String that represents a Target resource name. + * @return the next definition stage. + */ + WithCreate withExistingTarget(String resourceGroupName, String targetName); + } + + /** + * The stage of the Capability definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Capability create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Capability create(Context context); + } + + /** + * The stage of the Capability definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The properties of a capability resource.. + * + * @param properties The properties of a capability resource. + * @return the next definition stage. + */ + WithCreate withProperties(CapabilityProperties properties); + } + } + + /** + * Begins update for the Capability resource. * - * @return the parametersSchema value. + * @return the stage of resource update. + */ + Capability.Update update(); + + /** + * The template for Capability update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Capability apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Capability apply(Context context); + } + + /** + * The Capability update stages. */ - String parametersSchema(); + interface UpdateStages { + /** + * The stage of the Capability update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The properties of a capability resource.. + * + * @param properties The properties of a capability resource. + * @return the next definition stage. + */ + Update withProperties(CapabilityProperties properties); + } + } /** - * Gets the urn property: String of the URN for this Capability Type. + * Refreshes the resource to sync with Azure. * - * @return the urn value. + * @return the refreshed resource. */ - String urn(); + Capability refresh(); /** - * Gets the inner com.azure.resourcemanager.chaos.fluent.models.CapabilityInner object. + * Refreshes the resource to sync with Azure. * - * @return the inner object. + * @param context The context to associate with this operation. + * @return the refreshed resource. */ - CapabilityInner innerModel(); + Capability refresh(Context context); } 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..b2501b5f337c1 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 @@ -4,26 +4,29 @@ package com.azure.resourcemanager.chaos.models; -import com.azure.core.annotation.Immutable; +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.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 { +@Fluent +public final class CapabilityListResult implements JsonSerializable { /* - * List of Capability resources. + * The Capability items on this page */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* - * URL to retrieve the next page of Capability resources. + * The link to the next page of items */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -33,7 +36,7 @@ public CapabilityListResult() { } /** - * Get the value property: List of Capability resources. + * Get the value property: The Capability items on this page. * * @return the value value. */ @@ -42,7 +45,18 @@ public List value() { } /** - * Get the nextLink property: URL to retrieve the next page of Capability resources. + * Set the value property: The Capability items on this page. + * + * @param value the value value to set. + * @return the CapabilityListResult object itself. + */ + public CapabilityListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -50,14 +64,71 @@ public String nextLink() { return this.nextLink; } + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the CapabilityListResult object itself. + */ + public CapabilityListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (value() != null) { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model CapabilityListResult")); + } else { value().forEach(e -> e.validate()); } } + + private static final ClientLogger LOGGER = new ClientLogger(CapabilityListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + 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 IllegalStateException If the deserialized JSON object was missing any required properties. + * @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/CapabilityProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityProperties.java new file mode 100644 index 0000000000000..8e858b4e7d944 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityProperties.java @@ -0,0 +1,162 @@ +// 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.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 java.io.IOException; + +/** + * Model that represents the Capability properties model. + */ +@Immutable +public final class CapabilityProperties implements JsonSerializable { + /* + * String of the Publisher that this Capability extends. + */ + private String publisher; + + /* + * String of the Target Type that this Capability extends. + */ + private String targetType; + + /* + * Localized string of the description. + */ + private String description; + + /* + * URL to retrieve JSON schema of the Capability parameters. + */ + private String parametersSchema; + + /* + * String of the URN for this Capability Type. + */ + private String urn; + + /* + * Capability resource provisioning state. Not currently implemented. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of CapabilityProperties class. + */ + public CapabilityProperties() { + } + + /** + * Get the publisher property: String of the Publisher that this Capability extends. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Get the targetType property: String of the Target Type that this Capability extends. + * + * @return the targetType value. + */ + public String targetType() { + return this.targetType; + } + + /** + * Get the description property: Localized string of the description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the parametersSchema property: URL to retrieve JSON schema of the Capability parameters. + * + * @return the parametersSchema value. + */ + public String parametersSchema() { + return this.parametersSchema; + } + + /** + * Get the urn property: String of the URN for this Capability Type. + * + * @return the urn value. + */ + public String urn() { + return this.urn; + } + + /** + * Get the provisioningState property: Capability resource provisioning state. Not currently implemented. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + 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 if ("provisioningState".equals(fieldName)) { + deserializedCapabilityProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCapabilityProperties; + }); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityType.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityType.java index cc8626daf5295..d1d1a8fb7e8ac 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityType.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityType.java @@ -6,7 +6,6 @@ import com.azure.core.management.SystemData; import com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeInner; -import java.util.List; /** * An immutable client-side representation of CapabilityType. @@ -34,88 +33,18 @@ public interface CapabilityType { String type(); /** - * Gets the systemData property: The system metadata properties of the capability type resource. + * Gets the properties property: The properties of the capability type resource. * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the location property: Location of the Capability Type resource. - * - * @return the location value. - */ - String location(); - - /** - * Gets the publisher property: String of the Publisher that this Capability Type extends. - * - * @return the publisher value. - */ - String publisher(); - - /** - * Gets the targetType property: String of the Target Type that this Capability Type extends. - * - * @return the targetType value. - */ - String targetType(); - - /** - * Gets the displayName property: Localized string of the display name. - * - * @return the displayName value. - */ - String displayName(); - - /** - * Gets the description property: Localized string of the description. - * - * @return the description value. + * @return the properties value. */ - String description(); + CapabilityTypeProperties properties(); /** - * Gets the parametersSchema property: URL to retrieve JSON schema of the Capability Type parameters. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the parametersSchema value. - */ - String parametersSchema(); - - /** - * Gets the urn property: String of the URN for this Capability Type. - * - * @return the urn value. - */ - String urn(); - - /** - * Gets the kind property: String of the kind of this Capability Type. - * - * @return the kind value. - */ - String kind(); - - /** - * Gets the azureRbacActions property: Control plane actions necessary to execute capability type. - * - * @return the azureRbacActions value. - */ - List azureRbacActions(); - - /** - * Gets the azureRbacDataActions property: Data plane actions necessary to execute capability type. - * - * @return the azureRbacDataActions value. - */ - List azureRbacDataActions(); - - /** - * Gets the runtimeProperties property: Runtime properties of this Capability Type. - * - * @return the runtimeProperties value. + * @return the systemData value. */ - CapabilityTypePropertiesRuntimeProperties runtimeProperties(); + SystemData systemData(); /** * Gets the inner com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeInner object. 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..8fd9f593b7e0e 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 @@ -4,26 +4,29 @@ package com.azure.resourcemanager.chaos.models; -import com.azure.core.annotation.Immutable; +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.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 { +@Fluent +public final class CapabilityTypeListResult implements JsonSerializable { /* - * List of Capability Type resources. + * The CapabilityType items on this page */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* - * URL to retrieve the next page of Capability Type resources. + * The link to the next page of items */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -33,7 +36,7 @@ public CapabilityTypeListResult() { } /** - * Get the value property: List of Capability Type resources. + * Get the value property: The CapabilityType items on this page. * * @return the value value. */ @@ -42,7 +45,18 @@ public List value() { } /** - * Get the nextLink property: URL to retrieve the next page of Capability Type resources. + * Set the value property: The CapabilityType items on this page. + * + * @param value the value value to set. + * @return the CapabilityTypeListResult object itself. + */ + public CapabilityTypeListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -50,14 +64,72 @@ public String nextLink() { return this.nextLink; } + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the CapabilityTypeListResult object itself. + */ + public CapabilityTypeListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (value() != null) { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model CapabilityTypeListResult")); + } else { value().forEach(e -> e.validate()); } } + + private static final ClientLogger LOGGER = new ClientLogger(CapabilityTypeListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + 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 IllegalStateException If the deserialized JSON object was missing any required properties. + * @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/fluent/models/CapabilityTypeProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypeProperties.java similarity index 51% rename from sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeProperties.java rename to sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypeProperties.java index 823c0f6fffdcf..b47972c06185c 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/models/CapabilityTypeProperties.java @@ -2,76 +2,74 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.resourcemanager.chaos.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.chaos.models.CapabilityTypePropertiesRuntimeProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +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 java.io.IOException; import java.util.List; /** * Model that represents the Capability Type properties model. */ -@Fluent -public final class CapabilityTypeProperties { +@Immutable +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; + /* + * Capability type resource provisioning state. Not currently implemented. + */ + private ProvisioningState provisioningState; + /* * 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; /** @@ -144,23 +142,21 @@ public String kind() { } /** - * Get the azureRbacActions property: Control plane actions necessary to execute capability type. + * Get the provisioningState property: Capability type resource provisioning state. Not currently implemented. * - * @return the azureRbacActions value. + * @return the provisioningState value. */ - public List azureRbacActions() { - return this.azureRbacActions; + public ProvisioningState provisioningState() { + return this.provisioningState; } /** - * Set the azureRbacActions property: Control plane actions necessary to execute capability type. + * Get the azureRbacActions property: Control plane actions necessary to execute capability type. * - * @param azureRbacActions the azureRbacActions value to set. - * @return the CapabilityTypeProperties object itself. + * @return the azureRbacActions value. */ - public CapabilityTypeProperties withAzureRbacActions(List azureRbacActions) { - this.azureRbacActions = azureRbacActions; - return this; + public List azureRbacActions() { + return this.azureRbacActions; } /** @@ -172,17 +168,6 @@ public List azureRbacDataActions() { return this.azureRbacDataActions; } - /** - * Set the azureRbacDataActions property: Data plane actions necessary to execute capability type. - * - * @param azureRbacDataActions the azureRbacDataActions value to set. - * @return the CapabilityTypeProperties object itself. - */ - public CapabilityTypeProperties withAzureRbacDataActions(List azureRbacDataActions) { - this.azureRbacDataActions = azureRbacDataActions; - return this; - } - /** * Get the runtimeProperties property: Runtime properties of this Capability Type. * @@ -192,17 +177,6 @@ public CapabilityTypePropertiesRuntimeProperties runtimeProperties() { return this.runtimeProperties; } - /** - * Set the runtimeProperties property: Runtime properties of this Capability Type. - * - * @param runtimeProperties the runtimeProperties value to set. - * @return the CapabilityTypeProperties object itself. - */ - public CapabilityTypeProperties withRuntimeProperties(CapabilityTypePropertiesRuntimeProperties runtimeProperties) { - this.runtimeProperties = runtimeProperties; - return this; - } - /** * Validates the instance. * @@ -213,4 +187,63 @@ public void validate() { runtimeProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + 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 ("provisioningState".equals(fieldName)) { + deserializedCapabilityTypeProperties.provisioningState + = ProvisioningState.fromString(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/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/CapabilityTypes.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypes.java index f6625900b0084..7a005f4efcbe7 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypes.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypes.java @@ -15,7 +15,7 @@ public interface CapabilityTypes { /** * Get a list of Capability Type resources for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -23,12 +23,12 @@ public interface CapabilityTypes { * @return a list of Capability Type resources for given Target Type and location as paginated response with * {@link PagedIterable}. */ - PagedIterable list(String locationName, String targetTypeName); + PagedIterable list(String location, String targetTypeName); /** * Get a list of Capability Type resources for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. @@ -38,13 +38,13 @@ public interface CapabilityTypes { * @return a list of Capability Type resources for given Target Type and location as paginated response with * {@link PagedIterable}. */ - PagedIterable list(String locationName, String targetTypeName, String continuationToken, + PagedIterable list(String location, String targetTypeName, String continuationToken, Context context); /** * Get a Capability Type resource for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param capabilityTypeName String that represents a Capability Type resource name. * @param context The context to associate with this operation. @@ -53,13 +53,13 @@ PagedIterable list(String locationName, String targetTypeName, S * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a Capability Type resource for given Target Type and location along with {@link Response}. */ - Response getWithResponse(String locationName, String targetTypeName, String capabilityTypeName, + Response getWithResponse(String location, String targetTypeName, String capabilityTypeName, Context context); /** * Get a Capability Type resource for given Target Type and location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param capabilityTypeName String that represents a Capability Type resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -67,5 +67,5 @@ Response getWithResponse(String locationName, String targetTypeN * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a Capability Type resource for given Target Type and location. */ - CapabilityType get(String locationName, String targetTypeName, String capabilityTypeName); + CapabilityType get(String location, String targetTypeName, String capabilityTypeName); } 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..f78a258d73fe2 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 { + /* + * Chaos experiment action discriminator type + */ + private ExperimentActionType type = ExperimentActionType.fromString("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: Chaos experiment action discriminator type. + * + * @return the type value. + */ + public ExperimentActionType 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 == null ? null : this.type.toString()); + 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 ("continuous".equals(discriminatorValue)) { + return ContinuousAction.fromJson(readerToUse.reset()); + } else if ("delay".equals(discriminatorValue)) { + return DelayAction.fromJson(readerToUse.reset()); + } else if ("discrete".equals(discriminatorValue)) { + return DiscreteAction.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 = ExperimentActionType.fromString(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..22de7c2479557 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 { + /* + * Chaos target filter discriminator type + */ + private FilterType type = FilterType.fromString("ChaosTargetFilter"); + /** * Creates an instance of ChaosTargetFilter class. */ public ChaosTargetFilter() { } + /** + * Get the type property: Chaos target filter discriminator type. + * + * @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..83cfc0bb9527e 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 { + /* + * Chaos target selector discriminator 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: Chaos target selector discriminator 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..563eae7fb9e1f 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 { + /* + * Chaos target selector discriminator 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: Chaos target selector discriminator 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..9d77af9bf5eee 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 { + /* + * Chaos target selector discriminator 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: Chaos target selector discriminator 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..af63279d92517 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 { + /* + * Chaos target filter discriminator type + */ + 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: Chaos target filter discriminator type. + * + * @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..913a228674565 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 { + /* + * Chaos experiment action discriminator type + */ + private ExperimentActionType type = ExperimentActionType.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: Chaos experiment action discriminator type. + * + * @return the type value. + */ + @Override + public ExperimentActionType 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 == null ? null : this.type.toString()); + 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 = ExperimentActionType.fromString(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..4357df5dce9cf 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 { + /* + * Chaos experiment action discriminator type + */ + private ExperimentActionType type = ExperimentActionType.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: Chaos experiment action discriminator type. + * + * @return the type value. + */ + @Override + public ExperimentActionType 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 == null ? null : this.type.toString()); + 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 = ExperimentActionType.fromString(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..e143cff74b0c6 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 { + /* + * Chaos experiment action discriminator type + */ + private ExperimentActionType type = ExperimentActionType.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: Chaos experiment action discriminator type. + * + * @return the type value. + */ + @Override + public ExperimentActionType 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 == null ? null : this.type.toString()); + 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 = ExperimentActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscreteAction; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiment.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiment.java index 31e719c87678c..90fd4133f4d7b 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiment.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiment.java @@ -8,7 +8,6 @@ import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner; -import java.util.List; import java.util.Map; /** @@ -51,39 +50,25 @@ public interface Experiment { Map tags(); /** - * Gets the systemData property: The system metadata of the experiment resource. + * Gets the properties property: The properties of the experiment resource. * - * @return the systemData value. + * @return the properties value. */ - SystemData systemData(); + ExperimentProperties properties(); /** - * Gets the identity property: The identity of the experiment resource. + * Gets the identity property: The managed service identities assigned to this resource. * * @return the identity value. */ - ResourceIdentity identity(); - - /** - * Gets the provisioningState property: Most recent provisioning state for the given experiment resource. - * - * @return the provisioningState value. - */ - ProvisioningState provisioningState(); + ManagedServiceIdentity identity(); /** - * Gets the steps property: List of steps. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the steps value. - */ - List steps(); - - /** - * Gets the selectors property: List of selectors. - * - * @return the selectors value. + * @return the systemData value. */ - List selectors(); + SystemData systemData(); /** * Gets the region of the resource. @@ -116,9 +101,8 @@ public interface Experiment { /** * The entirety of the Experiment definition. */ - interface Definition - extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithResourceGroup, - DefinitionStages.WithSteps, DefinitionStages.WithSelectors, DefinitionStages.WithCreate { + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithProperties, DefinitionStages.WithCreate { } /** @@ -159,36 +143,23 @@ interface WithResourceGroup { /** * Specifies resourceGroupName. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @return the next definition stage. */ - WithSteps withExistingResourceGroup(String resourceGroupName); + WithProperties withExistingResourceGroup(String resourceGroupName); } /** - * The stage of the Experiment definition allowing to specify steps. + * The stage of the Experiment definition allowing to specify properties. */ - interface WithSteps { + interface WithProperties { /** - * Specifies the steps property: List of steps.. + * Specifies the properties property: The properties of the experiment resource.. * - * @param steps List of steps. + * @param properties The properties of the experiment resource. * @return the next definition stage. */ - WithSelectors withSteps(List steps); - } - - /** - * The stage of the Experiment definition allowing to specify selectors. - */ - interface WithSelectors { - /** - * Specifies the selectors property: List of selectors.. - * - * @param selectors List of selectors. - * @return the next definition stage. - */ - WithCreate withSelectors(List selectors); + WithCreate withProperties(ExperimentProperties properties); } /** @@ -230,12 +201,12 @@ interface WithTags { */ interface WithIdentity { /** - * Specifies the identity property: The identity of the experiment resource.. + * Specifies the identity property: The managed service identities assigned to this resource.. * - * @param identity The identity of the experiment resource. + * @param identity The managed service identities assigned to this resource. * @return the next definition stage. */ - WithCreate withIdentity(ResourceIdentity identity); + WithCreate withIdentity(ManagedServiceIdentity identity); } } @@ -275,9 +246,9 @@ interface UpdateStages { */ interface WithTags { /** - * Specifies the tags property: The tags of the experiment resource.. + * Specifies the tags property: Resource tags.. * - * @param tags The tags of the experiment resource. + * @param tags Resource tags. * @return the next definition stage. */ Update withTags(Map tags); @@ -288,12 +259,12 @@ interface WithTags { */ interface WithIdentity { /** - * Specifies the identity property: The identity of the experiment resource.. + * Specifies the identity property: Updatable managed service identity. * - * @param identity The identity of the experiment resource. + * @param identity Updatable managed service identity. * @return the next definition stage. */ - Update withIdentity(ResourceIdentity identity); + Update withIdentity(ManagedServiceIdentityUpdate identity); } } @@ -317,8 +288,9 @@ interface WithIdentity { * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the post action response. */ - void cancel(); + PostActionResponse cancel(); /** * Cancel a running Experiment resource. @@ -327,16 +299,18 @@ interface WithIdentity { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the post action response. */ - void cancel(Context context); + PostActionResponse cancel(Context context); /** * Start a Experiment resource. * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the post action response. */ - void start(); + PostActionResponse start(); /** * Start a Experiment resource. @@ -345,6 +319,7 @@ interface WithIdentity { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the post action response. */ - void start(Context context); + PostActionResponse start(Context context); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentActionType.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentActionType.java new file mode 100644 index 0000000000000..79ab22a178aad --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentActionType.java @@ -0,0 +1,56 @@ +// 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.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum union of Chaos experiment action types. + */ +public final class ExperimentActionType extends ExpandableStringEnum { + /** + * Static value discrete for ExperimentActionType. + */ + public static final ExperimentActionType DISCRETE = fromString("discrete"); + + /** + * Static value continuous for ExperimentActionType. + */ + public static final ExperimentActionType CONTINUOUS = fromString("continuous"); + + /** + * Static value delay for ExperimentActionType. + */ + public static final ExperimentActionType DELAY = fromString("delay"); + + /** + * Creates a new instance of ExperimentActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ExperimentActionType() { + } + + /** + * Creates or finds a ExperimentActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExperimentActionType. + */ + public static ExperimentActionType fromString(String name) { + return fromString(name, ExperimentActionType.class); + } + + /** + * Gets known ExperimentActionType values. + * + * @return known ExperimentActionType values. + */ + public static Collection values() { + return values(ExperimentActionType.class); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecution.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecution.java index 84c51ef155c60..cd86b62fab446 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecution.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecution.java @@ -4,54 +4,47 @@ package com.azure.resourcemanager.chaos.models; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionInner; -import java.time.OffsetDateTime; /** * An immutable client-side representation of ExperimentExecution. */ public interface ExperimentExecution { /** - * Gets the type property: String of the resource type. - * - * @return the type value. - */ - String type(); - - /** - * Gets the id property: String of the fully qualified resource ID. + * Gets the id property: Fully qualified resource Id for the resource. * * @return the id value. */ String id(); /** - * Gets the name property: String of the resource name. + * Gets the name property: The name of the resource. * * @return the name value. */ String name(); /** - * Gets the status property: The status of the execution. + * Gets the type property: The type of the resource. * - * @return the status value. + * @return the type value. */ - String status(); + String type(); /** - * Gets the startedAt property: String that represents the start date time. + * Gets the properties property: The properties of experiment execution status. * - * @return the startedAt value. + * @return the properties value. */ - OffsetDateTime startedAt(); + ExperimentExecutionProperties properties(); /** - * Gets the stoppedAt property: String that represents the stop date time. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the stoppedAt value. + * @return the systemData value. */ - OffsetDateTime stoppedAt(); + SystemData systemData(); /** * Gets the inner com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionInner object. 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/ExperimentExecutionDetails.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetails.java index a3389a3da0900..a49e9ebb3a198 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetails.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetails.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.chaos.models; import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; -import java.time.OffsetDateTime; /** * An immutable client-side representation of ExperimentExecutionDetails. @@ -33,46 +32,11 @@ public interface ExperimentExecutionDetails { String name(); /** - * Gets the failureReason property: The reason why the execution failed. + * Gets the properties property: The properties of the experiment execution details. * - * @return the failureReason value. + * @return the properties value. */ - String failureReason(); - - /** - * Gets the lastActionAt property: String that represents the last action date time. - * - * @return the lastActionAt value. - */ - OffsetDateTime lastActionAt(); - - /** - * Gets the runInformation property: The information of the experiment run. - * - * @return the runInformation value. - */ - ExperimentExecutionDetailsPropertiesRunInformation runInformation(); - - /** - * Gets the status property: The status of the execution. - * - * @return the status value. - */ - String status(); - - /** - * Gets the startedAt property: String that represents the start date time. - * - * @return the startedAt value. - */ - OffsetDateTime startedAt(); - - /** - * Gets the stoppedAt property: String that represents the stop date time. - * - * @return the stoppedAt value. - */ - OffsetDateTime stoppedAt(); + ExperimentExecutionDetailsProperties properties(); /** * Gets the inner com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner object. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsProperties.java new file mode 100644 index 0000000000000..c99133228c093 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsProperties.java @@ -0,0 +1,192 @@ +// 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.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 java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Model that represents the extended properties of an experiment execution. + */ +@Immutable +public final class ExperimentExecutionDetailsProperties extends ExperimentExecutionProperties { + /* + * The reason why the execution failed. + */ + private String failureReason; + + /* + * String that represents the last action date time. + */ + private OffsetDateTime lastActionAt; + + /* + * The information of the experiment run. + */ + private ExperimentExecutionDetailsPropertiesRunInformation runInformation; + + /* + * Experiment execution resource provisioning state. Not currently implemented. + */ + private ProvisioningState provisioningState; + + /* + * 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. + */ + public ExperimentExecutionDetailsProperties() { + } + + /** + * Get the failureReason property: The reason why the execution failed. + * + * @return the failureReason value. + */ + public String failureReason() { + return this.failureReason; + } + + /** + * Get the lastActionAt property: String that represents the last action date time. + * + * @return the lastActionAt value. + */ + public OffsetDateTime lastActionAt() { + return this.lastActionAt; + } + + /** + * Get the runInformation property: The information of the experiment run. + * + * @return the runInformation value. + */ + public ExperimentExecutionDetailsPropertiesRunInformation runInformation() { + return this.runInformation; + } + + /** + * Get the provisioningState property: Experiment execution resource provisioning state. Not currently implemented. + * + * @return the provisioningState value. + */ + @Override + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * 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. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void 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 ("provisioningState".equals(fieldName)) { + deserializedExperimentExecutionDetailsProperties.provisioningState + = ProvisioningState.fromString(reader.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/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..b94305dc98c0e 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 @@ -4,26 +4,29 @@ package com.azure.resourcemanager.chaos.models; -import com.azure.core.annotation.Immutable; +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.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 { +@Fluent +public final class ExperimentExecutionListResult implements JsonSerializable { /* - * List of Experiment executions. + * The ExperimentExecution items on this page */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* - * URL to retrieve the next page of Experiment executions. + * The link to the next page of items */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -33,7 +36,7 @@ public ExperimentExecutionListResult() { } /** - * Get the value property: List of Experiment executions. + * Get the value property: The ExperimentExecution items on this page. * * @return the value value. */ @@ -42,7 +45,18 @@ public List value() { } /** - * Get the nextLink property: URL to retrieve the next page of Experiment executions. + * Set the value property: The ExperimentExecution items on this page. + * + * @param value the value value to set. + * @return the ExperimentExecutionListResult object itself. + */ + public ExperimentExecutionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -50,14 +64,74 @@ public String nextLink() { return this.nextLink; } + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the ExperimentExecutionListResult object itself. + */ + public ExperimentExecutionListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (value() != null) { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model ExperimentExecutionListResult")); + } else { value().forEach(e -> e.validate()); } } + + private static final ClientLogger LOGGER = new ClientLogger(ExperimentExecutionListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + 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 IllegalStateException If the deserialized JSON object was missing any required properties. + * @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/ExperimentExecutionProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionProperties.java new file mode 100644 index 0000000000000..39865df6c7358 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionProperties.java @@ -0,0 +1,179 @@ +// 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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Model that represents the execution properties of an Experiment. + */ +@Immutable +public class ExperimentExecutionProperties implements JsonSerializable { + /* + * The status of the execution. + */ + private String status; + + /* + * String that represents the start date time. + */ + private OffsetDateTime startedAt; + + /* + * String that represents the stop date time. + */ + private OffsetDateTime stoppedAt; + + /* + * Experiment execution resource provisioning state. Not currently implemented. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of ExperimentExecutionProperties class. + */ + public ExperimentExecutionProperties() { + } + + /** + * Get the status property: The status of the execution. + * + * @return the status value. + */ + 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. + * + * @return the startedAt value. + */ + 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. + * + * @return the stoppedAt value. + */ + 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; + } + + /** + * Get the provisioningState property: Experiment execution resource provisioning state. Not currently implemented. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: Experiment execution resource provisioning state. Not currently implemented. + * + * @param provisioningState the provisioningState value to set. + * @return the ExperimentExecutionProperties object itself. + */ + ExperimentExecutionProperties withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + 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 if ("provisioningState".equals(fieldName)) { + deserializedExperimentExecutionProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedExperimentExecutionProperties; + }); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutions.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutions.java new file mode 100644 index 0000000000000..8628039f88915 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutions.java @@ -0,0 +1,95 @@ +// 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.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ExperimentExecutions. + */ +public interface ExperimentExecutions { + /** + * Get a list of executions of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String experimentName); + + /** + * Get a list of executions of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String experimentName, Context context); + + /** + * Get an execution of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of an Experiment resource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String experimentName, String executionId, + Context context); + + /** + * Get an execution of an Experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of an Experiment resource. + */ + ExperimentExecution get(String resourceGroupName, String experimentName, String executionId); + + /** + * Execution details of an experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the execution details of an Experiment along with {@link Response}. + */ + Response getExecutionDetailsWithResponse(String resourceGroupName, + String experimentName, String executionId, Context context); + + /** + * Execution details of an experiment resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param experimentName String that represents a Experiment resource name. + * @param executionId GUID that represents a Experiment execution detail. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the execution details of an Experiment. + */ + ExperimentExecutionDetails getExecutionDetails(String resourceGroupName, String experimentName, String executionId); +} 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..09a2479e10591 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 @@ -4,26 +4,29 @@ package com.azure.resourcemanager.chaos.models; -import com.azure.core.annotation.Immutable; +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.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 { +@Fluent +public final class ExperimentListResult implements JsonSerializable { /* - * List of Experiment resources. + * The Experiment items on this page */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* - * URL to retrieve the next page of Experiment resources. + * The link to the next page of items */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -33,7 +36,7 @@ public ExperimentListResult() { } /** - * Get the value property: List of Experiment resources. + * Get the value property: The Experiment items on this page. * * @return the value value. */ @@ -42,7 +45,18 @@ public List value() { } /** - * Get the nextLink property: URL to retrieve the next page of Experiment resources. + * Set the value property: The Experiment items on this page. + * + * @param value the value value to set. + * @return the ExperimentListResult object itself. + */ + public ExperimentListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -50,14 +64,71 @@ public String nextLink() { return this.nextLink; } + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the ExperimentListResult object itself. + */ + public ExperimentListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (value() != null) { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model ExperimentListResult")); + } else { value().forEach(e -> e.validate()); } } + + private static final ClientLogger LOGGER = new ClientLogger(ExperimentListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + 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 IllegalStateException If the deserialized JSON object was missing any required properties. + * @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/ExperimentProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentProperties.java new file mode 100644 index 0000000000000..c2ef1bcd46735 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentProperties.java @@ -0,0 +1,159 @@ +// 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.models; + +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 java.io.IOException; +import java.util.List; + +/** + * Model that represents the Experiment properties model. + */ +@Fluent +public final class ExperimentProperties implements JsonSerializable { + /* + * Most recent provisioning state for the given experiment resource. + */ + private ProvisioningState provisioningState; + + /* + * List of steps. + */ + private List steps; + + /* + * List of selectors. + */ + private List selectors; + + /** + * Creates an instance of ExperimentProperties class. + */ + public ExperimentProperties() { + } + + /** + * Get the provisioningState property: Most recent provisioning state for the given experiment resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the steps property: List of steps. + * + * @return the steps value. + */ + public List steps() { + return this.steps; + } + + /** + * Set the steps property: List of steps. + * + * @param steps the steps value to set. + * @return the ExperimentProperties object itself. + */ + public ExperimentProperties withSteps(List steps) { + this.steps = steps; + return this; + } + + /** + * Get the selectors property: List of selectors. + * + * @return the selectors value. + */ + public List selectors() { + return this.selectors; + } + + /** + * Set the selectors property: List of selectors. + * + * @param selectors the selectors value to set. + * @return the ExperimentProperties object itself. + */ + public ExperimentProperties withSelectors(List selectors) { + this.selectors = selectors; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (steps() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property steps in model ExperimentProperties")); + } else { + steps().forEach(e -> e.validate()); + } + if (selectors() == null) { + 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/models/ExperimentUpdate.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentUpdate.java index a58e286236650..12d89b4c50f5a 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,27 +5,27 @@ 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. + * Resource tags. */ - @JsonProperty(value = "identity") - private ResourceIdentity identity; + private Map tags; /* - * The tags of the experiment resource. + * Updatable managed service identity */ - @JsonProperty(value = "tags") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) - private Map tags; + private ManagedServiceIdentityUpdate identity; /** * Creates an instance of ExperimentUpdate class. @@ -34,42 +34,42 @@ public ExperimentUpdate() { } /** - * Get the identity property: The identity of the experiment resource. + * Get the tags property: Resource tags. * - * @return the identity value. + * @return the tags value. */ - public ResourceIdentity identity() { - return this.identity; + public Map tags() { + return this.tags; } /** - * Set the identity property: The identity of the experiment resource. + * Set the tags property: Resource tags. * - * @param identity the identity value to set. + * @param tags the tags value to set. * @return the ExperimentUpdate object itself. */ - public ExperimentUpdate withIdentity(ResourceIdentity identity) { - this.identity = identity; + public ExperimentUpdate withTags(Map tags) { + this.tags = tags; return this; } /** - * Get the tags property: The tags of the experiment resource. + * Get the identity property: Updatable managed service identity. * - * @return the tags value. + * @return the identity value. */ - public Map tags() { - return this.tags; + public ManagedServiceIdentityUpdate identity() { + return this.identity; } /** - * Set the tags property: The tags of the experiment resource. + * Set the identity property: Updatable managed service identity. * - * @param tags the tags value to set. + * @param identity the identity value to set. * @return the ExperimentUpdate object itself. */ - public ExperimentUpdate withTags(Map tags) { - this.tags = tags; + public ExperimentUpdate withIdentity(ManagedServiceIdentityUpdate identity) { + this.identity = identity; return this; } @@ -83,4 +83,44 @@ public void validate() { identity().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("identity", this.identity); + 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 ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedExperimentUpdate.tags = tags; + } else if ("identity".equals(fieldName)) { + deserializedExperimentUpdate.identity = ManagedServiceIdentityUpdate.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedExperimentUpdate; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiments.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiments.java index 60f1f37688616..4a9ac00aa36bb 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiments.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiments.java @@ -38,7 +38,7 @@ public interface Experiments { /** * Get a list of Experiment resources in a resource group. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -49,7 +49,7 @@ public interface Experiments { /** * Get a list of Experiment resources in a resource group. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param running Optional value that indicates whether to filter results based on if the Experiment is currently * running. If null, then the results will not be filtered. * @param continuationToken String that sets the continuation token. @@ -62,33 +62,10 @@ public interface Experiments { PagedIterable listByResourceGroup(String resourceGroupName, Boolean running, String continuationToken, Context context); - /** - * Delete a Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByResourceGroup(String resourceGroupName, String experimentName); - - /** - * Delete a Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void delete(String resourceGroupName, String experimentName, Context context); - /** * Get a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -102,7 +79,7 @@ Response getByResourceGroupWithResponse(String resourceGroupName, St /** * Get a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -112,132 +89,77 @@ Response getByResourceGroupWithResponse(String resourceGroupName, St Experiment getByResourceGroup(String resourceGroupName, String experimentName); /** - * Cancel a running Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void cancel(String resourceGroupName, String experimentName); - - /** - * Cancel a running Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void cancel(String resourceGroupName, String experimentName, Context context); - - /** - * Start a Experiment resource. + * Delete a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ - void start(String resourceGroupName, String experimentName); + void deleteByResourceGroup(String resourceGroupName, String experimentName); /** - * Start a Experiment resource. + * Delete a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ - void start(String resourceGroupName, String experimentName, Context context); - - /** - * Get a list of executions of an Experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. - */ - PagedIterable listAllExecutions(String resourceGroupName, String experimentName); + void delete(String resourceGroupName, String experimentName, Context context); /** - * Get a list of executions of an Experiment resource. + * Cancel a running Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of executions of an Experiment resource as paginated response with {@link PagedIterable}. + * @return model that represents the post action response. */ - PagedIterable listAllExecutions(String resourceGroupName, String experimentName, - Context context); + PostActionResponse cancel(String resourceGroupName, String experimentName); /** - * Get an execution of an Experiment resource. + * Cancel a running Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an execution of an Experiment resource along with {@link Response}. + * @return model that represents the post action response. */ - Response getExecutionWithResponse(String resourceGroupName, String experimentName, - String executionId, Context context); + PostActionResponse cancel(String resourceGroupName, String experimentName, Context context); /** - * Get an execution of an Experiment resource. + * Start a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an execution of an Experiment resource. + * @return model that represents the post action response. */ - ExperimentExecution getExecution(String resourceGroupName, String experimentName, String executionId); + PostActionResponse start(String resourceGroupName, String experimentName); /** - * Execution details of an experiment resource. + * Start a Experiment resource. * - * @param resourceGroupName String that represents an Azure resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents the execution details of an Experiment along with {@link Response}. - */ - Response executionDetailsWithResponse(String resourceGroupName, String experimentName, - String executionId, Context context); - - /** - * Execution details of an experiment resource. - * - * @param resourceGroupName String that represents an Azure resource group. - * @param experimentName String that represents a Experiment resource name. - * @param executionId GUID that represents a Experiment execution detail. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents the execution details of an Experiment. + * @return model that represents the post action response. */ - ExperimentExecutionDetails executionDetails(String resourceGroupName, String experimentName, String executionId); + PostActionResponse start(String resourceGroupName, String experimentName, Context context); /** * Get a Experiment resource. 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/ManagedServiceIdentity.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ManagedServiceIdentity.java new file mode 100644 index 0000000000000..84c7526e52212 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ManagedServiceIdentity.java @@ -0,0 +1,190 @@ +// 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.models; + +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 java.io.IOException; +import java.util.Map; +import java.util.UUID; + +/** + * Managed service identity (system assigned and/or user assigned identities). + */ +@Fluent +public final class ManagedServiceIdentity implements JsonSerializable { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + private UUID principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + private UUID tenantId; + + /* + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ + private ManagedServiceIdentityType type; + + /* + * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will + * be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/ + * userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property type in model ManagedServiceIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.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 ManagedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentity 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 ManagedServiceIdentity. + */ + public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("principalId".equals(fieldName)) { + deserializedManagedServiceIdentity.principalId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ManagedServiceIdentityType.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ManagedServiceIdentityType.java new file mode 100644 index 0000000000000..63dfbda4f1e7f --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ManagedServiceIdentityType.java @@ -0,0 +1,62 @@ +// 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.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** + * Static value None for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** + * Static value SystemAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Static value UserAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * Static value SystemAssigned,UserAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED + = fromString("SystemAssigned,UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ManagedServiceIdentityUpdate.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ManagedServiceIdentityUpdate.java new file mode 100644 index 0000000000000..9ebe09e34f19c --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ManagedServiceIdentityUpdate.java @@ -0,0 +1,134 @@ +// 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.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 java.io.IOException; +import java.util.Map; + +/** + * The template for adding optional properties. + */ +@Fluent +public final class ManagedServiceIdentityUpdate implements JsonSerializable { + /* + * The type of managed identity assigned to this resource. + */ + private ManagedServiceIdentityType type; + + /* + * The identities assigned to this resource by the user. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentityUpdate class. + */ + public ManagedServiceIdentityUpdate() { + } + + /** + * Get the type property: The type of managed identity assigned to this resource. + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of managed identity assigned to this resource. + * + * @param type the type value to set. + * @return the ManagedServiceIdentityUpdate object itself. + */ + public ManagedServiceIdentityUpdate withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentityUpdate object itself. + */ + public ManagedServiceIdentityUpdate + withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + /** + * {@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 ManagedServiceIdentityUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentityUpdate 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 ManagedServiceIdentityUpdate. + */ + public static ManagedServiceIdentityUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentityUpdate deserializedManagedServiceIdentityUpdate = new ManagedServiceIdentityUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedManagedServiceIdentityUpdate.type + = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentities.fromJson(reader1)); + deserializedManagedServiceIdentityUpdate.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentityUpdate; + }); + } +} 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 deleted file mode 100644 index b1e094af9f5e2..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatus.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.models; - -import com.azure.core.management.exception.ManagementError; -import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner; - -/** - * An immutable client-side representation of OperationStatus. - */ -public interface OperationStatus { - /** - * Gets the id property: The operation Id. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The operation name. - * - * @return the name value. - */ - String name(); - - /** - * Gets the startTime property: The start time of the operation. - * - * @return the startTime value. - */ - String startTime(); - - /** - * Gets the endTime property: The end time of the operation. - * - * @return the endTime value. - */ - String endTime(); - - /** - * Gets the status property: The status of the operation. - * - * @return the status value. - */ - String status(); - - /** - * Gets the error property: The error object. - * - * @return the error value. - */ - ManagementError error(); - - /** - * Gets the inner com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner object. - * - * @return the inner object. - */ - OperationStatusInner innerModel(); -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatuses.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatuses.java deleted file mode 100644 index 54ddb12e295ab..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatuses.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.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of OperationStatuses. - */ -public interface OperationStatuses { - /** - * Get the status of a long running azure asynchronous operation. - * - * @param location The name of the Azure region. - * @param asyncOperationId The operation Id. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the status of a long running azure asynchronous operation along with {@link Response}. - */ - Response getWithResponse(String location, String asyncOperationId, Context context); - - /** - * Get the status of a long running azure asynchronous operation. - * - * @param location The name of the Azure region. - * @param asyncOperationId The operation Id. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the status of a long running azure asynchronous operation. - */ - OperationStatus get(String location, String asyncOperationId); -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Operations.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Operations.java index 31ed96d56468b..99dbdad3cc5a9 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Operations.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Operations.java @@ -12,22 +12,24 @@ */ public interface Operations { /** - * Get a list all available Operations. + * List the operations for the provider. * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list all available Operations as paginated response with {@link PagedIterable}. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. */ - PagedIterable listAll(); + PagedIterable list(); /** - * Get a list all available Operations. + * List the operations for the provider. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list all available Operations as paginated response with {@link PagedIterable}. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. */ - PagedIterable listAll(Context context); + PagedIterable list(Context context); } 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/PostActionResponse.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/PostActionResponse.java new file mode 100644 index 0000000000000..12161596bd07c --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/PostActionResponse.java @@ -0,0 +1,33 @@ +// 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.models; + +import com.azure.resourcemanager.chaos.fluent.models.PostActionResponseInner; + +/** + * An immutable client-side representation of PostActionResponse. + */ +public interface PostActionResponse { + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the statusUrl property: The statusUrl of the post action. + * + * @return the statusUrl value. + */ + String statusUrl(); + + /** + * Gets the inner com.azure.resourcemanager.chaos.fluent.models.PostActionResponseInner object. + * + * @return the inner object. + */ + PostActionResponseInner innerModel(); +} 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 deleted file mode 100644 index 4a2268f6a8cdc..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentity.java +++ /dev/null @@ -1,134 +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.models; - -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 java.util.Map; - -/** - * The identity of a resource. - */ -@Fluent -public final class ResourceIdentity { - /* - * String of the resource identity type. - */ - @JsonProperty(value = "type", required = true) - private ResourceIdentityType type; - - /* - * The list of user identities associated with the Experiment. The user identity dictionary key references will be - * ARM resource ids in the form: - * '/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; - - /** - * Creates an instance of ResourceIdentity class. - */ - public ResourceIdentity() { - } - - /** - * Get the type property: String of the resource identity type. - * - * @return the type value. - */ - public ResourceIdentityType type() { - return this.type; - } - - /** - * Set the type property: String of the resource identity type. - * - * @param type the type value to set. - * @return the ResourceIdentity object itself. - */ - public ResourceIdentity withType(ResourceIdentityType type) { - this.type = type; - return this; - } - - /** - * Get the userAssignedIdentities property: The list of user identities associated with the Experiment. The user - * identity dictionary key references will be ARM resource ids in the form: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - * - * @return the userAssignedIdentities value. - */ - public Map userAssignedIdentities() { - return this.userAssignedIdentities; - } - - /** - * Set the userAssignedIdentities property: The list of user identities associated with the Experiment. The user - * identity dictionary key references will be ARM resource ids in the form: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - * - * @param userAssignedIdentities the userAssignedIdentities value to set. - * @return the ResourceIdentity object itself. - */ - public ResourceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { - this.userAssignedIdentities = userAssignedIdentities; - return this; - } - - /** - * Get the principalId property: GUID that represents the principal ID of this resource identity. - * - * @return the principalId value. - */ - public String principalId() { - return this.principalId; - } - - /** - * Get the tenantId property: GUID that represents the tenant ID of this resource identity. - * - * @return the tenantId value. - */ - public String tenantId() { - return this.tenantId; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (type() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property type in model ResourceIdentity")); - } - if (userAssignedIdentities() != null) { - userAssignedIdentities().values().forEach(e -> { - if (e != null) { - e.validate(); - } - }); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ResourceIdentity.class); -} 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 deleted file mode 100644 index f8f9bb37b4c29..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentityType.java +++ /dev/null @@ -1,66 +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.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * String of the resource identity type. - */ -public enum ResourceIdentityType { - /** - * Enum value None. - */ - NONE("None"), - - /** - * Enum value SystemAssigned. - */ - SYSTEM_ASSIGNED("SystemAssigned"), - - /** - * Enum value UserAssigned. - */ - USER_ASSIGNED("UserAssigned"); - - /** - * The actual serialized value for a ResourceIdentityType instance. - */ - private final String value; - - ResourceIdentityType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a ResourceIdentityType instance. - * - * @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; - } - ResourceIdentityType[] items = ResourceIdentityType.values(); - for (ResourceIdentityType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@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/Target.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Target.java index a4ada3a72e4c7..3317df15cc52e 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Target.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Target.java @@ -34,25 +34,25 @@ public interface Target { String type(); /** - * Gets the systemData property: The system metadata of the target resource. + * Gets the properties property: The properties of the target resource. * - * @return the systemData value. + * @return the properties value. */ - SystemData systemData(); + Map properties(); /** - * Gets the location property: Location of the target resource. + * Gets the location property: Azure resource location. * * @return the location value. */ String location(); /** - * Gets the properties property: The properties of the target resource. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the properties value. + * @return the systemData value. */ - Map properties(); + SystemData systemData(); /** * Gets the inner com.azure.resourcemanager.chaos.fluent.models.TargetInner object. 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..9b2e2df4b53a9 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 @@ -4,26 +4,29 @@ package com.azure.resourcemanager.chaos.models; -import com.azure.core.annotation.Immutable; +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.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 { +@Fluent +public final class TargetListResult implements JsonSerializable { /* - * List of Target resources. + * The Target items on this page */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* - * URL to retrieve the next page of Target resources. + * The link to the next page of items */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -33,7 +36,7 @@ public TargetListResult() { } /** - * Get the value property: List of Target resources. + * Get the value property: The Target items on this page. * * @return the value value. */ @@ -42,7 +45,18 @@ public List value() { } /** - * Get the nextLink property: URL to retrieve the next page of Target resources. + * Set the value property: The Target items on this page. + * + * @param value the value value to set. + * @return the TargetListResult object itself. + */ + public TargetListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -50,14 +64,71 @@ public String nextLink() { return this.nextLink; } + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the TargetListResult object itself. + */ + public TargetListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (value() != null) { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model TargetListResult")); + } else { value().forEach(e -> e.validate()); } } + + private static final ClientLogger LOGGER = new ClientLogger(TargetListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + 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 IllegalStateException If the deserialized JSON object was missing any required properties. + * @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/TargetType.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetType.java index f464af6c8f3cb..b5c220f58c0f3 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetType.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetType.java @@ -6,7 +6,6 @@ import com.azure.core.management.SystemData; import com.azure.resourcemanager.chaos.fluent.models.TargetTypeInner; -import java.util.List; /** * An immutable client-side representation of TargetType. @@ -34,46 +33,18 @@ public interface TargetType { String type(); /** - * Gets the systemData property: The system metadata properties of the target type resource. + * Gets the properties property: The properties of the target type resource. * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the location property: Location of the Target Type resource. - * - * @return the location value. - */ - String location(); - - /** - * Gets the displayName property: Localized string of the display name. - * - * @return the displayName value. + * @return the properties value. */ - String displayName(); + TargetTypeProperties properties(); /** - * Gets the description property: Localized string of the description. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the description value. - */ - String description(); - - /** - * Gets the propertiesSchema property: URL to retrieve JSON schema of the Target Type properties. - * - * @return the propertiesSchema value. - */ - String propertiesSchema(); - - /** - * Gets the resourceTypes property: List of resource types this Target Type can extend. - * - * @return the resourceTypes value. + * @return the systemData value. */ - List resourceTypes(); + SystemData systemData(); /** * Gets the inner com.azure.resourcemanager.chaos.fluent.models.TargetTypeInner object. 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..54cba9e13508e 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 @@ -4,26 +4,29 @@ package com.azure.resourcemanager.chaos.models; -import com.azure.core.annotation.Immutable; +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.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 { +@Fluent +public final class TargetTypeListResult implements JsonSerializable { /* - * List of Target Type resources. + * The TargetType items on this page */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* - * URL to retrieve the next page of Target Type resources. + * The link to the next page of items */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -33,7 +36,7 @@ public TargetTypeListResult() { } /** - * Get the value property: List of Target Type resources. + * Get the value property: The TargetType items on this page. * * @return the value value. */ @@ -42,7 +45,18 @@ public List value() { } /** - * Get the nextLink property: URL to retrieve the next page of Target Type resources. + * Set the value property: The TargetType items on this page. + * + * @param value the value value to set. + * @return the TargetTypeListResult object itself. + */ + public TargetTypeListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -50,14 +64,71 @@ public String nextLink() { return this.nextLink; } + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the TargetTypeListResult object itself. + */ + public TargetTypeListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (value() != null) { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model TargetTypeListResult")); + } else { value().forEach(e -> e.validate()); } } + + private static final ClientLogger LOGGER = new ClientLogger(TargetTypeListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + 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 IllegalStateException If the deserialized JSON object was missing any required properties. + * @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/TargetTypeProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypeProperties.java new file mode 100644 index 0000000000000..8e1f7e56d3e1c --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypeProperties.java @@ -0,0 +1,148 @@ +// 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.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 java.io.IOException; +import java.util.List; + +/** + * Model that represents the base Target Type properties model. + */ +@Immutable +public final class TargetTypeProperties implements JsonSerializable { + /* + * Localized string of the display name. + */ + private String displayName; + + /* + * Localized string of the description. + */ + private String description; + + /* + * URL to retrieve JSON schema of the Target Type properties. + */ + private String propertiesSchema; + + /* + * List of resource types this Target Type can extend. + */ + private List resourceTypes; + + /* + * Target type resource provisioning state. Not currently implemented. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of TargetTypeProperties class. + */ + public TargetTypeProperties() { + } + + /** + * Get the displayName property: Localized string of the display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the description property: Localized string of the description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the propertiesSchema property: URL to retrieve JSON schema of the Target Type properties. + * + * @return the propertiesSchema value. + */ + public String propertiesSchema() { + return this.propertiesSchema; + } + + /** + * Get the resourceTypes property: List of resource types this Target Type can extend. + * + * @return the resourceTypes value. + */ + public List resourceTypes() { + return this.resourceTypes; + } + + /** + * Get the provisioningState property: Target type resource provisioning state. Not currently implemented. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + 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 if ("provisioningState".equals(fieldName)) { + deserializedTargetTypeProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTargetTypeProperties; + }); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypes.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypes.java index 15b8a39602422..1f9ab8896318e 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypes.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypes.java @@ -15,18 +15,18 @@ public interface TargetTypes { /** * Get a list of Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of Target Type resources for given location as paginated response with {@link PagedIterable}. */ - PagedIterable list(String locationName); + PagedIterable list(String location); /** * Get a list of Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -34,12 +34,12 @@ public interface TargetTypes { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of Target Type resources for given location as paginated response with {@link PagedIterable}. */ - PagedIterable list(String locationName, String continuationToken, Context context); + PagedIterable list(String location, String continuationToken, Context context); /** * Get a Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -47,17 +47,17 @@ public interface TargetTypes { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a Target Type resources for given location along with {@link Response}. */ - Response getWithResponse(String locationName, String targetTypeName, Context context); + Response getWithResponse(String location, String targetTypeName, Context context); /** * Get a Target Type resources for given location. * - * @param locationName String that represents a Location resource name. + * @param location The name of the Azure region. * @param targetTypeName String that represents a Target Type resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a Target Type resources for given location. */ - TargetType get(String locationName, String targetTypeName); + TargetType get(String location, String targetTypeName); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Targets.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Targets.java index 12dc0dcad5a50..cadbf89066231 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Targets.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Targets.java @@ -16,10 +16,10 @@ public interface Targets { /** * Get a list of Target resources that extend a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -32,10 +32,10 @@ PagedIterable list(String resourceGroupName, String parentProviderNamesp /** * Get a list of Target resources that extend a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @param continuationToken String that sets the continuation token. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -50,100 +50,101 @@ PagedIterable list(String resourceGroupName, String parentProviderNamesp /** * Get a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a Target resource that extends a tracked regional resource along with {@link Response}. */ - Response getWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, Context context); + Response getWithResponse(String resourceGroupName, String targetName, String parentProviderNamespace, + String parentResourceType, String parentResourceName, Context context); /** * Get a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a Target resource that extends a tracked regional resource. */ - Target get(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName); + Target get(String resourceGroupName, String targetName, String parentProviderNamespace, String parentResourceType, + String parentResourceName); /** - * Delete a Target resource that extends a tracked regional resource. + * Create or update a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. + * @param resource Target resource to be created or updated. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. + * @return model that represents a Target resource along with {@link Response}. */ - Response deleteWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, Context context); + Response createOrUpdateWithResponse(String resourceGroupName, String targetName, + String parentProviderNamespace, String parentResourceType, String parentResourceName, TargetInner resource, + Context context); /** - * Delete a Target resource that extends a tracked regional resource. + * Create or update a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. + * @param resource Target resource to be created or updated. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Target resource. */ - void delete(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName); + Target createOrUpdate(String resourceGroupName, String targetName, String parentProviderNamespace, + String parentResourceType, String parentResourceName, TargetInner resource); /** - * Create or update a Target resource that extends a tracked regional resource. + * Delete a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. - * @param target Target resource to be created or updated. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a Target resource along with {@link Response}. + * @return the {@link Response}. */ - Response createOrUpdateWithResponse(String resourceGroupName, String parentProviderNamespace, - String parentResourceType, String parentResourceName, String targetName, TargetInner target, Context context); + Response deleteWithResponse(String resourceGroupName, String targetName, String parentProviderNamespace, + String parentResourceType, String parentResourceName, Context context); /** - * Create or update a Target resource that extends a tracked regional resource. + * Delete a Target resource that extends a tracked regional resource. * - * @param resourceGroupName String that represents an Azure resource group. - * @param parentProviderNamespace String that represents a resource provider namespace. - * @param parentResourceType String that represents a resource type. - * @param parentResourceName String that represents a resource name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param targetName String that represents a Target resource name. - * @param target Target resource to be created or updated. + * @param parentProviderNamespace Name of schema group. + * @param parentResourceType Name of schema group. + * @param parentResourceName Name of schema group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return model that represents a Target resource. */ - Target createOrUpdate(String resourceGroupName, String parentProviderNamespace, String parentResourceType, - String parentResourceName, String targetName, TargetInner target); + void delete(String resourceGroupName, String targetName, String parentProviderNamespace, String parentResourceType, + String parentResourceName); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/UserAssignedIdentities.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/UserAssignedIdentities.java new file mode 100644 index 0000000000000..bafea6c833986 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/UserAssignedIdentities.java @@ -0,0 +1,102 @@ +// 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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.UUID; + +/** + * The UserAssignedIdentities model. + */ +@Immutable +public final class UserAssignedIdentities extends UserAssignedIdentity { + /* + * The client ID of the assigned identity. + */ + private UUID clientId; + + /* + * The principal ID of the assigned identity. + */ + private UUID principalId; + + /** + * Creates an instance of UserAssignedIdentities class. + */ + public UserAssignedIdentities() { + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + @Override + public UUID clientId() { + return this.clientId; + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + @Override + public UUID principalId() { + return this.principalId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentities from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentities 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 UserAssignedIdentities. + */ + public static UserAssignedIdentities fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentities deserializedUserAssignedIdentities = new UserAssignedIdentities(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentities.principalId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentities.clientId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentities; + }); + } +} 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..35cbd0c9e2903 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 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; /** @@ -40,6 +42,17 @@ public UUID principalId() { return this.principalId; } + /** + * Set the principalId property: The principal ID of the assigned identity. + * + * @param principalId the principalId value to set. + * @return the UserAssignedIdentity object itself. + */ + UserAssignedIdentity withPrincipalId(UUID principalId) { + this.principalId = principalId; + return this; + } + /** * Get the clientId property: The client ID of the assigned identity. * @@ -49,6 +62,17 @@ public UUID clientId() { return this.clientId; } + /** + * Set the clientId property: The client ID of the assigned identity. + * + * @param clientId the clientId value to set. + * @return the UserAssignedIdentity object itself. + */ + UserAssignedIdentity withClientId(UUID clientId) { + this.clientId = clientId; + return this; + } + /** * Validates the instance. * @@ -56,4 +80,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..b9ab0a971fca1 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.ExperimentExecutionsClientImpl$ExperimentExecutionsService"],["com.azure.resourcemanager.chaos.implementation.ExperimentsClientImpl$ExperimentsService"],["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..0637a088a01e8 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 +[] \ 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..0401ea765156e 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 @@ -4,7 +4,7 @@ package com.azure.resourcemanager.chaos.generated; -import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; +import com.azure.resourcemanager.chaos.models.CapabilityProperties; /** * Samples for Capabilities CreateOrUpdate. @@ -12,7 +12,7 @@ public final class CapabilitiesCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CreateUpdateCapability.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Capabilities_CreateOrUpdate.json */ /** * Sample code: Create/update a Capability that extends a virtual machine Target resource. @@ -21,8 +21,10 @@ 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() + .define("Shutdown-1.0") + .withExistingTarget("exampleRG", "Microsoft-VirtualMachine") + .withProperties(new CapabilityProperties()) + .create(); } } 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..b301e5b9fe2b3 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 @@ -10,7 +10,7 @@ public final class CapabilitiesDeleteSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteCapability.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Capabilities_Delete.json */ /** * Sample code: Delete a Capability that extends a virtual machine Target resource. @@ -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-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..08ed15ca76cd6 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 @@ -10,7 +10,7 @@ public final class CapabilitiesGetSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetCapability.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Capabilities_Get.json */ /** * Sample code: Get a Capability that extends a virtual machine Target resource. @@ -19,7 +19,7 @@ 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-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..fd7ffd3298f61 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 @@ -10,7 +10,7 @@ public final class CapabilitiesListSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListCapabilities.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Capabilities_List.json */ /** * Sample code: List all Capabilities that extend a virtual machine Target resource. @@ -19,7 +19,6 @@ 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-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..e26c04b4c9f17 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 @@ -10,7 +10,7 @@ public final class CapabilityTypesGetSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetCapabilityType.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/CapabilityTypes_Get.json */ /** * Sample code: Get a Capability Type for a virtual machine Target resource on westus2 location. @@ -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/CapabilityTypesListSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListSamples.java index 41d3af07ff147..b99b37a755e98 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListSamples.java @@ -10,7 +10,7 @@ public final class CapabilityTypesListSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListCapabilityTypes.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/CapabilityTypes_List.json */ /** * Sample code: List all Capability Types for a virtual machine Target resource on westus2 location. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionsGetExecutionDetailsSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionsGetExecutionDetailsSamples.java new file mode 100644 index 0000000000000..19a6732800f8f --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionsGetExecutionDetailsSamples.java @@ -0,0 +1,25 @@ +// 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; + +/** + * Samples for ExperimentExecutions GetExecutionDetails. + */ +public final class ExperimentExecutionsGetExecutionDetailsSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/ + * ExperimentExecutions_GetExecutionDetails.json + */ + /** + * Sample code: Get experiment execution details. + * + * @param manager Entry point to ChaosManager. + */ + public static void getExperimentExecutionDetails(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experimentExecutions() + .getExecutionDetailsWithResponse("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/ExperimentsGetExecutionSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionsGetSamples.java similarity index 62% rename from sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionSamples.java rename to sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionsGetSamples.java index 6c17f0dddf124..3611e8952f388 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/ExperimentExecutionsGetSamples.java @@ -5,12 +5,12 @@ package com.azure.resourcemanager.chaos.generated; /** - * Samples for Experiments GetExecution. + * Samples for ExperimentExecutions Get. */ -public final class ExperimentsGetExecutionSamples { +public final class ExperimentExecutionsGetSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperimentExecution.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/ExperimentExecutions_Get.json */ /** * Sample code: Get the execution of a Experiment. @@ -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.experimentExecutions() + .getWithResponse("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/ExperimentsListAllExecutionsSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionsListSamples.java similarity index 67% rename from sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllExecutionsSamples.java rename to sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionsListSamples.java index 27038b5ac78d6..c33f7857ef212 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllExecutionsSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionsListSamples.java @@ -5,12 +5,12 @@ package com.azure.resourcemanager.chaos.generated; /** - * Samples for Experiments ListAllExecutions. + * Samples for ExperimentExecutions List. */ -public final class ExperimentsListAllExecutionsSamples { +public final class ExperimentExecutionsListSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentExecutions.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/ExperimentExecutions_List.json */ /** * Sample code: List all executions of an Experiment. @@ -18,6 +18,6 @@ public final class ExperimentsListAllExecutionsSamples { * @param manager Entry point to ChaosManager. */ public static void listAllExecutionsOfAnExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().listAllExecutions("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + manager.experimentExecutions().list("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCancelSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCancelSamples.java index 990b2f16fdb8e..f78f3f7d25349 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCancelSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCancelSamples.java @@ -10,7 +10,7 @@ public final class ExperimentsCancelSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CancelExperiment.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Experiments_Cancel.json */ /** * Sample code: Cancel a running Experiment. 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..4e5dfd9e1014a 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 @@ -8,13 +8,16 @@ import com.azure.resourcemanager.chaos.models.ChaosExperimentStep; import com.azure.resourcemanager.chaos.models.ChaosTargetListSelector; import com.azure.resourcemanager.chaos.models.ContinuousAction; +import com.azure.resourcemanager.chaos.models.ExperimentProperties; import com.azure.resourcemanager.chaos.models.KeyValuePair; -import com.azure.resourcemanager.chaos.models.ResourceIdentity; -import com.azure.resourcemanager.chaos.models.ResourceIdentityType; +import com.azure.resourcemanager.chaos.models.ManagedServiceIdentity; +import com.azure.resourcemanager.chaos.models.ManagedServiceIdentityType; import com.azure.resourcemanager.chaos.models.TargetReference; import com.azure.resourcemanager.chaos.models.TargetReferenceType; import java.time.Duration; import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; /** * Samples for Experiments CreateOrUpdate. @@ -22,7 +25,7 @@ public final class ExperimentsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CreateUpdateExperiment.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Experiments_CreateOrUpdate.json */ /** * Sample code: Create/update a Experiment in a resource group. @@ -30,20 +33,39 @@ 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") - .withBranches(Arrays.asList(new ChaosExperimentBranch().withName("branch1") - .withActions(Arrays.asList(new ContinuousAction() - .withName("urn:csci:microsoft:virtualMachine:shutdown/1.0") - .withDuration(Duration.parse("PT10M")) - .withParameters( - 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(); + .withProperties( + new ExperimentProperties() + .withSteps(Arrays.asList(new ChaosExperimentStep().withName("step1") + .withBranches(Arrays.asList(new ChaosExperimentBranch().withName("branch1") + .withActions(Arrays.asList( + new ContinuousAction().withName("urn:csci:microsoft:virtualMachine:shutdown/1.0") + .withDuration(Duration.parse("PT10M")) + .withParameters(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")))))) + .withTags(mapOf("key2138", "fakeTokenPlaceholder", "key7131", "fakeTokenPlaceholder")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsDeleteSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsDeleteSamples.java index d71ed6f1c2f9e..05e86d77252b9 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsDeleteSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsDeleteSamples.java @@ -10,7 +10,7 @@ public final class ExperimentsDeleteSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteExperiment.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Experiments_Delete.json */ /** * Sample code: Delete a Experiment in a resource group. 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 deleted file mode 100644 index b4b1018aeedaf..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsExecutionDetailsSamples.java +++ /dev/null @@ -1,24 +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; - -/** - * Samples for Experiments ExecutionDetails. - */ -public final class ExperimentsExecutionDetailsSamples { - /* - * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DetailsExperiment.json - */ - /** - * Sample code: Get experiment execution details. - * - * @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); - } -} 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..b14327daffbfb 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 @@ -10,7 +10,7 @@ public final class ExperimentsGetByResourceGroupSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperiment.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Experiments_Get.json */ /** * Sample code: Get a Experiment in a resource group. @@ -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/ExperimentsListByResourceGroupSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupSamples.java index 15eebd7e5b8c3..3b0c94718d537 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupSamples.java @@ -10,7 +10,7 @@ public final class ExperimentsListByResourceGroupSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInAResourceGroup. + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Experiments_ListByResourceGroup. * json */ /** diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListSamples.java index d9367565bfb47..276a1cec18887 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListSamples.java @@ -10,7 +10,7 @@ public final class ExperimentsListSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInASubscription. + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Experiments_ListBySubscription. * json */ /** diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsStartSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsStartSamples.java index e032207008d2b..aa7387b2dce67 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsStartSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsStartSamples.java @@ -10,7 +10,7 @@ public final class ExperimentsStartSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/StartExperiment.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Experiments_Start.json */ /** * Sample code: Start a Experiment. 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..2a04221db7f27 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 @@ -5,11 +5,6 @@ package com.azure.resourcemanager.chaos.generated; import com.azure.resourcemanager.chaos.models.Experiment; -import com.azure.resourcemanager.chaos.models.ResourceIdentity; -import com.azure.resourcemanager.chaos.models.ResourceIdentityType; -import com.azure.resourcemanager.chaos.models.UserAssignedIdentity; -import java.util.HashMap; -import java.util.Map; /** * Samples for Experiments Update. @@ -17,33 +12,17 @@ public final class ExperimentsUpdateSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/UpdateExperiment.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Experiments_Update.json */ /** - * Sample code: Update an Experiment in a resource group. + * Sample code: Update an Experiment. * * @param manager Entry point to ChaosManager. */ - public static void updateAnExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + public static void updateAnExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { 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()))) - .apply(); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; + resource.update().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 deleted file mode 100644 index 29c02fa4fa086..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/OperationStatusesGetSamples.java +++ /dev/null @@ -1,24 +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; - -/** - * Samples for OperationStatuses Get. - */ -public final class OperationStatusesGetSamples { - /* - * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetOperationStatus.json - */ - /** - * Sample code: Get specific operation status. - * - * @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); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetSamples.java index 8dcf3c0cc1d23..9b806b0b41816 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetSamples.java @@ -10,7 +10,7 @@ public final class TargetTypesGetSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetTargetType.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/TargetTypes_Get.json */ /** * Sample code: Get a Target Type for westus2 location. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesListSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesListSamples.java index 206536f875f70..f54c8bbc8dc6d 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesListSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesListSamples.java @@ -10,7 +10,7 @@ public final class TargetTypesListSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListTargetTypes.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/TargetTypes_List.json */ /** * Sample code: List all Target Types for westus2 location. 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..86b94f9c26d6e 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 @@ -4,46 +4,23 @@ package com.azure.resourcemanager.chaos.generated; -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerEncoding; -import com.azure.resourcemanager.chaos.fluent.models.TargetInner; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - /** * Samples for Targets CreateOrUpdate. */ public final class TargetsCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CreateUpdateTarget.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Targets_CreateOrUpdate.json */ /** * Sample code: Create/update a Target that extends a virtual machine resource. * * @param manager Entry point to ChaosManager. */ - 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); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; + public static void + createUpdateATargetThatExtendsAVirtualMachineResource(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.targets() + .createOrUpdateWithResponse("exampleRG", "Microsoft-Agent", "Microsoft.Compute", "virtualMachines", + "exampleVM", null, com.azure.core.util.Context.NONE); } } 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..a487c69b675a9 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 @@ -10,7 +10,7 @@ public final class TargetsDeleteSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteTarget.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Targets_Delete.json */ /** * Sample code: Delete a Target that extends a virtual machine resource. @@ -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-Agent", "Microsoft.Compute", "virtualMachines", "exampleVM", + 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..c6bf2c199d8ce 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 @@ -10,7 +10,7 @@ public final class TargetsGetSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetTarget.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Targets_Get.json */ /** * Sample code: Get a Target that extends a virtual machine resource. @@ -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-Agent", "Microsoft.Compute", "virtualMachines", "exampleVM", + 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..3de44bf200236 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 @@ -10,7 +10,7 @@ public final class TargetsListSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListTargets.json + * specification/chaos/resource-manager/Microsoft.Chaos/stable/2025-01-01/examples/Targets_List.json */ /** * Sample code: List all Targets that extend a virtual machine resource. @@ -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 deleted file mode 100644 index 4eb87b1914c3f..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,58 +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.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); - })); - - 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", - 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 deleted file mode 100644 index 491256d61d688..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteWithResponseMockTests.java +++ /dev/null @@ -1,54 +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 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); - })); - - 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", - 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 deleted file mode 100644 index 331be18d2d1e6..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetWithResponseMockTests.java +++ /dev/null @@ -1,56 +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.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); - })); - - 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) - .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 deleted file mode 100644 index 0e452f076aa78..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListMockTests.java +++ /dev/null @@ -1,57 +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.http.rest.PagedIterable; -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.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); - })); - - 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", - com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityInnerTests.java deleted file mode 100644 index 70b8bc2b67fb9..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityInnerTests.java +++ /dev/null @@ -1,23 +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.CapabilityInner; - -public final class CapabilityInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CapabilityInner model = BinaryData.fromString( - "{\"properties\":{\"publisher\":\"mparcryuanzw\",\"targetType\":\"zdxtayrlhmwhf\",\"description\":\"rqobmtuk\",\"parametersSchema\":\"ryrtihfxtijbpzv\",\"urn\":\"wzsymglzufcy\"},\"id\":\"kohdbiha\",\"name\":\"ufhfcbjysa\",\"type\":\"ithxqhabifpi\"}") - .toObject(CapabilityInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CapabilityInner model = new CapabilityInner(); - model = BinaryData.fromObject(model).toObject(CapabilityInner.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityListResultTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityListResultTests.java deleted file mode 100644 index 67964f884b7e5..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityListResultTests.java +++ /dev/null @@ -1,23 +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.models.CapabilityListResult; - -public final class CapabilityListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CapabilityListResult model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"publisher\":\"vgjxpybczm\",\"targetType\":\"mtz\",\"description\":\"bsphrupidgsybbe\",\"parametersSchema\":\"ph\",\"urn\":\"cmsxaobhdxbm\"},\"id\":\"qioqjzehtbmu\",\"name\":\"p\",\"type\":\"wnoi\"},{\"properties\":{\"publisher\":\"rxybqsoq\",\"targetType\":\"gkdmb\",\"description\":\"zlobcufpd\",\"parametersSchema\":\"rbt\",\"urn\":\"qjnqglhqgnufoooj\"},\"id\":\"wifsq\",\"name\":\"saagdf\",\"type\":\"glzlhjxrifkwmrv\"},{\"properties\":{\"publisher\":\"zntocipaouajps\",\"targetType\":\"cmpoyfdkfogkny\",\"description\":\"ofjdde\",\"parametersSchema\":\"rd\",\"urn\":\"pewnw\"},\"id\":\"eitjz\",\"name\":\"flusarhmof\",\"type\":\"qhsmyurkdtml\"}],\"nextLink\":\"ekuksjtx\"}") - .toObject(CapabilityListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CapabilityListResult model = new CapabilityListResult(); - model = BinaryData.fromObject(model).toObject(CapabilityListResult.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityPropertiesTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityPropertiesTests.java deleted file mode 100644 index 0fcdc6236f37c..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityPropertiesTests.java +++ /dev/null @@ -1,23 +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.CapabilityProperties; - -public final class CapabilityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CapabilityProperties model = BinaryData.fromString( - "{\"publisher\":\"wczbys\",\"targetType\":\"pqxu\",\"description\":\"vyq\",\"parametersSchema\":\"wby\",\"urn\":\"k\"}") - .toObject(CapabilityProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CapabilityProperties model = new CapabilityProperties(); - model = BinaryData.fromObject(model).toObject(CapabilityProperties.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypeInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypeInnerTests.java deleted file mode 100644 index 86ef79b9b2544..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypeInnerTests.java +++ /dev/null @@ -1,26 +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.CapabilityTypeInner; -import org.junit.jupiter.api.Assertions; - -public final class CapabilityTypeInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CapabilityTypeInner model = BinaryData.fromString( - "{\"location\":\"huticndvkao\",\"properties\":{\"publisher\":\"i\",\"targetType\":\"yhxhu\",\"displayName\":\"k\",\"description\":\"yxolniwp\",\"parametersSchema\":\"ukjfkgiawxklr\",\"urn\":\"lwckbasyypnddhs\",\"kind\":\"bacphejko\",\"azureRbacActions\":[\"qgoulznd\",\"i\",\"wyqkgfgibm\"],\"azureRbacDataActions\":[\"akeqs\",\"xybz\"],\"runtimeProperties\":{\"kind\":\"dqytbciqfouflmm\"}},\"id\":\"kzsmodm\",\"name\":\"lougpbkw\",\"type\":\"mutduqktaps\"}") - .toObject(CapabilityTypeInner.class); - Assertions.assertEquals("huticndvkao", model.location()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CapabilityTypeInner model = new CapabilityTypeInner().withLocation("huticndvkao"); - model = BinaryData.fromObject(model).toObject(CapabilityTypeInner.class); - Assertions.assertEquals("huticndvkao", model.location()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypeListResultTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypeListResultTests.java deleted file mode 100644 index f217bc572f4c5..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypeListResultTests.java +++ /dev/null @@ -1,23 +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.models.CapabilityTypeListResult; - -public final class CapabilityTypeListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CapabilityTypeListResult model = BinaryData.fromString( - "{\"value\":[{\"location\":\"jgrtfwvukxga\",\"properties\":{\"publisher\":\"cs\",\"targetType\":\"s\",\"displayName\":\"nyejhkryhtnap\",\"description\":\"wlokjyem\",\"parametersSchema\":\"vnipjox\",\"urn\":\"nchgej\",\"kind\":\"odmailzyd\",\"azureRbacActions\":[\"jwyahuxinpmqnja\"],\"azureRbacDataActions\":[\"xj\",\"prozvcputegjvwmf\",\"atscmd\",\"pjhulsuuvmkj\"],\"runtimeProperties\":{\"kind\":\"rwfndiod\"}},\"id\":\"pslwejdpvw\",\"name\":\"yoqpsoaccta\",\"type\":\"akl\"},{\"location\":\"hbcryffdfdosyge\",\"properties\":{\"publisher\":\"ojakhmsbzjhcrze\",\"targetType\":\"phlxa\",\"displayName\":\"thqt\",\"description\":\"qjbpfzfsin\",\"parametersSchema\":\"v\",\"urn\":\"jrwzox\",\"kind\":\"tfell\",\"azureRbacActions\":[\"zitonpeqfpjkjl\",\"ofpdvh\"],\"azureRbacDataActions\":[\"xypininmayhuybbk\",\"odepoogin\",\"vamih\"],\"runtimeProperties\":{\"kind\":\"narxzxtheotus\"}},\"id\":\"vyevcciqi\",\"name\":\"nhungbw\",\"type\":\"zrnf\"},{\"location\":\"gispemvtzfkufubl\",\"properties\":{\"publisher\":\"xqeofjaeqjhqjba\",\"targetType\":\"msmjqulngsntn\",\"displayName\":\"bkzgcwrwclx\",\"description\":\"rljdouskcqv\",\"parametersSchema\":\"cr\",\"urn\":\"dkwt\",\"kind\":\"xbnjbiksq\",\"azureRbacActions\":[\"ssainqpjwnzll\",\"fmppe\"],\"azureRbacDataActions\":[\"mgxsab\",\"yqduujit\"],\"runtimeProperties\":{\"kind\":\"zdzevndh\"}},\"id\":\"rwpdappdsbdkvwrw\",\"name\":\"feusnhut\",\"type\":\"eltmrldhugjzzdat\"}],\"nextLink\":\"hocdgeab\"}") - .toObject(CapabilityTypeListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CapabilityTypeListResult model = new CapabilityTypeListResult(); - model = BinaryData.fromObject(model).toObject(CapabilityTypeListResult.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypePropertiesRuntimePropertiesTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypePropertiesRuntimePropertiesTests.java deleted file mode 100644 index 4d7aa0103811e..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypePropertiesRuntimePropertiesTests.java +++ /dev/null @@ -1,22 +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.models.CapabilityTypePropertiesRuntimeProperties; - -public final class CapabilityTypePropertiesRuntimePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CapabilityTypePropertiesRuntimeProperties model = BinaryData.fromString("{\"kind\":\"uhmuouqfprwzwbn\"}") - .toObject(CapabilityTypePropertiesRuntimeProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CapabilityTypePropertiesRuntimeProperties model = new CapabilityTypePropertiesRuntimeProperties(); - model = BinaryData.fromObject(model).toObject(CapabilityTypePropertiesRuntimeProperties.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypePropertiesTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypePropertiesTests.java deleted file mode 100644 index 5d7b16915c7b2..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypePropertiesTests.java +++ /dev/null @@ -1,33 +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.CapabilityTypeProperties; -import com.azure.resourcemanager.chaos.models.CapabilityTypePropertiesRuntimeProperties; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class CapabilityTypePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CapabilityTypeProperties model = BinaryData.fromString( - "{\"publisher\":\"gcue\",\"targetType\":\"umkdosvqwhbmd\",\"displayName\":\"bjf\",\"description\":\"gmbmbexppbh\",\"parametersSchema\":\"qrolfpf\",\"urn\":\"algbquxigjyjg\",\"kind\":\"aoyfhrtxilnerkuj\",\"azureRbacActions\":[\"l\",\"juvf\",\"awrlyx\"],\"azureRbacDataActions\":[\"cpr\",\"nwbxgjvtbvpyssz\"],\"runtimeProperties\":{\"kind\":\"uj\"}}") - .toObject(CapabilityTypeProperties.class); - Assertions.assertEquals("l", model.azureRbacActions().get(0)); - Assertions.assertEquals("cpr", model.azureRbacDataActions().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CapabilityTypeProperties model - = new CapabilityTypeProperties().withAzureRbacActions(Arrays.asList("l", "juvf", "awrlyx")) - .withAzureRbacDataActions(Arrays.asList("cpr", "nwbxgjvtbvpyssz")) - .withRuntimeProperties(new CapabilityTypePropertiesRuntimeProperties()); - model = BinaryData.fromObject(model).toObject(CapabilityTypeProperties.class); - Assertions.assertEquals("l", model.azureRbacActions().get(0)); - Assertions.assertEquals("cpr", model.azureRbacDataActions().get(0)); - } -} 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 deleted file mode 100644 index 2d3887aff8446..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetWithResponseMockTests.java +++ /dev/null @@ -1,58 +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.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); - })); - - 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) - .getValue(); - - Assertions.assertEquals("csnjvcdwxlpqekft", 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 deleted file mode 100644 index 97628a3ce5ba9..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListMockTests.java +++ /dev/null @@ -1,58 +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.http.rest.PagedIterable; -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.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); - })); - - 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); - - Assertions.assertEquals("sexso", response.iterator().next().location()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosExperimentActionTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosExperimentActionTests.java deleted file mode 100644 index b68fefea7b58d..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosExperimentActionTests.java +++ /dev/null @@ -1,26 +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.models.ChaosExperimentAction; -import org.junit.jupiter.api.Assertions; - -public final class ChaosExperimentActionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ChaosExperimentAction model - = BinaryData.fromString("{\"type\":\"ChaosExperimentAction\",\"name\":\"nrjawgqwg\"}") - .toObject(ChaosExperimentAction.class); - Assertions.assertEquals("nrjawgqwg", model.name()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ChaosExperimentAction model = new ChaosExperimentAction().withName("nrjawgqwg"); - model = BinaryData.fromObject(model).toObject(ChaosExperimentAction.class); - Assertions.assertEquals("nrjawgqwg", model.name()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosExperimentBranchTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosExperimentBranchTests.java deleted file mode 100644 index 5cfee040ba421..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosExperimentBranchTests.java +++ /dev/null @@ -1,33 +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.models.ChaosExperimentAction; -import com.azure.resourcemanager.chaos.models.ChaosExperimentBranch; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ChaosExperimentBranchTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ChaosExperimentBranch model = BinaryData.fromString( - "{\"name\":\"ovbvmeueciv\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"zceuojgjrw\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"ueiotwmcdyt\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"x\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"it\"}]}") - .toObject(ChaosExperimentBranch.class); - Assertions.assertEquals("ovbvmeueciv", model.name()); - Assertions.assertEquals("zceuojgjrw", model.actions().get(0).name()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ChaosExperimentBranch model = new ChaosExperimentBranch().withName("ovbvmeueciv") - .withActions(Arrays.asList(new ChaosExperimentAction().withName("zceuojgjrw"), - new ChaosExperimentAction().withName("ueiotwmcdyt"), new ChaosExperimentAction().withName("x"), - new ChaosExperimentAction().withName("it"))); - model = BinaryData.fromObject(model).toObject(ChaosExperimentBranch.class); - Assertions.assertEquals("ovbvmeueciv", model.name()); - Assertions.assertEquals("zceuojgjrw", model.actions().get(0).name()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosExperimentStepTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosExperimentStepTests.java deleted file mode 100644 index d90372a6000fb..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosExperimentStepTests.java +++ /dev/null @@ -1,37 +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.models.ChaosExperimentAction; -import com.azure.resourcemanager.chaos.models.ChaosExperimentBranch; -import com.azure.resourcemanager.chaos.models.ChaosExperimentStep; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ChaosExperimentStepTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ChaosExperimentStep model = BinaryData.fromString( - "{\"name\":\"bnbbeldawkz\",\"branches\":[{\"name\":\"liourqhak\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"hashsfwxosow\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"xcug\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"cjooxdjebwpucwwf\"}]}]}") - .toObject(ChaosExperimentStep.class); - Assertions.assertEquals("bnbbeldawkz", model.name()); - Assertions.assertEquals("liourqhak", model.branches().get(0).name()); - Assertions.assertEquals("hashsfwxosow", model.branches().get(0).actions().get(0).name()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ChaosExperimentStep model = new ChaosExperimentStep().withName("bnbbeldawkz") - .withBranches(Arrays.asList(new ChaosExperimentBranch().withName("liourqhak") - .withActions(Arrays.asList(new ChaosExperimentAction().withName("hashsfwxosow"), - new ChaosExperimentAction().withName("xcug"), - new ChaosExperimentAction().withName("cjooxdjebwpucwwf"))))); - model = BinaryData.fromObject(model).toObject(ChaosExperimentStep.class); - Assertions.assertEquals("bnbbeldawkz", model.name()); - Assertions.assertEquals("liourqhak", model.branches().get(0).name()); - Assertions.assertEquals("hashsfwxosow", model.branches().get(0).actions().get(0).name()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetFilterTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetFilterTests.java deleted file mode 100644 index 38099d620262d..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetFilterTests.java +++ /dev/null @@ -1,22 +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.models.ChaosTargetFilter; - -public final class ChaosTargetFilterTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ChaosTargetFilter model - = BinaryData.fromString("{\"type\":\"ChaosTargetFilter\"}").toObject(ChaosTargetFilter.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ChaosTargetFilter model = new ChaosTargetFilter(); - model = BinaryData.fromObject(model).toObject(ChaosTargetFilter.class); - } -} 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 deleted file mode 100644 index a94b56301b422..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetListSelectorTests.java +++ /dev/null @@ -1,40 +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.models.ChaosTargetFilter; -import com.azure.resourcemanager.chaos.models.ChaosTargetListSelector; -import com.azure.resourcemanager.chaos.models.TargetReference; -import com.azure.resourcemanager.chaos.models.TargetReferenceType; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -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\"}}") - .toObject(ChaosTargetListSelector.class); - Assertions.assertEquals("waezkojvd", model.id()); - Assertions.assertEquals(TargetReferenceType.CHAOS_TARGET, model.targets().get(0).type()); - Assertions.assertEquals("puqujmqlgkfbtn", 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"))); - model = BinaryData.fromObject(model).toObject(ChaosTargetListSelector.class); - Assertions.assertEquals("waezkojvd", model.id()); - Assertions.assertEquals(TargetReferenceType.CHAOS_TARGET, model.targets().get(0).type()); - Assertions.assertEquals("puqujmqlgkfbtn", 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 deleted file mode 100644 index 9d51d038d8605..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetQuerySelectorTests.java +++ /dev/null @@ -1,35 +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.models.ChaosTargetFilter; -import com.azure.resourcemanager.chaos.models.ChaosTargetQuerySelector; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -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\"}}") - .toObject(ChaosTargetQuerySelector.class); - Assertions.assertEquals("utwpfhp", model.id()); - Assertions.assertEquals("lmnguxaw", model.queryString()); - Assertions.assertEquals("ldsyuuximerqfob", model.subscriptionIds().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ChaosTargetQuerySelector model = new ChaosTargetQuerySelector().withId("utwpfhp") - .withFilter(new ChaosTargetFilter()) - .withQueryString("lmnguxaw") - .withSubscriptionIds(Arrays.asList("ldsyuuximerqfob", "yznkby")); - model = BinaryData.fromObject(model).toObject(ChaosTargetQuerySelector.class); - Assertions.assertEquals("utwpfhp", model.id()); - Assertions.assertEquals("lmnguxaw", model.queryString()); - Assertions.assertEquals("ldsyuuximerqfob", model.subscriptionIds().get(0)); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetSelectorTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetSelectorTests.java deleted file mode 100644 index ffe2ce68ee082..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetSelectorTests.java +++ /dev/null @@ -1,43 +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.models.ChaosTargetFilter; -import com.azure.resourcemanager.chaos.models.ChaosTargetSelector; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ChaosTargetSelectorTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ChaosTargetSelector model = BinaryData.fromString( - "{\"type\":\"ChaosTargetSelector\",\"id\":\"hniskxfbkpyc\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"auwhvylwzbtdhx\":\"datandnhj\",\"pow\":\"datajznb\"}}") - .toObject(ChaosTargetSelector.class); - Assertions.assertEquals("hniskxfbkpyc", model.id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ChaosTargetSelector model = new ChaosTargetSelector().withId("hniskxfbkpyc") - .withFilter(new ChaosTargetFilter()) - .withAdditionalProperties(mapOf("type", "ChaosTargetSelector")); - model = BinaryData.fromObject(model).toObject(ChaosTargetSelector.class); - Assertions.assertEquals("hniskxfbkpyc", model.id()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} 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 deleted file mode 100644 index 4b83faaefc242..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetSimpleFilterParametersTests.java +++ /dev/null @@ -1,28 +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.models.ChaosTargetSimpleFilterParameters; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ChaosTargetSimpleFilterParametersTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ChaosTargetSimpleFilterParameters model - = BinaryData.fromString("{\"zones\":[\"hhziuief\",\"zbhd\",\"smlmzqhoftrm\",\"equi\"]}") - .toObject(ChaosTargetSimpleFilterParameters.class); - Assertions.assertEquals("hhziuief", 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")); - model = BinaryData.fromObject(model).toObject(ChaosTargetSimpleFilterParameters.class); - Assertions.assertEquals("hhziuief", 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 deleted file mode 100644 index 2362ff719dd6a..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetSimpleFilterTests.java +++ /dev/null @@ -1,29 +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.models.ChaosTargetSimpleFilter; -import com.azure.resourcemanager.chaos.models.ChaosTargetSimpleFilterParameters; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -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\"]}}") - .toObject(ChaosTargetSimpleFilter.class); - Assertions.assertEquals("fgmjzrwrdgrt", 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"))); - model = BinaryData.fromObject(model).toObject(ChaosTargetSimpleFilter.class); - Assertions.assertEquals("fgmjzrwrdgrt", 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 deleted file mode 100644 index f2a274939e8af..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/DelayActionTests.java +++ /dev/null @@ -1,28 +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.models.DelayAction; -import java.time.Duration; -import org.junit.jupiter.api.Assertions; - -public final class DelayActionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DelayAction model = BinaryData.fromString("{\"type\":\"delay\",\"duration\":\"PT185H37M50S\",\"name\":\"l\"}") - .toObject(DelayAction.class); - Assertions.assertEquals("l", model.name()); - Assertions.assertEquals(Duration.parse("PT185H37M50S"), model.duration()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DelayAction model = new DelayAction().withName("l").withDuration(Duration.parse("PT185H37M50S")); - model = BinaryData.fromObject(model).toObject(DelayAction.class); - Assertions.assertEquals("l", model.name()); - Assertions.assertEquals(Duration.parse("PT185H37M50S"), model.duration()); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsInnerTests.java deleted file mode 100644 index 670c59416742e..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsInnerTests.java +++ /dev/null @@ -1,23 +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.ExperimentExecutionDetailsInner; - -public final class ExperimentExecutionDetailsInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentExecutionDetailsInner model = BinaryData.fromString( - "{\"type\":\"tfdygpfqb\",\"id\":\"ceopzfqrhhuaopp\",\"name\":\"qeqxo\",\"properties\":{\"failureReason\":\"ahzxctobgbk\",\"lastActionAt\":\"2021-03-02T22:54:24Z\",\"runInformation\":{\"steps\":[{\"stepName\":\"stmgrcfbunrmfqjh\",\"stepId\":\"xbpvjymjhx\",\"status\":\"yngudivk\",\"branches\":[{},{}]},{\"stepName\":\"bxqz\",\"stepId\":\"zjf\",\"status\":\"vjfdx\",\"branches\":[{},{}]},{\"stepName\":\"tvtc\",\"stepId\":\"qtdo\",\"status\":\"cbxvwvxyslqbh\",\"branches\":[{},{},{}]},{\"stepName\":\"blytk\",\"stepId\":\"mpew\",\"status\":\"fbkrvrnsvs\",\"branches\":[{},{}]}]},\"status\":\"hxcr\",\"startedAt\":\"2020-12-28T12:25:09Z\",\"stoppedAt\":\"2021-11-28T02:47:56Z\"}}") - .toObject(ExperimentExecutionDetailsInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentExecutionDetailsInner model = new ExperimentExecutionDetailsInner(); - model = BinaryData.fromObject(model).toObject(ExperimentExecutionDetailsInner.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsPropertiesRunInformationTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsPropertiesRunInformationTests.java deleted file mode 100644 index f87544138491b..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsPropertiesRunInformationTests.java +++ /dev/null @@ -1,24 +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.models.ExperimentExecutionDetailsPropertiesRunInformation; - -public final class ExperimentExecutionDetailsPropertiesRunInformationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentExecutionDetailsPropertiesRunInformation model = BinaryData.fromString( - "{\"steps\":[{\"stepName\":\"efuzmuvpbttd\",\"stepId\":\"orppxebmnzbtb\",\"status\":\"pglkf\",\"branches\":[{\"branchName\":\"neuelfphsdyhtoz\",\"branchId\":\"kd\",\"status\":\"wq\",\"actions\":[{}]},{\"branchName\":\"zx\",\"branchId\":\"vithh\",\"status\":\"o\",\"actions\":[{}]},{\"branchName\":\"gbhcohfwdsj\",\"branchId\":\"aljutiiswac\",\"status\":\"gdkz\",\"actions\":[{},{},{},{}]}]},{\"stepName\":\"fvhqc\",\"stepId\":\"ilvpnppfuflrwd\",\"status\":\"dlxyjrxs\",\"branches\":[{\"branchName\":\"cnihgwqapnedgfbc\",\"branchId\":\"cvqvpkeqdcv\",\"status\":\"hvoodsotbobzd\",\"actions\":[{},{}]},{\"branchName\":\"wvnhdldwmgx\",\"branchId\":\"rslpmutwuoeg\",\"status\":\"khjwn\",\"actions\":[{},{}]}]}]}") - .toObject(ExperimentExecutionDetailsPropertiesRunInformation.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentExecutionDetailsPropertiesRunInformation model - = new ExperimentExecutionDetailsPropertiesRunInformation(); - model = BinaryData.fromObject(model).toObject(ExperimentExecutionDetailsPropertiesRunInformation.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsPropertiesTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsPropertiesTests.java deleted file mode 100644 index a4e513fabb733..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsPropertiesTests.java +++ /dev/null @@ -1,23 +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.ExperimentExecutionDetailsProperties; - -public final class ExperimentExecutionDetailsPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentExecutionDetailsProperties model = BinaryData.fromString( - "{\"failureReason\":\"srruvwbhsqfsubcg\",\"lastActionAt\":\"2021-02-04T22:06:27Z\",\"runInformation\":{\"steps\":[{\"stepName\":\"ybsrfbjfdtwss\",\"stepId\":\"ftpvjzbexil\",\"status\":\"nfqqnvwp\",\"branches\":[{\"branchName\":\"ruoujmk\",\"branchId\":\"hwqytj\",\"status\":\"bnw\",\"actions\":[{},{},{},{}]},{\"branchName\":\"drjervnaenqpehin\",\"branchId\":\"ygmi\",\"status\":\"hnzdndslgnayqi\",\"actions\":[{},{},{},{}]},{\"branchName\":\"uhavhql\",\"branchId\":\"humaqolbgyc\",\"status\":\"iertgccymvaolp\",\"actions\":[{},{}]}]},{\"stepName\":\"lfmmdnbbglzpswi\",\"stepId\":\"mcwyhzdxssadb\",\"status\":\"nvdfznuda\",\"branches\":[{\"branchName\":\"zbn\",\"branchId\":\"lylpstdb\",\"status\":\"xsrz\",\"actions\":[{},{},{},{}]},{\"branchName\":\"erscdntne\",\"branchId\":\"iwjmygtdssls\",\"status\":\"mweriofzpy\",\"actions\":[{},{}]}]},{\"stepName\":\"wab\",\"stepId\":\"tshhszhedp\",\"status\":\"wiwubm\",\"branches\":[{\"branchName\":\"sldnkwwtppjflcxo\",\"branchId\":\"okonzmnsikvmkqz\",\"status\":\"qkdltfz\",\"actions\":[{}]},{\"branchName\":\"v\",\"branchId\":\"ur\",\"status\":\"dkwobdagx\",\"actions\":[{},{}]},{\"branchName\":\"dxbx\",\"branchId\":\"kbogqxndlkzgx\",\"status\":\"ripl\",\"actions\":[{},{}]},{\"branchName\":\"xunkbebxmubyynt\",\"branchId\":\"rbqtkoie\",\"status\":\"eotg\",\"actions\":[{}]}]}]},\"status\":\"tmuwlauwzi\",\"startedAt\":\"2021-01-24T11:46:23Z\",\"stoppedAt\":\"2021-03-14T00:48:06Z\"}") - .toObject(ExperimentExecutionDetailsProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentExecutionDetailsProperties model = new ExperimentExecutionDetailsProperties(); - model = BinaryData.fromObject(model).toObject(ExperimentExecutionDetailsProperties.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionInnerTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionInnerTests.java deleted file mode 100644 index bf0ce793e2861..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionInnerTests.java +++ /dev/null @@ -1,23 +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.ExperimentExecutionInner; - -public final class ExperimentExecutionInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentExecutionInner model = BinaryData.fromString( - "{\"type\":\"tpnapnyiropuhpig\",\"id\":\"gylgqgitxmedjvcs\",\"name\":\"n\",\"properties\":{\"status\":\"ncw\",\"startedAt\":\"2021-09-15T03:16:23Z\",\"stoppedAt\":\"2021-03-30T03:40:31Z\"}}") - .toObject(ExperimentExecutionInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentExecutionInner model = new ExperimentExecutionInner(); - model = BinaryData.fromObject(model).toObject(ExperimentExecutionInner.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionListResultTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionListResultTests.java deleted file mode 100644 index beee7877c53cf..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionListResultTests.java +++ /dev/null @@ -1,23 +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.models.ExperimentExecutionListResult; - -public final class ExperimentExecutionListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentExecutionListResult model = BinaryData.fromString( - "{\"value\":[{\"type\":\"nojvknmefqsg\",\"id\":\"ah\",\"name\":\"jyzhpvgq\",\"properties\":{\"status\":\"rvxdjzlmw\",\"startedAt\":\"2021-07-11T22:18:52Z\",\"stoppedAt\":\"2021-11-03T14:53:04Z\"}},{\"type\":\"hzovawjvzunlut\",\"id\":\"n\",\"name\":\"nxipeil\",\"properties\":{\"status\":\"uaejxdultsk\",\"startedAt\":\"2021-11-26T08:31:17Z\",\"stoppedAt\":\"2021-05-16T15:29:03Z\"}},{\"type\":\"umveekgpwozuhkf\",\"id\":\"sjyofdx\",\"name\":\"us\",\"properties\":{\"status\":\"ouwaboekqvkeln\",\"startedAt\":\"2021-02-02T03:25:54Z\",\"stoppedAt\":\"2020-12-28T23:28:21Z\"}},{\"type\":\"yjsflhhcaalnji\",\"id\":\"sxyawjoyaqcs\",\"name\":\"jpkiidzyexznelix\",\"properties\":{\"status\":\"ztfolhbnxk\",\"startedAt\":\"2021-03-24T05:03:40Z\",\"stoppedAt\":\"2021-09-05T19:55:42Z\"}}],\"nextLink\":\"ppg\"}") - .toObject(ExperimentExecutionListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentExecutionListResult model = new ExperimentExecutionListResult(); - model = BinaryData.fromObject(model).toObject(ExperimentExecutionListResult.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionPropertiesTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionPropertiesTests.java deleted file mode 100644 index 437ca93c39f9f..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionPropertiesTests.java +++ /dev/null @@ -1,23 +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.ExperimentExecutionProperties; - -public final class ExperimentExecutionPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentExecutionProperties model = BinaryData.fromString( - "{\"status\":\"trmgucnapkte\",\"startedAt\":\"2021-08-31T01:54:16Z\",\"stoppedAt\":\"2021-11-12T01:15:19Z\"}") - .toObject(ExperimentExecutionProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentExecutionProperties model = new ExperimentExecutionProperties(); - model = BinaryData.fromObject(model).toObject(ExperimentExecutionProperties.class); - } -} 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 deleted file mode 100644 index 4bd2125e44b09..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentInnerTests.java +++ /dev/null @@ -1,99 +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.ExperimentInner; -import com.azure.resourcemanager.chaos.models.ChaosExperimentAction; -import com.azure.resourcemanager.chaos.models.ChaosExperimentBranch; -import com.azure.resourcemanager.chaos.models.ChaosExperimentStep; -import com.azure.resourcemanager.chaos.models.ChaosTargetFilter; -import com.azure.resourcemanager.chaos.models.ChaosTargetSelector; -import com.azure.resourcemanager.chaos.models.ResourceIdentity; -import com.azure.resourcemanager.chaos.models.ResourceIdentityType; -import com.azure.resourcemanager.chaos.models.UserAssignedIdentity; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -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\"}") - .toObject(ExperimentInner.class); - Assertions.assertEquals("axdbabph", model.location()); - Assertions.assertEquals("qlfktsths", model.tags().get("cocmnyyaztt")); - Assertions.assertEquals(ResourceIdentityType.USER_ASSIGNED, model.identity().type()); - Assertions.assertEquals("mryw", model.steps().get(0).name()); - Assertions.assertEquals("zoqftiyqzrnkcqvy", model.steps().get(0).branches().get(0).name()); - Assertions.assertEquals("whzlsicohoq", model.steps().get(0).branches().get(0).actions().get(0).name()); - Assertions.assertEquals("xnehmpvec", model.selectors().get(0).id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentInner model = new ExperimentInner().withLocation("axdbabph") - .withTags(mapOf("cocmnyyaztt", "qlfktsths", "edckzywbiexzfey", "twwrqp", "ujwb", "eaxib", "zjancuxr", - "qwalmuzyoxaepd")) - .withIdentity(new ResourceIdentity().withType(ResourceIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities(mapOf("hagalpbuxwgipwh", new UserAssignedIdentity()))) - .withSteps(Arrays.asList( - new ChaosExperimentStep().withName("mryw") - .withBranches(Arrays - .asList(new ChaosExperimentBranch().withName("zoqftiyqzrnkcqvy") - .withActions(Arrays.asList(new ChaosExperimentAction().withName("whzlsicohoq"))), - new ChaosExperimentBranch().withName("nwvlryavwhheunmm") - .withActions(Arrays.asList(new ChaosExperimentAction().withName("gyxzk"), - new ChaosExperimentAction().withName("noc"), - new ChaosExperimentAction().withName("koklya"))))), - new ChaosExperimentStep().withName("uconuqszfkbey") - .withBranches(Arrays.asList( - new ChaosExperimentBranch().withName("wrmjmwvvjektc") - .withActions(Arrays.asList(new ChaosExperimentAction().withName("enhwlrs"), - new ChaosExperimentAction().withName("frzpwvlqdqgb"))), - new ChaosExperimentBranch().withName("qylihkaetckt") - .withActions(Arrays.asList(new ChaosExperimentAction().withName("civfsnkymuctq"), - new ChaosExperimentAction().withName("jf"), - new ChaosExperimentAction().withName("ebrjcxe"))), - new ChaosExperimentBranch().withName("fuwutttxf") - .withActions(Arrays.asList(new ChaosExperimentAction().withName("rbirphxe"), - new ChaosExperimentAction().withName("c"), - new ChaosExperimentAction().withName("vahfn"), - new ChaosExperimentAction().withName("jky"))), - new ChaosExperimentBranch().withName("xjvuujqgidokg") - .withActions(Arrays.asList(new ChaosExperimentAction().withName("jyoxgvclt"), - new ChaosExperimentAction().withName("gsncghkjeszz"), - new ChaosExperimentAction().withName("bijhtxfvgxbf"))))))) - .withSelectors(Arrays.asList( - new ChaosTargetSelector().withId("xnehmpvec") - .withFilter(new ChaosTargetFilter()) - .withAdditionalProperties(mapOf("type", "ChaosTargetSelector")), - new ChaosTargetSelector().withId("buynhijggm") - .withFilter(new ChaosTargetFilter()) - .withAdditionalProperties(mapOf("type", "ChaosTargetSelector")))); - model = BinaryData.fromObject(model).toObject(ExperimentInner.class); - Assertions.assertEquals("axdbabph", model.location()); - Assertions.assertEquals("qlfktsths", model.tags().get("cocmnyyaztt")); - Assertions.assertEquals(ResourceIdentityType.USER_ASSIGNED, model.identity().type()); - Assertions.assertEquals("mryw", model.steps().get(0).name()); - Assertions.assertEquals("zoqftiyqzrnkcqvy", model.steps().get(0).branches().get(0).name()); - Assertions.assertEquals("whzlsicohoq", model.steps().get(0).branches().get(0).actions().get(0).name()); - Assertions.assertEquals("xnehmpvec", model.selectors().get(0).id()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} 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 deleted file mode 100644 index 0b4a18d4d4ec0..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentListResultTests.java +++ /dev/null @@ -1,23 +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.models.ExperimentListResult; - -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\"}") - .toObject(ExperimentListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentListResult model = new ExperimentListResult(); - model = BinaryData.fromObject(model).toObject(ExperimentListResult.class); - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentPropertiesTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentPropertiesTests.java deleted file mode 100644 index 4fcccf3fdd4e8..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentPropertiesTests.java +++ /dev/null @@ -1,91 +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.ExperimentProperties; -import com.azure.resourcemanager.chaos.models.ChaosExperimentAction; -import com.azure.resourcemanager.chaos.models.ChaosExperimentBranch; -import com.azure.resourcemanager.chaos.models.ChaosExperimentStep; -import com.azure.resourcemanager.chaos.models.ChaosTargetFilter; -import com.azure.resourcemanager.chaos.models.ChaosTargetSelector; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ExperimentPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExperimentProperties model = BinaryData.fromString( - "{\"provisioningState\":\"Creating\",\"steps\":[{\"name\":\"mg\",\"branches\":[{\"name\":\"nkjzkdeslpvlop\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"yighxpk\"}]},{\"name\":\"wzbaiue\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"a\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"m\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"yqupedeojnabckh\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"mtxpsiebtfh\"}]},{\"name\":\"pesapskrdqmhjj\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"tldwkyzxuutk\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"cwscwsvlx\"}]}]},{\"name\":\"togt\",\"branches\":[{\"name\":\"upqsx\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"micykvceoveilo\"}]},{\"name\":\"notyfjfcnjbkcn\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"hbttkphyw\"}]},{\"name\":\"nv\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"oqnermclfpl\"}]}]},{\"name\":\"hoxus\",\"branches\":[{\"name\":\"pabgyeps\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"tazqugxywpmueefj\"}]},{\"name\":\"wfqkquj\",\"actions\":[{\"type\":\"ChaosExperimentAction\",\"name\":\"suyonobglaocq\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"tcc\"},{\"type\":\"ChaosExperimentAction\",\"name\":\"g\"}]}]}],\"selectors\":[{\"type\":\"ChaosTargetSelector\",\"id\":\"dxyt\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"fudwpznt\":\"datarxv\",\"hckfrlhrx\":\"datahdzhlrqj\",\"ca\":\"databkyvp\",\"b\":\"datauzbpzkafku\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"rnwb\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"srtslhspkdeem\":\"dataseyvj\",\"ahvljuaha\":\"dataofmxagkvtmelmqkr\"}},{\"type\":\"ChaosTargetSelector\",\"id\":\"uhcdhm\",\"filter\":{\"type\":\"ChaosTargetFilter\"},\"\":{\"pvfadmwsrcr\":\"dataaex\",\"fmisg\":\"datavxpvgomz\"}}]}") - .toObject(ExperimentProperties.class); - Assertions.assertEquals("mg", model.steps().get(0).name()); - Assertions.assertEquals("nkjzkdeslpvlop", model.steps().get(0).branches().get(0).name()); - Assertions.assertEquals("yighxpk", model.steps().get(0).branches().get(0).actions().get(0).name()); - Assertions.assertEquals("dxyt", model.selectors().get(0).id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentProperties model = new ExperimentProperties() - .withSteps(Arrays.asList( - new ChaosExperimentStep().withName("mg") - .withBranches(Arrays.asList( - new ChaosExperimentBranch().withName("nkjzkdeslpvlop") - .withActions(Arrays.asList(new ChaosExperimentAction().withName("yighxpk"))), - new ChaosExperimentBranch().withName("wzbaiue") - .withActions(Arrays.asList(new ChaosExperimentAction().withName("a"), - new ChaosExperimentAction().withName("m"), - new ChaosExperimentAction().withName("yqupedeojnabckh"), - new ChaosExperimentAction().withName("mtxpsiebtfh"))), - new ChaosExperimentBranch().withName("pesapskrdqmhjj") - .withActions(Arrays.asList(new ChaosExperimentAction().withName("tldwkyzxuutk"), - new ChaosExperimentAction().withName("cwscwsvlx"))))), - new ChaosExperimentStep().withName("togt") - .withBranches(Arrays.asList( - new ChaosExperimentBranch().withName("upqsx") - .withActions(Arrays.asList(new ChaosExperimentAction().withName("micykvceoveilo"))), - new ChaosExperimentBranch().withName("notyfjfcnjbkcn") - .withActions(Arrays.asList(new ChaosExperimentAction().withName("hbttkphyw"))), - new ChaosExperimentBranch().withName("nv") - .withActions(Arrays.asList(new ChaosExperimentAction().withName("oqnermclfpl"))))), - new ChaosExperimentStep().withName("hoxus") - .withBranches(Arrays.asList(new ChaosExperimentBranch() - .withName("pabgyeps") - .withActions(Arrays.asList(new ChaosExperimentAction().withName("tazqugxywpmueefj"))), - new ChaosExperimentBranch().withName("wfqkquj") - .withActions(Arrays.asList(new ChaosExperimentAction().withName("suyonobglaocq"), - new ChaosExperimentAction().withName("tcc"), - new ChaosExperimentAction().withName("g"))))))) - .withSelectors(Arrays.asList( - new ChaosTargetSelector().withId("dxyt") - .withFilter(new ChaosTargetFilter()) - .withAdditionalProperties(mapOf("type", "ChaosTargetSelector")), - new ChaosTargetSelector().withId("rnwb") - .withFilter(new ChaosTargetFilter()) - .withAdditionalProperties(mapOf("type", "ChaosTargetSelector")), - new ChaosTargetSelector().withId("uhcdhm") - .withFilter(new ChaosTargetFilter()) - .withAdditionalProperties(mapOf("type", "ChaosTargetSelector")))); - model = BinaryData.fromObject(model).toObject(ExperimentProperties.class); - Assertions.assertEquals("mg", model.steps().get(0).name()); - Assertions.assertEquals("nkjzkdeslpvlop", model.steps().get(0).branches().get(0).name()); - Assertions.assertEquals("yighxpk", model.steps().get(0).branches().get(0).actions().get(0).name()); - Assertions.assertEquals("dxyt", model.selectors().get(0).id()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} 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 deleted file mode 100644 index 0308f43cc71fb..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentUpdateTests.java +++ /dev/null @@ -1,50 +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.models.ExperimentUpdate; -import com.azure.resourcemanager.chaos.models.ResourceIdentity; -import com.azure.resourcemanager.chaos.models.ResourceIdentityType; -import com.azure.resourcemanager.chaos.models.UserAssignedIdentity; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -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\"}}") - .toObject(ExperimentUpdate.class); - Assertions.assertEquals(ResourceIdentityType.NONE, model.identity().type()); - Assertions.assertEquals("mxiebw", model.tags().get("aloayqcgwrtzju")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExperimentUpdate model = new ExperimentUpdate().withIdentity(new ResourceIdentity() - .withType(ResourceIdentityType.NONE) - .withUserAssignedIdentities(mapOf("veual", new UserAssignedIdentity(), "mkh", new UserAssignedIdentity(), - "bbcswsrtjri", new UserAssignedIdentity(), "bpbewtghfgb", new UserAssignedIdentity()))) - .withTags(mapOf("aloayqcgwrtzju", "mxiebw", "txon", "gwyzm", "rknftguvriuhprwm", "mtsavjcbpwxqp", "bexrmcq", - "yvxqtayriwwroy")); - model = BinaryData.fromObject(model).toObject(ExperimentUpdate.class); - Assertions.assertEquals(ResourceIdentityType.NONE, model.identity().type()); - Assertions.assertEquals("mxiebw", model.tags().get("aloayqcgwrtzju")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} 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 deleted file mode 100644 index d5c7e89be9288..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateMockTests.java +++ /dev/null @@ -1,106 +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.ChaosExperimentBranch; -import com.azure.resourcemanager.chaos.models.ChaosExperimentStep; -import com.azure.resourcemanager.chaos.models.ChaosTargetFilter; -import com.azure.resourcemanager.chaos.models.ChaosTargetSelector; -import com.azure.resourcemanager.chaos.models.Experiment; -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; -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 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); - })); - - ChaosManager manager = ChaosManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Experiment response - = manager.experiments() - .define("yjkqabqgzslesjcb") - .withRegion("axconfozauo") - .withExistingResourceGroup("aryeu") - .withSteps(Arrays.asList(new ChaosExperimentStep().withName("ebjvewzcjzn") - .withBranches(Arrays.asList( - new ChaosExperimentBranch().withName("cpmguaadraufact").withActions(Arrays.asList()), - new ChaosExperimentBranch().withName("ahzovajjziuxxp").withActions(Arrays.asList()), - new ChaosExperimentBranch().withName("hneekul").withActions(Arrays.asList()), - new ChaosExperimentBranch().withName("gs").withActions(Arrays.asList()))))) - .withSelectors(Arrays.asList( - new ChaosTargetSelector().withId("ubkwdle") - .withFilter(new ChaosTargetFilter()) - .withAdditionalProperties(mapOf("type", "ChaosTargetSelector")), - new ChaosTargetSelector().withId("ygdxpgpqchis") - .withFilter(new ChaosTargetFilter()) - .withAdditionalProperties(mapOf("type", "ChaosTargetSelector")))) - .withTags(mapOf("epzl", "kokwbqplhlvnu", "vmnnrw", "phwzsoldweyuqdu", "wjhhgdnhxmsivf", "biorktal", - "zaofjchvcyy", "miloxggdufiqndie")) - .withIdentity(new ResourceIdentity().withType(ResourceIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities( - mapOf("w", new UserAssignedIdentity(), "vbquwr", new UserAssignedIdentity()))) - .create(); - - Assertions.assertEquals("yiopi", response.location()); - Assertions.assertEquals("qfkuvscxkdmli", response.tags().get("ovibrxkp")); - Assertions.assertEquals(ResourceIdentityType.USER_ASSIGNED, response.identity().type()); - Assertions.assertEquals("scjfnyns", response.steps().get(0).name()); - Assertions.assertEquals("ujiz", response.steps().get(0).branches().get(0).name()); - Assertions.assertEquals("owzfttsttkt", response.selectors().get(0).id()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} 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 deleted file mode 100644 index 747ce26c01907..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsExecutionDetailsWithResponseMockTests.java +++ /dev/null @@ -1,56 +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.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); - })); - - ChaosManager manager = ChaosManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ExperimentExecutionDetails response = manager.experiments() - .executionDetailsWithResponse("stgktst", "dxeclzedqbcvh", "lhpl", com.azure.core.util.Context.NONE) - .getValue(); - - } -} 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 deleted file mode 100644 index aa15ea8819576..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupWithResponseMockTests.java +++ /dev/null @@ -1,64 +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.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); - })); - - ChaosManager manager = ChaosManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Experiment response = manager.experiments() - .getByResourceGroupWithResponse("z", "ybycnunvj", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("aeqphchqnr", response.location()); - Assertions.assertEquals("x", response.tags().get("huwrykqgaifm")); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, response.identity().type()); - Assertions.assertEquals("jzhpjbibgjmfx", response.steps().get(0).name()); - Assertions.assertEquals("vfcluyovwxnbkfe", response.steps().get(0).branches().get(0).name()); - Assertions.assertEquals("czuhxacpqjlihh", response.selectors().get(0).id()); - } -} 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 deleted file mode 100644 index bf0cec19c3074..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionWithResponseMockTests.java +++ /dev/null @@ -1,56 +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.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); - })); - - ChaosManager manager = ChaosManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ExperimentExecution response = manager.experiments() - .getExecutionWithResponse("zqljyxgtczh", "ydbsd", "hmkxmaehvbb", com.azure.core.util.Context.NONE) - .getValue(); - - } -} 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 deleted file mode 100644 index b0e9614123c46..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllExecutionsMockTests.java +++ /dev/null @@ -1,56 +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.http.rest.PagedIterable; -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.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); - })); - - 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().listAllExecutions("ceamtm", "zuo", com.azure.core.util.Context.NONE); - - } -} 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 deleted file mode 100644 index dd7f2ad471922..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupMockTests.java +++ /dev/null @@ -1,64 +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.http.rest.PagedIterable; -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.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); - })); - - 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().listByResourceGroup("ixqtn", false, "tezlwff", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("zq", response.iterator().next().location()); - Assertions.assertEquals("f", response.iterator().next().tags().get("wesgogczh")); - Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, response.iterator().next().identity().type()); - Assertions.assertEquals("totxhojujb", response.iterator().next().steps().get(0).name()); - Assertions.assertEquals("elmcuvhixbjxyfw", response.iterator().next().steps().get(0).branches().get(0).name()); - Assertions.assertEquals("wjchrdg", response.iterator().next().selectors().get(0).id()); - } -} 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 deleted file mode 100644 index db36dc7afeaa9..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListMockTests.java +++ /dev/null @@ -1,64 +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.http.rest.PagedIterable; -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.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); - })); - - 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); - - 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("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 deleted file mode 100644 index 75d0dc13da38c..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationDisplayTests.java +++ /dev/null @@ -1,24 +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.models.OperationDisplay; - -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\"}") - .toObject(OperationDisplay.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationDisplay model = new OperationDisplay(); - model = BinaryData.fromObject(model).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 deleted file mode 100644 index 266bd595cc873..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationInnerTests.java +++ /dev/null @@ -1,24 +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.OperationInner; -import com.azure.resourcemanager.chaos.models.OperationDisplay; - -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\"}") - .toObject(OperationInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationInner model = new OperationInner().withDisplay(new OperationDisplay()); - model = BinaryData.fromObject(model).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 deleted file mode 100644 index 11837150b953f..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationListResultTests.java +++ /dev/null @@ -1,23 +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.models.OperationListResult; - -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\"}") - .toObject(OperationListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationListResult model = new OperationListResult(); - model = BinaryData.fromObject(model).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 deleted file mode 100644 index 9a55512823f94..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ResourceIdentityTests.java +++ /dev/null @@ -1,44 +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.models.ResourceIdentity; -import com.azure.resourcemanager.chaos.models.ResourceIdentityType; -import com.azure.resourcemanager.chaos.models.UserAssignedIdentity; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -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\"}") - .toObject(ResourceIdentity.class); - Assertions.assertEquals(ResourceIdentityType.USER_ASSIGNED, model.type()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceIdentity model = new ResourceIdentity().withType(ResourceIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities(mapOf("zabglcuhxwt", new UserAssignedIdentity(), "qik", - new UserAssignedIdentity(), "ovplw", new UserAssignedIdentity())); - model = BinaryData.fromObject(model).toObject(ResourceIdentity.class); - Assertions.assertEquals(ResourceIdentityType.USER_ASSIGNED, model.type()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/StepStatusTests.java b/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/StepStatusTests.java deleted file mode 100644 index 1b9539c392814..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/StepStatusTests.java +++ /dev/null @@ -1,23 +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.models.StepStatus; - -public final class StepStatusTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - StepStatus model = BinaryData.fromString( - "{\"stepName\":\"luicpdggkzzlvmbm\",\"stepId\":\"xmodf\",\"status\":\"efyw\",\"branches\":[{\"branchName\":\"vmwy\",\"branchId\":\"fouyf\",\"status\":\"akcp\",\"actions\":[{\"actionName\":\"vqtmnub\",\"actionId\":\"kpzksmondjmq\",\"status\":\"vypomgkopkwho\",\"startTime\":\"2021-08-09T17:57:45Z\",\"endTime\":\"2021-12-07T09:07:14Z\",\"targets\":[{},{},{},{}]},{\"actionName\":\"ysmocmbqfqvmkcxo\",\"actionId\":\"pvhelxprg\",\"status\":\"atddc\",\"startTime\":\"2021-09-13T16:27:08Z\",\"endTime\":\"2021-12-04T18:39:42Z\",\"targets\":[{},{},{},{}]}]},{\"branchName\":\"jxgciqibrh\",\"branchId\":\"xsdqrhzoymibmrqy\",\"status\":\"ahwfluszdtmhrk\",\"actions\":[{\"actionName\":\"yvoqa\",\"actionId\":\"iexpbtgiwbwo\",\"status\":\"washr\",\"startTime\":\"2021-08-01T13:56:15Z\",\"endTime\":\"2021-10-17T07:53:24Z\",\"targets\":[{},{},{}]},{\"actionName\":\"wbpokulpiujwaasi\",\"actionId\":\"i\",\"status\":\"byuqerpqlp\",\"startTime\":\"2021-10-05T15:21:02Z\",\"endTime\":\"2020-12-29T00:03:32Z\",\"targets\":[{},{}]}]},{\"branchName\":\"bdbutauvf\",\"branchId\":\"kuwhh\",\"status\":\"ykojoxafnndlpic\",\"actions\":[{\"actionName\":\"mkcdyhbpkkpwdre\",\"actionId\":\"ovvqfovljxywsu\",\"status\":\"yrs\",\"startTime\":\"2021-03-16T15:34:55Z\",\"endTime\":\"2021-05-20T04:26:58Z\",\"targets\":[{},{},{}]}]}]}") - .toObject(StepStatus.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - StepStatus model = new StepStatus(); - model = BinaryData.fromObject(model).toObject(StepStatus.class); - } -} 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 deleted file mode 100644 index 5b2a5d7669efa..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetInnerTests.java +++ /dev/null @@ -1,41 +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.TargetInner; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -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\"}") - .toObject(TargetInner.class); - Assertions.assertEquals("knnqvsaznq", model.location()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TargetInner model - = new TargetInner().withLocation("knnqvsaznq").withProperties(mapOf("mkycgra", "dataorudsgsa")); - model = BinaryData.fromObject(model).toObject(TargetInner.class); - Assertions.assertEquals("knnqvsaznq", model.location()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} 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 deleted file mode 100644 index 503cdf7830640..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetListResultTests.java +++ /dev/null @@ -1,23 +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.models.TargetListResult; - -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\"}") - .toObject(TargetListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TargetListResult model = new TargetListResult(); - model = BinaryData.fromObject(model).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 deleted file mode 100644 index d233e4c6b5094..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetReferenceTests.java +++ /dev/null @@ -1,28 +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.models.TargetReference; -import com.azure.resourcemanager.chaos.models.TargetReferenceType; -import org.junit.jupiter.api.Assertions; - -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); - Assertions.assertEquals(TargetReferenceType.CHAOS_TARGET, model.type()); - Assertions.assertEquals("gsfraoyzkoow", model.id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TargetReference model = new TargetReference().withType(TargetReferenceType.CHAOS_TARGET).withId("gsfraoyzkoow"); - model = BinaryData.fromObject(model).toObject(TargetReference.class); - Assertions.assertEquals(TargetReferenceType.CHAOS_TARGET, model.type()); - Assertions.assertEquals("gsfraoyzkoow", 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 deleted file mode 100644 index 585b05d7d3758..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeInnerTests.java +++ /dev/null @@ -1,26 +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.TargetTypeInner; -import org.junit.jupiter.api.Assertions; - -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\"}") - .toObject(TargetTypeInner.class); - Assertions.assertEquals("fimrzrtuzqogse", model.location()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TargetTypeInner model = new TargetTypeInner().withLocation("fimrzrtuzqogse"); - model = BinaryData.fromObject(model).toObject(TargetTypeInner.class); - Assertions.assertEquals("fimrzrtuzqogse", 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 deleted file mode 100644 index dc526578822a7..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeListResultTests.java +++ /dev/null @@ -1,23 +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.models.TargetTypeListResult; - -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\"}") - .toObject(TargetTypeListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TargetTypeListResult model = new TargetTypeListResult(); - model = BinaryData.fromObject(model).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 deleted file mode 100644 index 7b5100b2d9329..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypePropertiesTests.java +++ /dev/null @@ -1,23 +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.TargetTypeProperties; - -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\"]}") - .toObject(TargetTypeProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TargetTypeProperties model = new TargetTypeProperties(); - model = BinaryData.fromObject(model).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 deleted file mode 100644 index d112af34f7cb5..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetWithResponseMockTests.java +++ /dev/null @@ -1,58 +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.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); - })); - - 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) - .getValue(); - - Assertions.assertEquals("ddrihpf", 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 deleted file mode 100644 index 43bef962fa2c1..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesListMockTests.java +++ /dev/null @@ -1,58 +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.http.rest.PagedIterable; -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.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); - })); - - 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); - - Assertions.assertEquals("aiy", 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 deleted file mode 100644 index 8c32a74fc391c..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,76 +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.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); - })); - - 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")), - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("ocxvdfffwafqr", response.location()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} 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 deleted file mode 100644 index a870ee4717107..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteWithResponseMockTests.java +++ /dev/null @@ -1,54 +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 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); - })); - - 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", - 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 deleted file mode 100644 index 6a1eb6a6e8bed..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsGetWithResponseMockTests.java +++ /dev/null @@ -1,59 +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.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); - })); - - 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", - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("mldgxobfirc", 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 deleted file mode 100644 index 08af6d3894aa1..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsListMockTests.java +++ /dev/null @@ -1,58 +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.http.rest.PagedIterable; -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.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); - })); - - 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); - - Assertions.assertEquals("ambtrnegvm", 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 deleted file mode 100644 index b1fe4b0049d73..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/UserAssignedIdentityTests.java +++ /dev/null @@ -1,23 +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.models.UserAssignedIdentity; - -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\"}") - .toObject(UserAssignedIdentity.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UserAssignedIdentity model = new UserAssignedIdentity(); - model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); - } -}