From 707dbadccffa7319674c9483edf2faacf6b2ba37 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 6 Dec 2024 01:00:34 +0000 Subject: [PATCH] CodeGen from PR 31789 in Azure/azure-rest-api-specs Merge cdcb1df2b472095df7f565edf9c48f9958c279a4 into 2bde125befabb21807a2021765901f20e3e74ec8 --- .../azure-resourcemanager-chaos/CHANGELOG.md | 177 +++++++++++- .../azure-resourcemanager-chaos/README.md | 28 +- .../azure-resourcemanager-chaos/SAMPLE.md | 165 ++++++----- sdk/chaos/azure-resourcemanager-chaos/pom.xml | 4 +- .../resourcemanager/chaos/ChaosManager.java | 48 ++-- .../chaos/fluent/ChaosManagementClient.java | 20 +- .../chaos/fluent/models/CapabilityInner.java | 96 ++++++- .../fluent/models/CapabilityProperties.java | 56 +++- .../fluent/models/CapabilityTypeInner.java | 100 ++++++- .../models/CapabilityTypeProperties.java | 79 ++++- .../ExperimentExecutionDetailsInner.java | 55 +++- .../ExperimentExecutionDetailsProperties.java | 105 ++++++- .../models/ExperimentExecutionInner.java | 55 +++- .../models/ExperimentExecutionProperties.java | 87 +++++- .../chaos/fluent/models/ExperimentInner.java | 125 +++++++- .../fluent/models/ExperimentProperties.java | 80 ++++-- .../chaos/fluent/models/OperationInner.java | 57 +++- .../fluent/models/OperationStatusInner.java | 97 ++++--- .../chaos/fluent/models/TargetInner.java | 108 ++++++- .../chaos/fluent/models/TargetTypeInner.java | 106 ++++++- .../fluent/models/TargetTypeProperties.java | 54 +++- .../CapabilitiesClientImpl.java | 8 +- .../CapabilityTypesClientImpl.java | 8 +- .../ChaosManagementClientImpl.java | 49 ++-- .../chaos/implementation/ExperimentImpl.java | 16 +- .../implementation/ExperimentsClientImpl.java | 24 +- .../implementation/OperationStatusImpl.java | 5 +- .../implementation/OperationsClientImpl.java | 8 +- .../implementation/ResourceManagerUtils.java | 2 - .../implementation/TargetTypesClientImpl.java | 8 +- .../implementation/TargetsClientImpl.java | 8 +- .../resourcemanager/chaos/models/Action.java | 146 ++++++++++ .../chaos/models/ActionStatus.java | 64 ++++- .../chaos/models/ActionType.java | 2 - .../resourcemanager/chaos/models/Branch.java | 136 +++++++++ .../chaos/models/BranchStatus.java | 54 +++- .../chaos/models/CapabilityListResult.java | 48 +++- .../models/CapabilityTypeListResult.java | 49 +++- ...bilityTypePropertiesRuntimeProperties.java | 46 ++- .../chaos/models/ChaosExperimentAction.java | 74 ----- .../chaos/models/ChaosExperimentBranch.java | 94 ------ .../chaos/models/ChaosExperimentStep.java | 94 ------ .../chaos/models/ChaosTargetFilter.java | 37 --- .../chaos/models/ChaosTargetListSelector.java | 88 ------ .../models/ChaosTargetQuerySelector.java | 116 -------- .../chaos/models/ChaosTargetSelector.java | 142 --------- .../chaos/models/ChaosTargetSimpleFilter.java | 63 ---- .../ChaosTargetSimpleFilterParameters.java | 55 ---- .../chaos/models/ContinuousAction.java | 98 +++++-- .../chaos/models/DelayAction.java | 81 +++++- .../chaos/models/DiscreteAction.java | 88 +++++- .../chaos/models/Experiment.java | 8 +- ...mentExecutionActionTargetDetailsError.java | 49 +++- ...xecutionActionTargetDetailsProperties.java | 62 +++- ...cutionDetailsPropertiesRunInformation.java | 48 +++- .../models/ExperimentExecutionListResult.java | 50 +++- .../chaos/models/ExperimentListResult.java | 48 +++- .../chaos/models/ExperimentUpdate.java | 52 +++- .../resourcemanager/chaos/models/Filter.java | 107 +++++++ .../chaos/models/FilterType.java | 2 - .../chaos/models/KeyValuePair.java | 58 +++- .../chaos/models/ListSelector.java | 167 +++++++++++ .../chaos/models/OperationDisplay.java | 65 ++++- .../chaos/models/OperationListResult.java | 52 +++- .../chaos/models/OperationStatus.java | 5 +- .../resourcemanager/chaos/models/Origin.java | 2 - .../chaos/models/ProvisioningState.java | 2 - .../chaos/models/QuerySelector.java | 198 +++++++++++++ .../chaos/models/ResourceIdentity.java | 65 ++++- .../chaos/models/ResourceIdentityType.java | 5 - .../chaos/models/Selector.java | 213 ++++++++++++++ .../chaos/models/SelectorType.java | 2 - .../chaos/models/SimpleFilter.java | 114 ++++++++ .../chaos/models/SimpleFilterParameters.java | 95 ++++++ .../resourcemanager/chaos/models/Step.java | 136 +++++++++ .../chaos/models/StepStatus.java | 54 +++- .../chaos/models/TargetListResult.java | 48 +++- .../chaos/models/TargetReference.java | 58 +++- .../chaos/models/TargetReferenceType.java | 2 - .../chaos/models/TargetTypeListResult.java | 48 +++- .../chaos/models/UserAssignedIdentity.java | 49 +++- .../src/main/java/module-info.java | 4 +- .../proxy-config.json | 2 +- .../reflect-config.json | 272 +----------------- .../CapabilitiesCreateOrUpdateSamples.java | 9 +- .../generated/CapabilitiesDeleteSamples.java | 7 +- .../generated/CapabilitiesGetSamples.java | 7 +- .../generated/CapabilitiesListSamples.java | 7 +- .../generated/CapabilityTypesGetSamples.java | 6 +- .../generated/CapabilityTypesListSamples.java | 2 +- .../generated/ExperimentsCancelSamples.java | 2 +- .../ExperimentsCreateOrUpdateSamples.java | 27 +- .../generated/ExperimentsDeleteSamples.java | 2 +- .../ExperimentsExecutionDetailsSamples.java | 7 +- .../ExperimentsGetByResourceGroupSamples.java | 6 +- .../ExperimentsGetExecutionSamples.java | 8 +- .../ExperimentsListAllExecutionsSamples.java | 3 +- ...ExperimentsListByResourceGroupSamples.java | 5 +- .../generated/ExperimentsListSamples.java | 5 +- .../generated/ExperimentsStartSamples.java | 2 +- .../generated/ExperimentsUpdateSamples.java | 12 +- .../OperationStatusesGetSamples.java | 6 +- .../generated/TargetTypesGetSamples.java | 2 +- .../generated/TargetTypesListSamples.java | 2 +- .../TargetsCreateOrUpdateSamples.java | 17 +- .../chaos/generated/TargetsDeleteSamples.java | 7 +- .../chaos/generated/TargetsGetSamples.java | 7 +- .../chaos/generated/TargetsListSamples.java | 7 +- ...esCreateOrUpdateWithResponseMockTests.java | 58 ---- ...pabilitiesDeleteWithResponseMockTests.java | 54 ---- .../CapabilitiesGetWithResponseMockTests.java | 56 ---- .../generated/CapabilitiesListMockTests.java | 57 ---- .../chaos/generated/CapabilityInnerTests.java | 23 -- .../generated/CapabilityListResultTests.java | 23 -- .../generated/CapabilityPropertiesTests.java | 23 -- .../generated/CapabilityTypeInnerTests.java | 26 -- .../CapabilityTypeListResultTests.java | 23 -- ...yTypePropertiesRuntimePropertiesTests.java | 22 -- .../CapabilityTypePropertiesTests.java | 33 --- ...pabilityTypesGetWithResponseMockTests.java | 58 ---- .../CapabilityTypesListMockTests.java | 58 ---- .../generated/ChaosExperimentActionTests.java | 26 -- .../generated/ChaosExperimentBranchTests.java | 33 --- .../generated/ChaosExperimentStepTests.java | 37 --- .../generated/ChaosTargetFilterTests.java | 22 -- .../ChaosTargetListSelectorTests.java | 40 --- .../ChaosTargetQuerySelectorTests.java | 35 --- .../generated/ChaosTargetSelectorTests.java | 43 --- ...haosTargetSimpleFilterParametersTests.java | 28 -- .../ChaosTargetSimpleFilterTests.java | 29 -- .../chaos/generated/DelayActionTests.java | 28 -- .../ExperimentExecutionDetailsInnerTests.java | 23 -- ...nDetailsPropertiesRunInformationTests.java | 24 -- ...rimentExecutionDetailsPropertiesTests.java | 23 -- .../ExperimentExecutionInnerTests.java | 23 -- .../ExperimentExecutionListResultTests.java | 23 -- .../ExperimentExecutionPropertiesTests.java | 23 -- .../chaos/generated/ExperimentInnerTests.java | 99 ------- .../generated/ExperimentListResultTests.java | 23 -- .../generated/ExperimentPropertiesTests.java | 91 ------ .../generated/ExperimentUpdateTests.java | 50 ---- .../ExperimentsCreateOrUpdateMockTests.java | 106 ------- ...ExecutionDetailsWithResponseMockTests.java | 56 ---- ...tByResourceGroupWithResponseMockTests.java | 64 ----- ...entsGetExecutionWithResponseMockTests.java | 56 ---- ...ExperimentsListAllExecutionsMockTests.java | 56 ---- ...perimentsListByResourceGroupMockTests.java | 64 ----- .../generated/ExperimentsListMockTests.java | 64 ----- .../generated/OperationDisplayTests.java | 24 -- .../chaos/generated/OperationInnerTests.java | 24 -- .../generated/OperationListResultTests.java | 23 -- .../generated/OperationStatusInnerTests.java | 38 --- ...ationStatusesGetWithResponseMockTests.java | 62 ---- .../generated/ResourceIdentityTests.java | 44 --- .../chaos/generated/StepStatusTests.java | 23 -- .../chaos/generated/TargetInnerTests.java | 41 --- .../generated/TargetListResultTests.java | 23 -- .../chaos/generated/TargetReferenceTests.java | 28 -- .../chaos/generated/TargetTypeInnerTests.java | 26 -- .../generated/TargetTypeListResultTests.java | 23 -- .../generated/TargetTypePropertiesTests.java | 23 -- .../TargetTypesGetWithResponseMockTests.java | 58 ---- .../generated/TargetTypesListMockTests.java | 58 ---- ...tsCreateOrUpdateWithResponseMockTests.java | 76 ----- .../TargetsDeleteWithResponseMockTests.java | 54 ---- .../TargetsGetWithResponseMockTests.java | 59 ---- .../chaos/generated/TargetsListMockTests.java | 58 ---- .../generated/UserAssignedIdentityTests.java | 23 -- 168 files changed, 4088 insertions(+), 4123 deletions(-) create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Action.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Branch.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentAction.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentBranch.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentStep.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetFilter.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetListSelector.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetQuerySelector.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSelector.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilter.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilterParameters.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Filter.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ListSelector.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/QuerySelector.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Selector.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SimpleFilter.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SimpleFilterParameters.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Step.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateWithResponseMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteWithResponseMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetWithResponseMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityInnerTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityListResultTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityPropertiesTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypeInnerTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypeListResultTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypePropertiesRuntimePropertiesTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypePropertiesTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetWithResponseMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosExperimentActionTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosExperimentBranchTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosExperimentStepTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetFilterTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetListSelectorTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetQuerySelectorTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetSelectorTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetSimpleFilterParametersTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ChaosTargetSimpleFilterTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/DelayActionTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsInnerTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsPropertiesRunInformationTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionDetailsPropertiesTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionInnerTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionListResultTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentExecutionPropertiesTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentInnerTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentListResultTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentPropertiesTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentUpdateTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsExecutionDetailsWithResponseMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupWithResponseMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionWithResponseMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllExecutionsMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ExperimentsListMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationDisplayTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationInnerTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationListResultTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationStatusInnerTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/OperationStatusesGetWithResponseMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/ResourceIdentityTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/StepStatusTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetInnerTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetListResultTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetReferenceTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeInnerTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypeListResultTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypePropertiesTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetWithResponseMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetTypesListMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateWithResponseMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteWithResponseMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsGetWithResponseMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/TargetsListMockTests.java delete mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/test/java/com/azure/resourcemanager/chaos/generated/UserAssignedIdentityTests.java diff --git a/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md b/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md index ce03fbe3ff670..568850cf517b7 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md +++ b/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md @@ -1,14 +1,183 @@ # Release History -## 1.2.0-beta.1 (Unreleased) +## 1.0.0-beta.1 (2024-12-06) -### 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-preview-2024-12. 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.ChaosTargetListSelector` was removed + +#### `models.ChaosTargetSimpleFilterParameters` was removed + +#### `models.ChaosTargetQuerySelector` was removed + +#### `models.ChaosExperimentBranch` was removed + +#### `models.ChaosTargetFilter` was removed + +#### `models.ChaosTargetSimpleFilter` was removed + +#### `models.ChaosExperimentStep` was removed + +#### `models.ChaosExperimentAction` was removed + +#### `models.ChaosTargetSelector` was removed + +#### `models.DelayAction` was modified + +* `models.ChaosExperimentAction withName(java.lang.String)` -> `models.Action withName(java.lang.String)` + +#### `models.ContinuousAction` was modified + +* `models.ChaosExperimentAction withName(java.lang.String)` -> `models.Action withName(java.lang.String)` + +#### `models.OperationStatus` was modified + +* `java.lang.String endTime()` -> `java.time.OffsetDateTime endTime()` +* `java.lang.String startTime()` -> `java.time.OffsetDateTime startTime()` + +#### `models.DiscreteAction` was modified + +* `models.ChaosExperimentAction withName(java.lang.String)` -> `models.Action withName(java.lang.String)` + +### Features Added + +* `models.Selector` was added + +* `models.SimpleFilter` was added + +* `models.Action` was added + +* `models.Filter` was added + +* `models.Branch` was added + +* `models.QuerySelector` was added + +* `models.SimpleFilterParameters` was added + +* `models.Step` was added + +* `models.ListSelector` was added + +#### `models.TargetListResult` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.OperationDisplay` 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.ResourceIdentity` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.DelayAction` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `type()` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.OperationListResult` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.CapabilityTypeListResult` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ExperimentExecutionDetailsPropertiesRunInformation` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.StepStatus` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ContinuousAction` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `type()` was added + +#### `models.CapabilityTypePropertiesRuntimeProperties` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ExperimentExecutionActionTargetDetailsError` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ExperimentListResult` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ExperimentExecutionListResult` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.KeyValuePair` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.BranchStatus` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.TargetTypeListResult` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.DiscreteAction` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `type()` was added + +#### `models.ActionStatus` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.CapabilityListResult` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.ExperimentExecutionActionTargetDetailsProperties` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.ExperimentUpdate` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.TargetReference` was modified -### Other Changes +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` 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..353035a18b7cc 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-preview-2024-12. 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..6d106d004252f 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md +++ b/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md @@ -53,7 +53,8 @@ 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/preview/2024-12-01-preview/examples/CreateUpdateCapability. + * json */ /** * Sample code: Create/update a Capability that extends a virtual machine Target resource. @@ -62,9 +63,9 @@ public final class CapabilitiesCreateOrUpdateSamples { */ public static void createUpdateACapabilityThatExtendsAVirtualMachineTargetResource( com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.capabilities().createOrUpdateWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", - "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.0", new CapabilityInner(), - com.azure.core.util.Context.NONE); + manager.capabilities() + .createOrUpdateWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", + "Microsoft-VirtualMachine", "Shutdown-1.0", new CapabilityInner(), com.azure.core.util.Context.NONE); } } ``` @@ -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/preview/2024-12-01-preview/examples/DeleteCapability.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.Compute", "virtualMachines", "exampleVM", + "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/preview/2024-12-01-preview/examples/GetCapability.json */ /** * Sample code: Get a Capability that extends a virtual machine Target resource. @@ -111,8 +113,9 @@ public final class CapabilitiesGetSamples { */ public static void getACapabilityThatExtendsAVirtualMachineTargetResource(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.capabilities().getWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", - "Microsoft-VirtualMachine", "Shutdown-1.0", com.azure.core.util.Context.NONE); + manager.capabilities() + .getWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", + "Microsoft-VirtualMachine", "Shutdown-1.0", com.azure.core.util.Context.NONE); } } ``` @@ -126,7 +129,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/preview/2024-12-01-preview/examples/ListCapabilities.json */ /** * Sample code: List all Capabilities that extend a virtual machine Target resource. @@ -135,8 +138,9 @@ public final class CapabilitiesListSamples { */ public static void listAllCapabilitiesThatExtendAVirtualMachineTargetResource( com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.capabilities().list("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", - "Microsoft-VirtualMachine", null, com.azure.core.util.Context.NONE); + manager.capabilities() + .list("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", null, + com.azure.core.util.Context.NONE); } } ``` @@ -150,7 +154,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/preview/2024-12-01-preview/examples/GetCapabilityType.json */ /** * Sample code: Get a Capability Type for a virtual machine Target resource on westus2 location. @@ -159,8 +163,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 +178,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/preview/2024-12-01-preview/examples/ListCapabilityTypes.json */ /** * Sample code: List all Capability Types for a virtual machine Target resource on westus2 location. @@ -197,7 +201,7 @@ public final class CapabilityTypesListSamples { 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/preview/2024-12-01-preview/examples/CancelExperiment.json */ /** * Sample code: Cancel a running Experiment. @@ -213,13 +217,13 @@ public final class ExperimentsCancelSamples { ### 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.Branch; import com.azure.resourcemanager.chaos.models.ContinuousAction; import com.azure.resourcemanager.chaos.models.KeyValuePair; +import com.azure.resourcemanager.chaos.models.ListSelector; import com.azure.resourcemanager.chaos.models.ResourceIdentity; import com.azure.resourcemanager.chaos.models.ResourceIdentityType; +import com.azure.resourcemanager.chaos.models.Step; import com.azure.resourcemanager.chaos.models.TargetReference; import com.azure.resourcemanager.chaos.models.TargetReferenceType; import java.time.Duration; @@ -231,7 +235,8 @@ import java.util.Arrays; 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/preview/2024-12-01-preview/examples/CreateUpdateExperiment. + * json */ /** * Sample code: Create/update a Experiment in a resource group. @@ -239,21 +244,25 @@ 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") + Arrays.asList(new Step().withName("step1") + .withBranches(Arrays.asList(new Branch().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(); + .withSelectors(Arrays.asList(new ListSelector().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(); } } ``` @@ -267,7 +276,7 @@ public final class ExperimentsCreateOrUpdateSamples { 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/preview/2024-12-01-preview/examples/DeleteExperiment.json */ /** * Sample code: Delete a Experiment in a resource group. @@ -289,7 +298,7 @@ public final class ExperimentsDeleteSamples { public final class ExperimentsExecutionDetailsSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DetailsExperiment.json + * specification/chaos/resource-manager/Microsoft.Chaos/preview/2024-12-01-preview/examples/DetailsExperiment.json */ /** * Sample code: Get experiment execution details. @@ -297,8 +306,9 @@ public final class ExperimentsExecutionDetailsSamples { * @param manager Entry point to ChaosManager. */ public static void getExperimentExecutionDetails(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().executionDetailsWithResponse("exampleRG", "exampleExperiment", - "f24500ad-744e-4a26-864b-b76199eac333", com.azure.core.util.Context.NONE); + manager.experiments() + .executionDetailsWithResponse("exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333", + com.azure.core.util.Context.NONE); } } ``` @@ -312,7 +322,7 @@ public final class ExperimentsExecutionDetailsSamples { 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/preview/2024-12-01-preview/examples/GetExperiment.json */ /** * Sample code: Get a Experiment in a resource group. @@ -320,8 +330,8 @@ public final class ExperimentsGetByResourceGroupSamples { * @param manager Entry point to ChaosManager. */ public static void getAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().getByResourceGroupWithResponse("exampleRG", "exampleExperiment", - com.azure.core.util.Context.NONE); + manager.experiments() + .getByResourceGroupWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); } } ``` @@ -335,7 +345,8 @@ public final class ExperimentsGetByResourceGroupSamples { public final class ExperimentsGetExecutionSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperimentExecution.json + * specification/chaos/resource-manager/Microsoft.Chaos/preview/2024-12-01-preview/examples/GetExperimentExecution. + * json */ /** * Sample code: Get the execution of a Experiment. @@ -343,8 +354,9 @@ public final class ExperimentsGetExecutionSamples { * @param manager Entry point to ChaosManager. */ public static void getTheExecutionOfAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().getExecutionWithResponse("exampleRG", "exampleExperiment", - "f24500ad-744e-4a26-864b-b76199eac333", com.azure.core.util.Context.NONE); + manager.experiments() + .getExecutionWithResponse("exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333", + com.azure.core.util.Context.NONE); } } ``` @@ -357,9 +369,8 @@ public final class ExperimentsGetExecutionSamples { */ public final class ExperimentsListSamples { /* - * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInASubscription. - * json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2024-12-01-preview/examples/ + * ListExperimentsInASubscription.json */ /** * Sample code: List all Experiments in a subscription. @@ -381,7 +392,8 @@ public final class ExperimentsListSamples { public final class ExperimentsListAllExecutionsSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentExecutions.json + * specification/chaos/resource-manager/Microsoft.Chaos/preview/2024-12-01-preview/examples/ListExperimentExecutions + * .json */ /** * Sample code: List all executions of an Experiment. @@ -402,9 +414,8 @@ public final class ExperimentsListAllExecutionsSamples { */ public final class ExperimentsListByResourceGroupSamples { /* - * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInAResourceGroup. - * json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2024-12-01-preview/examples/ + * ListExperimentsInAResourceGroup.json */ /** * Sample code: List all Experiments in a resource group. @@ -426,7 +437,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/preview/2024-12-01-preview/examples/StartExperiment.json */ /** * Sample code: Start a Experiment. @@ -455,7 +466,7 @@ 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/preview/2024-12-01-preview/examples/UpdateExperiment.json */ /** * Sample code: Update an Experiment in a resource group. @@ -466,10 +477,12 @@ public final class ExperimentsUpdateSamples { Experiment resource = manager.experiments() .getByResourceGroupWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE) .getValue(); - resource.update().withTags(mapOf("key1", "fakeTokenPlaceholder", "key2", "fakeTokenPlaceholder")).withIdentity( - new ResourceIdentity().withType(ResourceIdentityType.USER_ASSIGNED).withUserAssignedIdentities(mapOf( - "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI", - new UserAssignedIdentity()))) + resource.update() + .withTags(mapOf("key1", "fakeTokenPlaceholder", "key2", "fakeTokenPlaceholder")) + .withIdentity(new ResourceIdentity().withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI", + new UserAssignedIdentity()))) .apply(); } @@ -496,7 +509,7 @@ public final class ExperimentsUpdateSamples { public final class OperationStatusesGetSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetOperationStatus.json + * specification/chaos/resource-manager/Microsoft.Chaos/preview/2024-12-01-preview/examples/GetOperationStatus.json */ /** * Sample code: Get specific operation status. @@ -504,8 +517,8 @@ public final class OperationStatusesGetSamples { * @param manager Entry point to ChaosManager. */ public static void getSpecificOperationStatus(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.operationStatuses().getWithResponse("West US", "713192d7-503f-477a-9cfe-4efc3ee2bd11", - com.azure.core.util.Context.NONE); + manager.operationStatuses() + .getWithResponse("West US", "713192d7-503f-477a-9cfe-4efc3ee2bd11", com.azure.core.util.Context.NONE); } } ``` @@ -519,7 +532,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/preview/2024-12-01-preview/examples/GetTargetType.json */ /** * Sample code: Get a Target Type for westus2 location. @@ -541,7 +554,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/preview/2024-12-01-preview/examples/ListTargetTypes.json */ /** * Sample code: List all Target Types for westus2 location. @@ -570,7 +583,7 @@ 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/preview/2024-12-01-preview/examples/CreateUpdateTarget.json */ /** * Sample code: Create/update a Target that extends a virtual machine resource. @@ -579,13 +592,14 @@ public final class TargetsCreateOrUpdateSamples { */ public static void createUpdateATargetThatExtendsAVirtualMachineResource( com.azure.resourcemanager.chaos.ChaosManager manager) throws IOException { - manager.targets().createOrUpdateWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", - "Microsoft-Agent", - new TargetInner().withProperties(mapOf("identities", - SerializerFactory.createDefaultManagementSerializerAdapter().deserialize( - "[{\"type\":\"CertificateSubjectIssuer\",\"subject\":\"CN=example.subject\"}]", Object.class, - SerializerEncoding.JSON))), - com.azure.core.util.Context.NONE); + manager.targets() + .createOrUpdateWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", + "Microsoft-Agent", + new TargetInner().withProperties(mapOf("identities", + SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize("[{\"type\":\"CertificateSubjectIssuer\",\"subject\":\"CN=example.subject\"}]", + Object.class, SerializerEncoding.JSON))), + com.azure.core.util.Context.NONE); } // Use "Map.of" if available @@ -611,7 +625,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/preview/2024-12-01-preview/examples/DeleteTarget.json */ /** * Sample code: Delete a Target that extends a virtual machine resource. @@ -620,8 +634,9 @@ public final class TargetsDeleteSamples { */ public static void deleteATargetThatExtendsAVirtualMachineResource(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.targets().deleteWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", - "Microsoft-Agent", com.azure.core.util.Context.NONE); + manager.targets() + .deleteWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", + com.azure.core.util.Context.NONE); } } ``` @@ -635,7 +650,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/preview/2024-12-01-preview/examples/GetTarget.json */ /** * Sample code: Get a Target that extends a virtual machine resource. @@ -644,8 +659,9 @@ public final class TargetsGetSamples { */ public static void getATargetThatExtendsAVirtualMachineResource(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.targets().getWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", - "Microsoft-Agent", com.azure.core.util.Context.NONE); + manager.targets() + .getWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", + com.azure.core.util.Context.NONE); } } ``` @@ -659,7 +675,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/preview/2024-12-01-preview/examples/ListTargets.json */ /** * Sample code: List all Targets that extend a virtual machine resource. @@ -668,8 +684,9 @@ public final class TargetsListSamples { */ public static void listAllTargetsThatExtendAVirtualMachineResource(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.targets().list("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", null, - com.azure.core.util.Context.NONE); + manager.targets() + .list("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", null, + com.azure.core.util.Context.NONE); } } ``` diff --git a/sdk/chaos/azure-resourcemanager-chaos/pom.xml b/sdk/chaos/azure-resourcemanager-chaos/pom.xml index c89a0e143acf5..5592acfd27d8a 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-preview-2024-12. 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..d918f9cfbce06 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; @@ -57,14 +57,14 @@ public final class ChaosManager { private Experiments experiments; - private OperationStatuses operationStatuses; - private Operations operations; - private TargetTypes targetTypes; + private OperationStatuses operationStatuses; private Targets targets; + private TargetTypes targetTypes; + 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())); @@ -311,18 +311,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. * @@ -336,15 +324,15 @@ public Operations operations() { } /** - * Gets the resource collection API of TargetTypes. + * Gets the resource collection API of OperationStatuses. * - * @return Resource collection API of TargetTypes. + * @return Resource collection API of OperationStatuses. */ - public TargetTypes targetTypes() { - if (this.targetTypes == null) { - this.targetTypes = new TargetTypesImpl(clientObject.getTargetTypes(), this); + public OperationStatuses operationStatuses() { + if (this.operationStatuses == null) { + this.operationStatuses = new OperationStatusesImpl(clientObject.getOperationStatuses(), this); } - return targetTypes; + return operationStatuses; } /** @@ -359,6 +347,18 @@ public Targets targets() { return targets; } + /** + * Gets the resource collection API of TargetTypes. + * + * @return Resource collection API of TargetTypes. + */ + public TargetTypes targetTypes() { + if (this.targetTypes == null) { + this.targetTypes = new TargetTypesImpl(clientObject.getTargetTypes(), this); + } + return targetTypes; + } + /** * 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/ChaosManagementClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ChaosManagementClient.java index 0957af884ce84..f119879f8b099 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 @@ -67,13 +67,6 @@ public interface ChaosManagementClient { */ ExperimentsClient getExperiments(); - /** - * Gets the OperationStatusesClient object to access its operations. - * - * @return the OperationStatusesClient object. - */ - OperationStatusesClient getOperationStatuses(); - /** * Gets the OperationsClient object to access its operations. * @@ -82,11 +75,11 @@ public interface ChaosManagementClient { OperationsClient getOperations(); /** - * Gets the TargetTypesClient object to access its operations. + * Gets the OperationStatusesClient object to access its operations. * - * @return the TargetTypesClient object. + * @return the OperationStatusesClient object. */ - TargetTypesClient getTargetTypes(); + OperationStatusesClient getOperationStatuses(); /** * Gets the TargetsClient object to access its operations. @@ -94,4 +87,11 @@ public interface ChaosManagementClient { * @return the TargetsClient object. */ TargetsClient getTargets(); + + /** + * Gets the TargetTypesClient object to access its operations. + * + * @return the TargetTypesClient object. + */ + TargetTypesClient getTargetTypes(); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityInner.java index 77d0fabdd71f2..88dd47d4314f7 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityInner.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityInner.java @@ -7,7 +7,10 @@ import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Model that represents a Capability resource. @@ -17,15 +20,28 @@ public final class CapabilityInner extends ProxyResource { /* * The standard system metadata of a resource type. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * The properties of a capability resource. */ - @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) private CapabilityProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of CapabilityInner class. */ @@ -50,6 +66,36 @@ private CapabilityProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the publisher property: String of the Publisher that this Capability extends. * @@ -105,4 +151,48 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CapabilityInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CapabilityInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CapabilityInner. + */ + public static CapabilityInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CapabilityInner deserializedCapabilityInner = new CapabilityInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCapabilityInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCapabilityInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCapabilityInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedCapabilityInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedCapabilityInner.innerProperties = CapabilityProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCapabilityInner; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityProperties.java index 2380ddf8be90a..8f64462599341 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityProperties.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityProperties.java @@ -5,41 +5,40 @@ package com.azure.resourcemanager.chaos.fluent.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Model that represents the Capability properties model. */ @Immutable -public final class CapabilityProperties { +public final class CapabilityProperties implements JsonSerializable { /* * String of the Publisher that this Capability extends. */ - @JsonProperty(value = "publisher", access = JsonProperty.Access.WRITE_ONLY) private String publisher; /* * String of the Target Type that this Capability extends. */ - @JsonProperty(value = "targetType", access = JsonProperty.Access.WRITE_ONLY) private String targetType; /* * Localized string of the description. */ - @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /* * URL to retrieve JSON schema of the Capability parameters. */ - @JsonProperty(value = "parametersSchema", access = JsonProperty.Access.WRITE_ONLY) private String parametersSchema; /* * String of the URN for this Capability Type. */ - @JsonProperty(value = "urn", access = JsonProperty.Access.WRITE_ONLY) private String urn; /** @@ -100,4 +99,47 @@ public String urn() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CapabilityProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CapabilityProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the CapabilityProperties. + */ + public static CapabilityProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CapabilityProperties deserializedCapabilityProperties = new CapabilityProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("publisher".equals(fieldName)) { + deserializedCapabilityProperties.publisher = reader.getString(); + } else if ("targetType".equals(fieldName)) { + deserializedCapabilityProperties.targetType = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedCapabilityProperties.description = reader.getString(); + } else if ("parametersSchema".equals(fieldName)) { + deserializedCapabilityProperties.parametersSchema = reader.getString(); + } else if ("urn".equals(fieldName)) { + deserializedCapabilityProperties.urn = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCapabilityProperties; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeInner.java index ffea085d3935f..16d896faffe06 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeInner.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeInner.java @@ -7,8 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.chaos.models.CapabilityTypePropertiesRuntimeProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -19,21 +22,33 @@ public final class CapabilityTypeInner extends ProxyResource { /* * The system metadata properties of the capability type resource. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * Location of the Capability Type resource. */ - @JsonProperty(value = "location") private String location; /* * The properties of the capability type resource. */ - @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) private CapabilityTypeProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of CapabilityTypeInner class. */ @@ -78,6 +93,36 @@ private CapabilityTypeProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the publisher property: String of the Publisher that this Capability Type extends. * @@ -220,4 +265,51 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", this.location); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CapabilityTypeInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CapabilityTypeInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CapabilityTypeInner. + */ + public static CapabilityTypeInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CapabilityTypeInner deserializedCapabilityTypeInner = new CapabilityTypeInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCapabilityTypeInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCapabilityTypeInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCapabilityTypeInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedCapabilityTypeInner.systemData = SystemData.fromJson(reader); + } else if ("location".equals(fieldName)) { + deserializedCapabilityTypeInner.location = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedCapabilityTypeInner.innerProperties = CapabilityTypeProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCapabilityTypeInner; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeProperties.java index 823c0f6fffdcf..1dad8bc5d8669 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeProperties.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeProperties.java @@ -5,73 +5,67 @@ package com.azure.resourcemanager.chaos.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.chaos.models.CapabilityTypePropertiesRuntimeProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Model that represents the Capability Type properties model. */ @Fluent -public final class CapabilityTypeProperties { +public final class CapabilityTypeProperties implements JsonSerializable { /* * String of the Publisher that this Capability Type extends. */ - @JsonProperty(value = "publisher", access = JsonProperty.Access.WRITE_ONLY) private String publisher; /* * String of the Target Type that this Capability Type extends. */ - @JsonProperty(value = "targetType", access = JsonProperty.Access.WRITE_ONLY) private String targetType; /* * Localized string of the display name. */ - @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) private String displayName; /* * Localized string of the description. */ - @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /* * URL to retrieve JSON schema of the Capability Type parameters. */ - @JsonProperty(value = "parametersSchema", access = JsonProperty.Access.WRITE_ONLY) private String parametersSchema; /* * String of the URN for this Capability Type. */ - @JsonProperty(value = "urn", access = JsonProperty.Access.WRITE_ONLY) private String urn; /* * String of the kind of this Capability Type. */ - @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) private String kind; /* * Control plane actions necessary to execute capability type. */ - @JsonProperty(value = "azureRbacActions") private List azureRbacActions; /* * Data plane actions necessary to execute capability type. */ - @JsonProperty(value = "azureRbacDataActions") private List azureRbacDataActions; /* * Runtime properties of this Capability Type. */ - @JsonProperty(value = "runtimeProperties") private CapabilityTypePropertiesRuntimeProperties runtimeProperties; /** @@ -213,4 +207,65 @@ public void validate() { runtimeProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("azureRbacActions", this.azureRbacActions, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("azureRbacDataActions", this.azureRbacDataActions, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("runtimeProperties", this.runtimeProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CapabilityTypeProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CapabilityTypeProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CapabilityTypeProperties. + */ + public static CapabilityTypeProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CapabilityTypeProperties deserializedCapabilityTypeProperties = new CapabilityTypeProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("publisher".equals(fieldName)) { + deserializedCapabilityTypeProperties.publisher = reader.getString(); + } else if ("targetType".equals(fieldName)) { + deserializedCapabilityTypeProperties.targetType = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedCapabilityTypeProperties.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedCapabilityTypeProperties.description = reader.getString(); + } else if ("parametersSchema".equals(fieldName)) { + deserializedCapabilityTypeProperties.parametersSchema = reader.getString(); + } else if ("urn".equals(fieldName)) { + deserializedCapabilityTypeProperties.urn = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedCapabilityTypeProperties.kind = reader.getString(); + } else if ("azureRbacActions".equals(fieldName)) { + List azureRbacActions = reader.readArray(reader1 -> reader1.getString()); + deserializedCapabilityTypeProperties.azureRbacActions = azureRbacActions; + } else if ("azureRbacDataActions".equals(fieldName)) { + List azureRbacDataActions = reader.readArray(reader1 -> reader1.getString()); + deserializedCapabilityTypeProperties.azureRbacDataActions = azureRbacDataActions; + } else if ("runtimeProperties".equals(fieldName)) { + deserializedCapabilityTypeProperties.runtimeProperties + = CapabilityTypePropertiesRuntimeProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCapabilityTypeProperties; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsInner.java index a9206b47ee9e4..ce96789954797 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsInner.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsInner.java @@ -5,37 +5,37 @@ package com.azure.resourcemanager.chaos.fluent.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsPropertiesRunInformation; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; /** * Model that represents the execution details of an Experiment. */ @Immutable -public final class ExperimentExecutionDetailsInner { +public final class ExperimentExecutionDetailsInner implements JsonSerializable { /* * String of the resource type. */ - @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) private String type; /* * String of the fully qualified resource ID. */ - @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) private String id; /* * String of the resource name. */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) private String name; /* * The properties of the experiment execution details. */ - @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) private ExperimentExecutionDetailsProperties innerProperties; /** @@ -144,4 +144,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExperimentExecutionDetailsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExperimentExecutionDetailsInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExperimentExecutionDetailsInner. + */ + public static ExperimentExecutionDetailsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExperimentExecutionDetailsInner deserializedExperimentExecutionDetailsInner + = new ExperimentExecutionDetailsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedExperimentExecutionDetailsInner.type = reader.getString(); + } else if ("id".equals(fieldName)) { + deserializedExperimentExecutionDetailsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedExperimentExecutionDetailsInner.name = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedExperimentExecutionDetailsInner.innerProperties + = ExperimentExecutionDetailsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedExperimentExecutionDetailsInner; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsProperties.java index d8094e07050fb..cc3245583b434 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsProperties.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsProperties.java @@ -5,8 +5,12 @@ package com.azure.resourcemanager.chaos.fluent.models; import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsPropertiesRunInformation; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; /** @@ -17,21 +21,33 @@ public final class ExperimentExecutionDetailsProperties extends ExperimentExecut /* * The reason why the execution failed. */ - @JsonProperty(value = "failureReason", access = JsonProperty.Access.WRITE_ONLY) private String failureReason; /* * String that represents the last action date time. */ - @JsonProperty(value = "lastActionAt", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime lastActionAt; /* * The information of the experiment run. */ - @JsonProperty(value = "runInformation", access = JsonProperty.Access.WRITE_ONLY) private ExperimentExecutionDetailsPropertiesRunInformation runInformation; + /* + * String that represents the stop date time. + */ + private OffsetDateTime stoppedAt; + + /* + * String that represents the start date time. + */ + private OffsetDateTime startedAt; + + /* + * The status of the execution. + */ + private String status; + /** * Creates an instance of ExperimentExecutionDetailsProperties class. */ @@ -65,6 +81,36 @@ public ExperimentExecutionDetailsPropertiesRunInformation runInformation() { return this.runInformation; } + /** + * Get the stoppedAt property: String that represents the stop date time. + * + * @return the stoppedAt value. + */ + @Override + public OffsetDateTime stoppedAt() { + return this.stoppedAt; + } + + /** + * Get the startedAt property: String that represents the start date time. + * + * @return the startedAt value. + */ + @Override + public OffsetDateTime startedAt() { + return this.startedAt; + } + + /** + * Get the status property: The status of the execution. + * + * @return the status value. + */ + @Override + public String status() { + return this.status; + } + /** * Validates the instance. * @@ -72,9 +118,58 @@ public ExperimentExecutionDetailsPropertiesRunInformation runInformation() { */ @Override public void validate() { - super.validate(); if (runInformation() != null) { runInformation().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExperimentExecutionDetailsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExperimentExecutionDetailsProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExperimentExecutionDetailsProperties. + */ + public static ExperimentExecutionDetailsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExperimentExecutionDetailsProperties deserializedExperimentExecutionDetailsProperties + = new ExperimentExecutionDetailsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedExperimentExecutionDetailsProperties.status = reader.getString(); + } else if ("startedAt".equals(fieldName)) { + deserializedExperimentExecutionDetailsProperties.startedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("stoppedAt".equals(fieldName)) { + deserializedExperimentExecutionDetailsProperties.stoppedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("failureReason".equals(fieldName)) { + deserializedExperimentExecutionDetailsProperties.failureReason = reader.getString(); + } else if ("lastActionAt".equals(fieldName)) { + deserializedExperimentExecutionDetailsProperties.lastActionAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("runInformation".equals(fieldName)) { + deserializedExperimentExecutionDetailsProperties.runInformation + = ExperimentExecutionDetailsPropertiesRunInformation.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedExperimentExecutionDetailsProperties; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionInner.java index 420ffd70a2dfe..df958584e6e65 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionInner.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionInner.java @@ -5,36 +5,36 @@ package com.azure.resourcemanager.chaos.fluent.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; /** * Model that represents the execution of a Experiment. */ @Immutable -public final class ExperimentExecutionInner { +public final class ExperimentExecutionInner implements JsonSerializable { /* * String of the resource type. */ - @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) private String type; /* * String of the fully qualified resource ID. */ - @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) private String id; /* * String of the resource name. */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) private String name; /* * The properties of experiment execution status. */ - @JsonProperty(value = "properties") private ExperimentExecutionProperties innerProperties; /** @@ -116,4 +116,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExperimentExecutionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExperimentExecutionInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExperimentExecutionInner. + */ + public static ExperimentExecutionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExperimentExecutionInner deserializedExperimentExecutionInner = new ExperimentExecutionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedExperimentExecutionInner.type = reader.getString(); + } else if ("id".equals(fieldName)) { + deserializedExperimentExecutionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedExperimentExecutionInner.name = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedExperimentExecutionInner.innerProperties + = ExperimentExecutionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedExperimentExecutionInner; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionProperties.java index 0338e23a53bbf..338aa56c85a71 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionProperties.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionProperties.java @@ -5,30 +5,32 @@ package com.azure.resourcemanager.chaos.fluent.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; /** * Model that represents the execution properties of an Experiment. */ @Immutable -public class ExperimentExecutionProperties { +public class ExperimentExecutionProperties implements JsonSerializable { /* * The status of the execution. */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) private String status; /* * String that represents the start date time. */ - @JsonProperty(value = "startedAt", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime startedAt; /* * String that represents the stop date time. */ - @JsonProperty(value = "stoppedAt", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime stoppedAt; /** @@ -46,6 +48,17 @@ public String status() { return this.status; } + /** + * Set the status property: The status of the execution. + * + * @param status the status value to set. + * @return the ExperimentExecutionProperties object itself. + */ + ExperimentExecutionProperties withStatus(String status) { + this.status = status; + return this; + } + /** * Get the startedAt property: String that represents the start date time. * @@ -55,6 +68,17 @@ public OffsetDateTime startedAt() { return this.startedAt; } + /** + * Set the startedAt property: String that represents the start date time. + * + * @param startedAt the startedAt value to set. + * @return the ExperimentExecutionProperties object itself. + */ + ExperimentExecutionProperties withStartedAt(OffsetDateTime startedAt) { + this.startedAt = startedAt; + return this; + } + /** * Get the stoppedAt property: String that represents the stop date time. * @@ -64,6 +88,17 @@ public OffsetDateTime stoppedAt() { return this.stoppedAt; } + /** + * Set the stoppedAt property: String that represents the stop date time. + * + * @param stoppedAt the stoppedAt value to set. + * @return the ExperimentExecutionProperties object itself. + */ + ExperimentExecutionProperties withStoppedAt(OffsetDateTime stoppedAt) { + this.stoppedAt = stoppedAt; + return this; + } + /** * Validates the instance. * @@ -71,4 +106,46 @@ public OffsetDateTime stoppedAt() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExperimentExecutionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExperimentExecutionProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExperimentExecutionProperties. + */ + public static ExperimentExecutionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExperimentExecutionProperties deserializedExperimentExecutionProperties + = new ExperimentExecutionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedExperimentExecutionProperties.status = reader.getString(); + } else if ("startedAt".equals(fieldName)) { + deserializedExperimentExecutionProperties.startedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("stoppedAt".equals(fieldName)) { + deserializedExperimentExecutionProperties.stoppedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedExperimentExecutionProperties; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentInner.java index 70656ef6bef37..81f40bf6e74aa 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentInner.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentInner.java @@ -8,11 +8,14 @@ import com.azure.core.management.Resource; import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.chaos.models.ChaosExperimentStep; -import com.azure.resourcemanager.chaos.models.ChaosTargetSelector; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.chaos.models.ProvisioningState; import com.azure.resourcemanager.chaos.models.ResourceIdentity; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.resourcemanager.chaos.models.Selector; +import com.azure.resourcemanager.chaos.models.Step; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -24,21 +27,33 @@ public final class ExperimentInner extends Resource { /* * The system metadata of the experiment resource. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * The identity of the experiment resource. */ - @JsonProperty(value = "identity") private ResourceIdentity identity; /* * The properties of the experiment resource. */ - @JsonProperty(value = "properties", required = true) private ExperimentProperties innerProperties = new ExperimentProperties(); + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ExperimentInner class. */ @@ -83,6 +98,36 @@ private ExperimentProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -115,7 +160,7 @@ public ProvisioningState provisioningState() { * * @return the steps value. */ - public List steps() { + public List steps() { return this.innerProperties() == null ? null : this.innerProperties().steps(); } @@ -125,7 +170,7 @@ public List steps() { * @param steps the steps value to set. * @return the ExperimentInner object itself. */ - public ExperimentInner withSteps(List steps) { + public ExperimentInner withSteps(List steps) { if (this.innerProperties() == null) { this.innerProperties = new ExperimentProperties(); } @@ -138,7 +183,7 @@ public ExperimentInner withSteps(List steps) { * * @return the selectors value. */ - public List selectors() { + public List selectors() { return this.innerProperties() == null ? null : this.innerProperties().selectors(); } @@ -148,7 +193,7 @@ public List selectors() { * @param selectors the selectors value to set. * @return the ExperimentInner object itself. */ - public ExperimentInner withSelectors(List selectors) { + public ExperimentInner withSelectors(List selectors) { if (this.innerProperties() == null) { this.innerProperties = new ExperimentProperties(); } @@ -166,12 +211,68 @@ public void validate() { identity().validate(); } if (innerProperties() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property innerProperties in model ExperimentInner")); + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property innerProperties in model ExperimentInner")); } else { innerProperties().validate(); } } private static final ClientLogger LOGGER = new ClientLogger(ExperimentInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExperimentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExperimentInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExperimentInner. + */ + public static ExperimentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExperimentInner deserializedExperimentInner = new ExperimentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedExperimentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedExperimentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedExperimentInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedExperimentInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedExperimentInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedExperimentInner.innerProperties = ExperimentProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedExperimentInner.systemData = SystemData.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedExperimentInner.identity = ResourceIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedExperimentInner; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentProperties.java index bb1445fe5dc11..0de9c92c2024e 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentProperties.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentProperties.java @@ -6,34 +6,35 @@ 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.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.chaos.models.ProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.resourcemanager.chaos.models.Selector; +import com.azure.resourcemanager.chaos.models.Step; +import java.io.IOException; import java.util.List; /** * Model that represents the Experiment properties model. */ @Fluent -public final class ExperimentProperties { +public final class ExperimentProperties implements JsonSerializable { /* * Most recent provisioning state for the given experiment resource. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /* * List of steps. */ - @JsonProperty(value = "steps", required = true) - private List steps; + private List steps; /* * List of selectors. */ - @JsonProperty(value = "selectors", required = true) - private List selectors; + private List selectors; /** * Creates an instance of ExperimentProperties class. @@ -55,7 +56,7 @@ public ProvisioningState provisioningState() { * * @return the steps value. */ - public List steps() { + public List steps() { return this.steps; } @@ -65,7 +66,7 @@ public List steps() { * @param steps the steps value to set. * @return the ExperimentProperties object itself. */ - public ExperimentProperties withSteps(List steps) { + public ExperimentProperties withSteps(List steps) { this.steps = steps; return this; } @@ -75,7 +76,7 @@ public ExperimentProperties withSteps(List steps) { * * @return the selectors value. */ - public List selectors() { + public List selectors() { return this.selectors; } @@ -85,7 +86,7 @@ public List selectors() { * @param selectors the selectors value to set. * @return the ExperimentProperties object itself. */ - public ExperimentProperties withSelectors(List selectors) { + public ExperimentProperties withSelectors(List selectors) { this.selectors = selectors; return this; } @@ -97,18 +98,63 @@ public ExperimentProperties withSelectors(List selectors) { */ public void validate() { if (steps() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property steps in model ExperimentProperties")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property steps in model ExperimentProperties")); } else { steps().forEach(e -> e.validate()); } if (selectors() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property selectors in model ExperimentProperties")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property selectors in model ExperimentProperties")); } else { selectors().forEach(e -> e.validate()); } } private static final ClientLogger LOGGER = new ClientLogger(ExperimentProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("steps", this.steps, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("selectors", this.selectors, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExperimentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExperimentProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExperimentProperties. + */ + public static ExperimentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExperimentProperties deserializedExperimentProperties = new ExperimentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("steps".equals(fieldName)) { + List steps = reader.readArray(reader1 -> Step.fromJson(reader1)); + deserializedExperimentProperties.steps = steps; + } else if ("selectors".equals(fieldName)) { + List selectors = reader.readArray(reader1 -> Selector.fromJson(reader1)); + deserializedExperimentProperties.selectors = selectors; + } else if ("provisioningState".equals(fieldName)) { + deserializedExperimentProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedExperimentProperties; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationInner.java index d71cf2dbad10e..113129ee153dd 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationInner.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationInner.java @@ -5,10 +5,14 @@ package com.azure.resourcemanager.chaos.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.chaos.models.ActionType; import com.azure.resourcemanager.chaos.models.OperationDisplay; import com.azure.resourcemanager.chaos.models.Origin; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * REST API Operation @@ -16,38 +20,33 @@ * Details of a REST API operation, returned from the Resource Provider Operations API. */ @Fluent -public final class OperationInner { +public final class OperationInner implements JsonSerializable { /* * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) private String name; /* * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for * ARM/control-plane operations. */ - @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) private Boolean isDataAction; /* * Localized display information for this particular operation. */ - @JsonProperty(value = "display") private OperationDisplay display; /* * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default * value is "user,system" */ - @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) private Origin origin; /* * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ - @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) private ActionType actionType; /** @@ -126,4 +125,48 @@ public void validate() { display().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationStatusInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationStatusInner.java index 24456ee1cf196..bfcf9bb40f928 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationStatusInner.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationStatusInner.java @@ -6,47 +6,47 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.exception.ManagementError; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; /** * The status of operation. */ @Fluent -public final class OperationStatusInner { +public final class OperationStatusInner implements JsonSerializable { /* * The operation Id. */ - @JsonProperty(value = "id") private String id; /* * The operation name. */ - @JsonProperty(value = "name") private String name; /* * The start time of the operation. */ - @JsonProperty(value = "startTime") - private String startTime; + private OffsetDateTime startTime; /* * The end time of the operation. */ - @JsonProperty(value = "endTime") - private String endTime; + private OffsetDateTime endTime; /* * The status of the operation. */ - @JsonProperty(value = "status") private String status; /* * The error object. */ - @JsonProperty(value = "error") private ManagementError error; /** @@ -100,41 +100,19 @@ public OperationStatusInner withName(String name) { * * @return the startTime value. */ - public String startTime() { + public OffsetDateTime startTime() { return this.startTime; } - /** - * Set the startTime property: The start time of the operation. - * - * @param startTime the startTime value to set. - * @return the OperationStatusInner object itself. - */ - public OperationStatusInner withStartTime(String startTime) { - this.startTime = startTime; - return this; - } - /** * Get the endTime property: The end time of the operation. * * @return the endTime value. */ - public String endTime() { + public OffsetDateTime endTime() { return this.endTime; } - /** - * Set the endTime property: The end time of the operation. - * - * @param endTime the endTime value to set. - * @return the OperationStatusInner object itself. - */ - public OperationStatusInner withEndTime(String endTime) { - this.endTime = endTime; - return this; - } - /** * Get the status property: The status of the operation. * @@ -182,4 +160,55 @@ public OperationStatusInner withError(ManagementError error) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("status", this.status); + jsonWriter.writeJsonField("error", this.error); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationStatusInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationStatusInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationStatusInner. + */ + public static OperationStatusInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationStatusInner deserializedOperationStatusInner = new OperationStatusInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedOperationStatusInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedOperationStatusInner.name = reader.getString(); + } else if ("startTime".equals(fieldName)) { + deserializedOperationStatusInner.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedOperationStatusInner.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("status".equals(fieldName)) { + deserializedOperationStatusInner.status = reader.getString(); + } else if ("error".equals(fieldName)) { + deserializedOperationStatusInner.error = ManagementError.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationStatusInner; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetInner.java index 2700e264d225d..9c7156ae10fc9 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetInner.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetInner.java @@ -8,8 +8,10 @@ import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; /** @@ -20,22 +22,33 @@ public final class TargetInner extends ProxyResource { /* * The system metadata of the target resource. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * Location of the target resource. */ - @JsonProperty(value = "location") private String location; /* * The properties of the target resource. */ - @JsonProperty(value = "properties", required = true) - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map properties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of TargetInner class. */ @@ -91,6 +104,36 @@ public TargetInner withProperties(Map properties) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -98,10 +141,59 @@ public TargetInner withProperties(Map properties) { */ public void validate() { if (properties() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property properties in model TargetInner")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property properties in model TargetInner")); } } private static final ClientLogger LOGGER = new ClientLogger(TargetInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("properties", this.properties, (writer, element) -> writer.writeUntyped(element)); + jsonWriter.writeStringField("location", this.location); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TargetInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TargetInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TargetInner. + */ + public static TargetInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TargetInner deserializedTargetInner = new TargetInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTargetInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedTargetInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTargetInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + Map properties = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedTargetInner.properties = properties; + } else if ("systemData".equals(fieldName)) { + deserializedTargetInner.systemData = SystemData.fromJson(reader); + } else if ("location".equals(fieldName)) { + deserializedTargetInner.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTargetInner; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeInner.java index 7977d4e0b5d8b..0f944a6e9ac34 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeInner.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeInner.java @@ -8,7 +8,10 @@ import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** @@ -19,21 +22,33 @@ public final class TargetTypeInner extends ProxyResource { /* * The system metadata properties of the target type resource. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * Location of the Target Type resource. */ - @JsonProperty(value = "location") private String location; /* * The properties of the target type resource. */ - @JsonProperty(value = "properties", required = true) private TargetTypeProperties innerProperties = new TargetTypeProperties(); + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of TargetTypeInner class. */ @@ -78,6 +93,36 @@ private TargetTypeProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the displayName property: Localized string of the display name. * @@ -121,12 +166,61 @@ public List resourceTypes() { */ public void validate() { if (innerProperties() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property innerProperties in model TargetTypeInner")); + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property innerProperties in model TargetTypeInner")); } else { innerProperties().validate(); } } private static final ClientLogger LOGGER = new ClientLogger(TargetTypeInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeStringField("location", this.location); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TargetTypeInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TargetTypeInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TargetTypeInner. + */ + public static TargetTypeInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TargetTypeInner deserializedTargetTypeInner = new TargetTypeInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTargetTypeInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedTargetTypeInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTargetTypeInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedTargetTypeInner.innerProperties = TargetTypeProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedTargetTypeInner.systemData = SystemData.fromJson(reader); + } else if ("location".equals(fieldName)) { + deserializedTargetTypeInner.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTargetTypeInner; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeProperties.java index 56be5f6e63786..7d3ee13e3ea3c 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeProperties.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeProperties.java @@ -5,36 +5,36 @@ package com.azure.resourcemanager.chaos.fluent.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Model that represents the base Target Type properties model. */ @Immutable -public final class TargetTypeProperties { +public final class TargetTypeProperties implements JsonSerializable { /* * Localized string of the display name. */ - @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) private String displayName; /* * Localized string of the description. */ - @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /* * URL to retrieve JSON schema of the Target Type properties. */ - @JsonProperty(value = "propertiesSchema", access = JsonProperty.Access.WRITE_ONLY) private String propertiesSchema; /* * List of resource types this Target Type can extend. */ - @JsonProperty(value = "resourceTypes", access = JsonProperty.Access.WRITE_ONLY) private List resourceTypes; /** @@ -86,4 +86,46 @@ public List resourceTypes() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TargetTypeProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TargetTypeProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the TargetTypeProperties. + */ + public static TargetTypeProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TargetTypeProperties deserializedTargetTypeProperties = new TargetTypeProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedTargetTypeProperties.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedTargetTypeProperties.description = reader.getString(); + } else if ("propertiesSchema".equals(fieldName)) { + deserializedTargetTypeProperties.propertiesSchema = reader.getString(); + } else if ("resourceTypes".equals(fieldName)) { + List resourceTypes = reader.readArray(reader1 -> reader1.getString()); + deserializedTargetTypeProperties.resourceTypes = resourceTypes; + } else { + reader.skipChildren(); + } + } + + return deserializedTargetTypeProperties; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilitiesClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilitiesClientImpl.java index 40ab78721ad4f..4a986b0ee909b 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilitiesClientImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilitiesClientImpl.java @@ -907,9 +907,7 @@ public CapabilityInner createOrUpdate(String resourceGroupName, String parentPro /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -935,9 +933,7 @@ private Mono> listNextSinglePageAsync(String next /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesClientImpl.java index b49dfa127debb..f9a5e16e973cf 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesClientImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesClientImpl.java @@ -395,9 +395,7 @@ public CapabilityTypeInner get(String locationName, String targetTypeName, Strin /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -423,9 +421,7 @@ private Mono> listNextSinglePageAsync(String /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientImpl.java index 2c063237e18b5..5fa0f27c2ec4f 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; @@ -170,20 +171,6 @@ public ExperimentsClient getExperiments() { return this.experiments; } - /** - * The OperationStatusesClient object to access its operations. - */ - private final OperationStatusesClient operationStatuses; - - /** - * Gets the OperationStatusesClient object to access its operations. - * - * @return the OperationStatusesClient object. - */ - public OperationStatusesClient getOperationStatuses() { - return this.operationStatuses; - } - /** * The OperationsClient object to access its operations. */ @@ -199,17 +186,17 @@ public OperationsClient getOperations() { } /** - * The TargetTypesClient object to access its operations. + * The OperationStatusesClient object to access its operations. */ - private final TargetTypesClient targetTypes; + private final OperationStatusesClient operationStatuses; /** - * Gets the TargetTypesClient object to access its operations. + * Gets the OperationStatusesClient object to access its operations. * - * @return the TargetTypesClient object. + * @return the OperationStatusesClient object. */ - public TargetTypesClient getTargetTypes() { - return this.targetTypes; + public OperationStatusesClient getOperationStatuses() { + return this.operationStatuses; } /** @@ -226,6 +213,20 @@ public TargetsClient getTargets() { return this.targets; } + /** + * The TargetTypesClient object to access its operations. + */ + private final TargetTypesClient targetTypes; + + /** + * Gets the TargetTypesClient object to access its operations. + * + * @return the TargetTypesClient object. + */ + public TargetTypesClient getTargetTypes() { + return this.targetTypes; + } + /** * Initializes an instance of ChaosManagementClient client. * @@ -243,14 +244,14 @@ public TargetsClient getTargets() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2024-01-01"; + this.apiVersion = "2024-12-01-preview"; this.capabilities = new CapabilitiesClientImpl(this); this.capabilityTypes = new CapabilityTypesClientImpl(this); this.experiments = new ExperimentsClientImpl(this); - this.operationStatuses = new OperationStatusesClientImpl(this); this.operations = new OperationsClientImpl(this); - this.targetTypes = new TargetTypesClientImpl(this); + this.operationStatuses = new OperationStatusesClientImpl(this); this.targets = new TargetsClientImpl(this); + this.targetTypes = new TargetTypesClientImpl(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/ExperimentImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentImpl.java index 105b47e7f110e..3846e8a94ab8b 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,12 +8,12 @@ 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.ExperimentUpdate; import com.azure.resourcemanager.chaos.models.ProvisioningState; import com.azure.resourcemanager.chaos.models.ResourceIdentity; +import com.azure.resourcemanager.chaos.models.Selector; +import com.azure.resourcemanager.chaos.models.Step; import java.util.Collections; import java.util.List; import java.util.Map; @@ -60,8 +60,8 @@ public ProvisioningState provisioningState() { return this.innerModel().provisioningState(); } - public List steps() { - List inner = this.innerModel().steps(); + public List steps() { + List inner = this.innerModel().steps(); if (inner != null) { return Collections.unmodifiableList(inner); } else { @@ -69,8 +69,8 @@ public List steps() { } } - public List selectors() { - List inner = this.innerModel().selectors(); + public List selectors() { + List inner = this.innerModel().selectors(); if (inner != null) { return Collections.unmodifiableList(inner); } else { @@ -197,12 +197,12 @@ public ExperimentImpl withRegion(String location) { return this; } - public ExperimentImpl withSteps(List steps) { + public ExperimentImpl withSteps(List steps) { this.innerModel().withSteps(steps); return this; } - public ExperimentImpl withSelectors(List selectors) { + public ExperimentImpl withSelectors(List selectors) { this.innerModel().withSelectors(selectors); return this; } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java index 91bb521156901..b76583e4324e3 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java @@ -2109,9 +2109,7 @@ public ExperimentExecutionDetailsInner executionDetails(String resourceGroupName /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -2138,9 +2136,7 @@ private Mono> listAllNextSinglePageAsync(String n /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -2167,9 +2163,7 @@ private Mono> listAllNextSinglePageAsync(String n /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -2195,9 +2189,7 @@ private Mono> listNextSinglePageAsync(String next /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -2224,9 +2216,7 @@ private Mono> listNextSinglePageAsync(String next /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -2253,9 +2243,7 @@ private Mono> listAllExecutionsNextSingl /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusImpl.java index 09adcaaa1102d..fee127f5b564e 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationStatusImpl.java @@ -7,6 +7,7 @@ import com.azure.core.management.exception.ManagementError; import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner; import com.azure.resourcemanager.chaos.models.OperationStatus; +import java.time.OffsetDateTime; public final class OperationStatusImpl implements OperationStatus { private OperationStatusInner innerObject; @@ -26,11 +27,11 @@ public String name() { return this.innerModel().name(); } - public String startTime() { + public OffsetDateTime startTime() { return this.innerModel().startTime(); } - public String endTime() { + public OffsetDateTime endTime() { return this.innerModel().endTime(); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsClientImpl.java index 3f14079d2aab9..7c36795820d22 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsClientImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsClientImpl.java @@ -179,9 +179,7 @@ public PagedIterable listAll(Context context) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -208,9 +206,7 @@ private Mono> listAllNextSinglePageAsync(String ne /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ResourceManagerUtils.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ResourceManagerUtils.java index 04312bfa92609..128fbddc5d7c5 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ResourceManagerUtils.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ResourceManagerUtils.java @@ -41,7 +41,6 @@ static String getValueFromIdByName(String id, String name) { } } return null; - } static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { @@ -75,7 +74,6 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri } } return null; - } static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesClientImpl.java index 1611957b7d981..3cf50d14e6229 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesClientImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesClientImpl.java @@ -354,9 +354,7 @@ public TargetTypeInner get(String locationName, String targetTypeName) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -382,9 +380,7 @@ private Mono> listNextSinglePageAsync(String next /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsClientImpl.java index f3de7fe94bafd..9a34d44737459 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsClientImpl.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsClientImpl.java @@ -847,9 +847,7 @@ public TargetInner createOrUpdate(String resourceGroupName, String parentProvide /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -875,9 +873,7 @@ private Mono> listNextSinglePageAsync(String nextLink /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Action.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Action.java new file mode 100644 index 0000000000000..b6a61ac672800 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Action.java @@ -0,0 +1,146 @@ +// 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; + +/** + * Model that represents the base action model. 9 total per experiment. + */ +@Fluent +public class Action implements JsonSerializable { + /* + * Enum that discriminates between action models. + */ + private String type = "Action"; + + /* + * String that represents a Capability URN. + */ + private String name; + + /** + * Creates an instance of Action class. + */ + public Action() { + } + + /** + * Get the type property: Enum that discriminates between action models. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: String that represents a Capability URN. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: String that represents a Capability URN. + * + * @param name the name value to set. + * @return the Action object itself. + */ + public Action withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property name in model Action")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Action.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Action from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Action 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 Action. + */ + public static Action fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("delay".equals(discriminatorValue)) { + return DelayAction.fromJson(readerToUse.reset()); + } else if ("discrete".equals(discriminatorValue)) { + return DiscreteAction.fromJson(readerToUse.reset()); + } else if ("continuous".equals(discriminatorValue)) { + return ContinuousAction.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static Action fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Action deserializedAction = new Action(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedAction.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAction.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAction; + }); + } +} 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/Branch.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Branch.java new file mode 100644 index 0000000000000..4d989bfeed620 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Branch.java @@ -0,0 +1,136 @@ +// 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 a branch in the step. 9 total per experiment. + */ +@Fluent +public final class Branch implements JsonSerializable { + /* + * String of the branch name. + */ + private String name; + + /* + * List of actions. + */ + private List actions; + + /** + * Creates an instance of Branch class. + */ + public Branch() { + } + + /** + * Get the name property: String of the branch name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: String of the branch name. + * + * @param name the name value to set. + * @return the Branch object itself. + */ + public Branch withName(String name) { + this.name = name; + return this; + } + + /** + * Get the actions property: List of actions. + * + * @return the actions value. + */ + public List actions() { + return this.actions; + } + + /** + * Set the actions property: List of actions. + * + * @param actions the actions value to set. + * @return the Branch object itself. + */ + public Branch withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property name in model Branch")); + } + if (actions() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property actions in model Branch")); + } else { + actions().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Branch.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 Branch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Branch 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 Branch. + */ + public static Branch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Branch deserializedBranch = new Branch(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedBranch.name = reader.getString(); + } else if ("actions".equals(fieldName)) { + List actions = reader.readArray(reader1 -> Action.fromJson(reader1)); + deserializedBranch.actions = actions; + } else { + reader.skipChildren(); + } + } + + return deserializedBranch; + }); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/BranchStatus.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/BranchStatus.java index 46752e6e415b2..0af395c3610e0 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/BranchStatus.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/BranchStatus.java @@ -5,36 +5,36 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Model that represents the a list of actions and action statuses. */ @Immutable -public final class BranchStatus { +public final class BranchStatus implements JsonSerializable { /* * The name of the branch status. */ - @JsonProperty(value = "branchName", access = JsonProperty.Access.WRITE_ONLY) private String branchName; /* * The id of the branch status. */ - @JsonProperty(value = "branchId", access = JsonProperty.Access.WRITE_ONLY) private String branchId; /* * The status of the branch. */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) private String status; /* * The array of actions. */ - @JsonProperty(value = "actions", access = JsonProperty.Access.WRITE_ONLY) private List actions; /** @@ -89,4 +89,46 @@ public void validate() { actions().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BranchStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BranchStatus if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BranchStatus. + */ + public static BranchStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BranchStatus deserializedBranchStatus = new BranchStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("branchName".equals(fieldName)) { + deserializedBranchStatus.branchName = reader.getString(); + } else if ("branchId".equals(fieldName)) { + deserializedBranchStatus.branchId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedBranchStatus.status = reader.getString(); + } else if ("actions".equals(fieldName)) { + List actions = reader.readArray(reader1 -> ActionStatus.fromJson(reader1)); + deserializedBranchStatus.actions = actions; + } else { + reader.skipChildren(); + } + } + + return deserializedBranchStatus; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityListResult.java index 5a8f1a78f705e..9aa574ce758ba 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityListResult.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityListResult.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Model that represents a list of Capability resources and a link for pagination. */ @Immutable -public final class CapabilityListResult { +public final class CapabilityListResult implements JsonSerializable { /* * List of Capability resources. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * URL to retrieve the next page of Capability resources. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -60,4 +62,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CapabilityListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CapabilityListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the CapabilityListResult. + */ + public static CapabilityListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CapabilityListResult deserializedCapabilityListResult = new CapabilityListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> CapabilityInner.fromJson(reader1)); + deserializedCapabilityListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCapabilityListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCapabilityListResult; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypeListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypeListResult.java index 39627dcd75350..791e7c926f1e9 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypeListResult.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypeListResult.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Model that represents a list of Capability Type resources and a link for pagination. */ @Immutable -public final class CapabilityTypeListResult { +public final class CapabilityTypeListResult implements JsonSerializable { /* * List of Capability Type resources. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * URL to retrieve the next page of Capability Type resources. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -60,4 +62,43 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CapabilityTypeListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CapabilityTypeListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CapabilityTypeListResult. + */ + public static CapabilityTypeListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CapabilityTypeListResult deserializedCapabilityTypeListResult = new CapabilityTypeListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> CapabilityTypeInner.fromJson(reader1)); + deserializedCapabilityTypeListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCapabilityTypeListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCapabilityTypeListResult; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypePropertiesRuntimeProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypePropertiesRuntimeProperties.java index 75b79cfeff2e3..9fb9432b83825 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypePropertiesRuntimeProperties.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypePropertiesRuntimeProperties.java @@ -5,17 +5,21 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Runtime properties of this Capability Type. */ @Immutable -public final class CapabilityTypePropertiesRuntimeProperties { +public final class CapabilityTypePropertiesRuntimeProperties + implements JsonSerializable { /* * String of the kind of the resource's action type (continuous or discrete). */ - @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) private String kind; /** @@ -40,4 +44,40 @@ public String kind() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CapabilityTypePropertiesRuntimeProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CapabilityTypePropertiesRuntimeProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CapabilityTypePropertiesRuntimeProperties. + */ + public static CapabilityTypePropertiesRuntimeProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CapabilityTypePropertiesRuntimeProperties deserializedCapabilityTypePropertiesRuntimeProperties + = new CapabilityTypePropertiesRuntimeProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedCapabilityTypePropertiesRuntimeProperties.kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCapabilityTypePropertiesRuntimeProperties; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentAction.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentAction.java deleted file mode 100644 index ca8fb8ed777b0..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentAction.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.models; - -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; - -/** - * 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 { - /* - * String that represents a Capability URN. - */ - @JsonProperty(value = "name", required = true) - private String name; - - /** - * Creates an instance of ChaosExperimentAction class. - */ - public ChaosExperimentAction() { - } - - /** - * Get the name property: String that represents a Capability URN. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: String that represents a Capability URN. - * - * @param name the name value to set. - * @return the ChaosExperimentAction object itself. - */ - public ChaosExperimentAction withName(String name) { - this.name = name; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (name() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property name in model ChaosExperimentAction")); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ChaosExperimentAction.class); -} 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 deleted file mode 100644 index 03176b9cee2d5..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentBranch.java +++ /dev/null @@ -1,94 +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.JsonProperty; -import java.util.List; - -/** - * Model that represents a branch in the step. 9 total per experiment. - */ -@Fluent -public final class ChaosExperimentBranch { - /* - * String of the branch name. - */ - @JsonProperty(value = "name", required = true) - private String name; - - /* - * List of actions. - */ - @JsonProperty(value = "actions", required = true) - private List actions; - - /** - * Creates an instance of ChaosExperimentBranch class. - */ - public ChaosExperimentBranch() { - } - - /** - * Get the name property: String of the branch name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: String of the branch name. - * - * @param name the name value to set. - * @return the ChaosExperimentBranch object itself. - */ - public ChaosExperimentBranch withName(String name) { - this.name = name; - return this; - } - - /** - * Get the actions property: List of actions. - * - * @return the actions value. - */ - public List actions() { - return this.actions; - } - - /** - * Set the actions property: List of actions. - * - * @param actions the actions value to set. - * @return the ChaosExperimentBranch object itself. - */ - public ChaosExperimentBranch withActions(List actions) { - this.actions = actions; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (name() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property name in model ChaosExperimentBranch")); - } - if (actions() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property actions in model ChaosExperimentBranch")); - } else { - actions().forEach(e -> e.validate()); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ChaosExperimentBranch.class); -} 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 deleted file mode 100644 index a217c09c74cdc..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosExperimentStep.java +++ /dev/null @@ -1,94 +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.JsonProperty; -import java.util.List; - -/** - * Model that represents a step in the Experiment resource. - */ -@Fluent -public final class ChaosExperimentStep { - /* - * String of the step name. - */ - @JsonProperty(value = "name", required = true) - private String name; - - /* - * List of branches. - */ - @JsonProperty(value = "branches", required = true) - private List branches; - - /** - * Creates an instance of ChaosExperimentStep class. - */ - public ChaosExperimentStep() { - } - - /** - * Get the name property: String of the step name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: String of the step name. - * - * @param name the name value to set. - * @return the ChaosExperimentStep object itself. - */ - public ChaosExperimentStep withName(String name) { - this.name = name; - return this; - } - - /** - * Get the branches property: List of branches. - * - * @return the branches value. - */ - public List branches() { - return this.branches; - } - - /** - * Set the branches property: List of branches. - * - * @param branches the branches value to set. - * @return the ChaosExperimentStep object itself. - */ - public ChaosExperimentStep withBranches(List branches) { - this.branches = branches; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (name() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property name in model ChaosExperimentStep")); - } - if (branches() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property branches in model ChaosExperimentStep")); - } else { - branches().forEach(e -> e.validate()); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ChaosExperimentStep.class); -} 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 deleted file mode 100644 index e40af79c50930..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetFilter.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.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; - -/** - * 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 { - /** - * Creates an instance of ChaosTargetFilter class. - */ - public ChaosTargetFilter() { - } - - /** - * 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/models/ChaosTargetListSelector.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetListSelector.java deleted file mode 100644 index 9a724295ecfc1..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetListSelector.java +++ /dev/null @@ -1,88 +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.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import java.util.List; - -/** - * 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 { - /* - * List of Target references. - */ - @JsonProperty(value = "targets", required = true) - private List targets; - - /** - * Creates an instance of ChaosTargetListSelector class. - */ - public ChaosTargetListSelector() { - } - - /** - * Get the targets property: List of Target references. - * - * @return the targets value. - */ - public List targets() { - return this.targets; - } - - /** - * Set the targets property: List of Target references. - * - * @param targets the targets value to set. - * @return the ChaosTargetListSelector object itself. - */ - public ChaosTargetListSelector withTargets(List targets) { - this.targets = targets; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ChaosTargetListSelector withId(String id) { - super.withId(id); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ChaosTargetListSelector withFilter(ChaosTargetFilter filter) { - super.withFilter(filter); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void validate() { - super.validate(); - if (targets() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property targets in model ChaosTargetListSelector")); - } else { - targets().forEach(e -> e.validate()); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ChaosTargetListSelector.class); -} 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 deleted file mode 100644 index 5e0aa3765518a..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetQuerySelector.java +++ /dev/null @@ -1,116 +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.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import java.util.List; - -/** - * 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 { - /* - * 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; - - /** - * Creates an instance of ChaosTargetQuerySelector class. - */ - public ChaosTargetQuerySelector() { - } - - /** - * Get the queryString property: Azure Resource Graph (ARG) Query Language query for target resources. - * - * @return the queryString value. - */ - public String queryString() { - return this.queryString; - } - - /** - * Set the queryString property: Azure Resource Graph (ARG) Query Language query for target resources. - * - * @param queryString the queryString value to set. - * @return the ChaosTargetQuerySelector object itself. - */ - public ChaosTargetQuerySelector withQueryString(String queryString) { - this.queryString = queryString; - return this; - } - - /** - * Get the subscriptionIds property: Subscription id list to scope resource query. - * - * @return the subscriptionIds value. - */ - public List subscriptionIds() { - return this.subscriptionIds; - } - - /** - * Set the subscriptionIds property: Subscription id list to scope resource query. - * - * @param subscriptionIds the subscriptionIds value to set. - * @return the ChaosTargetQuerySelector object itself. - */ - public ChaosTargetQuerySelector withSubscriptionIds(List subscriptionIds) { - this.subscriptionIds = subscriptionIds; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ChaosTargetQuerySelector withId(String id) { - super.withId(id); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ChaosTargetQuerySelector withFilter(ChaosTargetFilter filter) { - super.withFilter(filter); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void validate() { - super.validate(); - if (queryString() == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - "Missing required property queryString in model ChaosTargetQuerySelector")); - } - if (subscriptionIds() == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - "Missing required property subscriptionIds in model ChaosTargetQuerySelector")); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ChaosTargetQuerySelector.class); -} 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 deleted file mode 100644 index 4d30f8cc29ad9..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSelector.java +++ /dev/null @@ -1,142 +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.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 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 { - /* - * 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; - - /** - * Creates an instance of ChaosTargetSelector class. - */ - public ChaosTargetSelector() { - } - - /** - * Get the id property: String of the selector ID. - * - * @return the id value. - */ - public String id() { - return this.id; - } - - /** - * Set the id property: String of the selector ID. - * - * @param id the id value to set. - * @return the ChaosTargetSelector object itself. - */ - public ChaosTargetSelector withId(String id) { - this.id = id; - return this; - } - - /** - * Get the filter property: Model that represents available filter types that can be applied to a targets list. - * - * @return the filter value. - */ - public ChaosTargetFilter filter() { - return this.filter; - } - - /** - * Set the filter property: Model that represents available filter types that can be applied to a targets list. - * - * @param filter the filter value to set. - * @return the ChaosTargetSelector object itself. - */ - public ChaosTargetSelector withFilter(ChaosTargetFilter filter) { - this.filter = filter; - return this; - } - - /** - * Get the additionalProperties property: Model that represents a selector in the Experiment resource. - * - * @return the additionalProperties value. - */ - @JsonAnyGetter - public Map additionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: Model that represents a selector in the Experiment resource. - * - * @param additionalProperties the additionalProperties value to set. - * @return the ChaosTargetSelector object itself. - */ - public ChaosTargetSelector withAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - @JsonAnySetter - void withAdditionalProperties(String key, Object value) { - if (additionalProperties == null) { - additionalProperties = new HashMap<>(); - } - additionalProperties.put(key, value); - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (id() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property id in model ChaosTargetSelector")); - } - if (filter() != null) { - filter().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ChaosTargetSelector.class); -} 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 deleted file mode 100644 index d2a3e18b37d5a..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilter.java +++ /dev/null @@ -1,63 +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.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; - -/** - * 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 { - /* - * Model that represents the Simple filter parameters. - */ - @JsonProperty(value = "parameters") - private ChaosTargetSimpleFilterParameters parameters; - - /** - * Creates an instance of ChaosTargetSimpleFilter class. - */ - public ChaosTargetSimpleFilter() { - } - - /** - * Get the parameters property: Model that represents the Simple filter parameters. - * - * @return the parameters value. - */ - public ChaosTargetSimpleFilterParameters parameters() { - return this.parameters; - } - - /** - * Set the parameters property: Model that represents the Simple filter parameters. - * - * @param parameters the parameters value to set. - * @return the ChaosTargetSimpleFilter object itself. - */ - public ChaosTargetSimpleFilter withParameters(ChaosTargetSimpleFilterParameters parameters) { - this.parameters = parameters; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void validate() { - super.validate(); - if (parameters() != null) { - parameters().validate(); - } - } -} 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 deleted file mode 100644 index d0725941ad414..0000000000000 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ChaosTargetSimpleFilterParameters.java +++ /dev/null @@ -1,55 +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.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** - * Model that represents the Simple filter parameters. - */ -@Fluent -public final class ChaosTargetSimpleFilterParameters { - /* - * List of Azure availability zones to filter targets by. - */ - @JsonProperty(value = "zones") - private List zones; - - /** - * Creates an instance of ChaosTargetSimpleFilterParameters class. - */ - public ChaosTargetSimpleFilterParameters() { - } - - /** - * Get the zones property: List of Azure availability zones to filter targets by. - * - * @return the zones value. - */ - public List zones() { - return this.zones; - } - - /** - * Set the zones property: List of Azure availability zones to filter targets by. - * - * @param zones the zones value to set. - * @return the ChaosTargetSimpleFilterParameters object itself. - */ - public ChaosTargetSimpleFilterParameters withZones(List zones) { - this.zones = zones; - 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/models/ContinuousAction.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ContinuousAction.java index 3a2d7ed30bebb..6691589ecf8de 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 { +public final class ContinuousAction extends Action { + /* + * Enum that discriminates between action models. + */ + private String type = "continuous"; + /* * ISO8601 formatted string that represents a duration. */ - @JsonProperty(value = "duration", required = true) private Duration duration; /* * List of key value pairs. */ - @JsonProperty(value = "parameters", required = true) private List parameters; /* * String that represents a selector. */ - @JsonProperty(value = "selectorId", required = true) private String selectorId; /** @@ -43,6 +45,16 @@ public final class ContinuousAction extends ChaosExperimentAction { public ContinuousAction() { } + /** + * Get the type property: Enum that discriminates between action models. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + /** * Get the duration property: ISO8601 formatted string that represents a duration. * @@ -119,22 +131,76 @@ public ContinuousAction withName(String name) { */ @Override public void validate() { - super.validate(); if (duration() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property duration in model ContinuousAction")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property duration in model ContinuousAction")); } if (parameters() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property parameters in model ContinuousAction")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property parameters in model ContinuousAction")); } else { parameters().forEach(e -> e.validate()); } if (selectorId() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property selectorId in model ContinuousAction")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property selectorId in model ContinuousAction")); + } + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model ContinuousAction")); } } private static final ClientLogger LOGGER = new ClientLogger(ContinuousAction.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", name()); + jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); + jsonWriter.writeArrayField("parameters", this.parameters, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("selectorId", this.selectorId); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ContinuousAction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ContinuousAction if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ContinuousAction. + */ + public static ContinuousAction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ContinuousAction deserializedContinuousAction = new ContinuousAction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedContinuousAction.withName(reader.getString()); + } else if ("duration".equals(fieldName)) { + deserializedContinuousAction.duration + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("parameters".equals(fieldName)) { + List parameters = reader.readArray(reader1 -> KeyValuePair.fromJson(reader1)); + deserializedContinuousAction.parameters = parameters; + } else if ("selectorId".equals(fieldName)) { + deserializedContinuousAction.selectorId = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedContinuousAction.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedContinuousAction; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DelayAction.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DelayAction.java index 93a670931b6de..61188d4ad464d 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 { +public final class DelayAction extends Action { + /* + * Enum that discriminates between action models. + */ + private String type = "delay"; + /* * ISO8601 formatted string that represents a duration. */ - @JsonProperty(value = "duration", required = true) private Duration duration; /** @@ -30,6 +34,16 @@ public final class DelayAction extends ChaosExperimentAction { public DelayAction() { } + /** + * Get the type property: Enum that discriminates between action models. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + /** * Get the duration property: ISO8601 formatted string that represents a duration. * @@ -66,12 +80,59 @@ public DelayAction withName(String name) { */ @Override public void validate() { - super.validate(); if (duration() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property duration in model DelayAction")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property duration in model DelayAction")); + } + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model DelayAction")); } } private static final ClientLogger LOGGER = new ClientLogger(DelayAction.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", name()); + jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DelayAction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DelayAction if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DelayAction. + */ + public static DelayAction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DelayAction deserializedDelayAction = new DelayAction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedDelayAction.withName(reader.getString()); + } else if ("duration".equals(fieldName)) { + deserializedDelayAction.duration + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("type".equals(fieldName)) { + deserializedDelayAction.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDelayAction; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DiscreteAction.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DiscreteAction.java index ba456679176d0..f0cc3b2aba761 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 { +public final class DiscreteAction extends Action { + /* + * Enum that discriminates between action models. + */ + private String type = "discrete"; + /* * List of key value pairs. */ - @JsonProperty(value = "parameters", required = true) private List parameters; /* * String that represents a selector. */ - @JsonProperty(value = "selectorId", required = true) private String selectorId; /** @@ -36,6 +38,16 @@ public final class DiscreteAction extends ChaosExperimentAction { public DiscreteAction() { } + /** + * Get the type property: Enum that discriminates between action models. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + /** * Get the parameters property: List of key value pairs. * @@ -92,18 +104,68 @@ public DiscreteAction withName(String name) { */ @Override public void validate() { - super.validate(); if (parameters() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property parameters in model DiscreteAction")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property parameters in model DiscreteAction")); } else { parameters().forEach(e -> e.validate()); } if (selectorId() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property selectorId in model DiscreteAction")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property selectorId in model DiscreteAction")); + } + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model DiscreteAction")); } } private static final ClientLogger LOGGER = new ClientLogger(DiscreteAction.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", name()); + jsonWriter.writeArrayField("parameters", this.parameters, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("selectorId", this.selectorId); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscreteAction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscreteAction if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DiscreteAction. + */ + public static DiscreteAction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscreteAction deserializedDiscreteAction = new DiscreteAction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedDiscreteAction.withName(reader.getString()); + } else if ("parameters".equals(fieldName)) { + List parameters = reader.readArray(reader1 -> KeyValuePair.fromJson(reader1)); + deserializedDiscreteAction.parameters = parameters; + } else if ("selectorId".equals(fieldName)) { + deserializedDiscreteAction.selectorId = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDiscreteAction.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscreteAction; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiment.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiment.java index 31e719c87678c..4725528a444bd 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 @@ -76,14 +76,14 @@ public interface Experiment { * * @return the steps value. */ - List steps(); + List steps(); /** * Gets the selectors property: List of selectors. * * @return the selectors value. */ - List selectors(); + List selectors(); /** * Gets the region of the resource. @@ -175,7 +175,7 @@ interface WithSteps { * @param steps List of steps. * @return the next definition stage. */ - WithSelectors withSteps(List steps); + WithSelectors withSteps(List steps); } /** @@ -188,7 +188,7 @@ interface WithSelectors { * @param selectors List of selectors. * @return the next definition stage. */ - WithCreate withSelectors(List selectors); + WithCreate withSelectors(List selectors); } /** diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsError.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsError.java index 7dbf1ab4fd96f..6161bc8abf212 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsError.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsError.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Model that represents the Experiment action target details error model. */ @Immutable -public final class ExperimentExecutionActionTargetDetailsError { +public final class ExperimentExecutionActionTargetDetailsError + implements JsonSerializable { /* * The error code. */ - @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) private String code; /* * The error message */ - @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) private String message; /** @@ -55,4 +58,42 @@ public String message() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExperimentExecutionActionTargetDetailsError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExperimentExecutionActionTargetDetailsError if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExperimentExecutionActionTargetDetailsError. + */ + public static ExperimentExecutionActionTargetDetailsError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExperimentExecutionActionTargetDetailsError deserializedExperimentExecutionActionTargetDetailsError + = new ExperimentExecutionActionTargetDetailsError(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedExperimentExecutionActionTargetDetailsError.code = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedExperimentExecutionActionTargetDetailsError.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExperimentExecutionActionTargetDetailsError; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsProperties.java index 9d46d9bd9c4e9..0da343558927a 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsProperties.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsProperties.java @@ -5,42 +5,43 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; /** * Model that represents the Experiment action target details properties model. */ @Immutable -public final class ExperimentExecutionActionTargetDetailsProperties { +public final class ExperimentExecutionActionTargetDetailsProperties + implements JsonSerializable { /* * The status of the execution. */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) private String status; /* * The target for the action. */ - @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) private String target; /* * String that represents the failed date time. */ - @JsonProperty(value = "targetFailedTime", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime targetFailedTime; /* * String that represents the completed date time. */ - @JsonProperty(value = "targetCompletedTime", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime targetCompletedTime; /* * The error of the action. */ - @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) private ExperimentExecutionActionTargetDetailsError error; /** @@ -104,4 +105,51 @@ public void validate() { error().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExperimentExecutionActionTargetDetailsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExperimentExecutionActionTargetDetailsProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExperimentExecutionActionTargetDetailsProperties. + */ + public static ExperimentExecutionActionTargetDetailsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExperimentExecutionActionTargetDetailsProperties deserializedExperimentExecutionActionTargetDetailsProperties + = new ExperimentExecutionActionTargetDetailsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedExperimentExecutionActionTargetDetailsProperties.status = reader.getString(); + } else if ("target".equals(fieldName)) { + deserializedExperimentExecutionActionTargetDetailsProperties.target = reader.getString(); + } else if ("targetFailedTime".equals(fieldName)) { + deserializedExperimentExecutionActionTargetDetailsProperties.targetFailedTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("targetCompletedTime".equals(fieldName)) { + deserializedExperimentExecutionActionTargetDetailsProperties.targetCompletedTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("error".equals(fieldName)) { + deserializedExperimentExecutionActionTargetDetailsProperties.error + = ExperimentExecutionActionTargetDetailsError.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedExperimentExecutionActionTargetDetailsProperties; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsPropertiesRunInformation.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsPropertiesRunInformation.java index 9dea24cb514fa..edb4a93079e9e 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsPropertiesRunInformation.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsPropertiesRunInformation.java @@ -5,18 +5,22 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * The information of the experiment run. */ @Immutable -public final class ExperimentExecutionDetailsPropertiesRunInformation { +public final class ExperimentExecutionDetailsPropertiesRunInformation + implements JsonSerializable { /* * The steps of the experiment run. */ - @JsonProperty(value = "steps", access = JsonProperty.Access.WRITE_ONLY) private List steps; /** @@ -44,4 +48,42 @@ public void validate() { steps().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExperimentExecutionDetailsPropertiesRunInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExperimentExecutionDetailsPropertiesRunInformation if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExperimentExecutionDetailsPropertiesRunInformation. + */ + public static ExperimentExecutionDetailsPropertiesRunInformation fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + ExperimentExecutionDetailsPropertiesRunInformation deserializedExperimentExecutionDetailsPropertiesRunInformation + = new ExperimentExecutionDetailsPropertiesRunInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("steps".equals(fieldName)) { + List steps = reader.readArray(reader1 -> StepStatus.fromJson(reader1)); + deserializedExperimentExecutionDetailsPropertiesRunInformation.steps = steps; + } else { + reader.skipChildren(); + } + } + + return deserializedExperimentExecutionDetailsPropertiesRunInformation; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionListResult.java index d5a187706a501..660d83bb613fe 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionListResult.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionListResult.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Model that represents a list of Experiment executions and a link for pagination. */ @Immutable -public final class ExperimentExecutionListResult { +public final class ExperimentExecutionListResult implements JsonSerializable { /* * List of Experiment executions. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * URL to retrieve the next page of Experiment executions. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -60,4 +62,44 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExperimentExecutionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExperimentExecutionListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExperimentExecutionListResult. + */ + public static ExperimentExecutionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExperimentExecutionListResult deserializedExperimentExecutionListResult + = new ExperimentExecutionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ExperimentExecutionInner.fromJson(reader1)); + deserializedExperimentExecutionListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedExperimentExecutionListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExperimentExecutionListResult; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentListResult.java index 4865337f29486..8e27107020d01 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentListResult.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentListResult.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Model that represents a list of Experiment resources and a link for pagination. */ @Immutable -public final class ExperimentListResult { +public final class ExperimentListResult implements JsonSerializable { /* * List of Experiment resources. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * URL to retrieve the next page of Experiment resources. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -60,4 +62,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExperimentListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExperimentListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExperimentListResult. + */ + public static ExperimentListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExperimentListResult deserializedExperimentListResult = new ExperimentListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ExperimentInner.fromJson(reader1)); + deserializedExperimentListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedExperimentListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExperimentListResult; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentUpdate.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentUpdate.java index a58e286236650..6bcdfca6a62d3 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentUpdate.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentUpdate.java @@ -5,26 +5,26 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; /** * Describes an experiment update. */ @Fluent -public final class ExperimentUpdate { +public final class ExperimentUpdate implements JsonSerializable { /* * The identity of the experiment resource. */ - @JsonProperty(value = "identity") private ResourceIdentity identity; /* * The tags of the experiment resource. */ - @JsonProperty(value = "tags") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; /** @@ -83,4 +83,44 @@ public void validate() { identity().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExperimentUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExperimentUpdate if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ExperimentUpdate. + */ + public static ExperimentUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExperimentUpdate deserializedExperimentUpdate = new ExperimentUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identity".equals(fieldName)) { + deserializedExperimentUpdate.identity = ResourceIdentity.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedExperimentUpdate.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedExperimentUpdate; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Filter.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Filter.java new file mode 100644 index 0000000000000..e48b2377027e4 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Filter.java @@ -0,0 +1,107 @@ +// 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 available filter types that can be applied to a targets list. + */ +@Immutable +public class Filter implements JsonSerializable { + /* + * Enum that discriminates between filter types. Currently only `Simple` type is supported. + */ + private FilterType type = FilterType.fromString("Filter"); + + /** + * Creates an instance of Filter class. + */ + public Filter() { + } + + /** + * Get the type property: Enum that discriminates between filter types. Currently only `Simple` type is supported. + * + * @return the type value. + */ + public FilterType type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + 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 Filter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Filter 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 Filter. + */ + public static Filter 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 SimpleFilter.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static Filter fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Filter deserializedFilter = new Filter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedFilter.type = FilterType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedFilter; + }); + } +} 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/ListSelector.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ListSelector.java new file mode 100644 index 0000000000000..370b21768bfd3 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ListSelector.java @@ -0,0 +1,167 @@ +// 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.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. + */ +@Fluent +public final class ListSelector extends Selector { + /* + * Enum of the selector type. + */ + private SelectorType type = SelectorType.LIST; + + /* + * List of Target references. + */ + private List targets; + + /** + * Creates an instance of ListSelector class. + */ + public ListSelector() { + } + + /** + * Get the type property: Enum of the selector type. + * + * @return the type value. + */ + @Override + public SelectorType type() { + return this.type; + } + + /** + * Get the targets property: List of Target references. + * + * @return the targets value. + */ + public List targets() { + return this.targets; + } + + /** + * Set the targets property: List of Target references. + * + * @param targets the targets value to set. + * @return the ListSelector object itself. + */ + public ListSelector withTargets(List targets) { + this.targets = targets; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ListSelector withId(String id) { + super.withId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ListSelector withFilter(Filter filter) { + super.withFilter(filter); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (targets() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property targets in model ListSelector")); + } else { + targets().forEach(e -> e.validate()); + } + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property id in model ListSelector")); + } + if (filter() != null) { + filter().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ListSelector.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 ListSelector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListSelector 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 ListSelector. + */ + public static ListSelector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListSelector deserializedListSelector = new ListSelector(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedListSelector.withId(reader.getString()); + } else if ("filter".equals(fieldName)) { + deserializedListSelector.withFilter(Filter.fromJson(reader)); + } else if ("targets".equals(fieldName)) { + List targets = reader.readArray(reader1 -> TargetReference.fromJson(reader1)); + deserializedListSelector.targets = targets; + } else if ("type".equals(fieldName)) { + deserializedListSelector.type = SelectorType.fromString(reader.getString()); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedListSelector.withAdditionalProperties(additionalProperties); + + return deserializedListSelector; + }); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationDisplay.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationDisplay.java index fb7918a6873ac..618747f434e00 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationDisplay.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationDisplay.java @@ -5,38 +5,38 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Localized display information for this particular operation. */ @Immutable -public final class OperationDisplay { +public final class OperationDisplay implements JsonSerializable { /* - * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft - * Compute". + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". */ - @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) private String provider; /* - * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job - * Schedule Collections". + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". */ - @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) private String resource; /* - * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual - * Machine", "Restart Virtual Machine". + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". */ - @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) private String operation; /* * The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ - @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /** @@ -92,4 +92,45 @@ public String description() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationListResult.java index 098f1446216e8..29958ae44eeda 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationListResult.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationListResult.java @@ -5,26 +5,28 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.chaos.fluent.models.OperationInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** - * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set - * of results. + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. */ @Immutable -public final class OperationListResult { +public final class OperationListResult implements JsonSerializable { /* * List of operations supported by the resource provider */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * URL to get the next set of operation list results (if there are any). */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -61,4 +63,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatus.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatus.java index b1e094af9f5e2..e5269e5cbc2bc 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatus.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationStatus.java @@ -6,6 +6,7 @@ import com.azure.core.management.exception.ManagementError; import com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner; +import java.time.OffsetDateTime; /** * An immutable client-side representation of OperationStatus. @@ -30,14 +31,14 @@ public interface OperationStatus { * * @return the startTime value. */ - String startTime(); + OffsetDateTime startTime(); /** * Gets the endTime property: The end time of the operation. * * @return the endTime value. */ - String endTime(); + OffsetDateTime endTime(); /** * Gets the status property: The status of the operation. diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Origin.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Origin.java index 41a6ec69321b5..132f2e8631658 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Origin.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Origin.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -43,7 +42,6 @@ public Origin() { * @param name a name to look for. * @return the corresponding Origin. */ - @JsonCreator public static Origin fromString(String name) { return fromString(name, Origin.class); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ProvisioningState.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ProvisioningState.java index bd11aa2f6ec41..c36bfe167b045 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ProvisioningState.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ProvisioningState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -57,7 +56,6 @@ public ProvisioningState() { * @param name a name to look for. * @return the corresponding ProvisioningState. */ - @JsonCreator public static ProvisioningState fromString(String name) { return fromString(name, ProvisioningState.class); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/QuerySelector.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/QuerySelector.java new file mode 100644 index 0000000000000..53cf843944098 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/QuerySelector.java @@ -0,0 +1,198 @@ +// 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.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. + */ +@Fluent +public final class QuerySelector extends Selector { + /* + * Enum of the selector type. + */ + private SelectorType type = SelectorType.QUERY; + + /* + * Azure Resource Graph (ARG) Query Language query for target resources. + */ + private String queryString; + + /* + * Subscription id list to scope resource query. + */ + private List subscriptionIds; + + /** + * Creates an instance of QuerySelector class. + */ + public QuerySelector() { + } + + /** + * Get the type property: Enum of the selector type. + * + * @return the type value. + */ + @Override + public SelectorType type() { + return this.type; + } + + /** + * Get the queryString property: Azure Resource Graph (ARG) Query Language query for target resources. + * + * @return the queryString value. + */ + public String queryString() { + return this.queryString; + } + + /** + * Set the queryString property: Azure Resource Graph (ARG) Query Language query for target resources. + * + * @param queryString the queryString value to set. + * @return the QuerySelector object itself. + */ + public QuerySelector withQueryString(String queryString) { + this.queryString = queryString; + return this; + } + + /** + * Get the subscriptionIds property: Subscription id list to scope resource query. + * + * @return the subscriptionIds value. + */ + public List subscriptionIds() { + return this.subscriptionIds; + } + + /** + * Set the subscriptionIds property: Subscription id list to scope resource query. + * + * @param subscriptionIds the subscriptionIds value to set. + * @return the QuerySelector object itself. + */ + public QuerySelector withSubscriptionIds(List subscriptionIds) { + this.subscriptionIds = subscriptionIds; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public QuerySelector withId(String id) { + super.withId(id); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public QuerySelector withFilter(Filter filter) { + super.withFilter(filter); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (queryString() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property queryString in model QuerySelector")); + } + if (subscriptionIds() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property subscriptionIds in model QuerySelector")); + } + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property id in model QuerySelector")); + } + if (filter() != null) { + filter().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(QuerySelector.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 QuerySelector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QuerySelector 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 QuerySelector. + */ + public static QuerySelector fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QuerySelector deserializedQuerySelector = new QuerySelector(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedQuerySelector.withId(reader.getString()); + } else if ("filter".equals(fieldName)) { + deserializedQuerySelector.withFilter(Filter.fromJson(reader)); + } else if ("queryString".equals(fieldName)) { + deserializedQuerySelector.queryString = reader.getString(); + } else if ("subscriptionIds".equals(fieldName)) { + List subscriptionIds = reader.readArray(reader1 -> reader1.getString()); + deserializedQuerySelector.subscriptionIds = subscriptionIds; + } else if ("type".equals(fieldName)) { + deserializedQuerySelector.type = SelectorType.fromString(reader.getString()); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedQuerySelector.withAdditionalProperties(additionalProperties); + + return deserializedQuerySelector; + }); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentity.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentity.java index 4a2268f6a8cdc..03a2b50fa7925 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentity.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentity.java @@ -6,19 +6,21 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; /** * The identity of a resource. */ @Fluent -public final class ResourceIdentity { +public final class ResourceIdentity implements JsonSerializable { /* * String of the resource identity type. */ - @JsonProperty(value = "type", required = true) private ResourceIdentityType type; /* @@ -27,20 +29,16 @@ public final class ResourceIdentity { * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/ * userAssignedIdentities/{identityName}'. */ - @JsonProperty(value = "userAssignedIdentities") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map userAssignedIdentities; /* * GUID that represents the principal ID of this resource identity. */ - @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) private String principalId; /* * GUID that represents the tenant ID of this resource identity. */ - @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) private String tenantId; /** @@ -118,8 +116,8 @@ public String tenantId() { */ public void validate() { if (type() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property type in model ResourceIdentity")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property type in model ResourceIdentity")); } if (userAssignedIdentities() != null) { userAssignedIdentities().values().forEach(e -> { @@ -131,4 +129,51 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(ResourceIdentity.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceIdentity if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceIdentity. + */ + public static ResourceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceIdentity deserializedResourceIdentity = new ResourceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedResourceIdentity.type = ResourceIdentityType.fromString(reader.getString()); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedResourceIdentity.userAssignedIdentities = userAssignedIdentities; + } else if ("principalId".equals(fieldName)) { + deserializedResourceIdentity.principalId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedResourceIdentity.tenantId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceIdentity; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentityType.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentityType.java index f8f9bb37b4c29..18904e0c93a40 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentityType.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentityType.java @@ -4,9 +4,6 @@ package com.azure.resourcemanager.chaos.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - /** * String of the resource identity type. */ @@ -41,7 +38,6 @@ public enum ResourceIdentityType { * @param value the serialized value to parse. * @return the parsed ResourceIdentityType object, or null if unable to parse. */ - @JsonCreator public static ResourceIdentityType fromString(String value) { if (value == null) { return null; @@ -58,7 +54,6 @@ public static ResourceIdentityType fromString(String value) { /** * {@inheritDoc} */ - @JsonValue @Override public String toString() { return this.value; diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Selector.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Selector.java new file mode 100644 index 0000000000000..f7503fafe683f --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Selector.java @@ -0,0 +1,213 @@ +// 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.LinkedHashMap; +import java.util.Map; + +/** + * Model that represents a selector in the Experiment resource. + */ +@Fluent +public class Selector implements JsonSerializable { + /* + * Enum of the selector type. + */ + private SelectorType type = SelectorType.fromString("Selector"); + + /* + * String of the selector ID. + */ + private String id; + + /* + * Model that represents available filter types that can be applied to a targets list. + */ + private Filter filter; + + /* + * Model that represents a selector in the Experiment resource. + */ + private Map additionalProperties; + + /** + * Creates an instance of Selector class. + */ + public Selector() { + } + + /** + * Get the type property: Enum of the selector type. + * + * @return the type value. + */ + public SelectorType type() { + return this.type; + } + + /** + * Get the id property: String of the selector ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: String of the selector ID. + * + * @param id the id value to set. + * @return the Selector object itself. + */ + public Selector withId(String id) { + this.id = id; + return this; + } + + /** + * Get the filter property: Model that represents available filter types that can be applied to a targets list. + * + * @return the filter value. + */ + public Filter filter() { + return this.filter; + } + + /** + * Set the filter property: Model that represents available filter types that can be applied to a targets list. + * + * @param filter the filter value to set. + * @return the Selector object itself. + */ + public Selector withFilter(Filter filter) { + this.filter = filter; + return this; + } + + /** + * Get the additionalProperties property: Model that represents a selector in the Experiment resource. + * + * @return the additionalProperties value. + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Model that represents a selector in the Experiment resource. + * + * @param additionalProperties the additionalProperties value to set. + * @return the Selector object itself. + */ + public Selector withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property id in model Selector")); + } + if (filter() != null) { + filter().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Selector.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 Selector from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Selector 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 Selector. + */ + public static Selector 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 ListSelector.fromJson(readerToUse.reset()); + } else if ("Query".equals(discriminatorValue)) { + return QuerySelector.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static Selector fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Selector deserializedSelector = new Selector(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSelector.id = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSelector.type = SelectorType.fromString(reader.getString()); + } else if ("filter".equals(fieldName)) { + deserializedSelector.filter = Filter.fromJson(reader); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedSelector.additionalProperties = additionalProperties; + + return deserializedSelector; + }); + } +} 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/SimpleFilter.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SimpleFilter.java new file mode 100644 index 0000000000000..5ca906606a193 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SimpleFilter.java @@ -0,0 +1,114 @@ +// 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.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model that represents a simple target filter. + */ +@Fluent +public final class SimpleFilter extends Filter { + /* + * Enum that discriminates between filter types. Currently only `Simple` type is supported. + */ + private FilterType type = FilterType.SIMPLE; + + /* + * Model that represents the Simple filter parameters. + */ + private SimpleFilterParameters parameters; + + /** + * Creates an instance of SimpleFilter class. + */ + public SimpleFilter() { + } + + /** + * Get the type property: Enum that discriminates between filter types. Currently only `Simple` type is supported. + * + * @return the type value. + */ + @Override + public FilterType type() { + return this.type; + } + + /** + * Get the parameters property: Model that represents the Simple filter parameters. + * + * @return the parameters value. + */ + public SimpleFilterParameters parameters() { + return this.parameters; + } + + /** + * Set the parameters property: Model that represents the Simple filter parameters. + * + * @param parameters the parameters value to set. + * @return the SimpleFilter object itself. + */ + public SimpleFilter withParameters(SimpleFilterParameters parameters) { + this.parameters = parameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void 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 SimpleFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SimpleFilter 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 SimpleFilter. + */ + public static SimpleFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SimpleFilter deserializedSimpleFilter = new SimpleFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedSimpleFilter.type = FilterType.fromString(reader.getString()); + } else if ("parameters".equals(fieldName)) { + deserializedSimpleFilter.parameters = SimpleFilterParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSimpleFilter; + }); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SimpleFilterParameters.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SimpleFilterParameters.java new file mode 100644 index 0000000000000..02d8302c59010 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SimpleFilterParameters.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.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.List; + +/** + * Model that represents the Simple filter parameters. + */ +@Fluent +public final class SimpleFilterParameters implements JsonSerializable { + /* + * List of Azure availability zones to filter targets by. + */ + private List zones; + + /** + * Creates an instance of SimpleFilterParameters class. + */ + public SimpleFilterParameters() { + } + + /** + * Get the zones property: List of Azure availability zones to filter targets by. + * + * @return the zones value. + */ + public List zones() { + return this.zones; + } + + /** + * Set the zones property: List of Azure availability zones to filter targets by. + * + * @param zones the zones value to set. + * @return the SimpleFilterParameters object itself. + */ + public SimpleFilterParameters withZones(List zones) { + this.zones = zones; + 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(); + jsonWriter.writeArrayField("zones", this.zones, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SimpleFilterParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SimpleFilterParameters 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 SimpleFilterParameters. + */ + public static SimpleFilterParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SimpleFilterParameters deserializedSimpleFilterParameters = new SimpleFilterParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("zones".equals(fieldName)) { + List zones = reader.readArray(reader1 -> reader1.getString()); + deserializedSimpleFilterParameters.zones = zones; + } else { + reader.skipChildren(); + } + } + + return deserializedSimpleFilterParameters; + }); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Step.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Step.java new file mode 100644 index 0000000000000..ac4e9bda5fb7a --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Step.java @@ -0,0 +1,136 @@ +// 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 a step in the Experiment resource. + */ +@Fluent +public final class Step implements JsonSerializable { + /* + * String of the step name. + */ + private String name; + + /* + * List of branches. + */ + private List branches; + + /** + * Creates an instance of Step class. + */ + public Step() { + } + + /** + * Get the name property: String of the step name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: String of the step name. + * + * @param name the name value to set. + * @return the Step object itself. + */ + public Step withName(String name) { + this.name = name; + return this; + } + + /** + * Get the branches property: List of branches. + * + * @return the branches value. + */ + public List branches() { + return this.branches; + } + + /** + * Set the branches property: List of branches. + * + * @param branches the branches value to set. + * @return the Step object itself. + */ + public Step withBranches(List branches) { + this.branches = branches; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property name in model Step")); + } + if (branches() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property branches in model Step")); + } else { + branches().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Step.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 Step from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Step 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 Step. + */ + public static Step fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Step deserializedStep = new Step(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedStep.name = reader.getString(); + } else if ("branches".equals(fieldName)) { + List branches = reader.readArray(reader1 -> Branch.fromJson(reader1)); + deserializedStep.branches = branches; + } else { + reader.skipChildren(); + } + } + + return deserializedStep; + }); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/StepStatus.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/StepStatus.java index e615c194cedac..2695112b2e07d 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/StepStatus.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/StepStatus.java @@ -5,36 +5,36 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Model that represents the a list of branches and branch statuses. */ @Immutable -public final class StepStatus { +public final class StepStatus implements JsonSerializable { /* * The name of the step. */ - @JsonProperty(value = "stepName", access = JsonProperty.Access.WRITE_ONLY) private String stepName; /* * The id of the step. */ - @JsonProperty(value = "stepId", access = JsonProperty.Access.WRITE_ONLY) private String stepId; /* * The value of the status of the step. */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) private String status; /* * The array of branches. */ - @JsonProperty(value = "branches", access = JsonProperty.Access.WRITE_ONLY) private List branches; /** @@ -89,4 +89,46 @@ public void validate() { branches().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StepStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StepStatus if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the StepStatus. + */ + public static StepStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StepStatus deserializedStepStatus = new StepStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("stepName".equals(fieldName)) { + deserializedStepStatus.stepName = reader.getString(); + } else if ("stepId".equals(fieldName)) { + deserializedStepStatus.stepId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedStepStatus.status = reader.getString(); + } else if ("branches".equals(fieldName)) { + List branches = reader.readArray(reader1 -> BranchStatus.fromJson(reader1)); + deserializedStepStatus.branches = branches; + } else { + reader.skipChildren(); + } + } + + return deserializedStepStatus; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetListResult.java index 6fe46f644dd77..86686d0a2d92d 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetListResult.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetListResult.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.chaos.fluent.models.TargetInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Model that represents a list of Target resources and a link for pagination. */ @Immutable -public final class TargetListResult { +public final class TargetListResult implements JsonSerializable { /* * List of Target resources. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * URL to retrieve the next page of Target resources. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -60,4 +62,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TargetListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TargetListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TargetListResult. + */ + public static TargetListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TargetListResult deserializedTargetListResult = new TargetListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> TargetInner.fromJson(reader1)); + deserializedTargetListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedTargetListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTargetListResult; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReference.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReference.java index dfda7e9f14915..ce4f935b44050 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReference.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReference.java @@ -6,23 +6,25 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Model that represents a reference to a Target in the selector. */ @Fluent -public final class TargetReference { +public final class TargetReference implements JsonSerializable { /* * Enum of the Target reference type. */ - @JsonProperty(value = "type", required = true) private TargetReferenceType type; /* * String of the resource ID of a Target resource. */ - @JsonProperty(value = "id", required = true) private String id; /** @@ -78,14 +80,54 @@ public TargetReference withId(String id) { */ public void validate() { if (type() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property type in model TargetReference")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property type in model TargetReference")); } if (id() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property id in model TargetReference")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property id in model TargetReference")); } } private static final ClientLogger LOGGER = new ClientLogger(TargetReference.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TargetReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TargetReference if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TargetReference. + */ + public static TargetReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TargetReference deserializedTargetReference = new TargetReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedTargetReference.type = TargetReferenceType.fromString(reader.getString()); + } else if ("id".equals(fieldName)) { + deserializedTargetReference.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTargetReference; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReferenceType.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReferenceType.java index 6e196ebcd7f12..daed565c181ee 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReferenceType.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReferenceType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -32,7 +31,6 @@ public TargetReferenceType() { * @param name a name to look for. * @return the corresponding TargetReferenceType. */ - @JsonCreator public static TargetReferenceType fromString(String name) { return fromString(name, TargetReferenceType.class); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypeListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypeListResult.java index 1eca9e0228510..6ecb5da31c97a 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypeListResult.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypeListResult.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.chaos.fluent.models.TargetTypeInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Model that represents a list of Target Type resources and a link for pagination. */ @Immutable -public final class TargetTypeListResult { +public final class TargetTypeListResult implements JsonSerializable { /* * List of Target Type resources. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * URL to retrieve the next page of Target Type resources. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -60,4 +62,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TargetTypeListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TargetTypeListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the TargetTypeListResult. + */ + public static TargetTypeListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TargetTypeListResult deserializedTargetTypeListResult = new TargetTypeListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> TargetTypeInner.fromJson(reader1)); + deserializedTargetTypeListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedTargetTypeListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTargetTypeListResult; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/UserAssignedIdentity.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/UserAssignedIdentity.java index 7f8c9eba71ef9..6a9ef1fc7934a 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/UserAssignedIdentity.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/UserAssignedIdentity.java @@ -5,24 +5,26 @@ package com.azure.resourcemanager.chaos.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.UUID; /** * User assigned identity properties. */ @Immutable -public final class UserAssignedIdentity { +public final class UserAssignedIdentity implements JsonSerializable { /* * The principal ID of the assigned identity. */ - @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) private UUID principalId; /* * The client ID of the assigned identity. */ - @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) private UUID clientId; /** @@ -56,4 +58,43 @@ public UUID clientId() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the UserAssignedIdentity. + */ + public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentity.principalId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/module-info.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/module-info.java index 3eee0d4e8ba9e..e40af38897a9e 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/module-info.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/module-info.java @@ -10,6 +10,6 @@ exports com.azure.resourcemanager.chaos.fluent.models; exports com.azure.resourcemanager.chaos.models; - opens com.azure.resourcemanager.chaos.fluent.models to com.azure.core, com.fasterxml.jackson.databind; - opens com.azure.resourcemanager.chaos.models to com.azure.core, com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.chaos.fluent.models to com.azure.core; + opens com.azure.resourcemanager.chaos.models to com.azure.core; } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/proxy-config.json b/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/proxy-config.json index f87b72c22e1d8..0a68244d3b7c1 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/proxy-config.json +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/proxy-config.json @@ -1 +1 @@ -[ [ "com.azure.resourcemanager.chaos.implementation.CapabilitiesClientImpl$CapabilitiesService" ], [ "com.azure.resourcemanager.chaos.implementation.CapabilityTypesClientImpl$CapabilityTypesService" ], [ "com.azure.resourcemanager.chaos.implementation.ExperimentsClientImpl$ExperimentsService" ], [ "com.azure.resourcemanager.chaos.implementation.OperationStatusesClientImpl$OperationStatusesService" ], [ "com.azure.resourcemanager.chaos.implementation.OperationsClientImpl$OperationsService" ], [ "com.azure.resourcemanager.chaos.implementation.TargetTypesClientImpl$TargetTypesService" ], [ "com.azure.resourcemanager.chaos.implementation.TargetsClientImpl$TargetsService" ] ] \ No newline at end of file +[["com.azure.resourcemanager.chaos.implementation.CapabilitiesClientImpl$CapabilitiesService"],["com.azure.resourcemanager.chaos.implementation.CapabilityTypesClientImpl$CapabilityTypesService"],["com.azure.resourcemanager.chaos.implementation.ExperimentsClientImpl$ExperimentsService"],["com.azure.resourcemanager.chaos.implementation.OperationStatusesClientImpl$OperationStatusesService"],["com.azure.resourcemanager.chaos.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.chaos.implementation.TargetTypesClientImpl$TargetTypesService"],["com.azure.resourcemanager.chaos.implementation.TargetsClientImpl$TargetsService"]] \ No newline at end of file diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/reflect-config.json b/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/reflect-config.json index 2f448a3b7d62b..0faaad5435f39 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/reflect-config.json +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-chaos/reflect-config.json @@ -1,271 +1 @@ -[ { - "name" : "com.azure.resourcemanager.chaos.models.CapabilityListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.fluent.models.CapabilityInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.fluent.models.CapabilityProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.CapabilityTypeListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.CapabilityTypePropertiesRuntimeProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ExperimentListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ResourceIdentity", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.UserAssignedIdentity", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ChaosExperimentStep", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ChaosExperimentBranch", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ChaosExperimentAction", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ChaosTargetSelector", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ChaosTargetFilter", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ExperimentUpdate", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ExperimentExecutionListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsPropertiesRunInformation", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.StepStatus", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.BranchStatus", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ActionStatus", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ExperimentExecutionActionTargetDetailsProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ExperimentExecutionActionTargetDetailsError", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.OperationListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.fluent.models.OperationInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.OperationDisplay", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.TargetTypeListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.fluent.models.TargetTypeInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.fluent.models.TargetTypeProperties", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.TargetListResult", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.fluent.models.TargetInner", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.DelayAction", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.DiscreteAction", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.KeyValuePair", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ContinuousAction", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ChaosTargetListSelector", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.TargetReference", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ChaosTargetQuerySelector", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ChaosTargetSimpleFilter", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ChaosTargetSimpleFilterParameters", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ProvisioningState", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.SelectorType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.FilterType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.Origin", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ActionType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.TargetReferenceType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -}, { - "name" : "com.azure.resourcemanager.chaos.models.ResourceIdentityType", - "allDeclaredConstructors" : true, - "allDeclaredFields" : true, - "allDeclaredMethods" : true -} ] \ No newline at end of file +[{"name":"com.azure.resourcemanager.chaos.fluent.models.OperationStatusInner","allDeclaredConstructors":true,"allDeclaredFields":true,"allDeclaredMethods":true}] \ No newline at end of file diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateSamples.java index a1e390fbe238d..8be9a5ec8c596 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 @@ -12,7 +12,8 @@ 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/preview/2024-12-01-preview/examples/CreateUpdateCapability. + * json */ /** * Sample code: Create/update a Capability that extends a virtual machine Target resource. @@ -21,8 +22,8 @@ public final class CapabilitiesCreateOrUpdateSamples { */ public static void createUpdateACapabilityThatExtendsAVirtualMachineTargetResource( com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.capabilities().createOrUpdateWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", - "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.0", new CapabilityInner(), - com.azure.core.util.Context.NONE); + manager.capabilities() + .createOrUpdateWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", + "Microsoft-VirtualMachine", "Shutdown-1.0", new CapabilityInner(), com.azure.core.util.Context.NONE); } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteSamples.java index e50d25508504d..ee9bc9616d874 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/preview/2024-12-01-preview/examples/DeleteCapability.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.Compute", "virtualMachines", "exampleVM", + "Microsoft-VirtualMachine", "Shutdown-1.0", com.azure.core.util.Context.NONE); } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetSamples.java index f551931ddaf07..2b93b72a4a9b5 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/preview/2024-12-01-preview/examples/GetCapability.json */ /** * Sample code: Get a Capability that extends a virtual machine Target resource. @@ -19,7 +19,8 @@ public final class CapabilitiesGetSamples { */ public static void getACapabilityThatExtendsAVirtualMachineTargetResource(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.capabilities().getWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", - "Microsoft-VirtualMachine", "Shutdown-1.0", com.azure.core.util.Context.NONE); + manager.capabilities() + .getWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", + "Microsoft-VirtualMachine", "Shutdown-1.0", com.azure.core.util.Context.NONE); } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListSamples.java index 8df30c20895ff..c7507601d2e43 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/preview/2024-12-01-preview/examples/ListCapabilities.json */ /** * Sample code: List all Capabilities that extend a virtual machine Target resource. @@ -19,7 +19,8 @@ public final class CapabilitiesListSamples { */ public static void listAllCapabilitiesThatExtendAVirtualMachineTargetResource( com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.capabilities().list("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", - "Microsoft-VirtualMachine", null, com.azure.core.util.Context.NONE); + manager.capabilities() + .list("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", null, + com.azure.core.util.Context.NONE); } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetSamples.java index 2dfe563f27d7e..bdefb29814ed6 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/preview/2024-12-01-preview/examples/GetCapabilityType.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..9388ed608b8fb 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/preview/2024-12-01-preview/examples/ListCapabilityTypes.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/ExperimentsCancelSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCancelSamples.java index 990b2f16fdb8e..a45283bc83a09 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/preview/2024-12-01-preview/examples/CancelExperiment.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..2588c5e567bd8 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 @@ -4,13 +4,13 @@ package com.azure.resourcemanager.chaos.generated; -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.Branch; import com.azure.resourcemanager.chaos.models.ContinuousAction; import com.azure.resourcemanager.chaos.models.KeyValuePair; +import com.azure.resourcemanager.chaos.models.ListSelector; import com.azure.resourcemanager.chaos.models.ResourceIdentity; import com.azure.resourcemanager.chaos.models.ResourceIdentityType; +import com.azure.resourcemanager.chaos.models.Step; import com.azure.resourcemanager.chaos.models.TargetReference; import com.azure.resourcemanager.chaos.models.TargetReferenceType; import java.time.Duration; @@ -22,7 +22,8 @@ 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/preview/2024-12-01-preview/examples/CreateUpdateExperiment. + * json */ /** * Sample code: Create/update a Experiment in a resource group. @@ -30,20 +31,24 @@ 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") + Arrays.asList(new Step().withName("step1") + .withBranches(Arrays.asList(new Branch().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(); + .withSelectors(Arrays.asList(new ListSelector().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(); } } 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..ff038c3d777d0 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/preview/2024-12-01-preview/examples/DeleteExperiment.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 index b4b1018aeedaf..70bf507d0bf65 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsExecutionDetailsSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsExecutionDetailsSamples.java @@ -10,7 +10,7 @@ public final class ExperimentsExecutionDetailsSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DetailsExperiment.json + * specification/chaos/resource-manager/Microsoft.Chaos/preview/2024-12-01-preview/examples/DetailsExperiment.json */ /** * Sample code: Get experiment execution details. @@ -18,7 +18,8 @@ public final class ExperimentsExecutionDetailsSamples { * @param manager Entry point to ChaosManager. */ public static void getExperimentExecutionDetails(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().executionDetailsWithResponse("exampleRG", "exampleExperiment", - "f24500ad-744e-4a26-864b-b76199eac333", com.azure.core.util.Context.NONE); + manager.experiments() + .executionDetailsWithResponse("exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupSamples.java index bcff08a197cb5..d4c82b4a6e709 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/preview/2024-12-01-preview/examples/GetExperiment.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/ExperimentsGetExecutionSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionSamples.java index 6c17f0dddf124..4ad93297e0313 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionSamples.java @@ -10,7 +10,8 @@ public final class ExperimentsGetExecutionSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperimentExecution.json + * specification/chaos/resource-manager/Microsoft.Chaos/preview/2024-12-01-preview/examples/GetExperimentExecution. + * json */ /** * Sample code: Get the execution of a Experiment. @@ -18,7 +19,8 @@ public final class ExperimentsGetExecutionSamples { * @param manager Entry point to ChaosManager. */ public static void getTheExecutionOfAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.experiments().getExecutionWithResponse("exampleRG", "exampleExperiment", - "f24500ad-744e-4a26-864b-b76199eac333", com.azure.core.util.Context.NONE); + manager.experiments() + .getExecutionWithResponse("exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllExecutionsSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllExecutionsSamples.java index 27038b5ac78d6..6b5f2ecea3a84 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/ExperimentsListAllExecutionsSamples.java @@ -10,7 +10,8 @@ public final class ExperimentsListAllExecutionsSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentExecutions.json + * specification/chaos/resource-manager/Microsoft.Chaos/preview/2024-12-01-preview/examples/ListExperimentExecutions + * .json */ /** * Sample code: List all executions of an Experiment. 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..ebd5863344828 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 @@ -9,9 +9,8 @@ */ public final class ExperimentsListByResourceGroupSamples { /* - * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInAResourceGroup. - * json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2024-12-01-preview/examples/ + * ListExperimentsInAResourceGroup.json */ /** * Sample code: List all Experiments in a resource group. 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..a461cefe51c03 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 @@ -9,9 +9,8 @@ */ public final class ExperimentsListSamples { /* - * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInASubscription. - * json + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2024-12-01-preview/examples/ + * ListExperimentsInASubscription.json */ /** * Sample code: List all Experiments in a subscription. 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..9a27c3e53eb2e 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/preview/2024-12-01-preview/examples/StartExperiment.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..6acc1c3d3d452 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 @@ -17,7 +17,7 @@ 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/preview/2024-12-01-preview/examples/UpdateExperiment.json */ /** * Sample code: Update an Experiment in a resource group. @@ -28,10 +28,12 @@ public static void updateAnExperimentInAResourceGroup(com.azure.resourcemanager. Experiment resource = manager.experiments() .getByResourceGroupWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE) .getValue(); - resource.update().withTags(mapOf("key1", "fakeTokenPlaceholder", "key2", "fakeTokenPlaceholder")).withIdentity( - new ResourceIdentity().withType(ResourceIdentityType.USER_ASSIGNED).withUserAssignedIdentities(mapOf( - "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI", - new UserAssignedIdentity()))) + resource.update() + .withTags(mapOf("key1", "fakeTokenPlaceholder", "key2", "fakeTokenPlaceholder")) + .withIdentity(new ResourceIdentity().withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI", + new UserAssignedIdentity()))) .apply(); } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/OperationStatusesGetSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/OperationStatusesGetSamples.java index 29c02fa4fa086..6253da4c536ae 100644 --- a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/OperationStatusesGetSamples.java +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/OperationStatusesGetSamples.java @@ -10,7 +10,7 @@ public final class OperationStatusesGetSamples { /* * x-ms-original-file: - * specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetOperationStatus.json + * specification/chaos/resource-manager/Microsoft.Chaos/preview/2024-12-01-preview/examples/GetOperationStatus.json */ /** * Sample code: Get specific operation status. @@ -18,7 +18,7 @@ public final class OperationStatusesGetSamples { * @param manager Entry point to ChaosManager. */ public static void getSpecificOperationStatus(com.azure.resourcemanager.chaos.ChaosManager manager) { - manager.operationStatuses().getWithResponse("West US", "713192d7-503f-477a-9cfe-4efc3ee2bd11", - com.azure.core.util.Context.NONE); + manager.operationStatuses() + .getWithResponse("West US", "713192d7-503f-477a-9cfe-4efc3ee2bd11", com.azure.core.util.Context.NONE); } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetSamples.java index 8dcf3c0cc1d23..ea1f393e75091 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/preview/2024-12-01-preview/examples/GetTargetType.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..525dba2e51295 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/preview/2024-12-01-preview/examples/ListTargetTypes.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..fb3d41e423426 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 @@ -17,7 +17,7 @@ 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/preview/2024-12-01-preview/examples/CreateUpdateTarget.json */ /** * Sample code: Create/update a Target that extends a virtual machine resource. @@ -26,13 +26,14 @@ public final class TargetsCreateOrUpdateSamples { */ public static void createUpdateATargetThatExtendsAVirtualMachineResource( com.azure.resourcemanager.chaos.ChaosManager manager) throws IOException { - manager.targets().createOrUpdateWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", - "Microsoft-Agent", - new TargetInner().withProperties(mapOf("identities", - SerializerFactory.createDefaultManagementSerializerAdapter().deserialize( - "[{\"type\":\"CertificateSubjectIssuer\",\"subject\":\"CN=example.subject\"}]", Object.class, - SerializerEncoding.JSON))), - com.azure.core.util.Context.NONE); + manager.targets() + .createOrUpdateWithResponse("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", + "Microsoft-Agent", + new TargetInner().withProperties(mapOf("identities", + SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize("[{\"type\":\"CertificateSubjectIssuer\",\"subject\":\"CN=example.subject\"}]", + Object.class, SerializerEncoding.JSON))), + com.azure.core.util.Context.NONE); } // Use "Map.of" if available diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteSamples.java index ebce9379ebfcf..45d06dbba23a9 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/preview/2024-12-01-preview/examples/DeleteTarget.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.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsGetSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsGetSamples.java index 2a2a0ec5e3f5c..a750b05846883 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/preview/2024-12-01-preview/examples/GetTarget.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.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsListSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsListSamples.java index 0bc677e2566ed..5eb31a9e996e4 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/preview/2024-12-01-preview/examples/ListTargets.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); - } -}