From ead2bd4598d45666e2b2c505821f0c57b2250d7b Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 22 Mar 2023 20:19:49 +0000 Subject: [PATCH] CodeGen from PR 23171 in Azure/azure-rest-api-specs Merge b46b17e05f05d76b92b1d8b46c5399c099388e95 into 7824f04db829f016255f0042e86f7061401ca5bb --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../azure-resourcemanager-chaos/CHANGELOG.md | 5 + .../azure-resourcemanager-chaos/README.md | 105 + .../azure-resourcemanager-chaos/SAMPLE.md | 709 +++++ sdk/chaos/azure-resourcemanager-chaos/pom.xml | 61 + .../resourcemanager/chaos/ChaosManager.java | 362 +++ .../chaos/fluent/CapabilitiesClient.java | 210 ++ .../chaos/fluent/CapabilityTypesClient.java | 76 + .../chaos/fluent/ChaosManagementClient.java | 88 + .../chaos/fluent/ExperimentsClient.java | 362 +++ .../chaos/fluent/OperationsClient.java | 36 + .../chaos/fluent/TargetTypesClient.java | 68 + .../chaos/fluent/TargetsClient.java | 191 ++ .../chaos/fluent/models/CapabilityInner.java | 104 + .../fluent/models/CapabilityProperties.java | 99 + .../fluent/models/CapabilityTypeInner.java | 183 ++ .../models/CapabilityTypeProperties.java | 179 ++ .../ExperimentCancelOperationResultInner.java | 54 + .../ExperimentExecutionDetailsInner.java | 161 ++ .../ExperimentExecutionDetailsProperties.java | 149 + .../chaos/fluent/models/ExperimentInner.java | 185 ++ .../fluent/models/ExperimentProperties.java | 124 + .../ExperimentStartOperationResultInner.java | 54 + .../fluent/models/ExperimentStatusInner.java | 115 + .../models/ExperimentStatusProperties.java | 70 + .../chaos/fluent/models/OperationInner.java | 127 + .../chaos/fluent/models/TargetInner.java | 104 + .../chaos/fluent/models/TargetTypeInner.java | 129 + .../fluent/models/TargetTypeProperties.java | 85 + .../chaos/fluent/models/package-info.java | 6 + .../chaos/fluent/package-info.java | 6 + .../CapabilitiesClientImpl.java | 1348 +++++++++ .../implementation/CapabilitiesImpl.java | 222 ++ .../chaos/implementation/CapabilityImpl.java | 64 + .../implementation/CapabilityTypeImpl.java | 86 + .../CapabilityTypesClientImpl.java | 543 ++++ .../implementation/CapabilityTypesImpl.java | 73 + .../ChaosManagementClientBuilder.java | 144 + .../ChaosManagementClientImpl.java | 360 +++ .../ExperimentCancelOperationResultImpl.java | 36 + .../ExperimentExecutionDetailsImpl.java | 74 + .../chaos/implementation/ExperimentImpl.java | 251 ++ .../ExperimentStartOperationResultImpl.java | 36 + .../implementation/ExperimentStatusImpl.java | 53 + .../implementation/ExperimentsClientImpl.java | 2556 +++++++++++++++++ .../chaos/implementation/ExperimentsImpl.java | 306 ++ .../chaos/implementation/OperationImpl.java | 50 + .../implementation/OperationsClientImpl.java | 272 ++ .../chaos/implementation/OperationsImpl.java | 44 + .../chaos/implementation/TargetImpl.java | 59 + .../chaos/implementation/TargetTypeImpl.java | 71 + .../implementation/TargetTypesClientImpl.java | 496 ++++ .../chaos/implementation/TargetTypesImpl.java | 68 + .../implementation/TargetsClientImpl.java | 1226 ++++++++ .../chaos/implementation/TargetsImpl.java | 196 ++ .../chaos/implementation/Utils.java | 204 ++ .../chaos/implementation/package-info.java | 6 + .../resourcemanager/chaos/models/Action.java | 71 + .../chaos/models/ActionStatus.java | 119 + .../chaos/models/ActionType.java | 44 + .../resourcemanager/chaos/models/Branch.java | 90 + .../chaos/models/BranchStatus.java | 88 + .../chaos/models/Capabilities.java | 200 ++ .../chaos/models/Capability.java | 81 + .../chaos/models/CapabilityListResult.java | 59 + .../chaos/models/CapabilityType.java | 117 + .../models/CapabilityTypeListResult.java | 59 + ...ityTypePropertiesPermissionsNecessary.java | 77 + ...bilityTypePropertiesRuntimeProperties.java | 39 + .../chaos/models/CapabilityTypes.java | 69 + .../chaos/models/ContinuousAction.java | 137 + .../chaos/models/DelayAction.java | 72 + .../chaos/models/DiscreteAction.java | 105 + .../chaos/models/Experiment.java | 322 +++ .../ExperimentCancelOperationResult.java | 31 + ...mentExecutionActionTargetDetailsError.java | 54 + ...xecutionActionTargetDetailsProperties.java | 103 + .../models/ExperimentExecutionDetails.java | 95 + .../ExperimentExecutionDetailsListResult.java | 59 + ...cutionDetailsPropertiesRunInformation.java | 43 + .../chaos/models/ExperimentListResult.java | 59 + .../ExperimentStartOperationResult.java | 31 + .../chaos/models/ExperimentStatus.java | 60 + .../models/ExperimentStatusListResult.java | 59 + .../chaos/models/ExperimentUpdate.java | 53 + .../chaos/models/Experiments.java | 325 +++ .../resourcemanager/chaos/models/Filter.java | 33 + .../chaos/models/FilterType.java | 44 + .../chaos/models/KeyValuePair.java | 89 + .../chaos/models/Operation.java | 56 + .../chaos/models/OperationDisplay.java | 91 + .../chaos/models/OperationListResult.java | 62 + .../chaos/models/Operations.java | 31 + .../resourcemanager/chaos/models/Origin.java | 53 + .../chaos/models/ResourceIdentity.java | 133 + .../chaos/models/ResourceIdentityType.java | 54 + .../chaos/models/Selector.java | 150 + .../chaos/models/SelectorType.java | 57 + .../chaos/models/SimpleFilter.java | 59 + .../chaos/models/SimpleFilterParameters.java | 51 + .../resourcemanager/chaos/models/Step.java | 90 + .../chaos/models/StepStatus.java | 88 + .../resourcemanager/chaos/models/Target.java | 61 + .../chaos/models/TargetListResult.java | 59 + .../chaos/models/TargetReference.java | 85 + .../chaos/models/TargetType.java | 82 + .../chaos/models/TargetTypeListResult.java | 59 + .../chaos/models/TargetTypes.java | 61 + .../resourcemanager/chaos/models/Targets.java | 181 ++ .../chaos/models/UserAssignedIdentities.java | 54 + .../chaos/models/package-info.java | 6 + .../resourcemanager/chaos/package-info.java | 6 + .../src/main/java/module-info.java | 19 + .../CapabilitiesCreateOrUpdateSamples.java | 33 + .../generated/CapabilitiesDeleteSamples.java | 30 + .../generated/CapabilitiesGetSamples.java | 30 + .../generated/CapabilitiesListSamples.java | 30 + .../generated/CapabilityTypesGetSamples.java | 23 + .../generated/CapabilityTypesListSamples.java | 21 + .../generated/ExperimentsCancelSamples.java | 20 + .../ExperimentsCreateOrUpdateSamples.java | 73 + .../generated/ExperimentsDeleteSamples.java | 22 + .../ExperimentsGetByResourceGroupSamples.java | 22 + ...ExperimentsGetExecutionDetailsSamples.java | 26 + .../ExperimentsGetStatusSamples.java | 26 + .../ExperimentsListAllStatusesSamples.java | 20 + ...ExperimentsListByResourceGroupSamples.java | 20 + ...xperimentsListExecutionDetailsSamples.java | 20 + .../generated/ExperimentsListSamples.java | 20 + .../generated/ExperimentsStartSamples.java | 20 + .../generated/ExperimentsUpdateSamples.java | 52 + .../generated/TargetTypesGetSamples.java | 20 + .../generated/TargetTypesListSamples.java | 20 + .../TargetsCreateOrUpdateSamples.java | 57 + .../chaos/generated/TargetsDeleteSamples.java | 29 + .../chaos/generated/TargetsGetSamples.java | 29 + .../chaos/generated/TargetsListSamples.java | 29 + sdk/chaos/ci.yml | 47 + sdk/chaos/pom.xml | 15 + 140 files changed, 18342 insertions(+) create mode 100644 sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md create mode 100644 sdk/chaos/azure-resourcemanager-chaos/README.md create mode 100644 sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md create mode 100644 sdk/chaos/azure-resourcemanager-chaos/pom.xml create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/ChaosManager.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/CapabilitiesClient.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/CapabilityTypesClient.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ChaosManagementClient.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ExperimentsClient.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/OperationsClient.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/TargetTypesClient.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/TargetsClient.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityInner.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityProperties.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeInner.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeProperties.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentCancelOperationResultInner.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsInner.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsProperties.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentInner.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentProperties.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStartOperationResultInner.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStatusInner.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStatusProperties.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationInner.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetInner.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeInner.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeProperties.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/package-info.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/package-info.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilitiesClientImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilitiesImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypeImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesClientImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientBuilder.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentCancelOperationResultImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionDetailsImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentStartOperationResultImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentStatusImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsClientImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypeImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesClientImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsClientImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsImpl.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/Utils.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/package-info.java 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/ActionStatus.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ActionType.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Branch.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/BranchStatus.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Capabilities.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Capability.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityListResult.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityType.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypeListResult.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypePropertiesPermissionsNecessary.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypePropertiesRuntimeProperties.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypes.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ContinuousAction.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DelayAction.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DiscreteAction.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiment.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentCancelOperationResult.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsError.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsProperties.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetails.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsListResult.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsPropertiesRunInformation.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentListResult.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStartOperationResult.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStatus.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStatusListResult.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentUpdate.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiments.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/FilterType.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/KeyValuePair.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Operation.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationDisplay.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationListResult.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Operations.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Origin.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentity.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentityType.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/SelectorType.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 create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/StepStatus.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Target.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetListResult.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReference.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetType.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypeListResult.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypes.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Targets.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/UserAssignedIdentities.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/package-info.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/package-info.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/main/java/module-info.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCancelSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsDeleteSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionDetailsSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetStatusSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllStatusesSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListExecutionDetailsSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsStartSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsUpdateSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesListSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsGetSamples.java create mode 100644 sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsListSamples.java create mode 100644 sdk/chaos/ci.yml create mode 100644 sdk/chaos/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 1d7982c4b640d..f4a5c07fadda8 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -400,6 +400,7 @@ com.azure.resourcemanager:azure-resourcemanager-storagemover;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-containerservicefleet;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-voiceservices;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-graphservices;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-chaos;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index 4d9066affde57..2d6a9b5cb75e4 100644 --- a/pom.xml +++ b/pom.xml @@ -38,6 +38,7 @@ sdk/boms sdk/botservice sdk/changeanalysis + sdk/chaos sdk/cognitiveservices sdk/commerce sdk/communication diff --git a/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md b/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md new file mode 100644 index 0000000000000..1fc7467a09b1e --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-03-22) + +- 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-2023-04. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/chaos/azure-resourcemanager-chaos/README.md b/sdk/chaos/azure-resourcemanager-chaos/README.md new file mode 100644 index 0000000000000..fc9da051626cf --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/README.md @@ -0,0 +1,105 @@ +# Azure Resource Manager Chaos client library for Java + +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-2023-04. 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 + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-chaos;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-chaos + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables. + +- `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. + +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: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ChaosManager manager = ChaosManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[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 +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md b/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md new file mode 100644 index 0000000000000..7168be45def6c --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/SAMPLE.md @@ -0,0 +1,709 @@ +# Code snippets and samples + + +## Capabilities + +- [CreateOrUpdate](#capabilities_createorupdate) +- [Delete](#capabilities_delete) +- [Get](#capabilities_get) +- [List](#capabilities_list) + +## CapabilityTypes + +- [Get](#capabilitytypes_get) +- [List](#capabilitytypes_list) + +## Experiments + +- [Cancel](#experiments_cancel) +- [CreateOrUpdate](#experiments_createorupdate) +- [Delete](#experiments_delete) +- [GetByResourceGroup](#experiments_getbyresourcegroup) +- [GetExecutionDetails](#experiments_getexecutiondetails) +- [GetStatus](#experiments_getstatus) +- [List](#experiments_list) +- [ListAllStatuses](#experiments_listallstatuses) +- [ListByResourceGroup](#experiments_listbyresourcegroup) +- [ListExecutionDetails](#experiments_listexecutiondetails) +- [Start](#experiments_start) +- [Update](#experiments_update) + +## TargetTypes + +- [Get](#targettypes_get) +- [List](#targettypes_list) + +## Targets + +- [CreateOrUpdate](#targets_createorupdate) +- [Delete](#targets_delete) +- [Get](#targets_get) +- [List](#targets_list) +### Capabilities_CreateOrUpdate + +```java +import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; + +/** Samples for Capabilities CreateOrUpdate. */ +public final class CapabilitiesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/CreateOrUpdateACapability.json + */ + /** + * Sample code: Create/update a Capability that extends a virtual machine Target resource. + * + * @param manager Entry point to ChaosManager. + */ + 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); + } +} +``` + +### Capabilities_Delete + +```java +/** Samples for Capabilities Delete. */ +public final class CapabilitiesDeleteSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/DeleteACapability.json + */ + /** + * Sample code: Delete a Capability that extends a virtual machine Target resource. + * + * @param manager Entry point to ChaosManager. + */ + 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); + } +} +``` + +### Capabilities_Get + +```java +/** Samples for Capabilities Get. */ +public final class CapabilitiesGetSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/GetACapability.json + */ + /** + * Sample code: Get a Capability that extends a virtual machine Target resource. + * + * @param manager Entry point to ChaosManager. + */ + 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); + } +} +``` + +### Capabilities_List + +```java +/** Samples for Capabilities List. */ +public final class CapabilitiesListSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/ListCapabilities.json + */ + /** + * Sample code: List all Capabilities that extend a virtual machine Target resource. + * + * @param manager Entry point to ChaosManager. + */ + 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); + } +} +``` + +### CapabilityTypes_Get + +```java +/** Samples for CapabilityTypes Get. */ +public final class CapabilityTypesGetSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/GetACapabilityType.json + */ + /** + * Sample code: Get a Capability Type for a virtual machine Target resource on westus2 location. + * + * @param manager Entry point to ChaosManager. + */ + 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); + } +} +``` + +### CapabilityTypes_List + +```java +/** Samples for CapabilityTypes List. */ +public final class CapabilityTypesListSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/ListCapabilityTypes.json + */ + /** + * Sample code: List all Capability Types for a virtual machine Target resource on westus2 location. + * + * @param manager Entry point to ChaosManager. + */ + public static void listAllCapabilityTypesForAVirtualMachineTargetResourceOnWestus2Location( + com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.capabilityTypes().list("westus2", "Microsoft-VirtualMachine", null, com.azure.core.util.Context.NONE); + } +} +``` + +### Experiments_Cancel + +```java +/** Samples for Experiments Cancel. */ +public final class ExperimentsCancelSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/CancelAExperiment.json + */ + /** + * Sample code: Cancel a running Experiment. + * + * @param manager Entry point to ChaosManager. + */ + public static void cancelARunningExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments().cancelWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + } +} +``` + +### Experiments_CreateOrUpdate + +```java +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.ResourceIdentity; +import com.azure.resourcemanager.chaos.models.ResourceIdentityType; +import com.azure.resourcemanager.chaos.models.Selector; +import com.azure.resourcemanager.chaos.models.SelectorType; +import com.azure.resourcemanager.chaos.models.Step; +import com.azure.resourcemanager.chaos.models.TargetReference; +import java.time.Duration; +import java.util.Arrays; + +/** Samples for Experiments CreateOrUpdate. */ +public final class ExperimentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/CreateOrUpdateAExperiment.json + */ + /** + * Sample code: Create/update a Experiment in a resource group. + * + * @param manager Entry point to ChaosManager. + */ + public static void createUpdateAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager + .experiments() + .define("exampleExperiment") + .withRegion("eastus2euap") + .withExistingResourceGroup("exampleRG") + .withSteps( + Arrays + .asList( + new 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 Selector() + .withType(SelectorType.LIST) + .withId("selector1") + .withTargets( + Arrays + .asList( + new TargetReference() + .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(); + } +} +``` + +### Experiments_Delete + +```java +/** Samples for Experiments Delete. */ +public final class ExperimentsDeleteSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/DeleteAExperiment.json + */ + /** + * Sample code: Delete a Experiment in a resource group. + * + * @param manager Entry point to ChaosManager. + */ + public static void deleteAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager + .experiments() + .deleteByResourceGroupWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + } +} +``` + +### Experiments_GetByResourceGroup + +```java +/** Samples for Experiments GetByResourceGroup. */ +public final class ExperimentsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/GetAExperiment.json + */ + /** + * Sample code: Get a Experiment in a resource group. + * + * @param manager Entry point to ChaosManager. + */ + public static void getAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager + .experiments() + .getByResourceGroupWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + } +} +``` + +### Experiments_GetExecutionDetails + +```java +/** Samples for Experiments GetExecutionDetails. */ +public final class ExperimentsGetExecutionDetailsSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/GetAExperimentExecutionDetails.json + */ + /** + * Sample code: Get experiment execution details. + * + * @param manager Entry point to ChaosManager. + */ + public static void getExperimentExecutionDetails(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager + .experiments() + .getExecutionDetailsWithResponse( + "exampleRG", + "exampleExperiment", + "f24500ad-744e-4a26-864b-b76199eac333", + com.azure.core.util.Context.NONE); + } +} +``` + +### Experiments_GetStatus + +```java +/** Samples for Experiments GetStatus. */ +public final class ExperimentsGetStatusSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/GetAExperimentStatus.json + */ + /** + * Sample code: Get the status of a Experiment. + * + * @param manager Entry point to ChaosManager. + */ + public static void getTheStatusOfAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager + .experiments() + .getStatusWithResponse( + "exampleRG", + "exampleExperiment", + "50734542-2e64-4e08-814c-cc0e7475f7e4", + com.azure.core.util.Context.NONE); + } +} +``` + +### Experiments_List + +```java +/** Samples for Experiments List. */ +public final class ExperimentsListSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/ListExperimentsInASubscription.json + */ + /** + * Sample code: List all Experiments in a subscription. + * + * @param manager Entry point to ChaosManager. + */ + public static void listAllExperimentsInASubscription(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments().list(null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### Experiments_ListAllStatuses + +```java +/** Samples for Experiments ListAllStatuses. */ +public final class ExperimentsListAllStatusesSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/ListExperimentStatuses.json + */ + /** + * Sample code: List all statuses of a Experiment. + * + * @param manager Entry point to ChaosManager. + */ + public static void listAllStatusesOfAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments().listAllStatuses("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + } +} +``` + +### Experiments_ListByResourceGroup + +```java +/** Samples for Experiments ListByResourceGroup. */ +public final class ExperimentsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/ListExperimentsInAResourceGroup.json + */ + /** + * Sample code: List all Experiments in a resource group. + * + * @param manager Entry point to ChaosManager. + */ + public static void listAllExperimentsInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments().listByResourceGroup("exampleRG", null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### Experiments_ListExecutionDetails + +```java +/** Samples for Experiments ListExecutionDetails. */ +public final class ExperimentsListExecutionDetailsSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/ListExperimentExecutionsDetails.json + */ + /** + * Sample code: List experiment executions details. + * + * @param manager Entry point to ChaosManager. + */ + public static void listExperimentExecutionsDetails(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments().listExecutionDetails("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + } +} +``` + +### Experiments_Start + +```java +/** Samples for Experiments Start. */ +public final class ExperimentsStartSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/StartAExperiment.json + */ + /** + * Sample code: Start a Experiment. + * + * @param manager Entry point to ChaosManager. + */ + public static void startAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments().startWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + } +} +``` + +### Experiments_Update + +```java +import com.azure.resourcemanager.chaos.models.Experiment; +import com.azure.resourcemanager.chaos.models.ResourceIdentity; +import com.azure.resourcemanager.chaos.models.ResourceIdentityType; +import com.azure.resourcemanager.chaos.models.UserAssignedIdentities; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Experiments Update. */ +public final class ExperimentsUpdateSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/PatchExperiment.json + */ + /** + * Sample code: Patch an Experiment in a resource group. + * + * @param manager Entry point to ChaosManager. + */ + public static void patchAnExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + Experiment resource = + manager + .experiments() + .getByResourceGroupWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withIdentity( + new ResourceIdentity() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI", + new UserAssignedIdentities()))) + .apply(); + } + + @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; + } +} +``` + +### TargetTypes_Get + +```java +/** Samples for TargetTypes Get. */ +public final class TargetTypesGetSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/GetATargetType.json + */ + /** + * Sample code: Get a Target Type for westus2 location. + * + * @param manager Entry point to ChaosManager. + */ + public static void getATargetTypeForWestus2Location(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.targetTypes().getWithResponse("westus2", "Microsoft-Agent", com.azure.core.util.Context.NONE); + } +} +``` + +### TargetTypes_List + +```java +/** Samples for TargetTypes List. */ +public final class TargetTypesListSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/ListTargetTypes.json + */ + /** + * Sample code: List all Target Types for westus2 location. + * + * @param manager Entry point to ChaosManager. + */ + public static void listAllTargetTypesForWestus2Location(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.targetTypes().list("westus2", null, com.azure.core.util.Context.NONE); + } +} +``` + +### Targets_CreateOrUpdate + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.chaos.fluent.models.TargetInner; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Targets CreateOrUpdate. */ +public final class TargetsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/CreateOrUpdateATarget.json + */ + /** + * Sample code: Create/update a Target that extends a virtual machine resource. + * + * @param manager Entry point to ChaosManager. + */ + public static void createUpdateATargetThatExtendsAVirtualMachineResource( + com.azure.resourcemanager.chaos.ChaosManager manager) throws IOException { + manager + .targets() + .createOrUpdateWithResponse( + "exampleRG", + "Microsoft.Compute", + "virtualMachines", + "exampleVM", + "Microsoft-Agent", + new TargetInner() + .withProperties( + mapOf( + "identities", + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "[{\"type\":\"CertificateSubjectIssuer\",\"subject\":\"CN=example.subject\"}]", + Object.class, + SerializerEncoding.JSON))), + com.azure.core.util.Context.NONE); + } + + @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; + } +} +``` + +### Targets_Delete + +```java +/** Samples for Targets Delete. */ +public final class TargetsDeleteSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/DeleteATarget.json + */ + /** + * Sample code: Delete a Target that extends a virtual machine resource. + * + * @param manager Entry point to ChaosManager. + */ + 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); + } +} +``` + +### Targets_Get + +```java +/** Samples for Targets Get. */ +public final class TargetsGetSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/GetATarget.json + */ + /** + * Sample code: Get a Target that extends a virtual machine resource. + * + * @param manager Entry point to ChaosManager. + */ + 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); + } +} +``` + +### Targets_List + +```java +/** Samples for Targets List. */ +public final class TargetsListSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/ListTargets.json + */ + /** + * Sample code: List all Targets that extend a virtual machine resource. + * + * @param manager Entry point to ChaosManager. + */ + 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); + } +} +``` + diff --git a/sdk/chaos/azure-resourcemanager-chaos/pom.xml b/sdk/chaos/azure-resourcemanager-chaos/pom.xml new file mode 100644 index 0000000000000..156193bdd97f7 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-chaos + 1.0.0-beta.1 + 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-preview-2023-04. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + + + + com.azure + azure-core + 1.37.0 + + + com.azure + azure-core-management + 1.10.2 + + + 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 new file mode 100644 index 0000000000000..0a8981c49044c --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/ChaosManager.java @@ -0,0 +1,362 @@ +// 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; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +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; +import com.azure.resourcemanager.chaos.fluent.ChaosManagementClient; +import com.azure.resourcemanager.chaos.implementation.CapabilitiesImpl; +import com.azure.resourcemanager.chaos.implementation.CapabilityTypesImpl; +import com.azure.resourcemanager.chaos.implementation.ChaosManagementClientBuilder; +import com.azure.resourcemanager.chaos.implementation.ExperimentsImpl; +import com.azure.resourcemanager.chaos.implementation.OperationsImpl; +import com.azure.resourcemanager.chaos.implementation.TargetTypesImpl; +import com.azure.resourcemanager.chaos.implementation.TargetsImpl; +import com.azure.resourcemanager.chaos.models.Capabilities; +import com.azure.resourcemanager.chaos.models.CapabilityTypes; +import com.azure.resourcemanager.chaos.models.Experiments; +import com.azure.resourcemanager.chaos.models.Operations; +import com.azure.resourcemanager.chaos.models.TargetTypes; +import com.azure.resourcemanager.chaos.models.Targets; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** Entry point to ChaosManager. Chaos Management Client. */ +public final class ChaosManager { + private Capabilities capabilities; + + private CapabilityTypes capabilityTypes; + + private Experiments experiments; + + private Operations operations; + + private TargetTypes targetTypes; + + private Targets targets; + + private final ChaosManagementClient clientObject; + + private ChaosManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new ChaosManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Chaos service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Chaos service API instance. + */ + public static ChaosManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of Chaos service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Chaos service API instance. + */ + public static ChaosManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ChaosManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ChaosManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ChaosManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Chaos service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Chaos service API instance. + */ + public ChaosManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.chaos") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ChaosManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Capabilities. + * + * @return Resource collection API of Capabilities. + */ + public Capabilities capabilities() { + if (this.capabilities == null) { + this.capabilities = new CapabilitiesImpl(clientObject.getCapabilities(), this); + } + return capabilities; + } + + /** + * Gets the resource collection API of CapabilityTypes. + * + * @return Resource collection API of CapabilityTypes. + */ + public CapabilityTypes capabilityTypes() { + if (this.capabilityTypes == null) { + this.capabilityTypes = new CapabilityTypesImpl(clientObject.getCapabilityTypes(), this); + } + return capabilityTypes; + } + + /** + * Gets the resource collection API of Experiments. It manages Experiment. + * + * @return Resource collection API of Experiments. + */ + public Experiments experiments() { + if (this.experiments == null) { + this.experiments = new ExperimentsImpl(clientObject.getExperiments(), this); + } + return experiments; + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of TargetTypes. + * + * @return Resource collection API of TargetTypes. + */ + public TargetTypes targetTypes() { + if (this.targetTypes == null) { + this.targetTypes = new TargetTypesImpl(clientObject.getTargetTypes(), this); + } + return targetTypes; + } + + /** + * Gets the resource collection API of Targets. + * + * @return Resource collection API of Targets. + */ + public Targets targets() { + if (this.targets == null) { + this.targets = new TargetsImpl(clientObject.getTargets(), this); + } + return targets; + } + + /** + * @return Wrapped service client ChaosManagementClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public ChaosManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/CapabilitiesClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/CapabilitiesClient.java new file mode 100644 index 0000000000000..9de7900898eea --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/CapabilitiesClient.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; + +/** An instance of this class provides access to all the operations defined in CapabilitiesClient. */ +public interface CapabilitiesClient { + /** + * Get a list of Capability resources that extend a Target resource.. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability resources that extend a Target resource. as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName); + + /** + * Get a list of Capability resources that extend a Target resource.. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability resources that extend a Target resource. as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String continuationToken, + Context context); + + /** + * Get a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability resource that extends a Target resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + Context context); + + /** + * Get a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability resource that extends a Target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CapabilityInner get( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName); + + /** + * Delete a Capability that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + Context context); + + /** + * Delete a Capability that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName); + + /** + * Create or update a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @param capability Capability resource to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Capability resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + CapabilityInner capability, + Context context); + + /** + * Create or update a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @param capability Capability resource to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Capability resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CapabilityInner createOrUpdate( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + CapabilityInner capability); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/CapabilityTypesClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/CapabilityTypesClient.java new file mode 100644 index 0000000000000..1bf7ffdeaf694 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/CapabilityTypesClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeInner; + +/** An instance of this class provides access to all the operations defined in CapabilityTypesClient. */ +public interface CapabilityTypesClient { + /** + * Get a list of Capability Type resources for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability Type resources for given Target Type and location as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String locationName, String targetTypeName); + + /** + * Get a list of Capability Type resources for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability Type resources for given Target Type and location as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String locationName, String targetTypeName, String continuationToken, Context context); + + /** + * Get a Capability Type resource for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param capabilityTypeName String that represents a Capability Type resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability Type resource for given Target Type and location along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String locationName, String targetTypeName, String capabilityTypeName, Context context); + + /** + * Get a Capability Type resource for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param capabilityTypeName String that represents a Capability Type resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability Type resource for given Target Type and location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CapabilityTypeInner get(String locationName, String targetTypeName, String capabilityTypeName); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ChaosManagementClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ChaosManagementClient.java new file mode 100644 index 0000000000000..a0154a97764ed --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ChaosManagementClient.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ChaosManagementClient class. */ +public interface ChaosManagementClient { + /** + * Gets GUID that represents an Azure subscription ID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the CapabilitiesClient object to access its operations. + * + * @return the CapabilitiesClient object. + */ + CapabilitiesClient getCapabilities(); + + /** + * Gets the CapabilityTypesClient object to access its operations. + * + * @return the CapabilityTypesClient object. + */ + CapabilityTypesClient getCapabilityTypes(); + + /** + * Gets the ExperimentsClient object to access its operations. + * + * @return the ExperimentsClient object. + */ + ExperimentsClient getExperiments(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the TargetTypesClient object to access its operations. + * + * @return the TargetTypesClient object. + */ + TargetTypesClient getTargetTypes(); + + /** + * Gets the TargetsClient object to access its operations. + * + * @return the TargetsClient object. + */ + TargetsClient getTargets(); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ExperimentsClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ExperimentsClient.java new file mode 100644 index 0000000000000..a33fb3e5d4298 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/ExperimentsClient.java @@ -0,0 +1,362 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentCancelOperationResultInner; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentStartOperationResultInner; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentStatusInner; +import com.azure.resourcemanager.chaos.models.ExperimentUpdate; + +/** An instance of this class provides access to all the operations defined in ExperimentsClient. */ +public interface ExperimentsClient { + /** + * Get a list of Experiment resources in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get a list of Experiment resources in a subscription. + * + * @param running Optional value that indicates whether to filter results based on if the Experiment is currently + * running. If null, then the results will not be filtered. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Boolean running, String continuationToken, Context context); + + /** + * Get a list of Experiment resources in a resource group. + * + * @param resourceGroupName String that represents an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get a list of Experiment resources in a resource group. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param running Optional value that indicates whether to filter results based on if the Experiment is currently + * running. If null, then the results will not be filtered. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, Boolean running, String continuationToken, Context context); + + /** + * Delete a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String experimentName, Context context); + + /** + * Delete a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String experimentName); + + /** + * Get a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Experiment resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String experimentName, Context context); + + /** + * Get a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExperimentInner getByResourceGroup(String resourceGroupName, String experimentName); + + /** + * Create or update a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Experiment resource to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Experiment resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String experimentName, ExperimentInner experiment, Context context); + + /** + * Create or update a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Experiment resource to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExperimentInner createOrUpdate(String resourceGroupName, String experimentName, ExperimentInner experiment); + + /** + * The operation to update an experiment. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Parameters supplied to the Update experiment operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Experiment resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String experimentName, ExperimentUpdate experiment, Context context); + + /** + * The operation to update an experiment. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Parameters supplied to the Update experiment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExperimentInner update(String resourceGroupName, String experimentName, ExperimentUpdate experiment); + + /** + * Cancel a running Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a cancel Experiment operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelWithResponse( + String resourceGroupName, String experimentName, Context context); + + /** + * Cancel a running Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a cancel Experiment operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExperimentCancelOperationResultInner cancel(String resourceGroupName, String experimentName); + + /** + * Start a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a start Experiment operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response startWithResponse( + String resourceGroupName, String experimentName, Context context); + + /** + * Start a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a start Experiment operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExperimentStartOperationResultInner start(String resourceGroupName, String experimentName); + + /** + * Get a list of statuses of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of statuses of a Experiment resource as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAllStatuses(String resourceGroupName, String experimentName); + + /** + * Get a list of statuses of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of statuses of a Experiment resource as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAllStatuses( + String resourceGroupName, String experimentName, Context context); + + /** + * Get a status of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param statusId GUID that represents a Experiment status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a status of a Experiment resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getStatusWithResponse( + String resourceGroupName, String experimentName, String statusId, Context context); + + /** + * Get a status of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param statusId GUID that represents a Experiment status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a status of a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExperimentStatusInner getStatus(String resourceGroupName, String experimentName, String statusId); + + /** + * Get a list of execution details of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of execution details of a Experiment resource as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listExecutionDetails( + String resourceGroupName, String experimentName); + + /** + * Get a list of execution details of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of execution details of a Experiment resource as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listExecutionDetails( + String resourceGroupName, String experimentName, Context context); + + /** + * Get an execution detail of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param executionDetailsId GUID that represents a Experiment execution detail. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution detail of a Experiment resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getExecutionDetailsWithResponse( + String resourceGroupName, String experimentName, String executionDetailsId, Context context); + + /** + * Get an execution detail of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param executionDetailsId GUID that represents a Experiment execution detail. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution detail of a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExperimentExecutionDetailsInner getExecutionDetails( + String resourceGroupName, String experimentName, String executionDetailsId); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/OperationsClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/OperationsClient.java new file mode 100644 index 0000000000000..fdd25c05ff159 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.chaos.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Get a list all available Operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list all available Operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAll(); + + /** + * Get a list all available Operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list all available Operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAll(Context context); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/TargetTypesClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/TargetTypesClient.java new file mode 100644 index 0000000000000..46f1a4177d1fe --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/TargetTypesClient.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.chaos.fluent.models.TargetTypeInner; + +/** An instance of this class provides access to all the operations defined in TargetTypesClient. */ +public interface TargetTypesClient { + /** + * Get a list of Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target Type resources for given location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String locationName); + + /** + * Get a list of Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target Type resources for given location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String locationName, String continuationToken, Context context); + + /** + * Get a Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target Type resources for given location along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String locationName, String targetTypeName, Context context); + + /** + * Get a Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target Type resources for given location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TargetTypeInner get(String locationName, String targetTypeName); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/TargetsClient.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/TargetsClient.java new file mode 100644 index 0000000000000..a3ec48e28f4b0 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/TargetsClient.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.chaos.fluent.models.TargetInner; + +/** An instance of this class provides access to all the operations defined in TargetsClient. */ +public interface TargetsClient { + /** + * Get a list of Target resources that extend a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target resources that extend a tracked regional resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String parentProviderNamespace, String parentResourceType, String parentResourceName); + + /** + * Get a list of Target resources that extend a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target resources that extend a tracked regional resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String continuationToken, + Context context); + + /** + * Get a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target resource that extends a tracked regional resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + Context context); + + /** + * Get a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target resource that extends a tracked regional resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TargetInner get( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName); + + /** + * Delete a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + Context context); + + /** + * Delete a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName); + + /** + * Create or update a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param target Target resource to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Target resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + TargetInner target, + Context context); + + /** + * Create or update a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param target Target resource to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TargetInner createOrUpdate( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + TargetInner target); +} 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 new file mode 100644 index 0000000000000..32126fd4a0729 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Model that represents a Capability resource. */ +@Immutable +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; + + /** Creates an instance of CapabilityInner class. */ + public CapabilityInner() { + } + + /** + * Get the systemData property: The standard system metadata of a resource type. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: The properties of a capability resource. + * + * @return the innerProperties value. + */ + private CapabilityProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the publisher property: String of the Publisher that this Capability extends. + * + * @return the publisher value. + */ + public String publisher() { + return this.innerProperties() == null ? null : this.innerProperties().publisher(); + } + + /** + * Get the targetType property: String of the Target Type that this Capability extends. + * + * @return the targetType value. + */ + public String targetType() { + return this.innerProperties() == null ? null : this.innerProperties().targetType(); + } + + /** + * Get the description property: Localized string of the description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the parametersSchema property: URL to retrieve JSON schema of the Capability parameters. + * + * @return the parametersSchema value. + */ + public String parametersSchema() { + return this.innerProperties() == null ? null : this.innerProperties().parametersSchema(); + } + + /** + * Get the urn property: String of the URN for this Capability Type. + * + * @return the urn value. + */ + public String urn() { + return this.innerProperties() == null ? null : this.innerProperties().urn(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} 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 new file mode 100644 index 0000000000000..4970fe21a6cac --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityProperties.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Model that represents the Capability properties model. */ +@Immutable +public final class CapabilityProperties { + /* + * String of the Publisher that this Capability extends. + */ + @JsonProperty(value = "publisher", access = JsonProperty.Access.WRITE_ONLY) + private String publisher; + + /* + * String of the Target Type that this Capability extends. + */ + @JsonProperty(value = "targetType", access = JsonProperty.Access.WRITE_ONLY) + private String targetType; + + /* + * Localized string of the description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * URL to retrieve JSON schema of the Capability parameters. + */ + @JsonProperty(value = "parametersSchema", access = JsonProperty.Access.WRITE_ONLY) + private String parametersSchema; + + /* + * String of the URN for this Capability Type. + */ + @JsonProperty(value = "urn", access = JsonProperty.Access.WRITE_ONLY) + private String urn; + + /** Creates an instance of CapabilityProperties class. */ + public CapabilityProperties() { + } + + /** + * Get the publisher property: String of the Publisher that this Capability extends. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Get the targetType property: String of the Target Type that this Capability extends. + * + * @return the targetType value. + */ + public String targetType() { + return this.targetType; + } + + /** + * Get the description property: Localized string of the description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the parametersSchema property: URL to retrieve JSON schema of the Capability parameters. + * + * @return the parametersSchema value. + */ + public String parametersSchema() { + return this.parametersSchema; + } + + /** + * Get the urn property: String of the URN for this Capability Type. + * + * @return the urn value. + */ + public String urn() { + return this.urn; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeInner.java new file mode 100644 index 0000000000000..7b361d2878bff --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeInner.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.chaos.models.CapabilityTypePropertiesPermissionsNecessary; +import com.azure.resourcemanager.chaos.models.CapabilityTypePropertiesRuntimeProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Model that represents a Capability Type resource. */ +@Fluent +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; + + /** Creates an instance of CapabilityTypeInner class. */ + public CapabilityTypeInner() { + } + + /** + * Get the systemData property: The system metadata properties of the capability type resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the location property: Location of the Capability Type resource. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Location of the Capability Type resource. + * + * @param location the location value to set. + * @return the CapabilityTypeInner object itself. + */ + public CapabilityTypeInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the innerProperties property: The properties of the capability type resource. + * + * @return the innerProperties value. + */ + private CapabilityTypeProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the publisher property: String of the Publisher that this Capability Type extends. + * + * @return the publisher value. + */ + public String publisher() { + return this.innerProperties() == null ? null : this.innerProperties().publisher(); + } + + /** + * Get the targetType property: String of the Target Type that this Capability Type extends. + * + * @return the targetType value. + */ + public String targetType() { + return this.innerProperties() == null ? null : this.innerProperties().targetType(); + } + + /** + * Get the displayName property: Localized string of the display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Get the description property: Localized string of the description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the parametersSchema property: URL to retrieve JSON schema of the Capability Type parameters. + * + * @return the parametersSchema value. + */ + public String parametersSchema() { + return this.innerProperties() == null ? null : this.innerProperties().parametersSchema(); + } + + /** + * Get the urn property: String of the URN for this Capability Type. + * + * @return the urn value. + */ + public String urn() { + return this.innerProperties() == null ? null : this.innerProperties().urn(); + } + + /** + * Get the kind property: String of the kind of this Capability Type. + * + * @return the kind value. + */ + public String kind() { + return this.innerProperties() == null ? null : this.innerProperties().kind(); + } + + /** + * Get the permissionsNecessary property: Array of control and data plane actions necessary to execute capability + * type. + * + * @return the permissionsNecessary value. + */ + public CapabilityTypePropertiesPermissionsNecessary permissionsNecessary() { + return this.innerProperties() == null ? null : this.innerProperties().permissionsNecessary(); + } + + /** + * Get the runtimeProperties property: Runtime properties of this Capability Type. + * + * @return the runtimeProperties value. + */ + public CapabilityTypePropertiesRuntimeProperties runtimeProperties() { + return this.innerProperties() == null ? null : this.innerProperties().runtimeProperties(); + } + + /** + * Set the runtimeProperties property: Runtime properties of this Capability Type. + * + * @param runtimeProperties the runtimeProperties value to set. + * @return the CapabilityTypeInner object itself. + */ + public CapabilityTypeInner withRuntimeProperties(CapabilityTypePropertiesRuntimeProperties runtimeProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new CapabilityTypeProperties(); + } + this.innerProperties().withRuntimeProperties(runtimeProperties); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} 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 new file mode 100644 index 0000000000000..60147139f1c60 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/CapabilityTypeProperties.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.chaos.models.CapabilityTypePropertiesPermissionsNecessary; +import com.azure.resourcemanager.chaos.models.CapabilityTypePropertiesRuntimeProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Model that represents the Capability Type properties model. */ +@Fluent +public final class CapabilityTypeProperties { + /* + * 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; + + /* + * Array of control and data plane actions necessary to execute capability type. + */ + @JsonProperty(value = "permissionsNecessary", access = JsonProperty.Access.WRITE_ONLY) + private CapabilityTypePropertiesPermissionsNecessary permissionsNecessary; + + /* + * Runtime properties of this Capability Type. + */ + @JsonProperty(value = "runtimeProperties") + private CapabilityTypePropertiesRuntimeProperties runtimeProperties; + + /** Creates an instance of CapabilityTypeProperties class. */ + public CapabilityTypeProperties() { + } + + /** + * Get the publisher property: String of the Publisher that this Capability Type extends. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Get the targetType property: String of the Target Type that this Capability Type extends. + * + * @return the targetType value. + */ + public String targetType() { + return this.targetType; + } + + /** + * Get the displayName property: Localized string of the display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the description property: Localized string of the description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the parametersSchema property: URL to retrieve JSON schema of the Capability Type parameters. + * + * @return the parametersSchema value. + */ + public String parametersSchema() { + return this.parametersSchema; + } + + /** + * Get the urn property: String of the URN for this Capability Type. + * + * @return the urn value. + */ + public String urn() { + return this.urn; + } + + /** + * Get the kind property: String of the kind of this Capability Type. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the permissionsNecessary property: Array of control and data plane actions necessary to execute capability + * type. + * + * @return the permissionsNecessary value. + */ + public CapabilityTypePropertiesPermissionsNecessary permissionsNecessary() { + return this.permissionsNecessary; + } + + /** + * Get the runtimeProperties property: Runtime properties of this Capability Type. + * + * @return the runtimeProperties value. + */ + public CapabilityTypePropertiesRuntimeProperties runtimeProperties() { + return this.runtimeProperties; + } + + /** + * Set the runtimeProperties property: Runtime properties of this Capability Type. + * + * @param runtimeProperties the runtimeProperties value to set. + * @return the CapabilityTypeProperties object itself. + */ + public CapabilityTypeProperties withRuntimeProperties(CapabilityTypePropertiesRuntimeProperties runtimeProperties) { + this.runtimeProperties = runtimeProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (permissionsNecessary() != null) { + permissionsNecessary().validate(); + } + if (runtimeProperties() != null) { + runtimeProperties().validate(); + } + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentCancelOperationResultInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentCancelOperationResultInner.java new file mode 100644 index 0000000000000..051a70ae06f43 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentCancelOperationResultInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Model that represents the result of a cancel Experiment operation. */ +@Immutable +public final class ExperimentCancelOperationResultInner { + /* + * String of the Experiment name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * URL to retrieve the Experiment status. + */ + @JsonProperty(value = "statusUrl", access = JsonProperty.Access.WRITE_ONLY) + private String statusUrl; + + /** Creates an instance of ExperimentCancelOperationResultInner class. */ + public ExperimentCancelOperationResultInner() { + } + + /** + * Get the name property: String of the Experiment name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the statusUrl property: URL to retrieve the Experiment status. + * + * @return the statusUrl value. + */ + public String statusUrl() { + return this.statusUrl; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} 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 new file mode 100644 index 0000000000000..0df49eb47164c --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsInner.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsPropertiesRunInformation; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Model that represents the execution details of a Experiment. */ +@Immutable +public final class ExperimentExecutionDetailsInner { + /* + * 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; + + /** Creates an instance of ExperimentExecutionDetailsInner class. */ + public ExperimentExecutionDetailsInner() { + } + + /** + * Get the type property: String of the resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the id property: String of the fully qualified resource ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: String of the resource name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the innerProperties property: The properties of the experiment execution details. + * + * @return the innerProperties value. + */ + private ExperimentExecutionDetailsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the experimentId property: The id of the experiment. + * + * @return the experimentId value. + */ + public String experimentId() { + return this.innerProperties() == null ? null : this.innerProperties().experimentId(); + } + + /** + * Get the status property: The value of the status of the experiment execution. + * + * @return the status value. + */ + public String status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the failureReason property: The reason why the execution failed. + * + * @return the failureReason value. + */ + public String failureReason() { + return this.innerProperties() == null ? null : this.innerProperties().failureReason(); + } + + /** + * Get the createdDateTime property: String that represents the created date time. + * + * @return the createdDateTime value. + */ + public OffsetDateTime createdDateTime() { + return this.innerProperties() == null ? null : this.innerProperties().createdDateTime(); + } + + /** + * Get the lastActionDateTime property: String that represents the last action date time. + * + * @return the lastActionDateTime value. + */ + public OffsetDateTime lastActionDateTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastActionDateTime(); + } + + /** + * Get the startDateTime property: String that represents the start date time. + * + * @return the startDateTime value. + */ + public OffsetDateTime startDateTime() { + return this.innerProperties() == null ? null : this.innerProperties().startDateTime(); + } + + /** + * Get the stopDateTime property: String that represents the stop date time. + * + * @return the stopDateTime value. + */ + public OffsetDateTime stopDateTime() { + return this.innerProperties() == null ? null : this.innerProperties().stopDateTime(); + } + + /** + * Get the runInformation property: The information of the experiment run. + * + * @return the runInformation value. + */ + public ExperimentExecutionDetailsPropertiesRunInformation runInformation() { + return this.innerProperties() == null ? null : this.innerProperties().runInformation(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} 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 new file mode 100644 index 0000000000000..4ef82667e0726 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentExecutionDetailsProperties.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsPropertiesRunInformation; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Model that represents the Experiment execution details properties model. */ +@Immutable +public final class ExperimentExecutionDetailsProperties { + /* + * The id of the experiment. + */ + @JsonProperty(value = "experimentId", access = JsonProperty.Access.WRITE_ONLY) + private String experimentId; + + /* + * The value of the status of the experiment execution. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * The reason why the execution failed. + */ + @JsonProperty(value = "failureReason", access = JsonProperty.Access.WRITE_ONLY) + private String failureReason; + + /* + * String that represents the created date time. + */ + @JsonProperty(value = "createdDateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdDateTime; + + /* + * String that represents the last action date time. + */ + @JsonProperty(value = "lastActionDateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastActionDateTime; + + /* + * String that represents the start date time. + */ + @JsonProperty(value = "startDateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startDateTime; + + /* + * String that represents the stop date time. + */ + @JsonProperty(value = "stopDateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime stopDateTime; + + /* + * The information of the experiment run. + */ + @JsonProperty(value = "runInformation", access = JsonProperty.Access.WRITE_ONLY) + private ExperimentExecutionDetailsPropertiesRunInformation runInformation; + + /** Creates an instance of ExperimentExecutionDetailsProperties class. */ + public ExperimentExecutionDetailsProperties() { + } + + /** + * Get the experimentId property: The id of the experiment. + * + * @return the experimentId value. + */ + public String experimentId() { + return this.experimentId; + } + + /** + * Get the status property: The value of the status of the experiment execution. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the failureReason property: The reason why the execution failed. + * + * @return the failureReason value. + */ + public String failureReason() { + return this.failureReason; + } + + /** + * Get the createdDateTime property: String that represents the created date time. + * + * @return the createdDateTime value. + */ + public OffsetDateTime createdDateTime() { + return this.createdDateTime; + } + + /** + * Get the lastActionDateTime property: String that represents the last action date time. + * + * @return the lastActionDateTime value. + */ + public OffsetDateTime lastActionDateTime() { + return this.lastActionDateTime; + } + + /** + * Get the startDateTime property: String that represents the start date time. + * + * @return the startDateTime value. + */ + public OffsetDateTime startDateTime() { + return this.startDateTime; + } + + /** + * Get the stopDateTime property: String that represents the stop date time. + * + * @return the stopDateTime value. + */ + public OffsetDateTime stopDateTime() { + return this.stopDateTime; + } + + /** + * Get the runInformation property: The information of the experiment run. + * + * @return the runInformation value. + */ + public ExperimentExecutionDetailsPropertiesRunInformation runInformation() { + return this.runInformation; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (runInformation() != null) { + runInformation().validate(); + } + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentInner.java new file mode 100644 index 0000000000000..6e8ea34c269d7 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentInner.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.chaos.models.ResourceIdentity; +import com.azure.resourcemanager.chaos.models.Selector; +import com.azure.resourcemanager.chaos.models.Step; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Model that represents a Experiment resource. */ +@Fluent +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(); + + /** Creates an instance of ExperimentInner class. */ + public ExperimentInner() { + } + + /** + * Get the systemData property: The system metadata of the experiment resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the identity property: The identity of the experiment resource. + * + * @return the identity value. + */ + public ResourceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the experiment resource. + * + * @param identity the identity value to set. + * @return the ExperimentInner object itself. + */ + public ExperimentInner withIdentity(ResourceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the innerProperties property: The properties of the experiment resource. + * + * @return the innerProperties value. + */ + private ExperimentProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ExperimentInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ExperimentInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the steps property: List of steps. + * + * @return the steps value. + */ + public List steps() { + return this.innerProperties() == null ? null : this.innerProperties().steps(); + } + + /** + * Set the steps property: List of steps. + * + * @param steps the steps value to set. + * @return the ExperimentInner object itself. + */ + public ExperimentInner withSteps(List steps) { + if (this.innerProperties() == null) { + this.innerProperties = new ExperimentProperties(); + } + this.innerProperties().withSteps(steps); + return this; + } + + /** + * Get the selectors property: List of selectors. + * + * @return the selectors value. + */ + public List selectors() { + return this.innerProperties() == null ? null : this.innerProperties().selectors(); + } + + /** + * Set the selectors property: List of selectors. + * + * @param selectors the selectors value to set. + * @return the ExperimentInner object itself. + */ + public ExperimentInner withSelectors(List selectors) { + if (this.innerProperties() == null) { + this.innerProperties = new ExperimentProperties(); + } + this.innerProperties().withSelectors(selectors); + return this; + } + + /** + * Get the startOnCreation property: A boolean value that indicates if experiment should be started on creation or + * not. + * + * @return the startOnCreation value. + */ + public Boolean startOnCreation() { + return this.innerProperties() == null ? null : this.innerProperties().startOnCreation(); + } + + /** + * Set the startOnCreation property: A boolean value that indicates if experiment should be started on creation or + * not. + * + * @param startOnCreation the startOnCreation value to set. + * @return the ExperimentInner object itself. + */ + public ExperimentInner withStartOnCreation(Boolean startOnCreation) { + if (this.innerProperties() == null) { + this.innerProperties = new ExperimentProperties(); + } + this.innerProperties().withStartOnCreation(startOnCreation); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property innerProperties in model ExperimentInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ExperimentInner.class); +} 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 new file mode 100644 index 0000000000000..81e0dcaf89e35 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentProperties.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.chaos.models.Selector; +import com.azure.resourcemanager.chaos.models.Step; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Model that represents the Experiment properties model. */ +@Fluent +public final class ExperimentProperties { + /* + * List of steps. + */ + @JsonProperty(value = "steps", required = true) + private List steps; + + /* + * List of selectors. + */ + @JsonProperty(value = "selectors", required = true) + private List selectors; + + /* + * A boolean value that indicates if experiment should be started on creation or not. + */ + @JsonProperty(value = "startOnCreation") + private Boolean startOnCreation; + + /** Creates an instance of ExperimentProperties class. */ + public ExperimentProperties() { + } + + /** + * Get the steps property: List of steps. + * + * @return the steps value. + */ + public List steps() { + return this.steps; + } + + /** + * Set the steps property: List of steps. + * + * @param steps the steps value to set. + * @return the ExperimentProperties object itself. + */ + public ExperimentProperties withSteps(List steps) { + this.steps = steps; + return this; + } + + /** + * Get the selectors property: List of selectors. + * + * @return the selectors value. + */ + public List selectors() { + return this.selectors; + } + + /** + * Set the selectors property: List of selectors. + * + * @param selectors the selectors value to set. + * @return the ExperimentProperties object itself. + */ + public ExperimentProperties withSelectors(List selectors) { + this.selectors = selectors; + return this; + } + + /** + * Get the startOnCreation property: A boolean value that indicates if experiment should be started on creation or + * not. + * + * @return the startOnCreation value. + */ + public Boolean startOnCreation() { + return this.startOnCreation; + } + + /** + * Set the startOnCreation property: A boolean value that indicates if experiment should be started on creation or + * not. + * + * @param startOnCreation the startOnCreation value to set. + * @return the ExperimentProperties object itself. + */ + public ExperimentProperties withStartOnCreation(Boolean startOnCreation) { + this.startOnCreation = startOnCreation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (steps() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property steps in model ExperimentProperties")); + } else { + steps().forEach(e -> e.validate()); + } + if (selectors() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property selectors in model ExperimentProperties")); + } else { + selectors().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ExperimentProperties.class); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStartOperationResultInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStartOperationResultInner.java new file mode 100644 index 0000000000000..03dc806d31cd5 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStartOperationResultInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Model that represents the result of a start Experiment operation. */ +@Immutable +public final class ExperimentStartOperationResultInner { + /* + * String of the Experiment name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * URL to retrieve the Experiment status. + */ + @JsonProperty(value = "statusUrl", access = JsonProperty.Access.WRITE_ONLY) + private String statusUrl; + + /** Creates an instance of ExperimentStartOperationResultInner class. */ + public ExperimentStartOperationResultInner() { + } + + /** + * Get the name property: String of the Experiment name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the statusUrl property: URL to retrieve the Experiment status. + * + * @return the statusUrl value. + */ + public String statusUrl() { + return this.statusUrl; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStatusInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStatusInner.java new file mode 100644 index 0000000000000..9d65b12242b61 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStatusInner.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Model that represents the status of a Experiment. */ +@Immutable +public final class ExperimentStatusInner { + /* + * 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 ExperimentStatusProperties innerProperties; + + /** Creates an instance of ExperimentStatusInner class. */ + public ExperimentStatusInner() { + } + + /** + * Get the type property: String of the resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the id property: String of the fully qualified resource ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: String of the resource name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the innerProperties property: The properties of experiment execution status. + * + * @return the innerProperties value. + */ + private ExperimentStatusProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the status property: String that represents the status of a Experiment. + * + * @return the status value. + */ + public String status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the createdDateUtc property: String that represents the created date time of a Experiment. + * + * @return the createdDateUtc value. + */ + public OffsetDateTime createdDateUtc() { + return this.innerProperties() == null ? null : this.innerProperties().createdDateUtc(); + } + + /** + * Get the endDateUtc property: String that represents the end date time of a Experiment. + * + * @return the endDateUtc value. + */ + public OffsetDateTime endDateUtc() { + return this.innerProperties() == null ? null : this.innerProperties().endDateUtc(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStatusProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStatusProperties.java new file mode 100644 index 0000000000000..cef7dca7b1fbb --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/ExperimentStatusProperties.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Model that represents the Experiment status properties model. */ +@Immutable +public final class ExperimentStatusProperties { + /* + * String that represents the status of a Experiment. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * String that represents the created date time of a Experiment. + */ + @JsonProperty(value = "createdDateUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdDateUtc; + + /* + * String that represents the end date time of a Experiment. + */ + @JsonProperty(value = "endDateUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endDateUtc; + + /** Creates an instance of ExperimentStatusProperties class. */ + public ExperimentStatusProperties() { + } + + /** + * Get the status property: String that represents the status of a Experiment. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the createdDateUtc property: String that represents the created date time of a Experiment. + * + * @return the createdDateUtc value. + */ + public OffsetDateTime createdDateUtc() { + return this.createdDateUtc; + } + + /** + * Get the endDateUtc property: String that represents the end date time of a Experiment. + * + * @return the endDateUtc value. + */ + public OffsetDateTime endDateUtc() { + return this.endDateUtc; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationInner.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..e710daaf81ae3 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/OperationInner.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.chaos.models.ActionType; +import com.azure.resourcemanager.chaos.models.OperationDisplay; +import com.azure.resourcemanager.chaos.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API Operation + * + *

Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner { + /* + * 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; + + /** Creates an instance of OperationInner class. */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} 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 new file mode 100644 index 0000000000000..7145cd04d0680 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.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 java.util.Map; + +/** Model that represents a Target resource. */ +@Fluent +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; + + /** Creates an instance of TargetInner class. */ + public TargetInner() { + } + + /** + * Get the systemData property: The system metadata of the target resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the location property: Location of the target resource. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Location of the target resource. + * + * @param location the location value to set. + * @return the TargetInner object itself. + */ + public TargetInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the properties property: The properties of the target resource. + * + * @return the properties value. + */ + public Map properties() { + return this.properties; + } + + /** + * Set the properties property: The properties of the target resource. + * + * @param properties the properties value to set. + * @return the TargetInner object itself. + */ + public TargetInner withProperties(Map properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property properties in model TargetInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TargetInner.class); +} 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 new file mode 100644 index 0000000000000..d96b2afce917e --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeInner.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Model that represents a Target Type resource. */ +@Fluent +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(); + + /** Creates an instance of TargetTypeInner class. */ + public TargetTypeInner() { + } + + /** + * Get the systemData property: The system metadata properties of the target type resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the location property: Location of the Target Type resource. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Location of the Target Type resource. + * + * @param location the location value to set. + * @return the TargetTypeInner object itself. + */ + public TargetTypeInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the innerProperties property: The properties of the target type resource. + * + * @return the innerProperties value. + */ + private TargetTypeProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the displayName property: Localized string of the display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Get the description property: Localized string of the description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the propertiesSchema property: URL to retrieve JSON schema of the Target Type properties. + * + * @return the propertiesSchema value. + */ + public String propertiesSchema() { + return this.innerProperties() == null ? null : this.innerProperties().propertiesSchema(); + } + + /** + * Get the resourceTypes property: List of resource types this Target Type can extend. + * + * @return the resourceTypes value. + */ + public List resourceTypes() { + return this.innerProperties() == null ? null : this.innerProperties().resourceTypes(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property innerProperties in model TargetTypeInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TargetTypeInner.class); +} 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 new file mode 100644 index 0000000000000..9bc624dedb5c0 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/TargetTypeProperties.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Model that represents the base Target Type properties model. */ +@Immutable +public final class TargetTypeProperties { + /* + * Localized string of the display name. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * Localized string of the description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * URL to retrieve JSON schema of the Target Type properties. + */ + @JsonProperty(value = "propertiesSchema", access = JsonProperty.Access.WRITE_ONLY) + private String propertiesSchema; + + /* + * List of resource types this Target Type can extend. + */ + @JsonProperty(value = "resourceTypes", access = JsonProperty.Access.WRITE_ONLY) + private List resourceTypes; + + /** Creates an instance of TargetTypeProperties class. */ + public TargetTypeProperties() { + } + + /** + * Get the displayName property: Localized string of the display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the description property: Localized string of the description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the propertiesSchema property: URL to retrieve JSON schema of the Target Type properties. + * + * @return the propertiesSchema value. + */ + public String propertiesSchema() { + return this.propertiesSchema; + } + + /** + * Get the resourceTypes property: List of resource types this Target Type can extend. + * + * @return the resourceTypes value. + */ + public List resourceTypes() { + return this.resourceTypes; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/package-info.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/package-info.java new file mode 100644 index 0000000000000..528b3b0bc9607 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for ChaosManagementClient. Chaos Management Client. */ +package com.azure.resourcemanager.chaos.fluent.models; diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/package-info.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/package-info.java new file mode 100644 index 0000000000000..80b2eb1aca618 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for ChaosManagementClient. Chaos Management Client. */ +package com.azure.resourcemanager.chaos.fluent; 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 new file mode 100644 index 0000000000000..d9f1e9571315e --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilitiesClientImpl.java @@ -0,0 +1,1348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.chaos.fluent.CapabilitiesClient; +import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; +import com.azure.resourcemanager.chaos.models.CapabilityListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CapabilitiesClient. */ +public final class CapabilitiesClientImpl implements CapabilitiesClient { + /** The proxy service used to perform REST calls. */ + private final CapabilitiesService service; + + /** The service client containing this operation class. */ + private final ChaosManagementClientImpl client; + + /** + * Initializes an instance of CapabilitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CapabilitiesClientImpl(ChaosManagementClientImpl client) { + this.service = + RestProxy.create(CapabilitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ChaosManagementClientCapabilities to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ChaosManagementClien") + public interface CapabilitiesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("parentProviderNamespace") String parentProviderNamespace, + @PathParam("parentResourceType") String parentResourceType, + @PathParam("parentResourceName") String parentResourceName, + @PathParam("targetName") String targetName, + @QueryParam("continuationToken") String continuationToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("parentProviderNamespace") String parentProviderNamespace, + @PathParam("parentResourceType") String parentResourceType, + @PathParam("parentResourceName") String parentResourceName, + @PathParam("targetName") String targetName, + @PathParam("capabilityName") String capabilityName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("parentProviderNamespace") String parentProviderNamespace, + @PathParam("parentResourceType") String parentResourceType, + @PathParam("parentResourceName") String parentResourceName, + @PathParam("targetName") String targetName, + @PathParam("capabilityName") String capabilityName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("parentProviderNamespace") String parentProviderNamespace, + @PathParam("parentResourceType") String parentResourceType, + @PathParam("parentResourceName") String parentResourceName, + @PathParam("targetName") String targetName, + @PathParam("capabilityName") String capabilityName, + @BodyParam("application/json") CapabilityInner capability, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a list of Capability resources that extend a Target resource.. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param continuationToken String that sets the continuation token. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability resources that extend a Target resource. along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String continuationToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parentProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); + } + if (parentResourceType == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); + } + if (parentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); + } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + continuationToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of Capability resources that extend a Target resource.. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability resources that extend a Target resource. along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String continuationToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parentProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); + } + if (parentResourceType == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); + } + if (parentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); + } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + continuationToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list of Capability resources that extend a Target resource.. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param continuationToken String that sets the continuation token. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability resources that extend a Target resource. as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String continuationToken) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + continuationToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of Capability resources that extend a Target resource.. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability resources that extend a Target resource. as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName) { + final String continuationToken = null; + return new PagedFlux<>( + () -> + listSinglePageAsync( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + continuationToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of Capability resources that extend a Target resource.. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability resources that extend a Target resource. as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String continuationToken, + Context context) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + continuationToken, + context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of Capability resources that extend a Target resource.. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability resources that extend a Target resource. as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName) { + final String continuationToken = null; + return new PagedIterable<>( + listAsync( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + continuationToken)); + } + + /** + * Get a list of Capability resources that extend a Target resource.. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability resources that extend a Target resource. as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String continuationToken, + Context context) { + return new PagedIterable<>( + listAsync( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + continuationToken, + context)); + } + + /** + * Get a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability resource that extends a Target resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parentProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); + } + if (parentResourceType == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); + } + if (parentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); + } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } + if (capabilityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capabilityName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability resource that extends a Target resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parentProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); + } + if (parentResourceType == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); + } + if (parentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); + } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } + if (capabilityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capabilityName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + accept, + context); + } + + /** + * Get a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability resource that extends a Target resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName) { + return getWithResponseAsync( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability resource that extends a Target resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + Context context) { + return getWithResponseAsync( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + context) + .block(); + } + + /** + * Get a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability resource that extends a Target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CapabilityInner get( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName) { + return getWithResponse( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + Context.NONE) + .getValue(); + } + + /** + * Delete a Capability that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parentProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); + } + if (parentResourceType == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); + } + if (parentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); + } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } + if (capabilityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capabilityName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Capability that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parentProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); + } + if (parentResourceType == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); + } + if (parentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); + } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } + if (capabilityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capabilityName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + accept, + context); + } + + /** + * Delete a Capability that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName) { + return deleteWithResponseAsync( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a Capability that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + context) + .block(); + } + + /** + * Delete a Capability that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName) { + deleteWithResponse( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + Context.NONE); + } + + /** + * Create or update a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @param capability Capability resource to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Capability resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + CapabilityInner capability) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parentProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); + } + if (parentResourceType == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); + } + if (parentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); + } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } + if (capabilityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capabilityName is required and cannot be null.")); + } + if (capability == null) { + return Mono.error(new IllegalArgumentException("Parameter capability is required and cannot be null.")); + } else { + capability.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + capability, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @param capability Capability resource to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Capability resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + CapabilityInner capability, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parentProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); + } + if (parentResourceType == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); + } + if (parentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); + } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } + if (capabilityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capabilityName is required and cannot be null.")); + } + if (capability == null) { + return Mono.error(new IllegalArgumentException("Parameter capability is required and cannot be null.")); + } else { + capability.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + capability, + accept, + context); + } + + /** + * Create or update a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @param capability Capability resource to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Capability resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + CapabilityInner capability) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + capability) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @param capability Capability resource to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Capability resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + CapabilityInner capability, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + capability, + context) + .block(); + } + + /** + * Create or update a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @param capability Capability resource to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Capability resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CapabilityInner createOrUpdate( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + CapabilityInner capability) { + return createOrUpdateWithResponse( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + capability, + Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a list of Capability resources and a link for pagination along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a list of Capability resources and a link for pagination along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilitiesImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilitiesImpl.java new file mode 100644 index 0000000000000..524e853d9a4c6 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilitiesImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.chaos.fluent.CapabilitiesClient; +import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; +import com.azure.resourcemanager.chaos.models.Capabilities; +import com.azure.resourcemanager.chaos.models.Capability; + +public final class CapabilitiesImpl implements Capabilities { + private static final ClientLogger LOGGER = new ClientLogger(CapabilitiesImpl.class); + + private final CapabilitiesClient innerClient; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + public CapabilitiesImpl( + CapabilitiesClient innerClient, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName) { + PagedIterable inner = + this + .serviceClient() + .list(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName); + return Utils.mapPage(inner, inner1 -> new CapabilityImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String continuationToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .list( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + continuationToken, + context); + return Utils.mapPage(inner, inner1 -> new CapabilityImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CapabilityImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Capability get( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName) { + CapabilityInner inner = + this + .serviceClient() + .get( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName); + if (inner != null) { + return new CapabilityImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + Context context) { + return this + .serviceClient() + .deleteWithResponse( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + context); + } + + public void delete( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName) { + this + .serviceClient() + .delete( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName); + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + CapabilityInner capability, + Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + capability, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CapabilityImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Capability createOrUpdate( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + CapabilityInner capability) { + CapabilityInner inner = + this + .serviceClient() + .createOrUpdate( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + capabilityName, + capability); + if (inner != null) { + return new CapabilityImpl(inner, this.manager()); + } else { + return null; + } + } + + private CapabilitiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityImpl.java new file mode 100644 index 0000000000000..1fae5a86f13a8 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; +import com.azure.resourcemanager.chaos.models.Capability; + +public final class CapabilityImpl implements Capability { + private CapabilityInner innerObject; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + CapabilityImpl(CapabilityInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String publisher() { + return this.innerModel().publisher(); + } + + public String targetType() { + return this.innerModel().targetType(); + } + + public String description() { + return this.innerModel().description(); + } + + public String parametersSchema() { + return this.innerModel().parametersSchema(); + } + + public String urn() { + return this.innerModel().urn(); + } + + public CapabilityInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypeImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypeImpl.java new file mode 100644 index 0000000000000..5aa489fe119f6 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypeImpl.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeInner; +import com.azure.resourcemanager.chaos.models.CapabilityType; +import com.azure.resourcemanager.chaos.models.CapabilityTypePropertiesPermissionsNecessary; +import com.azure.resourcemanager.chaos.models.CapabilityTypePropertiesRuntimeProperties; + +public final class CapabilityTypeImpl implements CapabilityType { + private CapabilityTypeInner innerObject; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + CapabilityTypeImpl(CapabilityTypeInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String location() { + return this.innerModel().location(); + } + + public String publisher() { + return this.innerModel().publisher(); + } + + public String targetType() { + return this.innerModel().targetType(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String description() { + return this.innerModel().description(); + } + + public String parametersSchema() { + return this.innerModel().parametersSchema(); + } + + public String urn() { + return this.innerModel().urn(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public CapabilityTypePropertiesPermissionsNecessary permissionsNecessary() { + return this.innerModel().permissionsNecessary(); + } + + public CapabilityTypePropertiesRuntimeProperties runtimeProperties() { + return this.innerModel().runtimeProperties(); + } + + public CapabilityTypeInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesClientImpl.java new file mode 100644 index 0000000000000..fb5359984b2c1 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesClientImpl.java @@ -0,0 +1,543 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.chaos.fluent.CapabilityTypesClient; +import com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeInner; +import com.azure.resourcemanager.chaos.models.CapabilityTypeListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CapabilityTypesClient. */ +public final class CapabilityTypesClientImpl implements CapabilityTypesClient { + /** The proxy service used to perform REST calls. */ + private final CapabilityTypesService service; + + /** The service client containing this operation class. */ + private final ChaosManagementClientImpl client; + + /** + * Initializes an instance of CapabilityTypesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CapabilityTypesClientImpl(ChaosManagementClientImpl client) { + this.service = + RestProxy.create(CapabilityTypesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ChaosManagementClientCapabilityTypes to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ChaosManagementClien") + public interface CapabilityTypesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationName") String locationName, + @PathParam("targetTypeName") String targetTypeName, + @QueryParam("continuationToken") String continuationToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationName") String locationName, + @PathParam("targetTypeName") String targetTypeName, + @PathParam("capabilityTypeName") String capabilityTypeName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a list of Capability Type resources for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param continuationToken String that sets the continuation token. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability Type resources for given Target Type and location along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String locationName, String targetTypeName, String continuationToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (targetTypeName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetTypeName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + locationName, + targetTypeName, + continuationToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of Capability Type resources for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability Type resources for given Target Type and location along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String locationName, String targetTypeName, String continuationToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (targetTypeName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetTypeName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + locationName, + targetTypeName, + continuationToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list of Capability Type resources for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param continuationToken String that sets the continuation token. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability Type resources for given Target Type and location as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String locationName, String targetTypeName, String continuationToken) { + return new PagedFlux<>( + () -> listSinglePageAsync(locationName, targetTypeName, continuationToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of Capability Type resources for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability Type resources for given Target Type and location as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String locationName, String targetTypeName) { + final String continuationToken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(locationName, targetTypeName, continuationToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of Capability Type resources for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability Type resources for given Target Type and location as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String locationName, String targetTypeName, String continuationToken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(locationName, targetTypeName, continuationToken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of Capability Type resources for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability Type resources for given Target Type and location as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String locationName, String targetTypeName) { + final String continuationToken = null; + return new PagedIterable<>(listAsync(locationName, targetTypeName, continuationToken)); + } + + /** + * Get a list of Capability Type resources for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability Type resources for given Target Type and location as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String locationName, String targetTypeName, String continuationToken, Context context) { + return new PagedIterable<>(listAsync(locationName, targetTypeName, continuationToken, context)); + } + + /** + * Get a Capability Type resource for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param capabilityTypeName String that represents a Capability Type resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability Type resource for given Target Type and location along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, String targetTypeName, String capabilityTypeName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (targetTypeName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetTypeName is required and cannot be null.")); + } + if (capabilityTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter capabilityTypeName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + locationName, + targetTypeName, + capabilityTypeName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Capability Type resource for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param capabilityTypeName String that represents a Capability Type resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability Type resource for given Target Type and location along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, String targetTypeName, String capabilityTypeName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (targetTypeName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetTypeName is required and cannot be null.")); + } + if (capabilityTypeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter capabilityTypeName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + locationName, + targetTypeName, + capabilityTypeName, + accept, + context); + } + + /** + * Get a Capability Type resource for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param capabilityTypeName String that represents a Capability Type resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability Type resource for given Target Type and location on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String locationName, String targetTypeName, String capabilityTypeName) { + return getWithResponseAsync(locationName, targetTypeName, capabilityTypeName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Capability Type resource for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param capabilityTypeName String that represents a Capability Type resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability Type resource for given Target Type and location along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String locationName, String targetTypeName, String capabilityTypeName, Context context) { + return getWithResponseAsync(locationName, targetTypeName, capabilityTypeName, context).block(); + } + + /** + * Get a Capability Type resource for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param capabilityTypeName String that represents a Capability Type resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability Type resource for given Target Type and location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CapabilityTypeInner get(String locationName, String targetTypeName, String capabilityTypeName) { + return getWithResponse(locationName, targetTypeName, capabilityTypeName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a list of Capability Type resources and a link for pagination along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a list of Capability Type resources and a link for pagination along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesImpl.java new file mode 100644 index 0000000000000..d846aab402ea6 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/CapabilityTypesImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.chaos.fluent.CapabilityTypesClient; +import com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeInner; +import com.azure.resourcemanager.chaos.models.CapabilityType; +import com.azure.resourcemanager.chaos.models.CapabilityTypes; + +public final class CapabilityTypesImpl implements CapabilityTypes { + private static final ClientLogger LOGGER = new ClientLogger(CapabilityTypesImpl.class); + + private final CapabilityTypesClient innerClient; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + public CapabilityTypesImpl( + CapabilityTypesClient innerClient, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String locationName, String targetTypeName) { + PagedIterable inner = this.serviceClient().list(locationName, targetTypeName); + return Utils.mapPage(inner, inner1 -> new CapabilityTypeImpl(inner1, this.manager())); + } + + public PagedIterable list( + String locationName, String targetTypeName, String continuationToken, Context context) { + PagedIterable inner = + this.serviceClient().list(locationName, targetTypeName, continuationToken, context); + return Utils.mapPage(inner, inner1 -> new CapabilityTypeImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String locationName, String targetTypeName, String capabilityTypeName, Context context) { + Response inner = + this.serviceClient().getWithResponse(locationName, targetTypeName, capabilityTypeName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CapabilityTypeImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CapabilityType get(String locationName, String targetTypeName, String capabilityTypeName) { + CapabilityTypeInner inner = this.serviceClient().get(locationName, targetTypeName, capabilityTypeName); + if (inner != null) { + return new CapabilityTypeImpl(inner, this.manager()); + } else { + return null; + } + } + + private CapabilityTypesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientBuilder.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientBuilder.java new file mode 100644 index 0000000000000..ed74ff20611a7 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientBuilder.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the ChaosManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {ChaosManagementClientImpl.class}) +public final class ChaosManagementClientBuilder { + /* + * GUID that represents an Azure subscription ID. + */ + private String subscriptionId; + + /** + * Sets GUID that represents an Azure subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the ChaosManagementClientBuilder. + */ + public ChaosManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ChaosManagementClientBuilder. + */ + public ChaosManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ChaosManagementClientBuilder. + */ + public ChaosManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the ChaosManagementClientBuilder. + */ + public ChaosManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the ChaosManagementClientBuilder. + */ + public ChaosManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the ChaosManagementClientBuilder. + */ + public ChaosManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ChaosManagementClientImpl with the provided parameters. + * + * @return an instance of ChaosManagementClientImpl. + */ + public ChaosManagementClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = + (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval = + (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + ChaosManagementClientImpl client = + new ChaosManagementClientImpl( + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + subscriptionId, + localEndpoint); + return client; + } +} 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 new file mode 100644 index 0000000000000..ce1aa9e684fd7 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ChaosManagementClientImpl.java @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.chaos.fluent.CapabilitiesClient; +import com.azure.resourcemanager.chaos.fluent.CapabilityTypesClient; +import com.azure.resourcemanager.chaos.fluent.ChaosManagementClient; +import com.azure.resourcemanager.chaos.fluent.ExperimentsClient; +import com.azure.resourcemanager.chaos.fluent.OperationsClient; +import com.azure.resourcemanager.chaos.fluent.TargetTypesClient; +import com.azure.resourcemanager.chaos.fluent.TargetsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the ChaosManagementClientImpl type. */ +@ServiceClient(builder = ChaosManagementClientBuilder.class) +public final class ChaosManagementClientImpl implements ChaosManagementClient { + /** GUID that represents an Azure subscription ID. */ + private final String subscriptionId; + + /** + * Gets GUID that represents an Azure subscription ID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The CapabilitiesClient object to access its operations. */ + private final CapabilitiesClient capabilities; + + /** + * Gets the CapabilitiesClient object to access its operations. + * + * @return the CapabilitiesClient object. + */ + public CapabilitiesClient getCapabilities() { + return this.capabilities; + } + + /** The CapabilityTypesClient object to access its operations. */ + private final CapabilityTypesClient capabilityTypes; + + /** + * Gets the CapabilityTypesClient object to access its operations. + * + * @return the CapabilityTypesClient object. + */ + public CapabilityTypesClient getCapabilityTypes() { + return this.capabilityTypes; + } + + /** The ExperimentsClient object to access its operations. */ + private final ExperimentsClient experiments; + + /** + * Gets the ExperimentsClient object to access its operations. + * + * @return the ExperimentsClient object. + */ + public ExperimentsClient getExperiments() { + return this.experiments; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** 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; + } + + /** The TargetsClient object to access its operations. */ + private final TargetsClient targets; + + /** + * Gets the TargetsClient object to access its operations. + * + * @return the TargetsClient object. + */ + public TargetsClient getTargets() { + return this.targets; + } + + /** + * Initializes an instance of ChaosManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId GUID that represents an Azure subscription ID. + * @param endpoint server parameter. + */ + ChaosManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2023-04-01-preview"; + this.capabilities = new CapabilitiesClientImpl(this); + this.capabilityTypes = new CapabilityTypesClientImpl(this); + this.experiments = new ExperimentsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.targetTypes = new TargetTypesClientImpl(this); + this.targets = new TargetsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ChaosManagementClientImpl.class); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentCancelOperationResultImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentCancelOperationResultImpl.java new file mode 100644 index 0000000000000..ab9f6c580516b --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentCancelOperationResultImpl.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.resourcemanager.chaos.fluent.models.ExperimentCancelOperationResultInner; +import com.azure.resourcemanager.chaos.models.ExperimentCancelOperationResult; + +public final class ExperimentCancelOperationResultImpl implements ExperimentCancelOperationResult { + private ExperimentCancelOperationResultInner innerObject; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + ExperimentCancelOperationResultImpl( + ExperimentCancelOperationResultInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String statusUrl() { + return this.innerModel().statusUrl(); + } + + public ExperimentCancelOperationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionDetailsImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionDetailsImpl.java new file mode 100644 index 0000000000000..abb9d17a9c4b1 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentExecutionDetailsImpl.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; +import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetails; +import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsPropertiesRunInformation; +import java.time.OffsetDateTime; + +public final class ExperimentExecutionDetailsImpl implements ExperimentExecutionDetails { + private ExperimentExecutionDetailsInner innerObject; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + ExperimentExecutionDetailsImpl( + ExperimentExecutionDetailsInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String type() { + return this.innerModel().type(); + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String experimentId() { + return this.innerModel().experimentId(); + } + + public String status() { + return this.innerModel().status(); + } + + public String failureReason() { + return this.innerModel().failureReason(); + } + + public OffsetDateTime createdDateTime() { + return this.innerModel().createdDateTime(); + } + + public OffsetDateTime lastActionDateTime() { + return this.innerModel().lastActionDateTime(); + } + + public OffsetDateTime startDateTime() { + return this.innerModel().startDateTime(); + } + + public OffsetDateTime stopDateTime() { + return this.innerModel().stopDateTime(); + } + + public ExperimentExecutionDetailsPropertiesRunInformation runInformation() { + return this.innerModel().runInformation(); + } + + public ExperimentExecutionDetailsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentImpl.java new file mode 100644 index 0000000000000..d48f0bfa66a59 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentImpl.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +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.Experiment; +import com.azure.resourcemanager.chaos.models.ExperimentCancelOperationResult; +import com.azure.resourcemanager.chaos.models.ExperimentStartOperationResult; +import com.azure.resourcemanager.chaos.models.ExperimentUpdate; +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; + +public final class ExperimentImpl implements Experiment, Experiment.Definition, Experiment.Update { + private ExperimentInner innerObject; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ResourceIdentity identity() { + return this.innerModel().identity(); + } + + public List steps() { + List inner = this.innerModel().steps(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List selectors() { + List inner = this.innerModel().selectors(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean startOnCreation() { + return this.innerModel().startOnCreation(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ExperimentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String experimentName; + + private ExperimentUpdate updateExperiment; + + public ExperimentImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Experiment create() { + this.innerObject = + serviceManager + .serviceClient() + .getExperiments() + .createOrUpdateWithResponse(resourceGroupName, experimentName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Experiment create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getExperiments() + .createOrUpdateWithResponse(resourceGroupName, experimentName, this.innerModel(), context) + .getValue(); + return this; + } + + ExperimentImpl(String name, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerObject = new ExperimentInner(); + this.serviceManager = serviceManager; + this.experimentName = name; + } + + public ExperimentImpl update() { + this.updateExperiment = new ExperimentUpdate(); + return this; + } + + public Experiment apply() { + this.innerObject = + serviceManager + .serviceClient() + .getExperiments() + .updateWithResponse(resourceGroupName, experimentName, updateExperiment, Context.NONE) + .getValue(); + return this; + } + + public Experiment apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getExperiments() + .updateWithResponse(resourceGroupName, experimentName, updateExperiment, context) + .getValue(); + return this; + } + + ExperimentImpl(ExperimentInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.experimentName = Utils.getValueFromIdByName(innerObject.id(), "experiments"); + } + + public Experiment refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getExperiments() + .getByResourceGroupWithResponse(resourceGroupName, experimentName, Context.NONE) + .getValue(); + return this; + } + + public Experiment refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getExperiments() + .getByResourceGroupWithResponse(resourceGroupName, experimentName, context) + .getValue(); + return this; + } + + public Response cancelWithResponse(Context context) { + return serviceManager.experiments().cancelWithResponse(resourceGroupName, experimentName, context); + } + + public ExperimentCancelOperationResult cancel() { + return serviceManager.experiments().cancel(resourceGroupName, experimentName); + } + + public Response startWithResponse(Context context) { + return serviceManager.experiments().startWithResponse(resourceGroupName, experimentName, context); + } + + public ExperimentStartOperationResult start() { + return serviceManager.experiments().start(resourceGroupName, experimentName); + } + + public ExperimentImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ExperimentImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ExperimentImpl withSteps(List steps) { + this.innerModel().withSteps(steps); + return this; + } + + public ExperimentImpl withSelectors(List selectors) { + this.innerModel().withSelectors(selectors); + return this; + } + + public ExperimentImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public ExperimentImpl withIdentity(ResourceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateExperiment.withIdentity(identity); + return this; + } + } + + public ExperimentImpl withStartOnCreation(Boolean startOnCreation) { + this.innerModel().withStartOnCreation(startOnCreation); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentStartOperationResultImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentStartOperationResultImpl.java new file mode 100644 index 0000000000000..8fa3ca1fcc2c6 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentStartOperationResultImpl.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.resourcemanager.chaos.fluent.models.ExperimentStartOperationResultInner; +import com.azure.resourcemanager.chaos.models.ExperimentStartOperationResult; + +public final class ExperimentStartOperationResultImpl implements ExperimentStartOperationResult { + private ExperimentStartOperationResultInner innerObject; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + ExperimentStartOperationResultImpl( + ExperimentStartOperationResultInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String statusUrl() { + return this.innerModel().statusUrl(); + } + + public ExperimentStartOperationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentStatusImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentStatusImpl.java new file mode 100644 index 0000000000000..491789a838555 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentStatusImpl.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.resourcemanager.chaos.fluent.models.ExperimentStatusInner; +import com.azure.resourcemanager.chaos.models.ExperimentStatus; +import java.time.OffsetDateTime; + +public final class ExperimentStatusImpl implements ExperimentStatus { + private ExperimentStatusInner innerObject; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + ExperimentStatusImpl( + ExperimentStatusInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String type() { + return this.innerModel().type(); + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String status() { + return this.innerModel().status(); + } + + public OffsetDateTime createdDateUtc() { + return this.innerModel().createdDateUtc(); + } + + public OffsetDateTime endDateUtc() { + return this.innerModel().endDateUtc(); + } + + public ExperimentStatusInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java new file mode 100644 index 0000000000000..dcf3d6a39bc9f --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsClientImpl.java @@ -0,0 +1,2556 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.chaos.fluent.ExperimentsClient; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentCancelOperationResultInner; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentStartOperationResultInner; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentStatusInner; +import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetailsListResult; +import com.azure.resourcemanager.chaos.models.ExperimentListResult; +import com.azure.resourcemanager.chaos.models.ExperimentStatusListResult; +import com.azure.resourcemanager.chaos.models.ExperimentUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ExperimentsClient. */ +public final class ExperimentsClientImpl implements ExperimentsClient { + /** The proxy service used to perform REST calls. */ + private final ExperimentsService service; + + /** The service client containing this operation class. */ + private final ChaosManagementClientImpl client; + + /** + * Initializes an instance of ExperimentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExperimentsClientImpl(ChaosManagementClientImpl client) { + this.service = + RestProxy.create(ExperimentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ChaosManagementClientExperiments to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ChaosManagementClien") + public interface ExperimentsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/experiments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("running") Boolean running, + @QueryParam("continuationToken") String continuationToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("running") Boolean running, + @QueryParam("continuationToken") String continuationToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("experimentName") String experimentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("experimentName") String experimentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("experimentName") String experimentName, + @BodyParam("application/json") ExperimentInner experiment, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("experimentName") String experimentName, + @BodyParam("application/json") ExperimentUpdate experiment, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancel( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("experimentName") String experimentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> start( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("experimentName") String experimentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllStatuses( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("experimentName") String experimentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses/{statusId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getStatus( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("experimentName") String experimentName, + @PathParam("statusId") String statusId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listExecutionDetails( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("experimentName") String experimentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails/{executionDetailsId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getExecutionDetails( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("experimentName") String experimentName, + @PathParam("executionDetailsId") String executionDetailsId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllStatusesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listExecutionDetailsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a list of Experiment resources in a subscription. + * + * @param running Optional value that indicates whether to filter results based on if the Experiment is currently + * running. If null, then the results will not be filtered. + * @param continuationToken String that sets the continuation token. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Boolean running, String continuationToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + running, + continuationToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of Experiment resources in a subscription. + * + * @param running Optional value that indicates whether to filter results based on if the Experiment is currently + * running. If null, then the results will not be filtered. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + Boolean running, String continuationToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + running, + continuationToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list of Experiment resources in a subscription. + * + * @param running Optional value that indicates whether to filter results based on if the Experiment is currently + * running. If null, then the results will not be filtered. + * @param continuationToken String that sets the continuation token. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Boolean running, String continuationToken) { + return new PagedFlux<>( + () -> listSinglePageAsync(running, continuationToken), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of Experiment resources in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final Boolean running = null; + final String continuationToken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(running, continuationToken), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of Experiment resources in a subscription. + * + * @param running Optional value that indicates whether to filter results based on if the Experiment is currently + * running. If null, then the results will not be filtered. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Boolean running, String continuationToken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(running, continuationToken, context), + nextLink -> listAllNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of Experiment resources in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final Boolean running = null; + final String continuationToken = null; + return new PagedIterable<>(listAsync(running, continuationToken)); + } + + /** + * Get a list of Experiment resources in a subscription. + * + * @param running Optional value that indicates whether to filter results based on if the Experiment is currently + * running. If null, then the results will not be filtered. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Boolean running, String continuationToken, Context context) { + return new PagedIterable<>(listAsync(running, continuationToken, context)); + } + + /** + * Get a list of Experiment resources in a resource group. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param running Optional value that indicates whether to filter results based on if the Experiment is currently + * running. If null, then the results will not be filtered. + * @param continuationToken String that sets the continuation token. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a resource group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Boolean running, String continuationToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + running, + continuationToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of Experiment resources in a resource group. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param running Optional value that indicates whether to filter results based on if the Experiment is currently + * running. If null, then the results will not be filtered. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a resource group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Boolean running, String continuationToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + running, + continuationToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list of Experiment resources in a resource group. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param running Optional value that indicates whether to filter results based on if the Experiment is currently + * running. If null, then the results will not be filtered. + * @param continuationToken String that sets the continuation token. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Boolean running, String continuationToken) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, running, continuationToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of Experiment resources in a resource group. + * + * @param resourceGroupName String that represents an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final Boolean running = null; + final String continuationToken = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, running, continuationToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of Experiment resources in a resource group. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param running Optional value that indicates whether to filter results based on if the Experiment is currently + * running. If null, then the results will not be filtered. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Boolean running, String continuationToken, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, running, continuationToken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of Experiment resources in a resource group. + * + * @param resourceGroupName String that represents an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final Boolean running = null; + final String continuationToken = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, running, continuationToken)); + } + + /** + * Get a list of Experiment resources in a resource group. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param running Optional value that indicates whether to filter results based on if the Experiment is currently + * running. If null, then the results will not be filtered. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Boolean running, String continuationToken, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, running, continuationToken, context)); + } + + /** + * Delete a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String experimentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String experimentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + accept, + context); + } + + /** + * Delete a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String experimentName) { + return deleteWithResponseAsync(resourceGroupName, experimentName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String experimentName, Context context) { + return deleteWithResponseAsync(resourceGroupName, experimentName, context).block(); + } + + /** + * Delete a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String experimentName) { + deleteWithResponse(resourceGroupName, experimentName, Context.NONE); + } + + /** + * Get a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Experiment resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String experimentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Experiment resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String experimentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + accept, + context); + } + + /** + * Get a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Experiment resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String experimentName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, experimentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Experiment resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String experimentName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, experimentName, context).block(); + } + + /** + * Get a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExperimentInner getByResourceGroup(String resourceGroupName, String experimentName) { + return getByResourceGroupWithResponse(resourceGroupName, experimentName, Context.NONE).getValue(); + } + + /** + * Create or update a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Experiment resource to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Experiment resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String experimentName, ExperimentInner experiment) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + if (experiment == null) { + return Mono.error(new IllegalArgumentException("Parameter experiment is required and cannot be null.")); + } else { + experiment.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + experiment, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Experiment resource to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Experiment resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String experimentName, ExperimentInner experiment, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + if (experiment == null) { + return Mono.error(new IllegalArgumentException("Parameter experiment is required and cannot be null.")); + } else { + experiment.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + experiment, + accept, + context); + } + + /** + * Create or update a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Experiment resource to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Experiment resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String experimentName, ExperimentInner experiment) { + return createOrUpdateWithResponseAsync(resourceGroupName, experimentName, experiment) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Experiment resource to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Experiment resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String experimentName, ExperimentInner experiment, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, experimentName, experiment, context).block(); + } + + /** + * Create or update a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Experiment resource to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExperimentInner createOrUpdate(String resourceGroupName, String experimentName, ExperimentInner experiment) { + return createOrUpdateWithResponse(resourceGroupName, experimentName, experiment, Context.NONE).getValue(); + } + + /** + * The operation to update an experiment. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Parameters supplied to the Update experiment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Experiment resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String experimentName, ExperimentUpdate experiment) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + if (experiment == null) { + return Mono.error(new IllegalArgumentException("Parameter experiment is required and cannot be null.")); + } else { + experiment.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + experiment, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update an experiment. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Parameters supplied to the Update experiment operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Experiment resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String experimentName, ExperimentUpdate experiment, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + if (experiment == null) { + return Mono.error(new IllegalArgumentException("Parameter experiment is required and cannot be null.")); + } else { + experiment.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + experiment, + accept, + context); + } + + /** + * The operation to update an experiment. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Parameters supplied to the Update experiment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Experiment resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String experimentName, ExperimentUpdate experiment) { + return updateWithResponseAsync(resourceGroupName, experimentName, experiment) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * The operation to update an experiment. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Parameters supplied to the Update experiment operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Experiment resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String experimentName, ExperimentUpdate experiment, Context context) { + return updateWithResponseAsync(resourceGroupName, experimentName, experiment, context).block(); + } + + /** + * The operation to update an experiment. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param experiment Parameters supplied to the Update experiment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExperimentInner update(String resourceGroupName, String experimentName, ExperimentUpdate experiment) { + return updateWithResponse(resourceGroupName, experimentName, experiment, Context.NONE).getValue(); + } + + /** + * Cancel a running Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a cancel Experiment operation along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync( + String resourceGroupName, String experimentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .cancel( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Cancel a running Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a cancel Experiment operation along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync( + String resourceGroupName, String experimentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .cancel( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + accept, + context); + } + + /** + * Cancel a running Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a cancel Experiment operation on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAsync(String resourceGroupName, String experimentName) { + return cancelWithResponseAsync(resourceGroupName, experimentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Cancel a running Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a cancel Experiment operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelWithResponse( + String resourceGroupName, String experimentName, Context context) { + return cancelWithResponseAsync(resourceGroupName, experimentName, context).block(); + } + + /** + * Cancel a running Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a cancel Experiment operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExperimentCancelOperationResultInner cancel(String resourceGroupName, String experimentName) { + return cancelWithResponse(resourceGroupName, experimentName, Context.NONE).getValue(); + } + + /** + * Start a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a start Experiment operation along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> startWithResponseAsync( + String resourceGroupName, String experimentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .start( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Start a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a start Experiment operation along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> startWithResponseAsync( + String resourceGroupName, String experimentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .start( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + accept, + context); + } + + /** + * Start a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a start Experiment operation on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String experimentName) { + return startWithResponseAsync(resourceGroupName, experimentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Start a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a start Experiment operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response startWithResponse( + String resourceGroupName, String experimentName, Context context) { + return startWithResponseAsync(resourceGroupName, experimentName, context).block(); + } + + /** + * Start a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a start Experiment operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExperimentStartOperationResultInner start(String resourceGroupName, String experimentName) { + return startWithResponse(resourceGroupName, experimentName, Context.NONE).getValue(); + } + + /** + * Get a list of statuses of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of statuses of a Experiment resource along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllStatusesSinglePageAsync( + String resourceGroupName, String experimentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listAllStatuses( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of statuses of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of statuses of a Experiment resource along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllStatusesSinglePageAsync( + String resourceGroupName, String experimentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAllStatuses( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list of statuses of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of statuses of a Experiment resource as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAllStatusesAsync(String resourceGroupName, String experimentName) { + return new PagedFlux<>( + () -> listAllStatusesSinglePageAsync(resourceGroupName, experimentName), + nextLink -> listAllStatusesNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of statuses of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of statuses of a Experiment resource as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAllStatusesAsync( + String resourceGroupName, String experimentName, Context context) { + return new PagedFlux<>( + () -> listAllStatusesSinglePageAsync(resourceGroupName, experimentName, context), + nextLink -> listAllStatusesNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of statuses of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of statuses of a Experiment resource as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAllStatuses(String resourceGroupName, String experimentName) { + return new PagedIterable<>(listAllStatusesAsync(resourceGroupName, experimentName)); + } + + /** + * Get a list of statuses of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of statuses of a Experiment resource as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAllStatuses( + String resourceGroupName, String experimentName, Context context) { + return new PagedIterable<>(listAllStatusesAsync(resourceGroupName, experimentName, context)); + } + + /** + * Get a status of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param statusId GUID that represents a Experiment status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a status of a Experiment resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getStatusWithResponseAsync( + String resourceGroupName, String experimentName, String statusId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + if (statusId == null) { + return Mono.error(new IllegalArgumentException("Parameter statusId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getStatus( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + statusId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a status of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param statusId GUID that represents a Experiment status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a status of a Experiment resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getStatusWithResponseAsync( + String resourceGroupName, String experimentName, String statusId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + if (statusId == null) { + return Mono.error(new IllegalArgumentException("Parameter statusId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getStatus( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + statusId, + accept, + context); + } + + /** + * Get a status of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param statusId GUID that represents a Experiment status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a status of a Experiment resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getStatusAsync( + String resourceGroupName, String experimentName, String statusId) { + return getStatusWithResponseAsync(resourceGroupName, experimentName, statusId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a status of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param statusId GUID that represents a Experiment status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a status of a Experiment resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getStatusWithResponse( + String resourceGroupName, String experimentName, String statusId, Context context) { + return getStatusWithResponseAsync(resourceGroupName, experimentName, statusId, context).block(); + } + + /** + * Get a status of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param statusId GUID that represents a Experiment status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a status of a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExperimentStatusInner getStatus(String resourceGroupName, String experimentName, String statusId) { + return getStatusWithResponse(resourceGroupName, experimentName, statusId, Context.NONE).getValue(); + } + + /** + * Get a list of execution details of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of execution details of a Experiment resource along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listExecutionDetailsSinglePageAsync( + String resourceGroupName, String experimentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listExecutionDetails( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of execution details of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of execution details of a Experiment resource along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listExecutionDetailsSinglePageAsync( + String resourceGroupName, String experimentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listExecutionDetails( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list of execution details of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of execution details of a Experiment resource as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listExecutionDetailsAsync( + String resourceGroupName, String experimentName) { + return new PagedFlux<>( + () -> listExecutionDetailsSinglePageAsync(resourceGroupName, experimentName), + nextLink -> listExecutionDetailsNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of execution details of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of execution details of a Experiment resource as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listExecutionDetailsAsync( + String resourceGroupName, String experimentName, Context context) { + return new PagedFlux<>( + () -> listExecutionDetailsSinglePageAsync(resourceGroupName, experimentName, context), + nextLink -> listExecutionDetailsNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of execution details of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of execution details of a Experiment resource as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listExecutionDetails( + String resourceGroupName, String experimentName) { + return new PagedIterable<>(listExecutionDetailsAsync(resourceGroupName, experimentName)); + } + + /** + * Get a list of execution details of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of execution details of a Experiment resource as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listExecutionDetails( + String resourceGroupName, String experimentName, Context context) { + return new PagedIterable<>(listExecutionDetailsAsync(resourceGroupName, experimentName, context)); + } + + /** + * Get an execution detail of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param executionDetailsId GUID that represents a Experiment execution detail. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution detail of a Experiment resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getExecutionDetailsWithResponseAsync( + String resourceGroupName, String experimentName, String executionDetailsId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + if (executionDetailsId == null) { + return Mono + .error(new IllegalArgumentException("Parameter executionDetailsId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getExecutionDetails( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + executionDetailsId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get an execution detail of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param executionDetailsId GUID that represents a Experiment execution detail. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution detail of a Experiment resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getExecutionDetailsWithResponseAsync( + String resourceGroupName, String experimentName, String executionDetailsId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (experimentName == null) { + return Mono.error(new IllegalArgumentException("Parameter experimentName is required and cannot be null.")); + } + if (executionDetailsId == null) { + return Mono + .error(new IllegalArgumentException("Parameter executionDetailsId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getExecutionDetails( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + experimentName, + executionDetailsId, + accept, + context); + } + + /** + * Get an execution detail of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param executionDetailsId GUID that represents a Experiment execution detail. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution detail of a Experiment resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getExecutionDetailsAsync( + String resourceGroupName, String experimentName, String executionDetailsId) { + return getExecutionDetailsWithResponseAsync(resourceGroupName, experimentName, executionDetailsId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get an execution detail of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param executionDetailsId GUID that represents a Experiment execution detail. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution detail of a Experiment resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getExecutionDetailsWithResponse( + String resourceGroupName, String experimentName, String executionDetailsId, Context context) { + return getExecutionDetailsWithResponseAsync(resourceGroupName, experimentName, executionDetailsId, context) + .block(); + } + + /** + * Get an execution detail of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param executionDetailsId GUID that represents a Experiment execution detail. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution detail of a Experiment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExperimentExecutionDetailsInner getExecutionDetails( + String resourceGroupName, String experimentName, String executionDetailsId) { + return getExecutionDetailsWithResponse(resourceGroupName, experimentName, executionDetailsId, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a list of Experiment resources and a link for pagination along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAllNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a list of Experiment resources and a link for pagination along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAllNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a list of Experiment resources and a link for pagination along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a list of Experiment resources and a link for pagination along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a list of Experiment statuses and a link for pagination along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllStatusesNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAllStatusesNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a list of Experiment statuses and a link for pagination along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllStatusesNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAllStatusesNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a list of Experiment execution details and a link for pagination along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listExecutionDetailsNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listExecutionDetailsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a list of Experiment execution details and a link for pagination along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listExecutionDetailsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listExecutionDetailsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsImpl.java new file mode 100644 index 0000000000000..66d80202a470f --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/ExperimentsImpl.java @@ -0,0 +1,306 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.chaos.fluent.ExperimentsClient; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentCancelOperationResultInner; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentStartOperationResultInner; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentStatusInner; +import com.azure.resourcemanager.chaos.models.Experiment; +import com.azure.resourcemanager.chaos.models.ExperimentCancelOperationResult; +import com.azure.resourcemanager.chaos.models.ExperimentExecutionDetails; +import com.azure.resourcemanager.chaos.models.ExperimentStartOperationResult; +import com.azure.resourcemanager.chaos.models.ExperimentStatus; +import com.azure.resourcemanager.chaos.models.Experiments; + +public final class ExperimentsImpl implements Experiments { + private static final ClientLogger LOGGER = new ClientLogger(ExperimentsImpl.class); + + private final ExperimentsClient innerClient; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + public ExperimentsImpl(ExperimentsClient innerClient, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ExperimentImpl(inner1, this.manager())); + } + + public PagedIterable list(Boolean running, String continuationToken, Context context) { + PagedIterable inner = this.serviceClient().list(running, continuationToken, context); + return Utils.mapPage(inner, inner1 -> new ExperimentImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ExperimentImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, Boolean running, String continuationToken, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, running, continuationToken, context); + return Utils.mapPage(inner, inner1 -> new ExperimentImpl(inner1, this.manager())); + } + + public Response deleteByResourceGroupWithResponse( + String resourceGroupName, String experimentName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, experimentName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String experimentName) { + this.serviceClient().delete(resourceGroupName, experimentName); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String experimentName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, experimentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ExperimentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Experiment getByResourceGroup(String resourceGroupName, String experimentName) { + ExperimentInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, experimentName); + if (inner != null) { + return new ExperimentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response cancelWithResponse( + String resourceGroupName, String experimentName, Context context) { + Response inner = + this.serviceClient().cancelWithResponse(resourceGroupName, experimentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ExperimentCancelOperationResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ExperimentCancelOperationResult cancel(String resourceGroupName, String experimentName) { + ExperimentCancelOperationResultInner inner = this.serviceClient().cancel(resourceGroupName, experimentName); + if (inner != null) { + return new ExperimentCancelOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response startWithResponse( + String resourceGroupName, String experimentName, Context context) { + Response inner = + this.serviceClient().startWithResponse(resourceGroupName, experimentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ExperimentStartOperationResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ExperimentStartOperationResult start(String resourceGroupName, String experimentName) { + ExperimentStartOperationResultInner inner = this.serviceClient().start(resourceGroupName, experimentName); + if (inner != null) { + return new ExperimentStartOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listAllStatuses(String resourceGroupName, String experimentName) { + PagedIterable inner = + this.serviceClient().listAllStatuses(resourceGroupName, experimentName); + return Utils.mapPage(inner, inner1 -> new ExperimentStatusImpl(inner1, this.manager())); + } + + public PagedIterable listAllStatuses( + String resourceGroupName, String experimentName, Context context) { + PagedIterable inner = + this.serviceClient().listAllStatuses(resourceGroupName, experimentName, context); + return Utils.mapPage(inner, inner1 -> new ExperimentStatusImpl(inner1, this.manager())); + } + + public Response getStatusWithResponse( + String resourceGroupName, String experimentName, String statusId, Context context) { + Response inner = + this.serviceClient().getStatusWithResponse(resourceGroupName, experimentName, statusId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ExperimentStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ExperimentStatus getStatus(String resourceGroupName, String experimentName, String statusId) { + ExperimentStatusInner inner = this.serviceClient().getStatus(resourceGroupName, experimentName, statusId); + if (inner != null) { + return new ExperimentStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listExecutionDetails( + String resourceGroupName, String experimentName) { + PagedIterable inner = + this.serviceClient().listExecutionDetails(resourceGroupName, experimentName); + return Utils.mapPage(inner, inner1 -> new ExperimentExecutionDetailsImpl(inner1, this.manager())); + } + + public PagedIterable listExecutionDetails( + String resourceGroupName, String experimentName, Context context) { + PagedIterable inner = + this.serviceClient().listExecutionDetails(resourceGroupName, experimentName, context); + return Utils.mapPage(inner, inner1 -> new ExperimentExecutionDetailsImpl(inner1, this.manager())); + } + + public Response getExecutionDetailsWithResponse( + String resourceGroupName, String experimentName, String executionDetailsId, Context context) { + Response inner = + this + .serviceClient() + .getExecutionDetailsWithResponse(resourceGroupName, experimentName, executionDetailsId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ExperimentExecutionDetailsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ExperimentExecutionDetails getExecutionDetails( + String resourceGroupName, String experimentName, String executionDetailsId) { + ExperimentExecutionDetailsInner inner = + this.serviceClient().getExecutionDetails(resourceGroupName, experimentName, executionDetailsId); + if (inner != null) { + return new ExperimentExecutionDetailsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Experiment getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String experimentName = Utils.getValueFromIdByName(id, "experiments"); + if (experimentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'experiments'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, experimentName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String experimentName = Utils.getValueFromIdByName(id, "experiments"); + if (experimentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'experiments'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, experimentName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String experimentName = Utils.getValueFromIdByName(id, "experiments"); + if (experimentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'experiments'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, experimentName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String experimentName = Utils.getValueFromIdByName(id, "experiments"); + if (experimentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'experiments'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, experimentName, context); + } + + private ExperimentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } + + public ExperimentImpl define(String name) { + return new ExperimentImpl(name, this.manager()); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationImpl.java new file mode 100644 index 0000000000000..1680fbc0fd948 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.resourcemanager.chaos.fluent.models.OperationInner; +import com.azure.resourcemanager.chaos.models.ActionType; +import com.azure.resourcemanager.chaos.models.Operation; +import com.azure.resourcemanager.chaos.models.OperationDisplay; +import com.azure.resourcemanager.chaos.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..886c955a9fccc --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsClientImpl.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.chaos.fluent.OperationsClient; +import com.azure.resourcemanager.chaos.fluent.models.OperationInner; +import com.azure.resourcemanager.chaos.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final ChaosManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ChaosManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ChaosManagementClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ChaosManagementClien") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Chaos/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAll( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a list all available Operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list all available Operations along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listAll(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list all available Operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list all available Operations along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAll(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list all available Operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list all available Operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAllAsync() { + return new PagedFlux<>(() -> listAllSinglePageAsync(), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Get a list all available Operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list all available Operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAllAsync(Context context) { + return new PagedFlux<>( + () -> listAllSinglePageAsync(context), nextLink -> listAllNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list all available Operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list all available Operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAll() { + return new PagedIterable<>(listAllAsync()); + } + + /** + * Get a list all available Operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list all available Operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAll(Context context) { + return new PagedIterable<>(listAllAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAllNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAllNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..25e7075255985 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/OperationsImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.chaos.fluent.OperationsClient; +import com.azure.resourcemanager.chaos.fluent.models.OperationInner; +import com.azure.resourcemanager.chaos.models.Operation; +import com.azure.resourcemanager.chaos.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listAll() { + PagedIterable inner = this.serviceClient().listAll(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable listAll(Context context) { + PagedIterable inner = this.serviceClient().listAll(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetImpl.java new file mode 100644 index 0000000000000..ef8433375132c --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.chaos.fluent.models.TargetInner; +import com.azure.resourcemanager.chaos.models.Target; +import java.util.Collections; +import java.util.Map; + +public final class TargetImpl implements Target { + private TargetInner innerObject; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + TargetImpl(TargetInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map properties() { + Map inner = this.innerModel().properties(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public TargetInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypeImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypeImpl.java new file mode 100644 index 0000000000000..4d823d32c2b8f --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypeImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.chaos.fluent.models.TargetTypeInner; +import com.azure.resourcemanager.chaos.models.TargetType; +import java.util.Collections; +import java.util.List; + +public final class TargetTypeImpl implements TargetType { + private TargetTypeInner innerObject; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + TargetTypeImpl(TargetTypeInner innerObject, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String location() { + return this.innerModel().location(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String description() { + return this.innerModel().description(); + } + + public String propertiesSchema() { + return this.innerModel().propertiesSchema(); + } + + public List resourceTypes() { + List inner = this.innerModel().resourceTypes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public TargetTypeInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesClientImpl.java new file mode 100644 index 0000000000000..ce7407df6a7c3 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesClientImpl.java @@ -0,0 +1,496 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.chaos.fluent.TargetTypesClient; +import com.azure.resourcemanager.chaos.fluent.models.TargetTypeInner; +import com.azure.resourcemanager.chaos.models.TargetTypeListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TargetTypesClient. */ +public final class TargetTypesClientImpl implements TargetTypesClient { + /** The proxy service used to perform REST calls. */ + private final TargetTypesService service; + + /** The service client containing this operation class. */ + private final ChaosManagementClientImpl client; + + /** + * Initializes an instance of TargetTypesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TargetTypesClientImpl(ChaosManagementClientImpl client) { + this.service = + RestProxy.create(TargetTypesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ChaosManagementClientTargetTypes to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ChaosManagementClien") + public interface TargetTypesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationName") String locationName, + @QueryParam("continuationToken") String continuationToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationName") String locationName, + @PathParam("targetTypeName") String targetTypeName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a list of Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @param continuationToken String that sets the continuation token. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target Type resources for given location along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String locationName, String continuationToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + locationName, + continuationToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target Type resources for given location along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String locationName, String continuationToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + locationName, + continuationToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list of Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @param continuationToken String that sets the continuation token. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target Type resources for given location as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String locationName, String continuationToken) { + return new PagedFlux<>( + () -> listSinglePageAsync(locationName, continuationToken), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target Type resources for given location as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String locationName) { + final String continuationToken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(locationName, continuationToken), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target Type resources for given location as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String locationName, String continuationToken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(locationName, continuationToken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target Type resources for given location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String locationName) { + final String continuationToken = null; + return new PagedIterable<>(listAsync(locationName, continuationToken)); + } + + /** + * Get a list of Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target Type resources for given location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String locationName, String continuationToken, Context context) { + return new PagedIterable<>(listAsync(locationName, continuationToken, context)); + } + + /** + * Get a Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target Type resources for given location along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String locationName, String targetTypeName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (targetTypeName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetTypeName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + locationName, + targetTypeName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target Type resources for given location along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, String targetTypeName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (targetTypeName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetTypeName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + locationName, + targetTypeName, + accept, + context); + } + + /** + * Get a Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target Type resources for given location on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String locationName, String targetTypeName) { + return getWithResponseAsync(locationName, targetTypeName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target Type resources for given location along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String locationName, String targetTypeName, Context context) { + return getWithResponseAsync(locationName, targetTypeName, context).block(); + } + + /** + * Get a Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target Type resources for given location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TargetTypeInner get(String locationName, String targetTypeName) { + return getWithResponse(locationName, targetTypeName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a list of Target Type resources and a link for pagination along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a list of Target Type resources and a link for pagination along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesImpl.java new file mode 100644 index 0000000000000..f3b78d87c6c6f --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetTypesImpl.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.chaos.fluent.TargetTypesClient; +import com.azure.resourcemanager.chaos.fluent.models.TargetTypeInner; +import com.azure.resourcemanager.chaos.models.TargetType; +import com.azure.resourcemanager.chaos.models.TargetTypes; + +public final class TargetTypesImpl implements TargetTypes { + private static final ClientLogger LOGGER = new ClientLogger(TargetTypesImpl.class); + + private final TargetTypesClient innerClient; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + public TargetTypesImpl(TargetTypesClient innerClient, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String locationName) { + PagedIterable inner = this.serviceClient().list(locationName); + return Utils.mapPage(inner, inner1 -> new TargetTypeImpl(inner1, this.manager())); + } + + public PagedIterable list(String locationName, String continuationToken, Context context) { + PagedIterable inner = this.serviceClient().list(locationName, continuationToken, context); + return Utils.mapPage(inner, inner1 -> new TargetTypeImpl(inner1, this.manager())); + } + + public Response getWithResponse(String locationName, String targetTypeName, Context context) { + Response inner = this.serviceClient().getWithResponse(locationName, targetTypeName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TargetTypeImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TargetType get(String locationName, String targetTypeName) { + TargetTypeInner inner = this.serviceClient().get(locationName, targetTypeName); + if (inner != null) { + return new TargetTypeImpl(inner, this.manager()); + } else { + return null; + } + } + + private TargetTypesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsClientImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsClientImpl.java new file mode 100644 index 0000000000000..316f3813e73ac --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsClientImpl.java @@ -0,0 +1,1226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.chaos.fluent.TargetsClient; +import com.azure.resourcemanager.chaos.fluent.models.TargetInner; +import com.azure.resourcemanager.chaos.models.TargetListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TargetsClient. */ +public final class TargetsClientImpl implements TargetsClient { + /** The proxy service used to perform REST calls. */ + private final TargetsService service; + + /** The service client containing this operation class. */ + private final ChaosManagementClientImpl client; + + /** + * Initializes an instance of TargetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TargetsClientImpl(ChaosManagementClientImpl client) { + this.service = RestProxy.create(TargetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ChaosManagementClientTargets to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ChaosManagementClien") + public interface TargetsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("parentProviderNamespace") String parentProviderNamespace, + @PathParam("parentResourceType") String parentResourceType, + @PathParam("parentResourceName") String parentResourceName, + @QueryParam("continuationToken") String continuationToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("parentProviderNamespace") String parentProviderNamespace, + @PathParam("parentResourceType") String parentResourceType, + @PathParam("parentResourceName") String parentResourceName, + @PathParam("targetName") String targetName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("parentProviderNamespace") String parentProviderNamespace, + @PathParam("parentResourceType") String parentResourceType, + @PathParam("parentResourceName") String parentResourceName, + @PathParam("targetName") String targetName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("parentProviderNamespace") String parentProviderNamespace, + @PathParam("parentResourceType") String parentResourceType, + @PathParam("parentResourceName") String parentResourceName, + @PathParam("targetName") String targetName, + @BodyParam("application/json") TargetInner target, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a list of Target resources that extend a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param continuationToken String that sets the continuation token. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target resources that extend a tracked regional resource along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String continuationToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parentProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); + } + if (parentResourceType == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); + } + if (parentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + continuationToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of Target resources that extend a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target resources that extend a tracked regional resource along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String continuationToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parentProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); + } + if (parentResourceType == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); + } + if (parentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + continuationToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list of Target resources that extend a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param continuationToken String that sets the continuation token. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target resources that extend a tracked regional resource as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String continuationToken) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + continuationToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of Target resources that extend a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target resources that extend a tracked regional resource as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName) { + final String continuationToken = null; + return new PagedFlux<>( + () -> + listSinglePageAsync( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + continuationToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of Target resources that extend a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target resources that extend a tracked regional resource as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String continuationToken, + Context context) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + continuationToken, + context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of Target resources that extend a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target resources that extend a tracked regional resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName) { + final String continuationToken = null; + return new PagedIterable<>( + listAsync( + resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, continuationToken)); + } + + /** + * Get a list of Target resources that extend a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target resources that extend a tracked regional resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String continuationToken, + Context context) { + return new PagedIterable<>( + listAsync( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + continuationToken, + context)); + } + + /** + * Get a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target resource that extends a tracked regional resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parentProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); + } + if (parentResourceType == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); + } + if (parentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); + } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target resource that extends a tracked regional resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parentProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); + } + if (parentResourceType == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); + } + if (parentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); + } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + accept, + context); + } + + /** + * Get a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target resource that extends a tracked regional resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName) { + return getWithResponseAsync( + resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target resource that extends a tracked regional resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + Context context) { + return getWithResponseAsync( + resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName, context) + .block(); + } + + /** + * Get a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target resource that extends a tracked regional resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TargetInner get( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName) { + return getWithResponse( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + Context.NONE) + .getValue(); + } + + /** + * Delete a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parentProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); + } + if (parentResourceType == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); + } + if (parentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); + } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parentProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); + } + if (parentResourceType == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); + } + if (parentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); + } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + accept, + context); + } + + /** + * Delete a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName) { + return deleteWithResponseAsync( + resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName, context) + .block(); + } + + /** + * Delete a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName) { + deleteWithResponse( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + Context.NONE); + } + + /** + * Create or update a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param target Target resource to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Target resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + TargetInner target) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parentProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); + } + if (parentResourceType == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); + } + if (parentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); + } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } + if (target == null) { + return Mono.error(new IllegalArgumentException("Parameter target is required and cannot be null.")); + } else { + target.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + target, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param target Target resource to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Target resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + TargetInner target, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parentProviderNamespace == null) { + return Mono + .error( + new IllegalArgumentException("Parameter parentProviderNamespace is required and cannot be null.")); + } + if (parentResourceType == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceType is required and cannot be null.")); + } + if (parentResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter parentResourceName is required and cannot be null.")); + } + if (targetName == null) { + return Mono.error(new IllegalArgumentException("Parameter targetName is required and cannot be null.")); + } + if (target == null) { + return Mono.error(new IllegalArgumentException("Parameter target is required and cannot be null.")); + } else { + target.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + target, + accept, + context); + } + + /** + * Create or update a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param target Target resource to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Target resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + TargetInner target) { + return createOrUpdateWithResponseAsync( + resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName, target) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param target Target resource to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Target resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + TargetInner target, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + target, + context) + .block(); + } + + /** + * Create or update a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param target Target resource to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Target resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TargetInner createOrUpdate( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + TargetInner target) { + return createOrUpdateWithResponse( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + target, + Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a list of Target resources and a link for pagination along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a list of Target resources and a link for pagination along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsImpl.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsImpl.java new file mode 100644 index 0000000000000..7bcbde028239f --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/TargetsImpl.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.chaos.fluent.TargetsClient; +import com.azure.resourcemanager.chaos.fluent.models.TargetInner; +import com.azure.resourcemanager.chaos.models.Target; +import com.azure.resourcemanager.chaos.models.Targets; + +public final class TargetsImpl implements Targets { + private static final ClientLogger LOGGER = new ClientLogger(TargetsImpl.class); + + private final TargetsClient innerClient; + + private final com.azure.resourcemanager.chaos.ChaosManager serviceManager; + + public TargetsImpl(TargetsClient innerClient, com.azure.resourcemanager.chaos.ChaosManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName) { + PagedIterable inner = + this + .serviceClient() + .list(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName); + return Utils.mapPage(inner, inner1 -> new TargetImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String continuationToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .list( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + continuationToken, + context); + return Utils.mapPage(inner, inner1 -> new TargetImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TargetImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Target get( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName) { + TargetInner inner = + this + .serviceClient() + .get(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName); + if (inner != null) { + return new TargetImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + Context context) { + return this + .serviceClient() + .deleteWithResponse( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + context); + } + + public void delete( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName) { + this + .serviceClient() + .delete(resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName); + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + TargetInner target, + Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + target, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TargetImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Target createOrUpdate( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + TargetInner target) { + TargetInner inner = + this + .serviceClient() + .createOrUpdate( + resourceGroupName, + parentProviderNamespace, + parentResourceType, + parentResourceName, + targetName, + target); + if (inner != null) { + return new TargetImpl(inner, this.manager()); + } else { + return null; + } + } + + private TargetsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.chaos.ChaosManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/Utils.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/Utils.java new file mode 100644 index 0000000000000..a5c97173501ee --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/package-info.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/package-info.java new file mode 100644 index 0000000000000..a6fc0cab942d5 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for ChaosManagementClient. Chaos Management Client. */ +package com.azure.resourcemanager.chaos.implementation; 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..b66cd0a8ffc2d --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Action.java @@ -0,0 +1,71 @@ +// 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. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = Action.class) +@JsonTypeName("Action") +@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 Action { + /* + * String that represents a Capability URN. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** Creates an instance of Action class. */ + public Action() { + } + + /** + * 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 + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Action")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Action.class); +} 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 new file mode 100644 index 0000000000000..4307ffdb739a8 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ActionStatus.java @@ -0,0 +1,119 @@ +// 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.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Model that represents the an action and its status. */ +@Immutable +public final class ActionStatus { + /* + * 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; + + /** Creates an instance of ActionStatus class. */ + public ActionStatus() { + } + + /** + * Get the actionName property: The name of the action status. + * + * @return the actionName value. + */ + public String actionName() { + return this.actionName; + } + + /** + * Get the actionId property: The id of the action status. + * + * @return the actionId value. + */ + public String actionId() { + return this.actionId; + } + + /** + * Get the status property: The status of the action. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the startTime property: String that represents the start time of the action. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: String that represents the end time of the action. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the targets property: The array of targets. + * + * @return the targets value. + */ + public List targets() { + return this.targets; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (targets() != null) { + targets().forEach(e -> e.validate()); + } + } +} 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 new file mode 100644 index 0000000000000..83a87be8eca45 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ActionType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value Internal for ActionType. */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + @JsonCreator + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(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..6cb88d39d96ce --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Branch.java @@ -0,0 +1,90 @@ +// 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. */ +@Fluent +public final class Branch { + /* + * 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 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 + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Branch")); + } + if (actions() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property actions in model Branch")); + } else { + actions().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Branch.class); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/BranchStatus.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/BranchStatus.java new file mode 100644 index 0000000000000..af57124c70813 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/BranchStatus.java @@ -0,0 +1,88 @@ +// 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.JsonProperty; +import java.util.List; + +/** Model that represents the a list of actions and action statuses. */ +@Immutable +public final class BranchStatus { + /* + * 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; + + /** Creates an instance of BranchStatus class. */ + public BranchStatus() { + } + + /** + * Get the branchName property: The name of the branch status. + * + * @return the branchName value. + */ + public String branchName() { + return this.branchName; + } + + /** + * Get the branchId property: The id of the branch status. + * + * @return the branchId value. + */ + public String branchId() { + return this.branchId; + } + + /** + * Get the status property: The status of the branch. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the actions property: The array of actions. + * + * @return the actions value. + */ + public List actions() { + return this.actions; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (actions() != null) { + actions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Capabilities.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Capabilities.java new file mode 100644 index 0000000000000..e071ff39ef619 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Capabilities.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; + +/** Resource collection API of Capabilities. */ +public interface Capabilities { + /** + * Get a list of Capability resources that extend a Target resource.. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability resources that extend a Target resource. as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName); + + /** + * Get a list of Capability resources that extend a Target resource.. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability resources that extend a Target resource. as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String continuationToken, + Context context); + + /** + * Get a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability resource that extends a Target resource along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + Context context); + + /** + * Get a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability resource that extends a Target resource. + */ + Capability get( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName); + + /** + * Delete a Capability that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + Context context); + + /** + * Delete a Capability that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName); + + /** + * Create or update a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @param capability Capability resource to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Capability resource along with {@link Response}. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + CapabilityInner capability, + Context context); + + /** + * Create or update a Capability resource that extends a Target resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param capabilityName String that represents a Capability resource name. + * @param capability Capability resource to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Capability resource. + */ + Capability createOrUpdate( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + String capabilityName, + CapabilityInner capability); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Capability.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Capability.java new file mode 100644 index 0000000000000..26837dec35b4a --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Capability.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; + +/** An immutable client-side representation of Capability. */ +public interface Capability { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: The standard system metadata of a resource type. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the publisher property: String of the Publisher that this Capability extends. + * + * @return the publisher value. + */ + String publisher(); + + /** + * Gets the targetType property: String of the Target Type that this Capability extends. + * + * @return the targetType value. + */ + String targetType(); + + /** + * Gets the description property: Localized string of the description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the parametersSchema property: URL to retrieve JSON schema of the Capability parameters. + * + * @return the parametersSchema value. + */ + String parametersSchema(); + + /** + * Gets the urn property: String of the URN for this Capability Type. + * + * @return the urn value. + */ + String urn(); + + /** + * Gets the inner com.azure.resourcemanager.chaos.fluent.models.CapabilityInner object. + * + * @return the inner object. + */ + CapabilityInner innerModel(); +} 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 new file mode 100644 index 0000000000000..e1fd74729bef0 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityListResult.java @@ -0,0 +1,59 @@ +// 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.resourcemanager.chaos.fluent.models.CapabilityInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Model that represents a list of Capability resources and a link for pagination. */ +@Immutable +public final class CapabilityListResult { + /* + * 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; + + /** Creates an instance of CapabilityListResult class. */ + public CapabilityListResult() { + } + + /** + * Get the value property: List of Capability resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to retrieve the next page of Capability resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityType.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityType.java new file mode 100644 index 0000000000000..0b71d7d729cab --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityType.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeInner; + +/** An immutable client-side representation of CapabilityType. */ +public interface CapabilityType { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: The system metadata properties of the capability type resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the location property: Location of the Capability Type resource. + * + * @return the location value. + */ + String location(); + + /** + * Gets the publisher property: String of the Publisher that this Capability Type extends. + * + * @return the publisher value. + */ + String publisher(); + + /** + * Gets the targetType property: String of the Target Type that this Capability Type extends. + * + * @return the targetType value. + */ + String targetType(); + + /** + * Gets the displayName property: Localized string of the display name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the description property: Localized string of the description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the parametersSchema property: URL to retrieve JSON schema of the Capability Type parameters. + * + * @return the parametersSchema value. + */ + String parametersSchema(); + + /** + * Gets the urn property: String of the URN for this Capability Type. + * + * @return the urn value. + */ + String urn(); + + /** + * Gets the kind property: String of the kind of this Capability Type. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the permissionsNecessary property: Array of control and data plane actions necessary to execute capability + * type. + * + * @return the permissionsNecessary value. + */ + CapabilityTypePropertiesPermissionsNecessary permissionsNecessary(); + + /** + * Gets the runtimeProperties property: Runtime properties of this Capability Type. + * + * @return the runtimeProperties value. + */ + CapabilityTypePropertiesRuntimeProperties runtimeProperties(); + + /** + * Gets the inner com.azure.resourcemanager.chaos.fluent.models.CapabilityTypeInner object. + * + * @return the inner object. + */ + CapabilityTypeInner innerModel(); +} 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 new file mode 100644 index 0000000000000..103292b6fa7cd --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypeListResult.java @@ -0,0 +1,59 @@ +// 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.resourcemanager.chaos.fluent.models.CapabilityTypeInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Model that represents a list of Capability Type resources and a link for pagination. */ +@Immutable +public final class CapabilityTypeListResult { + /* + * 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; + + /** Creates an instance of CapabilityTypeListResult class. */ + public CapabilityTypeListResult() { + } + + /** + * Get the value property: List of Capability Type resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to retrieve the next page of Capability Type resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypePropertiesPermissionsNecessary.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypePropertiesPermissionsNecessary.java new file mode 100644 index 0000000000000..1434bdf9739bb --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypePropertiesPermissionsNecessary.java @@ -0,0 +1,77 @@ +// 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; + +/** Array of control and data plane actions necessary to execute capability type. */ +@Fluent +public final class CapabilityTypePropertiesPermissionsNecessary { + /* + * Control plane actions necessary to execute capability type. + */ + @JsonProperty(value = "actions") + private List actions; + + /* + * Control plane actions necessary to execute capability type. + */ + @JsonProperty(value = "dataActions") + private List dataActions; + + /** Creates an instance of CapabilityTypePropertiesPermissionsNecessary class. */ + public CapabilityTypePropertiesPermissionsNecessary() { + } + + /** + * Get the actions property: Control plane actions necessary to execute capability type. + * + * @return the actions value. + */ + public List actions() { + return this.actions; + } + + /** + * Set the actions property: Control plane actions necessary to execute capability type. + * + * @param actions the actions value to set. + * @return the CapabilityTypePropertiesPermissionsNecessary object itself. + */ + public CapabilityTypePropertiesPermissionsNecessary withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get the dataActions property: Control plane actions necessary to execute capability type. + * + * @return the dataActions value. + */ + public List dataActions() { + return this.dataActions; + } + + /** + * Set the dataActions property: Control plane actions necessary to execute capability type. + * + * @param dataActions the dataActions value to set. + * @return the CapabilityTypePropertiesPermissionsNecessary object itself. + */ + public CapabilityTypePropertiesPermissionsNecessary withDataActions(List dataActions) { + this.dataActions = dataActions; + 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/CapabilityTypePropertiesRuntimeProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypePropertiesRuntimeProperties.java new file mode 100644 index 0000000000000..4aea503b42c3d --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypePropertiesRuntimeProperties.java @@ -0,0 +1,39 @@ +// 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.JsonProperty; + +/** Runtime properties of this Capability Type. */ +@Immutable +public final class CapabilityTypePropertiesRuntimeProperties { + /* + * String of the kind of the resource's action type (continuous or discrete). + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** Creates an instance of CapabilityTypePropertiesRuntimeProperties class. */ + public CapabilityTypePropertiesRuntimeProperties() { + } + + /** + * Get the kind property: String of the kind of the resource's action type (continuous or discrete). + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * 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/CapabilityTypes.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypes.java new file mode 100644 index 0000000000000..b04d648c21f51 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/CapabilityTypes.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of CapabilityTypes. */ +public interface CapabilityTypes { + /** + * Get a list of Capability Type resources for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability Type resources for given Target Type and location as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(String locationName, String targetTypeName); + + /** + * Get a list of Capability Type resources for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Capability Type resources for given Target Type and location as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list( + String locationName, String targetTypeName, String continuationToken, Context context); + + /** + * Get a Capability Type resource for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param capabilityTypeName String that represents a Capability Type resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability Type resource for given Target Type and location along with {@link Response}. + */ + Response getWithResponse( + String locationName, String targetTypeName, String capabilityTypeName, Context context); + + /** + * Get a Capability Type resource for given Target Type and location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param capabilityTypeName String that represents a Capability Type resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Capability Type resource for given Target Type and location. + */ + CapabilityType get(String locationName, String targetTypeName, String capabilityTypeName); +} 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 new file mode 100644 index 0000000000000..b42856c08bfd0 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ContinuousAction.java @@ -0,0 +1,137 @@ +// 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.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 Action { + /* + * 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; + + /** Creates an instance of ContinuousAction class. */ + public ContinuousAction() { + } + + /** + * Get the duration property: ISO8601 formatted string that represents a duration. + * + * @return the duration value. + */ + public Duration duration() { + return this.duration; + } + + /** + * Set the duration property: ISO8601 formatted string that represents a duration. + * + * @param duration the duration value to set. + * @return the ContinuousAction object itself. + */ + public ContinuousAction withDuration(Duration duration) { + this.duration = duration; + return this; + } + + /** + * Get the parameters property: List of key value pairs. + * + * @return the parameters value. + */ + public List parameters() { + return this.parameters; + } + + /** + * Set the parameters property: List of key value pairs. + * + * @param parameters the parameters value to set. + * @return the ContinuousAction object itself. + */ + public ContinuousAction withParameters(List parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the selectorId property: String that represents a selector. + * + * @return the selectorId value. + */ + public String selectorId() { + return this.selectorId; + } + + /** + * Set the selectorId property: String that represents a selector. + * + * @param selectorId the selectorId value to set. + * @return the ContinuousAction object itself. + */ + public ContinuousAction withSelectorId(String selectorId) { + this.selectorId = selectorId; + return this; + } + + /** {@inheritDoc} */ + @Override + public ContinuousAction withName(String name) { + super.withName(name); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (duration() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property duration in model ContinuousAction")); + } + if (parameters() == null) { + throw LOGGER + .logExceptionAsError( + 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ContinuousAction.class); +} 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 new file mode 100644 index 0000000000000..b704318eccab5 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DelayAction.java @@ -0,0 +1,72 @@ +// 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.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 Action { + /* + * ISO8601 formatted string that represents a duration. + */ + @JsonProperty(value = "duration", required = true) + private Duration duration; + + /** Creates an instance of DelayAction class. */ + public DelayAction() { + } + + /** + * Get the duration property: ISO8601 formatted string that represents a duration. + * + * @return the duration value. + */ + public Duration duration() { + return this.duration; + } + + /** + * Set the duration property: ISO8601 formatted string that represents a duration. + * + * @param duration the duration value to set. + * @return the DelayAction object itself. + */ + public DelayAction withDuration(Duration duration) { + this.duration = duration; + return this; + } + + /** {@inheritDoc} */ + @Override + public DelayAction withName(String name) { + super.withName(name); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (duration() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property duration in model DelayAction")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DelayAction.class); +} 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 new file mode 100644 index 0000000000000..148c4c785fe74 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/DiscreteAction.java @@ -0,0 +1,105 @@ +// 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 discrete action. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("discrete") +@Fluent +public final class DiscreteAction extends Action { + /* + * 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; + + /** Creates an instance of DiscreteAction class. */ + public DiscreteAction() { + } + + /** + * Get the parameters property: List of key value pairs. + * + * @return the parameters value. + */ + public List parameters() { + return this.parameters; + } + + /** + * Set the parameters property: List of key value pairs. + * + * @param parameters the parameters value to set. + * @return the DiscreteAction object itself. + */ + public DiscreteAction withParameters(List parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the selectorId property: String that represents a selector. + * + * @return the selectorId value. + */ + public String selectorId() { + return this.selectorId; + } + + /** + * Set the selectorId property: String that represents a selector. + * + * @param selectorId the selectorId value to set. + * @return the DiscreteAction object itself. + */ + public DiscreteAction withSelectorId(String selectorId) { + this.selectorId = selectorId; + return this; + } + + /** {@inheritDoc} */ + @Override + public DiscreteAction withName(String name) { + super.withName(name); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (parameters() == null) { + throw LOGGER + .logExceptionAsError( + 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")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DiscreteAction.class); +} 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 new file mode 100644 index 0000000000000..022571a9a5441 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiment.java @@ -0,0 +1,322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.chaos.fluent.models.ExperimentInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Experiment. */ +public interface Experiment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: The system metadata of the experiment resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the identity property: The identity of the experiment resource. + * + * @return the identity value. + */ + ResourceIdentity identity(); + + /** + * Gets the steps property: List of steps. + * + * @return the steps value. + */ + List steps(); + + /** + * Gets the selectors property: List of selectors. + * + * @return the selectors value. + */ + List selectors(); + + /** + * Gets the startOnCreation property: A boolean value that indicates if experiment should be started on creation or + * not. + * + * @return the startOnCreation value. + */ + Boolean startOnCreation(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.chaos.fluent.models.ExperimentInner object. + * + * @return the inner object. + */ + ExperimentInner innerModel(); + + /** The entirety of the Experiment definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithSteps, + DefinitionStages.WithSelectors, + DefinitionStages.WithCreate { + } + /** The Experiment definition stages. */ + interface DefinitionStages { + /** The first stage of the Experiment definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Experiment definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the Experiment definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName String that represents an Azure resource group. + * @return the next definition stage. + */ + WithSteps withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the Experiment definition allowing to specify steps. */ + interface WithSteps { + /** + * Specifies the steps property: List of steps.. + * + * @param steps List of steps. + * @return the next definition stage. + */ + WithSelectors withSteps(List steps); + } + /** The stage of the Experiment definition allowing to specify selectors. */ + interface WithSelectors { + /** + * Specifies the selectors property: List of selectors.. + * + * @param selectors List of selectors. + * @return the next definition stage. + */ + WithCreate withSelectors(List selectors); + } + /** + * The stage of the Experiment definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithStartOnCreation { + /** + * Executes the create request. + * + * @return the created resource. + */ + Experiment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Experiment create(Context context); + } + /** The stage of the Experiment definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the Experiment definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the experiment resource.. + * + * @param identity The identity of the experiment resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ResourceIdentity identity); + } + /** The stage of the Experiment definition allowing to specify startOnCreation. */ + interface WithStartOnCreation { + /** + * Specifies the startOnCreation property: A boolean value that indicates if experiment should be started on + * creation or not.. + * + * @param startOnCreation A boolean value that indicates if experiment should be started on creation or not. + * @return the next definition stage. + */ + WithCreate withStartOnCreation(Boolean startOnCreation); + } + } + /** + * Begins update for the Experiment resource. + * + * @return the stage of resource update. + */ + Experiment.Update update(); + + /** The template for Experiment update. */ + interface Update extends UpdateStages.WithIdentity { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Experiment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Experiment apply(Context context); + } + /** The Experiment update stages. */ + interface UpdateStages { + /** The stage of the Experiment update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the experiment resource.. + * + * @param identity The identity of the experiment resource. + * @return the next definition stage. + */ + Update withIdentity(ResourceIdentity identity); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Experiment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Experiment refresh(Context context); + + /** + * Cancel a running Experiment resource. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a cancel Experiment operation along with {@link Response}. + */ + Response cancelWithResponse(Context context); + + /** + * Cancel a running Experiment resource. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a cancel Experiment operation. + */ + ExperimentCancelOperationResult cancel(); + + /** + * Start a Experiment resource. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a start Experiment operation along with {@link Response}. + */ + Response startWithResponse(Context context); + + /** + * Start a Experiment resource. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a start Experiment operation. + */ + ExperimentStartOperationResult start(); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentCancelOperationResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentCancelOperationResult.java new file mode 100644 index 0000000000000..863656108f975 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentCancelOperationResult.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.resourcemanager.chaos.fluent.models.ExperimentCancelOperationResultInner; + +/** An immutable client-side representation of ExperimentCancelOperationResult. */ +public interface ExperimentCancelOperationResult { + /** + * Gets the name property: String of the Experiment name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the statusUrl property: URL to retrieve the Experiment status. + * + * @return the statusUrl value. + */ + String statusUrl(); + + /** + * Gets the inner com.azure.resourcemanager.chaos.fluent.models.ExperimentCancelOperationResultInner object. + * + * @return the inner object. + */ + ExperimentCancelOperationResultInner innerModel(); +} 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 new file mode 100644 index 0000000000000..39adeaad1e032 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsError.java @@ -0,0 +1,54 @@ +// 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.JsonProperty; + +/** Model that represents the Experiment action target details error model. */ +@Immutable +public final class ExperimentExecutionActionTargetDetailsError { + /* + * 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; + + /** Creates an instance of ExperimentExecutionActionTargetDetailsError class. */ + public ExperimentExecutionActionTargetDetailsError() { + } + + /** + * Get the code property: The error code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Get the message property: The error message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * 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/ExperimentExecutionActionTargetDetailsProperties.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsProperties.java new file mode 100644 index 0000000000000..b238ea3c146e8 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionActionTargetDetailsProperties.java @@ -0,0 +1,103 @@ +// 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.JsonProperty; +import java.time.OffsetDateTime; + +/** Model that represents the Experiment action target details properties model. */ +@Immutable +public final class ExperimentExecutionActionTargetDetailsProperties { + /* + * 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; + + /** Creates an instance of ExperimentExecutionActionTargetDetailsProperties class. */ + public ExperimentExecutionActionTargetDetailsProperties() { + } + + /** + * Get the status property: The status of the execution. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the target property: The target for the action. + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Get the targetFailedTime property: String that represents the failed date time. + * + * @return the targetFailedTime value. + */ + public OffsetDateTime targetFailedTime() { + return this.targetFailedTime; + } + + /** + * Get the targetCompletedTime property: String that represents the completed date time. + * + * @return the targetCompletedTime value. + */ + public OffsetDateTime targetCompletedTime() { + return this.targetCompletedTime; + } + + /** + * Get the error property: The error of the action. + * + * @return the error value. + */ + public ExperimentExecutionActionTargetDetailsError error() { + return this.error; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (error() != null) { + error().validate(); + } + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetails.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetails.java new file mode 100644 index 0000000000000..7c9b3f5f1e47e --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetails.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.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ExperimentExecutionDetails. */ +public interface ExperimentExecutionDetails { + /** + * Gets the type property: String of the resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the id property: String of the fully qualified resource ID. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: String of the resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the experimentId property: The id of the experiment. + * + * @return the experimentId value. + */ + String experimentId(); + + /** + * Gets the status property: The value of the status of the experiment execution. + * + * @return the status value. + */ + String status(); + + /** + * Gets the failureReason property: The reason why the execution failed. + * + * @return the failureReason value. + */ + String failureReason(); + + /** + * Gets the createdDateTime property: String that represents the created date time. + * + * @return the createdDateTime value. + */ + OffsetDateTime createdDateTime(); + + /** + * Gets the lastActionDateTime property: String that represents the last action date time. + * + * @return the lastActionDateTime value. + */ + OffsetDateTime lastActionDateTime(); + + /** + * Gets the startDateTime property: String that represents the start date time. + * + * @return the startDateTime value. + */ + OffsetDateTime startDateTime(); + + /** + * Gets the stopDateTime property: String that represents the stop date time. + * + * @return the stopDateTime value. + */ + OffsetDateTime stopDateTime(); + + /** + * Gets the runInformation property: The information of the experiment run. + * + * @return the runInformation value. + */ + ExperimentExecutionDetailsPropertiesRunInformation runInformation(); + + /** + * Gets the inner com.azure.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner object. + * + * @return the inner object. + */ + ExperimentExecutionDetailsInner innerModel(); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsListResult.java new file mode 100644 index 0000000000000..9b96e10d36b84 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsListResult.java @@ -0,0 +1,59 @@ +// 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.resourcemanager.chaos.fluent.models.ExperimentExecutionDetailsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Model that represents a list of Experiment execution details and a link for pagination. */ +@Immutable +public final class ExperimentExecutionDetailsListResult { + /* + * List of Experiment execution details. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to retrieve the next page of Experiment execution details. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ExperimentExecutionDetailsListResult class. */ + public ExperimentExecutionDetailsListResult() { + } + + /** + * Get the value property: List of Experiment execution details. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to retrieve the next page of Experiment execution details. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} 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 new file mode 100644 index 0000000000000..11f4e69ec52cc --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentExecutionDetailsPropertiesRunInformation.java @@ -0,0 +1,43 @@ +// 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.JsonProperty; +import java.util.List; + +/** The information of the experiment run. */ +@Immutable +public final class ExperimentExecutionDetailsPropertiesRunInformation { + /* + * The steps of the experiment run. + */ + @JsonProperty(value = "steps", access = JsonProperty.Access.WRITE_ONLY) + private List steps; + + /** Creates an instance of ExperimentExecutionDetailsPropertiesRunInformation class. */ + public ExperimentExecutionDetailsPropertiesRunInformation() { + } + + /** + * Get the steps property: The steps of the experiment run. + * + * @return the steps value. + */ + public List steps() { + return this.steps; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (steps() != null) { + steps().forEach(e -> e.validate()); + } + } +} 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 new file mode 100644 index 0000000000000..3c55db51087b0 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentListResult.java @@ -0,0 +1,59 @@ +// 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.resourcemanager.chaos.fluent.models.ExperimentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Model that represents a list of Experiment resources and a link for pagination. */ +@Immutable +public final class ExperimentListResult { + /* + * 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; + + /** Creates an instance of ExperimentListResult class. */ + public ExperimentListResult() { + } + + /** + * Get the value property: List of Experiment resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to retrieve the next page of Experiment resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStartOperationResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStartOperationResult.java new file mode 100644 index 0000000000000..0db3964c30d31 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStartOperationResult.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.resourcemanager.chaos.fluent.models.ExperimentStartOperationResultInner; + +/** An immutable client-side representation of ExperimentStartOperationResult. */ +public interface ExperimentStartOperationResult { + /** + * Gets the name property: String of the Experiment name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the statusUrl property: URL to retrieve the Experiment status. + * + * @return the statusUrl value. + */ + String statusUrl(); + + /** + * Gets the inner com.azure.resourcemanager.chaos.fluent.models.ExperimentStartOperationResultInner object. + * + * @return the inner object. + */ + ExperimentStartOperationResultInner innerModel(); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStatus.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStatus.java new file mode 100644 index 0000000000000..2924619daa9e7 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStatus.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.resourcemanager.chaos.fluent.models.ExperimentStatusInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ExperimentStatus. */ +public interface ExperimentStatus { + /** + * Gets the type property: String of the resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the id property: String of the fully qualified resource ID. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: String of the resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the status property: String that represents the status of a Experiment. + * + * @return the status value. + */ + String status(); + + /** + * Gets the createdDateUtc property: String that represents the created date time of a Experiment. + * + * @return the createdDateUtc value. + */ + OffsetDateTime createdDateUtc(); + + /** + * Gets the endDateUtc property: String that represents the end date time of a Experiment. + * + * @return the endDateUtc value. + */ + OffsetDateTime endDateUtc(); + + /** + * Gets the inner com.azure.resourcemanager.chaos.fluent.models.ExperimentStatusInner object. + * + * @return the inner object. + */ + ExperimentStatusInner innerModel(); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStatusListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStatusListResult.java new file mode 100644 index 0000000000000..465ebd010b07f --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentStatusListResult.java @@ -0,0 +1,59 @@ +// 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.resourcemanager.chaos.fluent.models.ExperimentStatusInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Model that represents a list of Experiment statuses and a link for pagination. */ +@Immutable +public final class ExperimentStatusListResult { + /* + * List of Experiment statuses. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to retrieve the next page of Experiment statuses. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ExperimentStatusListResult class. */ + public ExperimentStatusListResult() { + } + + /** + * Get the value property: List of Experiment statuses. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to retrieve the next page of Experiment statuses. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} 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 new file mode 100644 index 0000000000000..9f36b57da5487 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ExperimentUpdate.java @@ -0,0 +1,53 @@ +// 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; + +/** Describes an experiment update. */ +@Fluent +public final class ExperimentUpdate { + /* + * The identity of the experiment resource. + */ + @JsonProperty(value = "identity") + private ResourceIdentity identity; + + /** Creates an instance of ExperimentUpdate class. */ + public ExperimentUpdate() { + } + + /** + * Get the identity property: The identity of the experiment resource. + * + * @return the identity value. + */ + public ResourceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the experiment resource. + * + * @param identity the identity value to set. + * @return the ExperimentUpdate object itself. + */ + public ExperimentUpdate withIdentity(ResourceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiments.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiments.java new file mode 100644 index 0000000000000..e5449ba5a57dd --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Experiments.java @@ -0,0 +1,325 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Experiments. */ +public interface Experiments { + /** + * Get a list of Experiment resources in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Get a list of Experiment resources in a subscription. + * + * @param running Optional value that indicates whether to filter results based on if the Experiment is currently + * running. If null, then the results will not be filtered. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Boolean running, String continuationToken, Context context); + + /** + * Get a list of Experiment resources in a resource group. + * + * @param resourceGroupName String that represents an Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get a list of Experiment resources in a resource group. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param running Optional value that indicates whether to filter results based on if the Experiment is currently + * running. If null, then the results will not be filtered. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Experiment resources in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup( + String resourceGroupName, Boolean running, String continuationToken, Context context); + + /** + * Delete a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String experimentName, Context context); + + /** + * Delete a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String experimentName); + + /** + * Get a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Experiment resource along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String experimentName, Context context); + + /** + * Get a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Experiment resource. + */ + Experiment getByResourceGroup(String resourceGroupName, String experimentName); + + /** + * Cancel a running Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a cancel Experiment operation along with {@link Response}. + */ + Response cancelWithResponse( + String resourceGroupName, String experimentName, Context context); + + /** + * Cancel a running Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a cancel Experiment operation. + */ + ExperimentCancelOperationResult cancel(String resourceGroupName, String experimentName); + + /** + * Start a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a start Experiment operation along with {@link Response}. + */ + Response startWithResponse( + String resourceGroupName, String experimentName, Context context); + + /** + * Start a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents the result of a start Experiment operation. + */ + ExperimentStartOperationResult start(String resourceGroupName, String experimentName); + + /** + * Get a list of statuses of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of statuses of a Experiment resource as paginated response with {@link PagedIterable}. + */ + PagedIterable listAllStatuses(String resourceGroupName, String experimentName); + + /** + * Get a list of statuses of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of statuses of a Experiment resource as paginated response with {@link PagedIterable}. + */ + PagedIterable listAllStatuses(String resourceGroupName, String experimentName, Context context); + + /** + * Get a status of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param statusId GUID that represents a Experiment status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a status of a Experiment resource along with {@link Response}. + */ + Response getStatusWithResponse( + String resourceGroupName, String experimentName, String statusId, Context context); + + /** + * Get a status of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param statusId GUID that represents a Experiment status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a status of a Experiment resource. + */ + ExperimentStatus getStatus(String resourceGroupName, String experimentName, String statusId); + + /** + * Get a list of execution details of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of execution details of a Experiment resource as paginated response with {@link PagedIterable}. + */ + PagedIterable listExecutionDetails(String resourceGroupName, String experimentName); + + /** + * Get a list of execution details of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of execution details of a Experiment resource as paginated response with {@link PagedIterable}. + */ + PagedIterable listExecutionDetails( + String resourceGroupName, String experimentName, Context context); + + /** + * Get an execution detail of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param executionDetailsId GUID that represents a Experiment execution detail. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution detail of a Experiment resource along with {@link Response}. + */ + Response getExecutionDetailsWithResponse( + String resourceGroupName, String experimentName, String executionDetailsId, Context context); + + /** + * Get an execution detail of a Experiment resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param experimentName String that represents a Experiment resource name. + * @param executionDetailsId GUID that represents a Experiment execution detail. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution detail of a Experiment resource. + */ + ExperimentExecutionDetails getExecutionDetails( + String resourceGroupName, String experimentName, String executionDetailsId); + + /** + * Get a Experiment resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Experiment resource along with {@link Response}. + */ + Experiment getById(String id); + + /** + * Get a Experiment resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Experiment resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Experiment resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a Experiment resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Experiment resource. + * + * @param name resource name. + * @return the first stage of the new Experiment definition. + */ + Experiment.DefinitionStages.Blank define(String name); +} 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..de171a32c6939 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Filter.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.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 = Filter.class) +@JsonTypeName("Filter") +@JsonSubTypes({@JsonSubTypes.Type(name = "Simple", value = SimpleFilter.class)}) +@Immutable +public class Filter { + /** Creates an instance of Filter class. */ + public Filter() { + } + + /** + * 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/FilterType.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/FilterType.java new file mode 100644 index 0000000000000..53ee9caa8191a --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/FilterType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Enum that discriminates between filter types. Currently only `Simple` type is supported. */ +public final class FilterType extends ExpandableStringEnum { + /** Static value Simple for FilterType. */ + public static final FilterType SIMPLE = fromString("Simple"); + + /** + * Creates a new instance of FilterType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FilterType() { + } + + /** + * Creates or finds a FilterType from its string representation. + * + * @param name a name to look for. + * @return the corresponding FilterType. + */ + @JsonCreator + public static FilterType fromString(String name) { + return fromString(name, FilterType.class); + } + + /** + * Gets known FilterType values. + * + * @return known FilterType values. + */ + public static Collection values() { + return values(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 new file mode 100644 index 0000000000000..8b63f9050d981 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/KeyValuePair.java @@ -0,0 +1,89 @@ +// 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; + +/** A map to describe the settings of an action. */ +@Fluent +public final class KeyValuePair { + /* + * 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; + + /** Creates an instance of KeyValuePair class. */ + public KeyValuePair() { + } + + /** + * Get the key property: The name of the setting for the action. + * + * @return the key value. + */ + public String key() { + return this.key; + } + + /** + * Set the key property: The name of the setting for the action. + * + * @param key the key value to set. + * @return the KeyValuePair object itself. + */ + public KeyValuePair withKey(String key) { + this.key = key; + return this; + } + + /** + * Get the value property: The value of the setting for the action. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the setting for the action. + * + * @param value the value value to set. + * @return the KeyValuePair object itself. + */ + public KeyValuePair withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (key() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property key in model KeyValuePair")); + } + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model KeyValuePair")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(KeyValuePair.class); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Operation.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Operation.java new file mode 100644 index 0000000000000..b5c9d7060c9d1 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Operation.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.resourcemanager.chaos.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.chaos.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} 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 new file mode 100644 index 0000000000000..c94f5b20ac746 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationDisplay.java @@ -0,0 +1,91 @@ +// 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.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplay { + /* + * 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". + */ + @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". + */ + @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; + + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * 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/OperationListResult.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationListResult.java new file mode 100644 index 0000000000000..62f3cb4b30bf7 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/OperationListResult.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.chaos.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +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. + */ +@Immutable +public final class OperationListResult { + /* + * 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; + + /** Creates an instance of OperationListResult class. */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Operations.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Operations.java new file mode 100644 index 0000000000000..a0fb76ffe3943 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Get a list all available Operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list all available Operations as paginated response with {@link PagedIterable}. + */ + PagedIterable listAll(); + + /** + * Get a list all available Operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list all available Operations as paginated response with {@link PagedIterable}. + */ + PagedIterable listAll(Context context); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Origin.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Origin.java new file mode 100644 index 0000000000000..daccb78e7d022 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Origin.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** Static value user for Origin. */ + public static final Origin USER = fromString("user"); + + /** Static value system for Origin. */ + public static final Origin SYSTEM = fromString("system"); + + /** Static value user,system for Origin. */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + @JsonCreator + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentity.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentity.java new file mode 100644 index 0000000000000..a8d463958dbd3 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentity.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The identity of a resource. */ +@Fluent +public final class ResourceIdentity { + /* + * String of the resource identity type. + */ + @JsonProperty(value = "type", required = true) + private ResourceIdentityType type; + + /* + * The list of user identities associated with the experiment. The user identity dictionary key references will be + * ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /* + * GUID that represents the principal ID of this resource identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * GUID that represents the tenant ID of this resource identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** Creates an instance of ResourceIdentity class. */ + public ResourceIdentity() { + } + + /** + * Get the type property: String of the resource identity type. + * + * @return the type value. + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: String of the resource identity type. + * + * @param type the type value to set. + * @return the ResourceIdentity object itself. + */ + public ResourceIdentity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The list of user identities associated with the experiment. The user + * identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The list of user identities associated with the experiment. The user + * identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ResourceIdentity object itself. + */ + public ResourceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Get the principalId property: GUID that represents the principal ID of this resource identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: GUID that represents the tenant ID of this resource identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model ResourceIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourceIdentity.class); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentityType.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentityType.java new file mode 100644 index 0000000000000..682743cc21364 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/ResourceIdentityType.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** String of the resource identity type. */ +public enum ResourceIdentityType { + /** Enum value None. */ + NONE("None"), + + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value UserAssigned. */ + USER_ASSIGNED("UserAssigned"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private final String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + if (value == null) { + return null; + } + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Selector.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Selector.java new file mode 100644 index 0000000000000..77df1a3b30b40 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Selector.java @@ -0,0 +1,150 @@ +// 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 selector in the Experiment resource. */ +@Fluent +public final class Selector { + /* + * Enum of the selector type. + */ + @JsonProperty(value = "type", required = true) + private SelectorType type; + + /* + * String of the selector ID. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * List of Target references. + */ + @JsonProperty(value = "targets", required = true) + private List targets; + + /* + * Model that represents available filter types that can be applied to a targets list. + */ + @JsonProperty(value = "filter") + private Filter filter; + + /** 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; + } + + /** + * Set the type property: Enum of the selector type. + * + * @param type the type value to set. + * @return the Selector object itself. + */ + public Selector withType(SelectorType type) { + this.type = type; + return this; + } + + /** + * 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 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 Selector object itself. + */ + public Selector withTargets(List targets) { + this.targets = targets; + 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property type in model Selector")); + } + if (id() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property id in model Selector")); + } + if (targets() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property targets in model Selector")); + } else { + targets().forEach(e -> e.validate()); + } + if (filter() != null) { + filter().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Selector.class); +} 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 new file mode 100644 index 0000000000000..c2b60800e2d63 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SelectorType.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Enum of the selector type. */ +public enum SelectorType { + /** Enum value Percent. */ + PERCENT("Percent"), + + /** Enum value Random. */ + RANDOM("Random"), + + /** Enum value Tag. */ + TAG("Tag"), + + /** Enum value List. */ + LIST("List"); + + /** The actual serialized value for a SelectorType instance. */ + private final String value; + + SelectorType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SelectorType instance. + * + * @param value the serialized value to parse. + * @return the parsed SelectorType object, or null if unable to parse. + */ + @JsonCreator + public static SelectorType fromString(String value) { + if (value == null) { + return null; + } + SelectorType[] items = SelectorType.values(); + for (SelectorType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SimpleFilter.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SimpleFilter.java new file mode 100644 index 0000000000000..46ff007cc7ab9 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SimpleFilter.java @@ -0,0 +1,59 @@ +// 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 SimpleFilter extends Filter { + /* + * Model that represents the Simple filter parameters. + */ + @JsonProperty(value = "parameters") + private SimpleFilterParameters parameters; + + /** Creates an instance of SimpleFilter class. */ + public SimpleFilter() { + } + + /** + * 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() { + super.validate(); + if (parameters() != null) { + parameters().validate(); + } + } +} 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..b3b08c559efe0 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/SimpleFilterParameters.java @@ -0,0 +1,51 @@ +// 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 SimpleFilterParameters { + /* + * List of Azure availability zones to filter targets by. + */ + @JsonProperty(value = "zones") + 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() { + } +} 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..a8e01d2246e06 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Step.java @@ -0,0 +1,90 @@ +// 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 Step { + /* + * 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 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 + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Step")); + } + if (branches() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property branches in model Step")); + } else { + branches().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Step.class); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/StepStatus.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/StepStatus.java new file mode 100644 index 0000000000000..c4670d561f380 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/StepStatus.java @@ -0,0 +1,88 @@ +// 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.JsonProperty; +import java.util.List; + +/** Model that represents the a list of branches and branch statuses. */ +@Immutable +public final class StepStatus { + /* + * 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; + + /** Creates an instance of StepStatus class. */ + public StepStatus() { + } + + /** + * Get the stepName property: The name of the step. + * + * @return the stepName value. + */ + public String stepName() { + return this.stepName; + } + + /** + * Get the stepId property: The id of the step. + * + * @return the stepId value. + */ + public String stepId() { + return this.stepId; + } + + /** + * Get the status property: The value of the status of the step. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the branches property: The array of branches. + * + * @return the branches value. + */ + public List branches() { + return this.branches; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (branches() != null) { + branches().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Target.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Target.java new file mode 100644 index 0000000000000..064f0d74239b0 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Target.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.chaos.fluent.models.TargetInner; +import java.util.Map; + +/** An immutable client-side representation of Target. */ +public interface Target { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: The system metadata of the target resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the location property: Location of the target resource. + * + * @return the location value. + */ + String location(); + + /** + * Gets the properties property: The properties of the target resource. + * + * @return the properties value. + */ + Map properties(); + + /** + * Gets the inner com.azure.resourcemanager.chaos.fluent.models.TargetInner object. + * + * @return the inner object. + */ + TargetInner innerModel(); +} 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 new file mode 100644 index 0000000000000..de6d488fdf68b --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetListResult.java @@ -0,0 +1,59 @@ +// 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.resourcemanager.chaos.fluent.models.TargetInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Model that represents a list of Target resources and a link for pagination. */ +@Immutable +public final class TargetListResult { + /* + * 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; + + /** Creates an instance of TargetListResult class. */ + public TargetListResult() { + } + + /** + * Get the value property: List of Target resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to retrieve the next page of Target resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} 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 new file mode 100644 index 0000000000000..f7a6450cec36a --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetReference.java @@ -0,0 +1,85 @@ +// 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; + +/** Model that represents a reference to a Target in the selector. */ +@Fluent +public final class TargetReference { + /* + * Enum of the Target reference type. + */ + @JsonProperty(value = "type", required = true) + private String type = "ChaosTarget"; + + /* + * String of the resource ID of a Target resource. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** Creates an instance of TargetReference class. */ + public TargetReference() { + type = "ChaosTarget"; + } + + /** + * Get the type property: Enum of the Target reference type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Enum of the Target reference type. + * + * @param type the type value to set. + * @return the TargetReference object itself. + */ + public TargetReference withType(String type) { + this.type = type; + return this; + } + + /** + * Get the id property: String of the resource ID of a Target resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: String of the resource ID of a Target resource. + * + * @param id the id value to set. + * @return the TargetReference object itself. + */ + public TargetReference withId(String id) { + this.id = id; + return this; + } + + /** + * 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 TargetReference")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TargetReference.class); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetType.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetType.java new file mode 100644 index 0000000000000..ebc7a5164cf01 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetType.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.chaos.fluent.models.TargetTypeInner; +import java.util.List; + +/** An immutable client-side representation of TargetType. */ +public interface TargetType { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: The system metadata properties of the target type resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the location property: Location of the Target Type resource. + * + * @return the location value. + */ + String location(); + + /** + * Gets the displayName property: Localized string of the display name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the description property: Localized string of the description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the propertiesSchema property: URL to retrieve JSON schema of the Target Type properties. + * + * @return the propertiesSchema value. + */ + String propertiesSchema(); + + /** + * Gets the resourceTypes property: List of resource types this Target Type can extend. + * + * @return the resourceTypes value. + */ + List resourceTypes(); + + /** + * Gets the inner com.azure.resourcemanager.chaos.fluent.models.TargetTypeInner object. + * + * @return the inner object. + */ + TargetTypeInner innerModel(); +} 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 new file mode 100644 index 0000000000000..ffb021af968c5 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypeListResult.java @@ -0,0 +1,59 @@ +// 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.resourcemanager.chaos.fluent.models.TargetTypeInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Model that represents a list of Target Type resources and a link for pagination. */ +@Immutable +public final class TargetTypeListResult { + /* + * 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; + + /** Creates an instance of TargetTypeListResult class. */ + public TargetTypeListResult() { + } + + /** + * Get the value property: List of Target Type resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to retrieve the next page of Target Type resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypes.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypes.java new file mode 100644 index 0000000000000..8ff793a6ccfaf --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/TargetTypes.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of TargetTypes. */ +public interface TargetTypes { + /** + * Get a list of Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target Type resources for given location as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String locationName); + + /** + * Get a list of Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target Type resources for given location as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String locationName, String continuationToken, Context context); + + /** + * Get a Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target Type resources for given location along with {@link Response}. + */ + Response getWithResponse(String locationName, String targetTypeName, Context context); + + /** + * Get a Target Type resources for given location. + * + * @param locationName String that represents a Location resource name. + * @param targetTypeName String that represents a Target Type resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target Type resources for given location. + */ + TargetType get(String locationName, String targetTypeName); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Targets.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Targets.java new file mode 100644 index 0000000000000..6187753e73276 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/Targets.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.chaos.fluent.models.TargetInner; + +/** Resource collection API of Targets. */ +public interface Targets { + /** + * Get a list of Target resources that extend a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target resources that extend a tracked regional resource as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, String parentProviderNamespace, String parentResourceType, String parentResourceName); + + /** + * Get a list of Target resources that extend a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param continuationToken String that sets the continuation token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Target resources that extend a tracked regional resource as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String continuationToken, + Context context); + + /** + * Get a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target resource that extends a tracked regional resource along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + Context context); + + /** + * Get a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Target resource that extends a tracked regional resource. + */ + Target get( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName); + + /** + * Delete a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + Context context); + + /** + * Delete a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName); + + /** + * Create or update a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param target Target resource to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Target resource along with {@link Response}. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + TargetInner target, + Context context); + + /** + * Create or update a Target resource that extends a tracked regional resource. + * + * @param resourceGroupName String that represents an Azure resource group. + * @param parentProviderNamespace String that represents a resource provider namespace. + * @param parentResourceType String that represents a resource type. + * @param parentResourceName String that represents a resource name. + * @param targetName String that represents a Target resource name. + * @param target Target resource to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model that represents a Target resource. + */ + Target createOrUpdate( + String resourceGroupName, + String parentProviderNamespace, + String parentResourceType, + String parentResourceName, + String targetName, + TargetInner target); +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/UserAssignedIdentities.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/UserAssignedIdentities.java new file mode 100644 index 0000000000000..c7c476221ef95 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/UserAssignedIdentities.java @@ -0,0 +1,54 @@ +// 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.JsonProperty; + +/** The list of user identities associated with the experiment. */ +@Immutable +public final class UserAssignedIdentities { + /* + * The principal id of user assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The client id of user assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** Creates an instance of UserAssignedIdentities class. */ + public UserAssignedIdentities() { + } + + /** + * Get the principalId property: The principal id of user assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client id of user assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * 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/package-info.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/package-info.java new file mode 100644 index 0000000000000..081adb707661f --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for ChaosManagementClient. Chaos Management Client. */ +package com.azure.resourcemanager.chaos.models; diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/package-info.java b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/package-info.java new file mode 100644 index 0000000000000..9da2e994a2c79 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/com/azure/resourcemanager/chaos/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for ChaosManagementClient. Chaos Management Client. */ +package com.azure.resourcemanager.chaos; 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 new file mode 100644 index 0000000000000..0a9080fade2a8 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.chaos { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.chaos; + exports com.azure.resourcemanager.chaos.fluent; + 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; +} 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 new file mode 100644 index 0000000000000..01df848dd9ff4 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesCreateOrUpdateSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +import com.azure.resourcemanager.chaos.fluent.models.CapabilityInner; + +/** Samples for Capabilities CreateOrUpdate. */ +public final class CapabilitiesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/CreateOrUpdateACapability.json + */ + /** + * Sample code: Create/update a Capability that extends a virtual machine Target resource. + * + * @param manager Entry point to ChaosManager. + */ + 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); + } +} 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 new file mode 100644 index 0000000000000..9a6f3b611c631 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesDeleteSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for Capabilities Delete. */ +public final class CapabilitiesDeleteSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/DeleteACapability.json + */ + /** + * Sample code: Delete a Capability that extends a virtual machine Target resource. + * + * @param manager Entry point to ChaosManager. + */ + 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); + } +} 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 new file mode 100644 index 0000000000000..df837899d798c --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesGetSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for Capabilities Get. */ +public final class CapabilitiesGetSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/GetACapability.json + */ + /** + * Sample code: Get a Capability that extends a virtual machine Target resource. + * + * @param manager Entry point to ChaosManager. + */ + 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); + } +} 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 new file mode 100644 index 0000000000000..9d76318e57125 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilitiesListSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for Capabilities List. */ +public final class CapabilitiesListSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/ListCapabilities.json + */ + /** + * Sample code: List all Capabilities that extend a virtual machine Target resource. + * + * @param manager Entry point to ChaosManager. + */ + 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); + } +} 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 new file mode 100644 index 0000000000000..06ca67c0d96cc --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for CapabilityTypes Get. */ +public final class CapabilityTypesGetSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/GetACapabilityType.json + */ + /** + * Sample code: Get a Capability Type for a virtual machine Target resource on westus2 location. + * + * @param manager Entry point to ChaosManager. + */ + 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); + } +} 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 new file mode 100644 index 0000000000000..2eda25a14384b --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/CapabilityTypesListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for CapabilityTypes List. */ +public final class CapabilityTypesListSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/ListCapabilityTypes.json + */ + /** + * Sample code: List all Capability Types for a virtual machine Target resource on westus2 location. + * + * @param manager Entry point to ChaosManager. + */ + public static void listAllCapabilityTypesForAVirtualMachineTargetResourceOnWestus2Location( + com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.capabilityTypes().list("westus2", "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/ExperimentsCancelSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCancelSamples.java new file mode 100644 index 0000000000000..29a00adf1e5a0 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCancelSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for Experiments Cancel. */ +public final class ExperimentsCancelSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/CancelAExperiment.json + */ + /** + * Sample code: Cancel a running Experiment. + * + * @param manager Entry point to ChaosManager. + */ + public static void cancelARunningExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments().cancelWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..63bdd041577f1 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsCreateOrUpdateSamples.java @@ -0,0 +1,73 @@ +// 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.resourcemanager.chaos.models.Branch; +import com.azure.resourcemanager.chaos.models.ContinuousAction; +import com.azure.resourcemanager.chaos.models.KeyValuePair; +import com.azure.resourcemanager.chaos.models.ResourceIdentity; +import com.azure.resourcemanager.chaos.models.ResourceIdentityType; +import com.azure.resourcemanager.chaos.models.Selector; +import com.azure.resourcemanager.chaos.models.SelectorType; +import com.azure.resourcemanager.chaos.models.Step; +import com.azure.resourcemanager.chaos.models.TargetReference; +import java.time.Duration; +import java.util.Arrays; + +/** Samples for Experiments CreateOrUpdate. */ +public final class ExperimentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/CreateOrUpdateAExperiment.json + */ + /** + * Sample code: Create/update a Experiment in a resource group. + * + * @param manager Entry point to ChaosManager. + */ + public static void createUpdateAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager + .experiments() + .define("exampleExperiment") + .withRegion("eastus2euap") + .withExistingResourceGroup("exampleRG") + .withSteps( + Arrays + .asList( + new 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 Selector() + .withType(SelectorType.LIST) + .withId("selector1") + .withTargets( + Arrays + .asList( + new TargetReference() + .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 new file mode 100644 index 0000000000000..6c9e327704dca --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for Experiments Delete. */ +public final class ExperimentsDeleteSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/DeleteAExperiment.json + */ + /** + * Sample code: Delete a Experiment in a resource group. + * + * @param manager Entry point to ChaosManager. + */ + public static void deleteAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager + .experiments() + .deleteByResourceGroupWithResponse("exampleRG", "exampleExperiment", 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 new file mode 100644 index 0000000000000..5e707abf714e2 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for Experiments GetByResourceGroup. */ +public final class ExperimentsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/GetAExperiment.json + */ + /** + * Sample code: Get a Experiment in a resource group. + * + * @param manager Entry point to ChaosManager. + */ + public static void getAExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager + .experiments() + .getByResourceGroupWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionDetailsSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionDetailsSamples.java new file mode 100644 index 0000000000000..41457cbb1f2e5 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetExecutionDetailsSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for Experiments GetExecutionDetails. */ +public final class ExperimentsGetExecutionDetailsSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/GetAExperimentExecutionDetails.json + */ + /** + * Sample code: Get experiment execution details. + * + * @param manager Entry point to ChaosManager. + */ + public static void getExperimentExecutionDetails(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager + .experiments() + .getExecutionDetailsWithResponse( + "exampleRG", + "exampleExperiment", + "f24500ad-744e-4a26-864b-b76199eac333", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetStatusSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetStatusSamples.java new file mode 100644 index 0000000000000..7b0263d7777db --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsGetStatusSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for Experiments GetStatus. */ +public final class ExperimentsGetStatusSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/GetAExperimentStatus.json + */ + /** + * Sample code: Get the status of a Experiment. + * + * @param manager Entry point to ChaosManager. + */ + public static void getTheStatusOfAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager + .experiments() + .getStatusWithResponse( + "exampleRG", + "exampleExperiment", + "50734542-2e64-4e08-814c-cc0e7475f7e4", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllStatusesSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllStatusesSamples.java new file mode 100644 index 0000000000000..22baf556be26b --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListAllStatusesSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for Experiments ListAllStatuses. */ +public final class ExperimentsListAllStatusesSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/ListExperimentStatuses.json + */ + /** + * Sample code: List all statuses of a Experiment. + * + * @param manager Entry point to ChaosManager. + */ + public static void listAllStatusesOfAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments().listAllStatuses("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..5d6001023bf59 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListByResourceGroupSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for Experiments ListByResourceGroup. */ +public final class ExperimentsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/ListExperimentsInAResourceGroup.json + */ + /** + * Sample code: List all Experiments in a resource group. + * + * @param manager Entry point to ChaosManager. + */ + public static void listAllExperimentsInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments().listByResourceGroup("exampleRG", null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListExecutionDetailsSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListExecutionDetailsSamples.java new file mode 100644 index 0000000000000..afa4c05677651 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListExecutionDetailsSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for Experiments ListExecutionDetails. */ +public final class ExperimentsListExecutionDetailsSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/ListExperimentExecutionsDetails.json + */ + /** + * Sample code: List experiment executions details. + * + * @param manager Entry point to ChaosManager. + */ + public static void listExperimentExecutionsDetails(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments().listExecutionDetails("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + } +} 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 new file mode 100644 index 0000000000000..bd3a1f18ffdfa --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for Experiments List. */ +public final class ExperimentsListSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/ListExperimentsInASubscription.json + */ + /** + * Sample code: List all Experiments in a subscription. + * + * @param manager Entry point to ChaosManager. + */ + public static void listAllExperimentsInASubscription(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments().list(null, null, com.azure.core.util.Context.NONE); + } +} 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 new file mode 100644 index 0000000000000..5efede266c4c6 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsStartSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for Experiments Start. */ +public final class ExperimentsStartSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/StartAExperiment.json + */ + /** + * Sample code: Start a Experiment. + * + * @param manager Entry point to ChaosManager. + */ + public static void startAExperiment(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.experiments().startWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsUpdateSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsUpdateSamples.java new file mode 100644 index 0000000000000..e69757c21289a --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/ExperimentsUpdateSamples.java @@ -0,0 +1,52 @@ +// 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.resourcemanager.chaos.models.Experiment; +import com.azure.resourcemanager.chaos.models.ResourceIdentity; +import com.azure.resourcemanager.chaos.models.ResourceIdentityType; +import com.azure.resourcemanager.chaos.models.UserAssignedIdentities; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Experiments Update. */ +public final class ExperimentsUpdateSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/PatchExperiment.json + */ + /** + * Sample code: Patch an Experiment in a resource group. + * + * @param manager Entry point to ChaosManager. + */ + public static void patchAnExperimentInAResourceGroup(com.azure.resourcemanager.chaos.ChaosManager manager) { + Experiment resource = + manager + .experiments() + .getByResourceGroupWithResponse("exampleRG", "exampleExperiment", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withIdentity( + new ResourceIdentity() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI", + new UserAssignedIdentities()))) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetSamples.java new file mode 100644 index 0000000000000..b7e78d993dd59 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesGetSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for TargetTypes Get. */ +public final class TargetTypesGetSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/GetATargetType.json + */ + /** + * Sample code: Get a Target Type for westus2 location. + * + * @param manager Entry point to ChaosManager. + */ + public static void getATargetTypeForWestus2Location(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.targetTypes().getWithResponse("westus2", "Microsoft-Agent", com.azure.core.util.Context.NONE); + } +} 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 new file mode 100644 index 0000000000000..2d60d4effe56a --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetTypesListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for TargetTypes List. */ +public final class TargetTypesListSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/ListTargetTypes.json + */ + /** + * Sample code: List all Target Types for westus2 location. + * + * @param manager Entry point to ChaosManager. + */ + public static void listAllTargetTypesForWestus2Location(com.azure.resourcemanager.chaos.ChaosManager manager) { + manager.targetTypes().list("westus2", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..64c6b0d23f37f --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsCreateOrUpdateSamples.java @@ -0,0 +1,57 @@ +// 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.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.chaos.fluent.models.TargetInner; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Targets CreateOrUpdate. */ +public final class TargetsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/CreateOrUpdateATarget.json + */ + /** + * Sample code: Create/update a Target that extends a virtual machine resource. + * + * @param manager Entry point to ChaosManager. + */ + public static void createUpdateATargetThatExtendsAVirtualMachineResource( + com.azure.resourcemanager.chaos.ChaosManager manager) throws IOException { + manager + .targets() + .createOrUpdateWithResponse( + "exampleRG", + "Microsoft.Compute", + "virtualMachines", + "exampleVM", + "Microsoft-Agent", + new TargetInner() + .withProperties( + mapOf( + "identities", + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "[{\"type\":\"CertificateSubjectIssuer\",\"subject\":\"CN=example.subject\"}]", + Object.class, + SerializerEncoding.JSON))), + com.azure.core.util.Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteSamples.java b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteSamples.java new file mode 100644 index 0000000000000..a20bd7f16351b --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsDeleteSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for Targets Delete. */ +public final class TargetsDeleteSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/DeleteATarget.json + */ + /** + * Sample code: Delete a Target that extends a virtual machine resource. + * + * @param manager Entry point to ChaosManager. + */ + 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); + } +} 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 new file mode 100644 index 0000000000000..1d30460b489c2 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsGetSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for Targets Get. */ +public final class TargetsGetSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/GetATarget.json + */ + /** + * Sample code: Get a Target that extends a virtual machine resource. + * + * @param manager Entry point to ChaosManager. + */ + 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); + } +} 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 new file mode 100644 index 0000000000000..988ae3cc57451 --- /dev/null +++ b/sdk/chaos/azure-resourcemanager-chaos/src/samples/java/com/azure/resourcemanager/chaos/generated/TargetsListSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.chaos.generated; + +/** Samples for Targets List. */ +public final class TargetsListSamples { + /* + * x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-01-preview/examples/ListTargets.json + */ + /** + * Sample code: List all Targets that extend a virtual machine resource. + * + * @param manager Entry point to ChaosManager. + */ + 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); + } +} diff --git a/sdk/chaos/ci.yml b/sdk/chaos/ci.yml new file mode 100644 index 0000000000000..9cbb028f42abf --- /dev/null +++ b/sdk/chaos/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/chaos/ci.yml + - sdk/chaos/azure-resourcemanager-chaos/ + exclude: + - sdk/chaos/pom.xml + - sdk/chaos/azure-resourcemanager-chaos/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/chaos/ci.yml + - sdk/chaos/azure-resourcemanager-chaos/ + exclude: + - sdk/chaos/pom.xml + - sdk/chaos/azure-resourcemanager-chaos/pom.xml + +parameters: + - name: release_azureresourcemanagerchaos + displayName: azure-resourcemanager-chaos + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: chaos + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-chaos + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerchaos + releaseInBatch: ${{ parameters.release_azureresourcemanagerchaos }} diff --git a/sdk/chaos/pom.xml b/sdk/chaos/pom.xml new file mode 100644 index 0000000000000..ba36292a2ffd4 --- /dev/null +++ b/sdk/chaos/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-chaos-service + pom + 1.0.0 + + + azure-resourcemanager-chaos + +