From 46b13b69c6fd40091830bddbe24c835aea8c6ce8 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Fri, 20 Sep 2024 05:56:05 +0000 Subject: [PATCH 1/3] [Automation] External Change --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../azure-resourcemanager-fabric/CHANGELOG.md | 5 + .../azure-resourcemanager-fabric/README.md | 104 + .../azure-resourcemanager-fabric/SAMPLE.md | 320 +++ .../azure-resourcemanager-fabric/pom.xml | 97 + .../resourcemanager/fabric/FabricManager.java | 290 +++ .../fabric/fluent/FabricCapacitiesClient.java | 482 ++++ .../fabric/fluent/FabricClient.java | 62 + .../fabric/fluent/OperationsClient.java | 40 + .../CheckNameAvailabilityResponseInner.java | 120 + .../fluent/models/FabricCapacityInner.java | 233 ++ .../fabric/fluent/models/OperationInner.java | 159 ++ .../RpSkuDetailsForExistingResourceInner.java | 118 + .../RpSkuDetailsForNewResourceInner.java | 138 + .../fabric/fluent/models/package-info.java | 8 + .../fabric/fluent/package-info.java | 8 + .../CheckNameAvailabilityResponseImpl.java | 41 + .../FabricCapacitiesClientImpl.java | 2310 +++++++++++++++++ .../implementation/FabricCapacitiesImpl.java | 218 ++ .../implementation/FabricCapacityImpl.java | 213 ++ .../implementation/FabricClientBuilder.java | 138 + .../implementation/FabricClientImpl.java | 304 +++ .../fabric/implementation/OperationImpl.java | 50 + .../implementation/OperationsClientImpl.java | 239 ++ .../fabric/implementation/OperationsImpl.java | 44 + .../implementation/ResourceManagerUtils.java | 195 ++ .../RpSkuDetailsForExistingResourceImpl.java | 37 + .../RpSkuDetailsForNewResourceImpl.java | 47 + .../models/FabricCapacityListResult.java | 113 + .../models/OperationListResult.java | 113 + ...uEnumerationForExistingResourceResult.java | 116 + .../RpSkuEnumerationForNewResourceResult.java | 116 + .../fabric/implementation/package-info.java | 8 + .../fabric/models/ActionType.java | 46 + .../fabric/models/CapacityAdministration.java | 103 + .../models/CheckNameAvailabilityReason.java | 51 + .../models/CheckNameAvailabilityRequest.java | 121 + .../models/CheckNameAvailabilityResponse.java | 40 + .../fabric/models/FabricCapacities.java | 288 ++ .../fabric/models/FabricCapacity.java | 335 +++ .../models/FabricCapacityProperties.java | 141 + .../fabric/models/FabricCapacityUpdate.java | 157 ++ .../FabricCapacityUpdateProperties.java | 97 + .../fabric/models/Operation.java | 58 + .../fabric/models/OperationDisplay.java | 136 + .../fabric/models/Operations.java | 35 + .../resourcemanager/fabric/models/Origin.java | 57 + .../fabric/models/ProvisioningState.java | 71 + .../fabric/models/ResourceState.java | 101 + .../resourcemanager/fabric/models/RpSku.java | 131 + .../RpSkuDetailsForExistingResource.java | 33 + .../models/RpSkuDetailsForNewResource.java | 41 + .../fabric/models/RpSkuTier.java | 46 + .../fabric/models/package-info.java | 8 + .../resourcemanager/fabric/package-info.java | 8 + .../src/main/java/module-info.java | 14 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + ...apacitiesCheckNameAvailabilitySamples.java | 27 + ...FabricCapacitiesCreateOrUpdateSamples.java | 35 + .../FabricCapacitiesDeleteSamples.java | 22 + ...icCapacitiesGetByResourceGroupSamples.java | 23 + ...cCapacitiesListByResourceGroupSamples.java | 22 + .../FabricCapacitiesListSamples.java | 22 + ...cCapacitiesListSkusForCapacitySamples.java | 22 + .../FabricCapacitiesListSkusSamples.java | 22 + .../FabricCapacitiesResumeSamples.java | 22 + .../FabricCapacitiesSuspendSamples.java | 22 + .../FabricCapacitiesUpdateSamples.java | 51 + .../generated/OperationsListSamples.java | 22 + .../CapacityAdministrationTests.java | 27 + .../CheckNameAvailabilityRequestTests.java | 28 + ...eckNameAvailabilityResponseInnerTests.java | 22 + ...NameAvailabilityWithResponseMockTests.java | 44 + ...bricCapacitiesCreateOrUpdateMockTests.java | 68 + ...tByResourceGroupWithResponseMockTests.java | 44 + ...apacitiesListByResourceGroupMockTests.java | 45 + .../FabricCapacitiesListMockTests.java | 44 + ...apacitiesListSkusForCapacityMockTests.java | 42 + .../FabricCapacitiesListSkusMockTests.java | 41 + .../FabricCapacitiesResumeMockTests.java | 33 + .../FabricCapacitiesSuspendMockTests.java | 33 + .../generated/FabricCapacityInnerTests.java | 57 + .../FabricCapacityListResultTests.java | 26 + .../FabricCapacityPropertiesTests.java | 29 + .../FabricCapacityUpdatePropertiesTests.java | 29 + .../generated/FabricCapacityUpdateTests.java | 55 + .../generated/OperationDisplayTests.java | 17 + .../fabric/generated/OperationInnerTests.java | 20 + .../generated/OperationListResultTests.java | 21 + .../generated/OperationsListMockTests.java | 39 + ...uDetailsForExistingResourceInnerTests.java | 22 + .../RpSkuDetailsForNewResourceInnerTests.java | 21 + ...erationForExistingResourceResultTests.java | 23 + ...uEnumerationForNewResourceResultTests.java | 22 + .../fabric/generated/RpSkuTests.java | 27 + .../tsp-location.yaml | 4 + sdk/fabric/ci.yml | 46 + sdk/fabric/pom.xml | 15 + 100 files changed, 9864 insertions(+) create mode 100644 sdk/fabric/azure-resourcemanager-fabric/CHANGELOG.md create mode 100644 sdk/fabric/azure-resourcemanager-fabric/README.md create mode 100644 sdk/fabric/azure-resourcemanager-fabric/SAMPLE.md create mode 100644 sdk/fabric/azure-resourcemanager-fabric/pom.xml create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/FabricManager.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/FabricCapacitiesClient.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/FabricClient.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/OperationsClient.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/CheckNameAvailabilityResponseInner.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/FabricCapacityInner.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/OperationInner.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/RpSkuDetailsForExistingResourceInner.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/RpSkuDetailsForNewResourceInner.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/package-info.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/package-info.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/CheckNameAvailabilityResponseImpl.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricCapacitiesClientImpl.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricCapacitiesImpl.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricCapacityImpl.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricClientBuilder.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricClientImpl.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/OperationImpl.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/OperationsClientImpl.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/OperationsImpl.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/ResourceManagerUtils.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/RpSkuDetailsForExistingResourceImpl.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/RpSkuDetailsForNewResourceImpl.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/models/FabricCapacityListResult.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/models/OperationListResult.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/models/RpSkuEnumerationForExistingResourceResult.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/models/RpSkuEnumerationForNewResourceResult.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/package-info.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/ActionType.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/CapacityAdministration.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/CheckNameAvailabilityReason.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/CheckNameAvailabilityRequest.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/CheckNameAvailabilityResponse.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacities.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacity.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacityProperties.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacityUpdate.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacityUpdateProperties.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/Operation.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/OperationDisplay.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/Operations.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/Origin.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/ProvisioningState.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/ResourceState.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/RpSku.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/RpSkuDetailsForExistingResource.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/RpSkuDetailsForNewResource.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/RpSkuTier.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/package-info.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/package-info.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/java/module-info.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-fabric/proxy-config.json create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-fabric/reflect-config.json create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesCheckNameAvailabilitySamples.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesCreateOrUpdateSamples.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesDeleteSamples.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesGetByResourceGroupSamples.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListByResourceGroupSamples.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSamples.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSkusForCapacitySamples.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSkusSamples.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesResumeSamples.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesSuspendSamples.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesUpdateSamples.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/OperationsListSamples.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/CapacityAdministrationTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/CheckNameAvailabilityRequestTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/CheckNameAvailabilityResponseInnerTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesCheckNameAvailabilityWithResponseMockTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesCreateOrUpdateMockTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesGetByResourceGroupWithResponseMockTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListByResourceGroupMockTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListMockTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSkusForCapacityMockTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSkusMockTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesResumeMockTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesSuspendMockTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityInnerTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityListResultTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityPropertiesTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityUpdatePropertiesTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityUpdateTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/OperationDisplayTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/OperationInnerTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/OperationListResultTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/OperationsListMockTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuDetailsForExistingResourceInnerTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuDetailsForNewResourceInnerTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuEnumerationForExistingResourceResultTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuEnumerationForNewResourceResultTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuTests.java create mode 100644 sdk/fabric/azure-resourcemanager-fabric/tsp-location.yaml create mode 100644 sdk/fabric/ci.yml create mode 100644 sdk/fabric/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 7aaaaeae2697b..c197674c77faa 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -471,6 +471,7 @@ com.azure.resourcemanager:azure-resourcemanager-computefleet;1.0.0-beta.2;1.0.0- com.azure.resourcemanager:azure-resourcemanager-servicefabricmanagedclusters;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-healthdataaiservices;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-redhatopenshift;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-fabric;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;1.1.0-beta.1 io.clientcore:clientcore-parent;1.0.0-beta.1;1.0.0-beta.1 diff --git a/pom.xml b/pom.xml index 2016ea2e3bf3e..4b2d9941ab25b 100644 --- a/pom.xml +++ b/pom.xml @@ -93,6 +93,7 @@ sdk/eventgrid sdk/eventhubs sdk/extendedlocation + sdk/fabric sdk/face sdk/fluidrelay sdk/formrecognizer diff --git a/sdk/fabric/azure-resourcemanager-fabric/CHANGELOG.md b/sdk/fabric/azure-resourcemanager-fabric/CHANGELOG.md new file mode 100644 index 0000000000000..ecf4edd592cb3 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2024-09-20) + +- Azure Resource Manager Fabric client library for Java. This package contains Microsoft Azure SDK for Fabric Management SDK. 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/fabric/azure-resourcemanager-fabric/README.md b/sdk/fabric/azure-resourcemanager-fabric/README.md new file mode 100644 index 0000000000000..40734070ae3c9 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/README.md @@ -0,0 +1,104 @@ +# Azure Resource Manager Fabric client library for Java + +Azure Resource Manager Fabric client library for Java. + +This package contains Microsoft Azure SDK for Fabric Management SDK. 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-fabric;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-fabric + 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 + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +FabricManager manager = FabricManager + .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/fabric/azure-resourcemanager-fabric/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://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[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/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Ffabric%2Fazure-resourcemanager-fabric%2FREADME.png) diff --git a/sdk/fabric/azure-resourcemanager-fabric/SAMPLE.md b/sdk/fabric/azure-resourcemanager-fabric/SAMPLE.md new file mode 100644 index 0000000000000..cddcfaf4cf044 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/SAMPLE.md @@ -0,0 +1,320 @@ +# Code snippets and samples + + +## FabricCapacities + +- [CheckNameAvailability](#fabriccapacities_checknameavailability) +- [CreateOrUpdate](#fabriccapacities_createorupdate) +- [Delete](#fabriccapacities_delete) +- [GetByResourceGroup](#fabriccapacities_getbyresourcegroup) +- [List](#fabriccapacities_list) +- [ListByResourceGroup](#fabriccapacities_listbyresourcegroup) +- [ListSkus](#fabriccapacities_listskus) +- [ListSkusForCapacity](#fabriccapacities_listskusforcapacity) +- [Resume](#fabriccapacities_resume) +- [Suspend](#fabriccapacities_suspend) +- [Update](#fabriccapacities_update) + +## Operations + +- [List](#operations_list) +### FabricCapacities_CheckNameAvailability + +```java +import com.azure.resourcemanager.fabric.models.CheckNameAvailabilityRequest; + +/** + * Samples for FabricCapacities CheckNameAvailability. + */ +public final class FabricCapacitiesCheckNameAvailabilitySamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_CheckNameAvailability.json + */ + /** + * Sample code: Check name availability of a capacity. + * + * @param manager Entry point to FabricManager. + */ + public static void checkNameAvailabilityOfACapacity(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities() + .checkNameAvailabilityWithResponse("westcentralus", + new CheckNameAvailabilityRequest().withName("azsdktest").withType("Microsoft.Fabric/capacities"), + com.azure.core.util.Context.NONE); + } +} +``` + +### FabricCapacities_CreateOrUpdate + +```java +import com.azure.resourcemanager.fabric.models.CapacityAdministration; +import com.azure.resourcemanager.fabric.models.FabricCapacityProperties; +import com.azure.resourcemanager.fabric.models.RpSku; +import com.azure.resourcemanager.fabric.models.RpSkuTier; +import java.util.Arrays; + +/** + * Samples for FabricCapacities CreateOrUpdate. + */ +public final class FabricCapacitiesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_CreateOrUpdate.json + */ + /** + * Sample code: Create or update a capacity. + * + * @param manager Entry point to FabricManager. + */ + public static void createOrUpdateACapacity(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities() + .define("azsdktest") + .withRegion("westcentralus") + .withExistingResourceGroup("TestRG") + .withProperties(new FabricCapacityProperties().withAdministration(new CapacityAdministration() + .withMembers(Arrays.asList("azsdktest@microsoft.com", "azsdktest2@microsoft.com")))) + .withSku(new RpSku().withName("F2").withTier(RpSkuTier.FABRIC)) + .create(); + } +} +``` + +### FabricCapacities_Delete + +```java +/** + * Samples for FabricCapacities Delete. + */ +public final class FabricCapacitiesDeleteSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_Delete.json + */ + /** + * Sample code: Delete a capacity. + * + * @param manager Entry point to FabricManager. + */ + public static void deleteACapacity(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities().delete("TestRG", "azsdktest", com.azure.core.util.Context.NONE); + } +} +``` + +### FabricCapacities_GetByResourceGroup + +```java +/** + * Samples for FabricCapacities GetByResourceGroup. + */ +public final class FabricCapacitiesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_Get.json + */ + /** + * Sample code: Get a capacity. + * + * @param manager Entry point to FabricManager. + */ + public static void getACapacity(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities() + .getByResourceGroupWithResponse("TestRG", "azsdktest", com.azure.core.util.Context.NONE); + } +} +``` + +### FabricCapacities_List + +```java +/** + * Samples for FabricCapacities List. + */ +public final class FabricCapacitiesListSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_ListBySubscription.json + */ + /** + * Sample code: List capacities by subscription. + * + * @param manager Entry point to FabricManager. + */ + public static void listCapacitiesBySubscription(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities().list(com.azure.core.util.Context.NONE); + } +} +``` + +### FabricCapacities_ListByResourceGroup + +```java +/** + * Samples for FabricCapacities ListByResourceGroup. + */ +public final class FabricCapacitiesListByResourceGroupSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_ListByResourceGroup.json + */ + /** + * Sample code: List capacities by resource group. + * + * @param manager Entry point to FabricManager. + */ + public static void listCapacitiesByResourceGroup(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities().listByResourceGroup("TestRG", com.azure.core.util.Context.NONE); + } +} +``` + +### FabricCapacities_ListSkus + +```java +/** + * Samples for FabricCapacities ListSkus. + */ +public final class FabricCapacitiesListSkusSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_ListSkus.json + */ + /** + * Sample code: List eligible SKUs for a new capacity. + * + * @param manager Entry point to FabricManager. + */ + public static void listEligibleSKUsForANewCapacity(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities().listSkus(com.azure.core.util.Context.NONE); + } +} +``` + +### FabricCapacities_ListSkusForCapacity + +```java +/** + * Samples for FabricCapacities ListSkusForCapacity. + */ +public final class FabricCapacitiesListSkusForCapacitySamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_ListSkusForCapacity.json + */ + /** + * Sample code: List eligible SKUs for an existing capacity. + * + * @param manager Entry point to FabricManager. + */ + public static void listEligibleSKUsForAnExistingCapacity(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities().listSkusForCapacity("TestRG", "azsdktest", com.azure.core.util.Context.NONE); + } +} +``` + +### FabricCapacities_Resume + +```java +/** + * Samples for FabricCapacities Resume. + */ +public final class FabricCapacitiesResumeSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_Resume.json + */ + /** + * Sample code: Resume capacity. + * + * @param manager Entry point to FabricManager. + */ + public static void resumeCapacity(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities().resume("TestRG", "azsdktest", com.azure.core.util.Context.NONE); + } +} +``` + +### FabricCapacities_Suspend + +```java +/** + * Samples for FabricCapacities Suspend. + */ +public final class FabricCapacitiesSuspendSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_Suspend.json + */ + /** + * Sample code: Suspend capacity. + * + * @param manager Entry point to FabricManager. + */ + public static void suspendCapacity(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities().suspend("TestRG", "azsdktest", com.azure.core.util.Context.NONE); + } +} +``` + +### FabricCapacities_Update + +```java +import com.azure.resourcemanager.fabric.models.CapacityAdministration; +import com.azure.resourcemanager.fabric.models.FabricCapacity; +import com.azure.resourcemanager.fabric.models.FabricCapacityUpdateProperties; +import com.azure.resourcemanager.fabric.models.RpSku; +import com.azure.resourcemanager.fabric.models.RpSkuTier; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for FabricCapacities Update. + */ +public final class FabricCapacitiesUpdateSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_Update.json + */ + /** + * Sample code: Update capacity properties. + * + * @param manager Entry point to FabricManager. + */ + public static void updateCapacityProperties(com.azure.resourcemanager.fabric.FabricManager manager) { + FabricCapacity resource = manager.fabricCapacities() + .getByResourceGroupWithResponse("TestRG", "azsdktest", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("testKey", "fakeTokenPlaceholder")) + .withSku(new RpSku().withName("F8").withTier(RpSkuTier.FABRIC)) + .withProperties(new FabricCapacityUpdateProperties().withAdministration( + new CapacityAdministration().withMembers(Arrays.asList("azsdktest2@microsoft.com")))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2023-11-01/Operations_List.json + */ + /** + * Sample code: List operations. + * + * @param manager Entry point to FabricManager. + */ + public static void listOperations(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/fabric/azure-resourcemanager-fabric/pom.xml b/sdk/fabric/azure-resourcemanager-fabric/pom.xml new file mode 100644 index 0000000000000..b90417eee747a --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/pom.xml @@ -0,0 +1,97 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-fabric + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Fabric Management + This package contains Microsoft Azure SDK for Fabric Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. + 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 + true + + + + com.azure + azure-json + 1.3.0 + + + com.azure + azure-core + 1.52.0 + + + com.azure + azure-core-management + 1.15.3 + + + com.azure + azure-core-test + 1.26.2 + test + + + com.azure + azure-identity + 1.13.3 + test + + + org.junit.jupiter + junit-jupiter-api + 5.9.3 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.9.3 + test + + + org.slf4j + slf4j-simple + 1.7.36 + test + + + diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/FabricManager.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/FabricManager.java new file mode 100644 index 0000000000000..4437d7f4329d7 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/FabricManager.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric; + +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.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpLogOptions; +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.fabric.fluent.FabricClient; +import com.azure.resourcemanager.fabric.implementation.FabricCapacitiesImpl; +import com.azure.resourcemanager.fabric.implementation.FabricClientBuilder; +import com.azure.resourcemanager.fabric.implementation.OperationsImpl; +import com.azure.resourcemanager.fabric.models.FabricCapacities; +import com.azure.resourcemanager.fabric.models.Operations; +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 FabricManager. + */ +public final class FabricManager { + private FabricCapacities fabricCapacities; + + private Operations operations; + + private final FabricClient clientObject; + + private FabricManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new FabricClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Fabric service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Fabric service API instance. + */ + public static FabricManager 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 Fabric service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Fabric service API instance. + */ + public static FabricManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new FabricManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create FabricManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new FabricManager.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 Fabric service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Fabric service API instance. + */ + public FabricManager 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.fabric") + .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 FabricManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of FabricCapacities. It manages FabricCapacity. + * + * @return Resource collection API of FabricCapacities. + */ + public FabricCapacities fabricCapacities() { + if (this.fabricCapacities == null) { + this.fabricCapacities = new FabricCapacitiesImpl(clientObject.getFabricCapacities(), this); + } + return fabricCapacities; + } + + /** + * 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 wrapped service client FabricClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client FabricClient. + */ + public FabricClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/FabricCapacitiesClient.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/FabricCapacitiesClient.java new file mode 100644 index 0000000000000..01eeb6911b6d7 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/FabricCapacitiesClient.java @@ -0,0 +1,482 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.fabric.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.fabric.fluent.models.FabricCapacityInner; +import com.azure.resourcemanager.fabric.fluent.models.RpSkuDetailsForExistingResourceInner; +import com.azure.resourcemanager.fabric.fluent.models.RpSkuDetailsForNewResourceInner; +import com.azure.resourcemanager.fabric.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.fabric.models.FabricCapacityUpdate; + +/** + * An instance of this class provides access to all the operations defined in FabricCapacitiesClient. + */ +public interface FabricCapacitiesClient { + /** + * Get a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @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 FabricCapacity along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String capacityName, + Context context); + + /** + * Get a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @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 FabricCapacity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FabricCapacityInner getByResourceGroup(String resourceGroupName, String capacityName); + + /** + * Create a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FabricCapacityInner> beginCreateOrUpdate(String resourceGroupName, + String capacityName, FabricCapacityInner resource); + + /** + * Create a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FabricCapacityInner> beginCreateOrUpdate(String resourceGroupName, + String capacityName, FabricCapacityInner resource, Context context); + + /** + * Create a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param resource Resource create parameters. + * @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 fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FabricCapacityInner createOrUpdate(String resourceGroupName, String capacityName, FabricCapacityInner resource); + + /** + * Create a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param resource Resource create parameters. + * @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 fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FabricCapacityInner createOrUpdate(String resourceGroupName, String capacityName, FabricCapacityInner resource, + Context context); + + /** + * Update a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param properties The resource properties to be 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 the {@link SyncPoller} for polling of fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FabricCapacityInner> beginUpdate(String resourceGroupName, + String capacityName, FabricCapacityUpdate properties); + + /** + * Update a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FabricCapacityInner> beginUpdate(String resourceGroupName, + String capacityName, FabricCapacityUpdate properties, Context context); + + /** + * Update a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param properties The resource properties to be 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 fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FabricCapacityInner update(String resourceGroupName, String capacityName, FabricCapacityUpdate properties); + + /** + * Update a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param properties The resource properties to be 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 fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FabricCapacityInner update(String resourceGroupName, String capacityName, FabricCapacityUpdate properties, + Context context); + + /** + * Delete a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String capacityName); + + /** + * Delete a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String capacityName, Context context); + + /** + * Delete a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @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 capacityName); + + /** + * Delete a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String capacityName, Context context); + + /** + * List FabricCapacity resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FabricCapacity list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List FabricCapacity resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 response of a FabricCapacity list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List FabricCapacity resources by subscription ID. + * + * @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 response of a FabricCapacity list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List FabricCapacity resources by subscription 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 response of a FabricCapacity list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginResume(String resourceGroupName, String capacityName); + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginResume(String resourceGroupName, String capacityName, Context context); + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @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 resume(String resourceGroupName, String capacityName); + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void resume(String resourceGroupName, String capacityName, Context context); + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginSuspend(String resourceGroupName, String capacityName); + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginSuspend(String resourceGroupName, String capacityName, Context context); + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @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 suspend(String resourceGroupName, String capacityName); + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void suspend(String resourceGroupName, String capacityName, Context context); + + /** + * Implements local CheckNameAvailability operations. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability request. + * @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 check availability result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse(String location, + CheckNameAvailabilityRequest body, Context context); + + /** + * Implements local CheckNameAvailability operations. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability request. + * @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 check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResponseInner checkNameAvailability(String location, CheckNameAvailabilityRequest body); + + /** + * List eligible SKUs for a Microsoft Fabric resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the capacity. + * @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 object that represents enumerating SKUs for existing resources as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSkusForCapacity(String resourceGroupName, + String capacityName); + + /** + * List eligible SKUs for a Microsoft Fabric resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the capacity. + * @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 object that represents enumerating SKUs for existing resources as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSkusForCapacity(String resourceGroupName, + String capacityName, Context context); + + /** + * List eligible SKUs for Microsoft Fabric resource provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an object that represents enumerating SKUs for new resources as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSkus(); + + /** + * List eligible SKUs for Microsoft Fabric resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an object that represents enumerating SKUs for new resources as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSkus(Context context); +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/FabricClient.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/FabricClient.java new file mode 100644 index 0000000000000..eae0c8df93360 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/FabricClient.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for FabricClient class. + */ +public interface FabricClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * 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 FabricCapacitiesClient object to access its operations. + * + * @return the FabricCapacitiesClient object. + */ + FabricCapacitiesClient getFabricCapacities(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/OperationsClient.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/OperationsClient.java new file mode 100644 index 0000000000000..18bfb99a44470 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.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.fabric.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/CheckNameAvailabilityResponseInner.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/CheckNameAvailabilityResponseInner.java new file mode 100644 index 0000000000000..152f1aa50221d --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/CheckNameAvailabilityResponseInner.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.fabric.models.CheckNameAvailabilityReason; +import java.io.IOException; + +/** + * The check availability result. + */ +@Immutable +public final class CheckNameAvailabilityResponseInner implements JsonSerializable { + /* + * Indicates if the resource name is available. + */ + private Boolean nameAvailable; + + /* + * The reason why the given name is not available. + */ + private CheckNameAvailabilityReason reason; + + /* + * Detailed reason why the given name is not available. + */ + private String message; + + /** + * Creates an instance of CheckNameAvailabilityResponseInner class. + */ + private CheckNameAvailabilityResponseInner() { + } + + /** + * Get the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + public CheckNameAvailabilityReason reason() { + return this.reason; + } + + /** + * Get the message property: Detailed reason why the given name is not available. + * + * @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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("nameAvailable", this.nameAvailable); + jsonWriter.writeStringField("reason", this.reason == null ? null : this.reason.toString()); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckNameAvailabilityResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckNameAvailabilityResponseInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CheckNameAvailabilityResponseInner. + */ + public static CheckNameAvailabilityResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckNameAvailabilityResponseInner deserializedCheckNameAvailabilityResponseInner + = new CheckNameAvailabilityResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nameAvailable".equals(fieldName)) { + deserializedCheckNameAvailabilityResponseInner.nameAvailable + = reader.getNullable(JsonReader::getBoolean); + } else if ("reason".equals(fieldName)) { + deserializedCheckNameAvailabilityResponseInner.reason + = CheckNameAvailabilityReason.fromString(reader.getString()); + } else if ("message".equals(fieldName)) { + deserializedCheckNameAvailabilityResponseInner.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckNameAvailabilityResponseInner; + }); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/FabricCapacityInner.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/FabricCapacityInner.java new file mode 100644 index 0000000000000..b31d3becb76d2 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/FabricCapacityInner.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.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.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.fabric.models.FabricCapacityProperties; +import com.azure.resourcemanager.fabric.models.RpSku; +import java.io.IOException; +import java.util.Map; + +/** + * Fabric Capacity resource. + */ +@Fluent +public final class FabricCapacityInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private FabricCapacityProperties properties; + + /* + * The SKU details + */ + private RpSku sku; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of FabricCapacityInner class. + */ + public FabricCapacityInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public FabricCapacityProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the FabricCapacityInner object itself. + */ + public FabricCapacityInner withProperties(FabricCapacityProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the sku property: The SKU details. + * + * @return the sku value. + */ + public RpSku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU details. + * + * @param sku the sku value to set. + * @return the FabricCapacityInner object itself. + */ + public FabricCapacityInner withSku(RpSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public FabricCapacityInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public FabricCapacityInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property properties in model FabricCapacityInner")); + } else { + properties().validate(); + } + if (sku() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property sku in model FabricCapacityInner")); + } else { + sku().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FabricCapacityInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("sku", this.sku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FabricCapacityInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FabricCapacityInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FabricCapacityInner. + */ + public static FabricCapacityInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FabricCapacityInner deserializedFabricCapacityInner = new FabricCapacityInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedFabricCapacityInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedFabricCapacityInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedFabricCapacityInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedFabricCapacityInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedFabricCapacityInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedFabricCapacityInner.properties = FabricCapacityProperties.fromJson(reader); + } else if ("sku".equals(fieldName)) { + deserializedFabricCapacityInner.sku = RpSku.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedFabricCapacityInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFabricCapacityInner; + }); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/OperationInner.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..489a882b7d1af --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/OperationInner.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.fabric.models.ActionType; +import com.azure.resourcemanager.fabric.models.OperationDisplay; +import com.azure.resourcemanager.fabric.models.Origin; +import java.io.IOException; + +/** + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + * Resource Manager/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + 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" + */ + private Origin origin; + + /* + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + private 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 Azure Resource Manager/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; + } + + /** + * 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: Extensible 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(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("actionType", this.actionType == null ? null : this.actionType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/RpSkuDetailsForExistingResourceInner.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/RpSkuDetailsForExistingResourceInner.java new file mode 100644 index 0000000000000..419ee06d321d4 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/RpSkuDetailsForExistingResourceInner.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.fabric.models.RpSku; +import java.io.IOException; + +/** + * An object that represents SKU details for existing resources. + */ +@Immutable +public final class RpSkuDetailsForExistingResourceInner + implements JsonSerializable { + /* + * The resource type + */ + private String resourceType; + + /* + * The SKU details + */ + private RpSku sku; + + /** + * Creates an instance of RpSkuDetailsForExistingResourceInner class. + */ + private RpSkuDetailsForExistingResourceInner() { + } + + /** + * Get the resourceType property: The resource type. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Get the sku property: The SKU details. + * + * @return the sku value. + */ + public RpSku sku() { + return this.sku; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property resourceType in model RpSkuDetailsForExistingResourceInner")); + } + if (sku() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sku in model RpSkuDetailsForExistingResourceInner")); + } else { + sku().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RpSkuDetailsForExistingResourceInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceType", this.resourceType); + jsonWriter.writeJsonField("sku", this.sku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RpSkuDetailsForExistingResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RpSkuDetailsForExistingResourceInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RpSkuDetailsForExistingResourceInner. + */ + public static RpSkuDetailsForExistingResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RpSkuDetailsForExistingResourceInner deserializedRpSkuDetailsForExistingResourceInner + = new RpSkuDetailsForExistingResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceType".equals(fieldName)) { + deserializedRpSkuDetailsForExistingResourceInner.resourceType = reader.getString(); + } else if ("sku".equals(fieldName)) { + deserializedRpSkuDetailsForExistingResourceInner.sku = RpSku.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRpSkuDetailsForExistingResourceInner; + }); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/RpSkuDetailsForNewResourceInner.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/RpSkuDetailsForNewResourceInner.java new file mode 100644 index 0000000000000..c41c0ce11dd8b --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/RpSkuDetailsForNewResourceInner.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The SKU details. + */ +@Immutable +public final class RpSkuDetailsForNewResourceInner implements JsonSerializable { + /* + * The resource type + */ + private String resourceType; + + /* + * The SKU's name + */ + private String name; + + /* + * The list of available locations for the SKU + */ + private List locations; + + /** + * Creates an instance of RpSkuDetailsForNewResourceInner class. + */ + private RpSkuDetailsForNewResourceInner() { + } + + /** + * Get the resourceType property: The resource type. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Get the name property: The SKU's name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the locations property: The list of available locations for the SKU. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property resourceType in model RpSkuDetailsForNewResourceInner")); + } + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property name in model RpSkuDetailsForNewResourceInner")); + } + if (locations() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property locations in model RpSkuDetailsForNewResourceInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RpSkuDetailsForNewResourceInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceType", this.resourceType); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeArrayField("locations", this.locations, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RpSkuDetailsForNewResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RpSkuDetailsForNewResourceInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RpSkuDetailsForNewResourceInner. + */ + public static RpSkuDetailsForNewResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RpSkuDetailsForNewResourceInner deserializedRpSkuDetailsForNewResourceInner + = new RpSkuDetailsForNewResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceType".equals(fieldName)) { + deserializedRpSkuDetailsForNewResourceInner.resourceType = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRpSkuDetailsForNewResourceInner.name = reader.getString(); + } else if ("locations".equals(fieldName)) { + List locations = reader.readArray(reader1 -> reader1.getString()); + deserializedRpSkuDetailsForNewResourceInner.locations = locations; + } else { + reader.skipChildren(); + } + } + + return deserializedRpSkuDetailsForNewResourceInner; + }); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/package-info.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/package-info.java new file mode 100644 index 0000000000000..a80d80b0f9627 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/models/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for Fabric. + */ +package com.azure.resourcemanager.fabric.fluent.models; diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/package-info.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/package-info.java new file mode 100644 index 0000000000000..582ad57469192 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/fluent/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for Fabric. + */ +package com.azure.resourcemanager.fabric.fluent; diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/CheckNameAvailabilityResponseImpl.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/CheckNameAvailabilityResponseImpl.java new file mode 100644 index 0000000000000..9b5254600007b --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/CheckNameAvailabilityResponseImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.implementation; + +import com.azure.resourcemanager.fabric.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.fabric.models.CheckNameAvailabilityReason; +import com.azure.resourcemanager.fabric.models.CheckNameAvailabilityResponse; + +public final class CheckNameAvailabilityResponseImpl implements CheckNameAvailabilityResponse { + private CheckNameAvailabilityResponseInner innerObject; + + private final com.azure.resourcemanager.fabric.FabricManager serviceManager; + + CheckNameAvailabilityResponseImpl(CheckNameAvailabilityResponseInner innerObject, + com.azure.resourcemanager.fabric.FabricManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public CheckNameAvailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.fabric.FabricManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricCapacitiesClientImpl.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricCapacitiesClientImpl.java new file mode 100644 index 0000000000000..deacb81001dbb --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricCapacitiesClientImpl.java @@ -0,0 +1,2310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.fabric.fluent.FabricCapacitiesClient; +import com.azure.resourcemanager.fabric.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.fabric.fluent.models.FabricCapacityInner; +import com.azure.resourcemanager.fabric.fluent.models.RpSkuDetailsForExistingResourceInner; +import com.azure.resourcemanager.fabric.fluent.models.RpSkuDetailsForNewResourceInner; +import com.azure.resourcemanager.fabric.implementation.models.FabricCapacityListResult; +import com.azure.resourcemanager.fabric.implementation.models.RpSkuEnumerationForExistingResourceResult; +import com.azure.resourcemanager.fabric.implementation.models.RpSkuEnumerationForNewResourceResult; +import com.azure.resourcemanager.fabric.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.fabric.models.FabricCapacityUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in FabricCapacitiesClient. + */ +public final class FabricCapacitiesClientImpl implements FabricCapacitiesClient { + /** + * The proxy service used to perform REST calls. + */ + private final FabricCapacitiesService service; + + /** + * The service client containing this operation class. + */ + private final FabricClientImpl client; + + /** + * Initializes an instance of FabricCapacitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FabricCapacitiesClientImpl(FabricClientImpl client) { + this.service + = RestProxy.create(FabricCapacitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for FabricClientFabricCapacities to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "FabricClientFabricCa") + public interface FabricCapacitiesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("capacityName") String capacityName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("capacityName") String capacityName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") FabricCapacityInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("capacityName") String capacityName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") FabricCapacityUpdate properties, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("capacityName") String capacityName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Fabric/capacities") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}/resume") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> resume(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("capacityName") String capacityName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}/suspend") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> suspend(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("capacityName") String capacityName, + @HeaderParam("Accept") String accept, Context context); + + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Fabric/locations/{location}/checkNameAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") CheckNameAvailabilityRequest body, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}/skus") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSkusForCapacity( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("capacityName") String capacityName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Fabric/skus") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSkus(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSkusForCapacityNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSkusNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 FabricCapacity along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String capacityName) { + 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 (capacityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capacityName 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, capacityName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @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 FabricCapacity along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String capacityName, 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 (capacityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capacityName 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, capacityName, accept, context); + } + + /** + * Get a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 FabricCapacity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String capacityName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, capacityName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @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 FabricCapacity along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String capacityName, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, capacityName, context).block(); + } + + /** + * Get a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 FabricCapacity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FabricCapacityInner getByResourceGroup(String resourceGroupName, String capacityName) { + return getByResourceGroupWithResponse(resourceGroupName, capacityName, Context.NONE).getValue(); + } + + /** + * Create a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 fabric Capacity resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String capacityName, FabricCapacityInner resource) { + 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 (capacityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capacityName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, capacityName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param resource Resource create parameters. + * @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 fabric Capacity resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String capacityName, FabricCapacityInner resource, 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 (capacityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capacityName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, capacityName, contentType, accept, resource, context); + } + + /** + * Create a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FabricCapacityInner> + beginCreateOrUpdateAsync(String resourceGroupName, String capacityName, FabricCapacityInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, capacityName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FabricCapacityInner.class, FabricCapacityInner.class, this.client.getContext()); + } + + /** + * Create a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FabricCapacityInner> beginCreateOrUpdateAsync( + String resourceGroupName, String capacityName, FabricCapacityInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, capacityName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FabricCapacityInner.class, FabricCapacityInner.class, context); + } + + /** + * Create a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FabricCapacityInner> + beginCreateOrUpdate(String resourceGroupName, String capacityName, FabricCapacityInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, capacityName, resource).getSyncPoller(); + } + + /** + * Create a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FabricCapacityInner> beginCreateOrUpdate( + String resourceGroupName, String capacityName, FabricCapacityInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, capacityName, resource, context).getSyncPoller(); + } + + /** + * Create a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 fabric Capacity resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String capacityName, + FabricCapacityInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, capacityName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param resource Resource create parameters. + * @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 fabric Capacity resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String capacityName, + FabricCapacityInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, capacityName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FabricCapacityInner createOrUpdate(String resourceGroupName, String capacityName, + FabricCapacityInner resource) { + return createOrUpdateAsync(resourceGroupName, capacityName, resource).block(); + } + + /** + * Create a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param resource Resource create parameters. + * @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 fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FabricCapacityInner createOrUpdate(String resourceGroupName, String capacityName, + FabricCapacityInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, capacityName, resource, context).block(); + } + + /** + * Update a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param properties The resource properties to be 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 fabric Capacity resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String capacityName, + FabricCapacityUpdate properties) { + 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 (capacityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capacityName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, capacityName, contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param properties The resource properties to be 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 fabric Capacity resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String capacityName, + FabricCapacityUpdate properties, 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 (capacityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capacityName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, capacityName, contentType, accept, properties, context); + } + + /** + * Update a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FabricCapacityInner> beginUpdateAsync(String resourceGroupName, + String capacityName, FabricCapacityUpdate properties) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, capacityName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FabricCapacityInner.class, FabricCapacityInner.class, this.client.getContext()); + } + + /** + * Update a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FabricCapacityInner> beginUpdateAsync(String resourceGroupName, + String capacityName, FabricCapacityUpdate properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, capacityName, properties, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + FabricCapacityInner.class, FabricCapacityInner.class, context); + } + + /** + * Update a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FabricCapacityInner> beginUpdate(String resourceGroupName, + String capacityName, FabricCapacityUpdate properties) { + return this.beginUpdateAsync(resourceGroupName, capacityName, properties).getSyncPoller(); + } + + /** + * Update a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FabricCapacityInner> beginUpdate(String resourceGroupName, + String capacityName, FabricCapacityUpdate properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, capacityName, properties, context).getSyncPoller(); + } + + /** + * Update a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param properties The resource properties to be 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 fabric Capacity resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String capacityName, + FabricCapacityUpdate properties) { + return beginUpdateAsync(resourceGroupName, capacityName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param properties The resource properties to be 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 fabric Capacity resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String capacityName, + FabricCapacityUpdate properties, Context context) { + return beginUpdateAsync(resourceGroupName, capacityName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param properties The resource properties to be 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 fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FabricCapacityInner update(String resourceGroupName, String capacityName, FabricCapacityUpdate properties) { + return updateAsync(resourceGroupName, capacityName, properties).block(); + } + + /** + * Update a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param properties The resource properties to be 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 fabric Capacity resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FabricCapacityInner update(String resourceGroupName, String capacityName, FabricCapacityUpdate properties, + Context context) { + return updateAsync(resourceGroupName, capacityName, properties, context).block(); + } + + /** + * Delete a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 capacityName) { + 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 (capacityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capacityName 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, capacityName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @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 capacityName, + 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 (capacityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capacityName 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, capacityName, accept, context); + } + + /** + * Delete a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String capacityName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, capacityName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String capacityName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, capacityName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String capacityName) { + return this.beginDeleteAsync(resourceGroupName, capacityName).getSyncPoller(); + } + + /** + * Delete a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String capacityName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, capacityName, context).getSyncPoller(); + } + + /** + * Delete a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 capacityName) { + return beginDeleteAsync(resourceGroupName, capacityName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String capacityName, Context context) { + return beginDeleteAsync(resourceGroupName, capacityName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 capacityName) { + deleteAsync(resourceGroupName, capacityName).block(); + } + + /** + * Delete a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String capacityName, Context context) { + deleteAsync(resourceGroupName, capacityName, context).block(); + } + + /** + * List FabricCapacity resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FabricCapacity list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + 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, 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())); + } + + /** + * List FabricCapacity resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 response of a FabricCapacity list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + 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, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List FabricCapacity resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FabricCapacity list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List FabricCapacity resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 response of a FabricCapacity list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List FabricCapacity resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FabricCapacity list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List FabricCapacity resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 response of a FabricCapacity list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List FabricCapacity resources by subscription ID. + * + * @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 response of a FabricCapacity list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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(), 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())); + } + + /** + * List FabricCapacity resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FabricCapacity list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List FabricCapacity resources by subscription ID. + * + * @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 response of a FabricCapacity list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List FabricCapacity resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FabricCapacity list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List FabricCapacity resources by subscription ID. + * + * @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 response of a FabricCapacity list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List FabricCapacity resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FabricCapacity list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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>> resumeWithResponseAsync(String resourceGroupName, String capacityName) { + 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 (capacityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capacityName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.resume(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, capacityName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @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>> resumeWithResponseAsync(String resourceGroupName, String capacityName, + 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 (capacityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capacityName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.resume(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, capacityName, accept, context); + } + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginResumeAsync(String resourceGroupName, String capacityName) { + Mono>> mono = resumeWithResponseAsync(resourceGroupName, capacityName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginResumeAsync(String resourceGroupName, String capacityName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = resumeWithResponseAsync(resourceGroupName, capacityName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginResume(String resourceGroupName, String capacityName) { + return this.beginResumeAsync(resourceGroupName, capacityName).getSyncPoller(); + } + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginResume(String resourceGroupName, String capacityName, + Context context) { + return this.beginResumeAsync(resourceGroupName, capacityName, context).getSyncPoller(); + } + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 resumeAsync(String resourceGroupName, String capacityName) { + return beginResumeAsync(resourceGroupName, capacityName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono resumeAsync(String resourceGroupName, String capacityName, Context context) { + return beginResumeAsync(resourceGroupName, capacityName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 resume(String resourceGroupName, String capacityName) { + resumeAsync(resourceGroupName, capacityName).block(); + } + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void resume(String resourceGroupName, String capacityName, Context context) { + resumeAsync(resourceGroupName, capacityName, context).block(); + } + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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>> suspendWithResponseAsync(String resourceGroupName, String capacityName) { + 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 (capacityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capacityName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.suspend(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, capacityName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @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>> suspendWithResponseAsync(String resourceGroupName, String capacityName, + 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 (capacityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capacityName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.suspend(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, capacityName, accept, context); + } + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginSuspendAsync(String resourceGroupName, String capacityName) { + Mono>> mono = suspendWithResponseAsync(resourceGroupName, capacityName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginSuspendAsync(String resourceGroupName, String capacityName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = suspendWithResponseAsync(resourceGroupName, capacityName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginSuspend(String resourceGroupName, String capacityName) { + return this.beginSuspendAsync(resourceGroupName, capacityName).getSyncPoller(); + } + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginSuspend(String resourceGroupName, String capacityName, + Context context) { + return this.beginSuspendAsync(resourceGroupName, capacityName, context).getSyncPoller(); + } + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 suspendAsync(String resourceGroupName, String capacityName) { + return beginSuspendAsync(resourceGroupName, capacityName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono suspendAsync(String resourceGroupName, String capacityName, Context context) { + return beginSuspendAsync(resourceGroupName, capacityName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 suspend(String resourceGroupName, String capacityName) { + suspendAsync(resourceGroupName, capacityName).block(); + } + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void suspend(String resourceGroupName, String capacityName, Context context) { + suspendAsync(resourceGroupName, capacityName, context).block(); + } + + /** + * Implements local CheckNameAvailability operations. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 check availability result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync(String location, + CheckNameAvailabilityRequest body) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.checkNameAvailability(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements local CheckNameAvailability operations. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability request. + * @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 check availability result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync(String location, + CheckNameAvailabilityRequest body, 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.checkNameAvailability(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, contentType, accept, body, context); + } + + /** + * Implements local CheckNameAvailability operations. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 check availability result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync(String location, + CheckNameAvailabilityRequest body) { + return checkNameAvailabilityWithResponseAsync(location, body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Implements local CheckNameAvailability operations. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability request. + * @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 check availability result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse(String location, + CheckNameAvailabilityRequest body, Context context) { + return checkNameAvailabilityWithResponseAsync(location, body, context).block(); + } + + /** + * Implements local CheckNameAvailability operations. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResponseInner checkNameAvailability(String location, + CheckNameAvailabilityRequest body) { + return checkNameAvailabilityWithResponse(location, body, Context.NONE).getValue(); + } + + /** + * List eligible SKUs for a Microsoft Fabric resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the capacity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 object that represents enumerating SKUs for existing resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listSkusForCapacitySinglePageAsync(String resourceGroupName, String capacityName) { + 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 (capacityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capacityName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listSkusForCapacity(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, capacityName, 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())); + } + + /** + * List eligible SKUs for a Microsoft Fabric resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the capacity. + * @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 object that represents enumerating SKUs for existing resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listSkusForCapacitySinglePageAsync(String resourceGroupName, String capacityName, 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 (capacityName == null) { + return Mono.error(new IllegalArgumentException("Parameter capacityName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSkusForCapacity(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, capacityName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List eligible SKUs for a Microsoft Fabric resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the capacity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 object that represents enumerating SKUs for existing resources as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSkusForCapacityAsync(String resourceGroupName, + String capacityName) { + return new PagedFlux<>(() -> listSkusForCapacitySinglePageAsync(resourceGroupName, capacityName), + nextLink -> listSkusForCapacityNextSinglePageAsync(nextLink)); + } + + /** + * List eligible SKUs for a Microsoft Fabric resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the capacity. + * @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 object that represents enumerating SKUs for existing resources as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSkusForCapacityAsync(String resourceGroupName, + String capacityName, Context context) { + return new PagedFlux<>(() -> listSkusForCapacitySinglePageAsync(resourceGroupName, capacityName, context), + nextLink -> listSkusForCapacityNextSinglePageAsync(nextLink, context)); + } + + /** + * List eligible SKUs for a Microsoft Fabric resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the capacity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 object that represents enumerating SKUs for existing resources as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSkusForCapacity(String resourceGroupName, + String capacityName) { + return new PagedIterable<>(listSkusForCapacityAsync(resourceGroupName, capacityName)); + } + + /** + * List eligible SKUs for a Microsoft Fabric resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the capacity. + * @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 object that represents enumerating SKUs for existing resources as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSkusForCapacity(String resourceGroupName, + String capacityName, Context context) { + return new PagedIterable<>(listSkusForCapacityAsync(resourceGroupName, capacityName, context)); + } + + /** + * List eligible SKUs for Microsoft Fabric resource provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an object that represents enumerating SKUs for new resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSkusSinglePageAsync() { + 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.listSkus(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), 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())); + } + + /** + * List eligible SKUs for Microsoft Fabric resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an object that represents enumerating SKUs for new resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSkusSinglePageAsync(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 + .listSkus(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List eligible SKUs for Microsoft Fabric resource provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an object that represents enumerating SKUs for new resources as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSkusAsync() { + return new PagedFlux<>(() -> listSkusSinglePageAsync(), nextLink -> listSkusNextSinglePageAsync(nextLink)); + } + + /** + * List eligible SKUs for Microsoft Fabric resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an object that represents enumerating SKUs for new resources as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSkusAsync(Context context) { + return new PagedFlux<>(() -> listSkusSinglePageAsync(context), + nextLink -> listSkusNextSinglePageAsync(nextLink, context)); + } + + /** + * List eligible SKUs for Microsoft Fabric resource provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an object that represents enumerating SKUs for new resources as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSkus() { + return new PagedIterable<>(listSkusAsync()); + } + + /** + * List eligible SKUs for Microsoft Fabric resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an object that represents enumerating SKUs for new resources as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSkus(Context context) { + return new PagedIterable<>(listSkusAsync(context)); + } + + /** + * List FabricCapacity resources by resource group + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FabricCapacity list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List FabricCapacity resources by resource group + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FabricCapacity list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List FabricCapacity resources by subscription ID + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FabricCapacity list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List FabricCapacity resources by subscription ID + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FabricCapacity list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List eligible SKUs for a Microsoft Fabric resource + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an object that represents enumerating SKUs for existing resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listSkusForCapacityNextSinglePageAsync(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.listSkusForCapacityNext(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())); + } + + /** + * List eligible SKUs for a Microsoft Fabric resource + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an object that represents enumerating SKUs for existing resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listSkusForCapacityNextSinglePageAsync(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.listSkusForCapacityNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List eligible SKUs for Microsoft Fabric resource provider + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an object that represents enumerating SKUs for new resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSkusNextSinglePageAsync(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.listSkusNext(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())); + } + + /** + * List eligible SKUs for Microsoft Fabric resource provider + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an object that represents enumerating SKUs for new resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSkusNextSinglePageAsync(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.listSkusNext(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/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricCapacitiesImpl.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricCapacitiesImpl.java new file mode 100644 index 0000000000000..63aa16b844d2b --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricCapacitiesImpl.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.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.fabric.fluent.FabricCapacitiesClient; +import com.azure.resourcemanager.fabric.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.fabric.fluent.models.FabricCapacityInner; +import com.azure.resourcemanager.fabric.fluent.models.RpSkuDetailsForExistingResourceInner; +import com.azure.resourcemanager.fabric.fluent.models.RpSkuDetailsForNewResourceInner; +import com.azure.resourcemanager.fabric.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.fabric.models.CheckNameAvailabilityResponse; +import com.azure.resourcemanager.fabric.models.FabricCapacities; +import com.azure.resourcemanager.fabric.models.FabricCapacity; +import com.azure.resourcemanager.fabric.models.RpSkuDetailsForExistingResource; +import com.azure.resourcemanager.fabric.models.RpSkuDetailsForNewResource; + +public final class FabricCapacitiesImpl implements FabricCapacities { + private static final ClientLogger LOGGER = new ClientLogger(FabricCapacitiesImpl.class); + + private final FabricCapacitiesClient innerClient; + + private final com.azure.resourcemanager.fabric.FabricManager serviceManager; + + public FabricCapacitiesImpl(FabricCapacitiesClient innerClient, + com.azure.resourcemanager.fabric.FabricManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String capacityName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, capacityName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new FabricCapacityImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public FabricCapacity getByResourceGroup(String resourceGroupName, String capacityName) { + FabricCapacityInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, capacityName); + if (inner != null) { + return new FabricCapacityImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String capacityName) { + this.serviceClient().delete(resourceGroupName, capacityName); + } + + public void delete(String resourceGroupName, String capacityName, Context context) { + this.serviceClient().delete(resourceGroupName, capacityName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FabricCapacityImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FabricCapacityImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FabricCapacityImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FabricCapacityImpl(inner1, this.manager())); + } + + public void resume(String resourceGroupName, String capacityName) { + this.serviceClient().resume(resourceGroupName, capacityName); + } + + public void resume(String resourceGroupName, String capacityName, Context context) { + this.serviceClient().resume(resourceGroupName, capacityName, context); + } + + public void suspend(String resourceGroupName, String capacityName) { + this.serviceClient().suspend(resourceGroupName, capacityName); + } + + public void suspend(String resourceGroupName, String capacityName, Context context) { + this.serviceClient().suspend(resourceGroupName, capacityName, context); + } + + public Response checkNameAvailabilityWithResponse(String location, + CheckNameAvailabilityRequest body, Context context) { + Response inner + = this.serviceClient().checkNameAvailabilityWithResponse(location, body, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CheckNameAvailabilityResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckNameAvailabilityResponse checkNameAvailability(String location, CheckNameAvailabilityRequest body) { + CheckNameAvailabilityResponseInner inner = this.serviceClient().checkNameAvailability(location, body); + if (inner != null) { + return new CheckNameAvailabilityResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listSkusForCapacity(String resourceGroupName, + String capacityName) { + PagedIterable inner + = this.serviceClient().listSkusForCapacity(resourceGroupName, capacityName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new RpSkuDetailsForExistingResourceImpl(inner1, this.manager())); + } + + public PagedIterable listSkusForCapacity(String resourceGroupName, + String capacityName, Context context) { + PagedIterable inner + = this.serviceClient().listSkusForCapacity(resourceGroupName, capacityName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new RpSkuDetailsForExistingResourceImpl(inner1, this.manager())); + } + + public PagedIterable listSkus() { + PagedIterable inner = this.serviceClient().listSkus(); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new RpSkuDetailsForNewResourceImpl(inner1, this.manager())); + } + + public PagedIterable listSkus(Context context) { + PagedIterable inner = this.serviceClient().listSkus(context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new RpSkuDetailsForNewResourceImpl(inner1, this.manager())); + } + + public FabricCapacity getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String capacityName = ResourceManagerUtils.getValueFromIdByName(id, "capacities"); + if (capacityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'capacities'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, capacityName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String capacityName = ResourceManagerUtils.getValueFromIdByName(id, "capacities"); + if (capacityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'capacities'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, capacityName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String capacityName = ResourceManagerUtils.getValueFromIdByName(id, "capacities"); + if (capacityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'capacities'.", id))); + } + this.delete(resourceGroupName, capacityName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String capacityName = ResourceManagerUtils.getValueFromIdByName(id, "capacities"); + if (capacityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'capacities'.", id))); + } + this.delete(resourceGroupName, capacityName, context); + } + + private FabricCapacitiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.fabric.FabricManager manager() { + return this.serviceManager; + } + + public FabricCapacityImpl define(String name) { + return new FabricCapacityImpl(name, this.manager()); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricCapacityImpl.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricCapacityImpl.java new file mode 100644 index 0000000000000..c85a982e52c4b --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricCapacityImpl.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.fabric.fluent.models.FabricCapacityInner; +import com.azure.resourcemanager.fabric.models.FabricCapacity; +import com.azure.resourcemanager.fabric.models.FabricCapacityProperties; +import com.azure.resourcemanager.fabric.models.FabricCapacityUpdate; +import com.azure.resourcemanager.fabric.models.FabricCapacityUpdateProperties; +import com.azure.resourcemanager.fabric.models.RpSku; +import java.util.Collections; +import java.util.Map; + +public final class FabricCapacityImpl implements FabricCapacity, FabricCapacity.Definition, FabricCapacity.Update { + private FabricCapacityInner innerObject; + + private final com.azure.resourcemanager.fabric.FabricManager 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 FabricCapacityProperties properties() { + return this.innerModel().properties(); + } + + public RpSku sku() { + return this.innerModel().sku(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public FabricCapacityInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.fabric.FabricManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String capacityName; + + private FabricCapacityUpdate updateProperties; + + public FabricCapacityImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public FabricCapacity create() { + this.innerObject = serviceManager.serviceClient() + .getFabricCapacities() + .createOrUpdate(resourceGroupName, capacityName, this.innerModel(), Context.NONE); + return this; + } + + public FabricCapacity create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFabricCapacities() + .createOrUpdate(resourceGroupName, capacityName, this.innerModel(), context); + return this; + } + + FabricCapacityImpl(String name, com.azure.resourcemanager.fabric.FabricManager serviceManager) { + this.innerObject = new FabricCapacityInner(); + this.serviceManager = serviceManager; + this.capacityName = name; + } + + public FabricCapacityImpl update() { + this.updateProperties = new FabricCapacityUpdate(); + return this; + } + + public FabricCapacity apply() { + this.innerObject = serviceManager.serviceClient() + .getFabricCapacities() + .update(resourceGroupName, capacityName, updateProperties, Context.NONE); + return this; + } + + public FabricCapacity apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFabricCapacities() + .update(resourceGroupName, capacityName, updateProperties, context); + return this; + } + + FabricCapacityImpl(FabricCapacityInner innerObject, com.azure.resourcemanager.fabric.FabricManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.capacityName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "capacities"); + } + + public FabricCapacity refresh() { + this.innerObject = serviceManager.serviceClient() + .getFabricCapacities() + .getByResourceGroupWithResponse(resourceGroupName, capacityName, Context.NONE) + .getValue(); + return this; + } + + public FabricCapacity refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getFabricCapacities() + .getByResourceGroupWithResponse(resourceGroupName, capacityName, context) + .getValue(); + return this; + } + + public void resume() { + serviceManager.fabricCapacities().resume(resourceGroupName, capacityName); + } + + public void resume(Context context) { + serviceManager.fabricCapacities().resume(resourceGroupName, capacityName, context); + } + + public void suspend() { + serviceManager.fabricCapacities().suspend(resourceGroupName, capacityName); + } + + public void suspend(Context context) { + serviceManager.fabricCapacities().suspend(resourceGroupName, capacityName, context); + } + + public FabricCapacityImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public FabricCapacityImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public FabricCapacityImpl withProperties(FabricCapacityProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public FabricCapacityImpl withSku(RpSku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateProperties.withSku(sku); + return this; + } + } + + public FabricCapacityImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public FabricCapacityImpl withProperties(FabricCapacityUpdateProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricClientBuilder.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricClientBuilder.java new file mode 100644 index 0000000000000..15fd7b2666871 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.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 FabricClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { FabricClientImpl.class }) +public final class FabricClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the FabricClientBuilder. + */ + public FabricClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the FabricClientBuilder. + */ + public FabricClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the FabricClientBuilder. + */ + public FabricClientBuilder 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 FabricClientBuilder. + */ + public FabricClientBuilder 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 FabricClientBuilder. + */ + public FabricClientBuilder 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 FabricClientBuilder. + */ + public FabricClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of FabricClientImpl with the provided parameters. + * + * @return an instance of FabricClientImpl. + */ + public FabricClientImpl 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(); + FabricClientImpl client = new FabricClientImpl(localPipeline, localSerializerAdapter, localDefaultPollInterval, + localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricClientImpl.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricClientImpl.java new file mode 100644 index 0000000000000..dc62ca7c9a70d --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/FabricClientImpl.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +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.PollerFactory; +import com.azure.core.management.polling.PollResult; +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.fabric.fluent.FabricCapacitiesClient; +import com.azure.resourcemanager.fabric.fluent.FabricClient; +import com.azure.resourcemanager.fabric.fluent.OperationsClient; +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 FabricClientImpl type. + */ +@ServiceClient(builder = FabricClientBuilder.class) +public final class FabricClientImpl implements FabricClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * 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 FabricCapacitiesClient object to access its operations. + */ + private final FabricCapacitiesClient fabricCapacities; + + /** + * Gets the FabricCapacitiesClient object to access its operations. + * + * @return the FabricCapacitiesClient object. + */ + public FabricCapacitiesClient getFabricCapacities() { + return this.fabricCapacities; + } + + /** + * 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; + } + + /** + * Initializes an instance of FabricClient 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 endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + FabricClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, + AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2023-11-01"; + this.fabricCapacities = new FabricCapacitiesClientImpl(this); + this.operations = new OperationsClientImpl(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(HttpHeaderName.fromString(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(FabricClientImpl.class); +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/OperationImpl.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/OperationImpl.java new file mode 100644 index 0000000000000..d4de62d2aae29 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/OperationImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.implementation; + +import com.azure.resourcemanager.fabric.fluent.models.OperationInner; +import com.azure.resourcemanager.fabric.models.ActionType; +import com.azure.resourcemanager.fabric.models.Operation; +import com.azure.resourcemanager.fabric.models.OperationDisplay; +import com.azure.resourcemanager.fabric.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.fabric.FabricManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.fabric.FabricManager 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.fabric.FabricManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/OperationsClientImpl.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..81e3a3ec9f67c --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/OperationsClientImpl.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.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.fabric.fluent.OperationsClient; +import com.azure.resourcemanager.fabric.fluent.models.OperationInner; +import com.azure.resourcemanager.fabric.implementation.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 FabricClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(FabricClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for FabricClientOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "FabricClientOperatio") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Fabric/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") 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> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list 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> listSinglePageAsync() { + 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.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list 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> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List the operations for the provider + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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> 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())); + } + + /** + * List the operations for the provider + * + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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> 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/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/OperationsImpl.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..3ca3369828a1d --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/OperationsImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.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.fabric.fluent.OperationsClient; +import com.azure.resourcemanager.fabric.fluent.models.OperationInner; +import com.azure.resourcemanager.fabric.models.Operation; +import com.azure.resourcemanager.fabric.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.fabric.FabricManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, com.azure.resourcemanager.fabric.FabricManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.fabric.FabricManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/ResourceManagerUtils.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/ResourceManagerUtils.java new file mode 100644 index 0000000000000..faaf09a437e39 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.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 ResourceManagerUtils { + private ResourceManagerUtils() { + } + + 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.isEmpty() && 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<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(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/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/RpSkuDetailsForExistingResourceImpl.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/RpSkuDetailsForExistingResourceImpl.java new file mode 100644 index 0000000000000..bc082ec34ced1 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/RpSkuDetailsForExistingResourceImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.implementation; + +import com.azure.resourcemanager.fabric.fluent.models.RpSkuDetailsForExistingResourceInner; +import com.azure.resourcemanager.fabric.models.RpSku; +import com.azure.resourcemanager.fabric.models.RpSkuDetailsForExistingResource; + +public final class RpSkuDetailsForExistingResourceImpl implements RpSkuDetailsForExistingResource { + private RpSkuDetailsForExistingResourceInner innerObject; + + private final com.azure.resourcemanager.fabric.FabricManager serviceManager; + + RpSkuDetailsForExistingResourceImpl(RpSkuDetailsForExistingResourceInner innerObject, + com.azure.resourcemanager.fabric.FabricManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String resourceType() { + return this.innerModel().resourceType(); + } + + public RpSku sku() { + return this.innerModel().sku(); + } + + public RpSkuDetailsForExistingResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.fabric.FabricManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/RpSkuDetailsForNewResourceImpl.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/RpSkuDetailsForNewResourceImpl.java new file mode 100644 index 0000000000000..7035d0a6411ae --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/RpSkuDetailsForNewResourceImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.implementation; + +import com.azure.resourcemanager.fabric.fluent.models.RpSkuDetailsForNewResourceInner; +import com.azure.resourcemanager.fabric.models.RpSkuDetailsForNewResource; +import java.util.Collections; +import java.util.List; + +public final class RpSkuDetailsForNewResourceImpl implements RpSkuDetailsForNewResource { + private RpSkuDetailsForNewResourceInner innerObject; + + private final com.azure.resourcemanager.fabric.FabricManager serviceManager; + + RpSkuDetailsForNewResourceImpl(RpSkuDetailsForNewResourceInner innerObject, + com.azure.resourcemanager.fabric.FabricManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String resourceType() { + return this.innerModel().resourceType(); + } + + public String name() { + return this.innerModel().name(); + } + + public List locations() { + List inner = this.innerModel().locations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public RpSkuDetailsForNewResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.fabric.FabricManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/models/FabricCapacityListResult.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/models/FabricCapacityListResult.java new file mode 100644 index 0000000000000..999d331df40cd --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/models/FabricCapacityListResult.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.fabric.fluent.models.FabricCapacityInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a FabricCapacity list operation. + */ +@Immutable +public final class FabricCapacityListResult implements JsonSerializable { + /* + * The FabricCapacity items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of FabricCapacityListResult class. + */ + private FabricCapacityListResult() { + } + + /** + * Get the value property: The FabricCapacity items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @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) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model FabricCapacityListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FabricCapacityListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FabricCapacityListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FabricCapacityListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FabricCapacityListResult. + */ + public static FabricCapacityListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FabricCapacityListResult deserializedFabricCapacityListResult = new FabricCapacityListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> FabricCapacityInner.fromJson(reader1)); + deserializedFabricCapacityListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedFabricCapacityListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFabricCapacityListResult; + }); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/models/OperationListResult.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/models/OperationListResult.java new file mode 100644 index 0000000000000..619afdfb1c0f7 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/models/OperationListResult.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.fabric.fluent.models.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @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) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model OperationListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperationListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/models/RpSkuEnumerationForExistingResourceResult.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/models/RpSkuEnumerationForExistingResourceResult.java new file mode 100644 index 0000000000000..00bd745d95678 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/models/RpSkuEnumerationForExistingResourceResult.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.fabric.fluent.models.RpSkuDetailsForExistingResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * An object that represents enumerating SKUs for existing resources. + */ +@Immutable +public final class RpSkuEnumerationForExistingResourceResult + implements JsonSerializable { + /* + * The SKU details + */ + private List value; + + /* + * Url for the next page. Null if no more pages available + */ + private String nextLink; + + /** + * Creates an instance of RpSkuEnumerationForExistingResourceResult class. + */ + private RpSkuEnumerationForExistingResourceResult() { + } + + /** + * Get the value property: The SKU details. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Url for the next page. Null if no more pages available. + * + * @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) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model RpSkuEnumerationForExistingResourceResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RpSkuEnumerationForExistingResourceResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RpSkuEnumerationForExistingResourceResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RpSkuEnumerationForExistingResourceResult if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RpSkuEnumerationForExistingResourceResult. + */ + public static RpSkuEnumerationForExistingResourceResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RpSkuEnumerationForExistingResourceResult deserializedRpSkuEnumerationForExistingResourceResult + = new RpSkuEnumerationForExistingResourceResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RpSkuDetailsForExistingResourceInner.fromJson(reader1)); + deserializedRpSkuEnumerationForExistingResourceResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedRpSkuEnumerationForExistingResourceResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRpSkuEnumerationForExistingResourceResult; + }); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/models/RpSkuEnumerationForNewResourceResult.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/models/RpSkuEnumerationForNewResourceResult.java new file mode 100644 index 0000000000000..262224e0303aa --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/models/RpSkuEnumerationForNewResourceResult.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.fabric.fluent.models.RpSkuDetailsForNewResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * An object that represents enumerating SKUs for new resources. + */ +@Immutable +public final class RpSkuEnumerationForNewResourceResult + implements JsonSerializable { + /* + * The collection of available SKUs for new resources + */ + private List value; + + /* + * Url for the next page. Null if no more pages available + */ + private String nextLink; + + /** + * Creates an instance of RpSkuEnumerationForNewResourceResult class. + */ + private RpSkuEnumerationForNewResourceResult() { + } + + /** + * Get the value property: The collection of available SKUs for new resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Url for the next page. Null if no more pages available. + * + * @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) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model RpSkuEnumerationForNewResourceResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RpSkuEnumerationForNewResourceResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RpSkuEnumerationForNewResourceResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RpSkuEnumerationForNewResourceResult if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RpSkuEnumerationForNewResourceResult. + */ + public static RpSkuEnumerationForNewResourceResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RpSkuEnumerationForNewResourceResult deserializedRpSkuEnumerationForNewResourceResult + = new RpSkuEnumerationForNewResourceResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RpSkuDetailsForNewResourceInner.fromJson(reader1)); + deserializedRpSkuEnumerationForNewResourceResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedRpSkuEnumerationForNewResourceResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRpSkuEnumerationForNewResourceResult; + }); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/package-info.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/package-info.java new file mode 100644 index 0000000000000..fd22d3fa8e93c --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/implementation/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for Fabric. + */ +package com.azure.resourcemanager.fabric.implementation; diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/ActionType.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/ActionType.java new file mode 100644 index 0000000000000..cf04598fbffef --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Extensible 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. + */ + 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/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/CapacityAdministration.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/CapacityAdministration.java new file mode 100644 index 0000000000000..46391bbf73846 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/CapacityAdministration.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The administration properties of the Fabric capacity resource. + */ +@Fluent +public final class CapacityAdministration implements JsonSerializable { + /* + * An array of administrator user identities. + */ + private List members; + + /** + * Creates an instance of CapacityAdministration class. + */ + public CapacityAdministration() { + } + + /** + * Get the members property: An array of administrator user identities. + * + * @return the members value. + */ + public List members() { + return this.members; + } + + /** + * Set the members property: An array of administrator user identities. + * + * @param members the members value to set. + * @return the CapacityAdministration object itself. + */ + public CapacityAdministration withMembers(List members) { + this.members = members; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (members() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property members in model CapacityAdministration")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CapacityAdministration.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("members", this.members, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CapacityAdministration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CapacityAdministration if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CapacityAdministration. + */ + public static CapacityAdministration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CapacityAdministration deserializedCapacityAdministration = new CapacityAdministration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("members".equals(fieldName)) { + List members = reader.readArray(reader1 -> reader1.getString()); + deserializedCapacityAdministration.members = members; + } else { + reader.skipChildren(); + } + } + + return deserializedCapacityAdministration; + }); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/CheckNameAvailabilityReason.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/CheckNameAvailabilityReason.java new file mode 100644 index 0000000000000..6eb3555d9b718 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/CheckNameAvailabilityReason.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Possible reasons for a name not being available. + */ +public final class CheckNameAvailabilityReason extends ExpandableStringEnum { + /** + * Static value Invalid for CheckNameAvailabilityReason. + */ + public static final CheckNameAvailabilityReason INVALID = fromString("Invalid"); + + /** + * Static value AlreadyExists for CheckNameAvailabilityReason. + */ + public static final CheckNameAvailabilityReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates a new instance of CheckNameAvailabilityReason value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CheckNameAvailabilityReason() { + } + + /** + * Creates or finds a CheckNameAvailabilityReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding CheckNameAvailabilityReason. + */ + public static CheckNameAvailabilityReason fromString(String name) { + return fromString(name, CheckNameAvailabilityReason.class); + } + + /** + * Gets known CheckNameAvailabilityReason values. + * + * @return known CheckNameAvailabilityReason values. + */ + public static Collection values() { + return values(CheckNameAvailabilityReason.class); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/CheckNameAvailabilityRequest.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/CheckNameAvailabilityRequest.java new file mode 100644 index 0000000000000..4c41f72345c5a --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/CheckNameAvailabilityRequest.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The check availability request body. + */ +@Fluent +public final class CheckNameAvailabilityRequest implements JsonSerializable { + /* + * The name of the resource for which availability needs to be checked. + */ + private String name; + + /* + * The resource type. + */ + private String type; + + /** + * Creates an instance of CheckNameAvailabilityRequest class. + */ + public CheckNameAvailabilityRequest() { + } + + /** + * Get the name property: The name of the resource for which availability needs to be checked. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the resource for which availability needs to be checked. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The resource type. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckNameAvailabilityRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckNameAvailabilityRequest if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CheckNameAvailabilityRequest. + */ + public static CheckNameAvailabilityRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckNameAvailabilityRequest deserializedCheckNameAvailabilityRequest = new CheckNameAvailabilityRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCheckNameAvailabilityRequest.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCheckNameAvailabilityRequest.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckNameAvailabilityRequest; + }); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/CheckNameAvailabilityResponse.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/CheckNameAvailabilityResponse.java new file mode 100644 index 0000000000000..eb9d43064dffa --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/CheckNameAvailabilityResponse.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.resourcemanager.fabric.fluent.models.CheckNameAvailabilityResponseInner; + +/** + * An immutable client-side representation of CheckNameAvailabilityResponse. + */ +public interface CheckNameAvailabilityResponse { + /** + * Gets the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + CheckNameAvailabilityReason reason(); + + /** + * Gets the message property: Detailed reason why the given name is not available. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.fabric.fluent.models.CheckNameAvailabilityResponseInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResponseInner innerModel(); +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacities.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacities.java new file mode 100644 index 0000000000000..d314e4d896fab --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacities.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.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 FabricCapacities. + */ +public interface FabricCapacities { + /** + * Get a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @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 FabricCapacity along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String capacityName, + Context context); + + /** + * Get a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @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 FabricCapacity. + */ + FabricCapacity getByResourceGroup(String resourceGroupName, String capacityName); + + /** + * Delete a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @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 capacityName); + + /** + * Delete a FabricCapacity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String capacityName, Context context); + + /** + * List FabricCapacity resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a FabricCapacity list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List FabricCapacity resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 response of a FabricCapacity list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List FabricCapacity resources by subscription ID. + * + * @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 response of a FabricCapacity list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List FabricCapacity resources by subscription 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 response of a FabricCapacity list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @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 resume(String resourceGroupName, String capacityName); + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void resume(String resourceGroupName, String capacityName, Context context); + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @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 suspend(String resourceGroupName, String capacityName); + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a + * maximum of 63. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void suspend(String resourceGroupName, String capacityName, Context context); + + /** + * Implements local CheckNameAvailability operations. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability request. + * @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 check availability result along with {@link Response}. + */ + Response checkNameAvailabilityWithResponse(String location, + CheckNameAvailabilityRequest body, Context context); + + /** + * Implements local CheckNameAvailability operations. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability request. + * @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 check availability result. + */ + CheckNameAvailabilityResponse checkNameAvailability(String location, CheckNameAvailabilityRequest body); + + /** + * List eligible SKUs for a Microsoft Fabric resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the capacity. + * @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 object that represents enumerating SKUs for existing resources as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listSkusForCapacity(String resourceGroupName, String capacityName); + + /** + * List eligible SKUs for a Microsoft Fabric resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param capacityName The name of the capacity. + * @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 object that represents enumerating SKUs for existing resources as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listSkusForCapacity(String resourceGroupName, String capacityName, + Context context); + + /** + * List eligible SKUs for Microsoft Fabric resource provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an object that represents enumerating SKUs for new resources as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listSkus(); + + /** + * List eligible SKUs for Microsoft Fabric resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an object that represents enumerating SKUs for new resources as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listSkus(Context context); + + /** + * Get a FabricCapacity. + * + * @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 FabricCapacity along with {@link Response}. + */ + FabricCapacity getById(String id); + + /** + * Get a FabricCapacity. + * + * @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 FabricCapacity along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a FabricCapacity. + * + * @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 FabricCapacity. + * + * @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. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new FabricCapacity resource. + * + * @param name resource name. + * @return the first stage of the new FabricCapacity definition. + */ + FabricCapacity.DefinitionStages.Blank define(String name); +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacity.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacity.java new file mode 100644 index 0000000000000..e224c1ef72113 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacity.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.fabric.fluent.models.FabricCapacityInner; +import java.util.Map; + +/** + * An immutable client-side representation of FabricCapacity. + */ +public interface FabricCapacity { + /** + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + FabricCapacityProperties properties(); + + /** + * Gets the sku property: The SKU details. + * + * @return the sku value. + */ + RpSku sku(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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.fabric.fluent.models.FabricCapacityInner object. + * + * @return the inner object. + */ + FabricCapacityInner innerModel(); + + /** + * The entirety of the FabricCapacity definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithResourceGroup, + DefinitionStages.WithProperties, DefinitionStages.WithSku, DefinitionStages.WithCreate { + } + + /** + * The FabricCapacity definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the FabricCapacity definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the FabricCapacity 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 FabricCapacity definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithProperties withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the FabricCapacity definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithSku withProperties(FabricCapacityProperties properties); + } + + /** + * The stage of the FabricCapacity definition allowing to specify sku. + */ + interface WithSku { + /** + * Specifies the sku property: The SKU details. + * + * @param sku The SKU details. + * @return the next definition stage. + */ + WithCreate withSku(RpSku sku); + } + + /** + * The stage of the FabricCapacity 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + FabricCapacity create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + FabricCapacity create(Context context); + } + + /** + * The stage of the FabricCapacity 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); + } + } + + /** + * Begins update for the FabricCapacity resource. + * + * @return the stage of resource update. + */ + FabricCapacity.Update update(); + + /** + * The template for FabricCapacity update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithSku, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + FabricCapacity apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + FabricCapacity apply(Context context); + } + + /** + * The FabricCapacity update stages. + */ + interface UpdateStages { + /** + * The stage of the FabricCapacity update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the FabricCapacity update allowing to specify sku. + */ + interface WithSku { + /** + * Specifies the sku property: The SKU details. + * + * @param sku The SKU details. + * @return the next definition stage. + */ + Update withSku(RpSku sku); + } + + /** + * The stage of the FabricCapacity update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(FabricCapacityUpdateProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + FabricCapacity refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + FabricCapacity refresh(Context context); + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @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 resume(); + + /** + * Resume operation of the specified Fabric capacity instance. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void resume(Context context); + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @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 suspend(); + + /** + * Suspend operation of the specified Fabric capacity instance. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void suspend(Context context); +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacityProperties.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacityProperties.java new file mode 100644 index 0000000000000..759596d7e077d --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacityProperties.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Microsoft Fabric capacity properties. + */ +@Fluent +public final class FabricCapacityProperties implements JsonSerializable { + /* + * The current deployment state of Microsoft Fabric resource. The provisioningState is to indicate states for + * resource provisioning. + */ + private ProvisioningState provisioningState; + + /* + * The current state of Microsoft Fabric resource. The state is to indicate more states outside of resource + * provisioning. + */ + private ResourceState state; + + /* + * The capacity administration + */ + private CapacityAdministration administration; + + /** + * Creates an instance of FabricCapacityProperties class. + */ + public FabricCapacityProperties() { + } + + /** + * Get the provisioningState property: The current deployment state of Microsoft Fabric resource. The + * provisioningState is to indicate states for resource provisioning. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the state property: The current state of Microsoft Fabric resource. The state is to indicate more states + * outside of resource provisioning. + * + * @return the state value. + */ + public ResourceState state() { + return this.state; + } + + /** + * Get the administration property: The capacity administration. + * + * @return the administration value. + */ + public CapacityAdministration administration() { + return this.administration; + } + + /** + * Set the administration property: The capacity administration. + * + * @param administration the administration value to set. + * @return the FabricCapacityProperties object itself. + */ + public FabricCapacityProperties withAdministration(CapacityAdministration administration) { + this.administration = administration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (administration() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property administration in model FabricCapacityProperties")); + } else { + administration().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FabricCapacityProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("administration", this.administration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FabricCapacityProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FabricCapacityProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FabricCapacityProperties. + */ + public static FabricCapacityProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FabricCapacityProperties deserializedFabricCapacityProperties = new FabricCapacityProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("administration".equals(fieldName)) { + deserializedFabricCapacityProperties.administration = CapacityAdministration.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedFabricCapacityProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("state".equals(fieldName)) { + deserializedFabricCapacityProperties.state = ResourceState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedFabricCapacityProperties; + }); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacityUpdate.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacityUpdate.java new file mode 100644 index 0000000000000..974febd7cd8ae --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacityUpdate.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The type used for update operations of the FabricCapacity. + */ +@Fluent +public final class FabricCapacityUpdate implements JsonSerializable { + /* + * The SKU details + */ + private RpSku sku; + + /* + * Resource tags. + */ + private Map tags; + + /* + * The resource-specific properties for this resource. + */ + private FabricCapacityUpdateProperties properties; + + /** + * Creates an instance of FabricCapacityUpdate class. + */ + public FabricCapacityUpdate() { + } + + /** + * Get the sku property: The SKU details. + * + * @return the sku value. + */ + public RpSku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU details. + * + * @param sku the sku value to set. + * @return the FabricCapacityUpdate object itself. + */ + public FabricCapacityUpdate withSku(RpSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the FabricCapacityUpdate object itself. + */ + public FabricCapacityUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public FabricCapacityUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the FabricCapacityUpdate object itself. + */ + public FabricCapacityUpdate withProperties(FabricCapacityUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("sku", this.sku); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FabricCapacityUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FabricCapacityUpdate if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the FabricCapacityUpdate. + */ + public static FabricCapacityUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FabricCapacityUpdate deserializedFabricCapacityUpdate = new FabricCapacityUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sku".equals(fieldName)) { + deserializedFabricCapacityUpdate.sku = RpSku.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedFabricCapacityUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedFabricCapacityUpdate.properties = FabricCapacityUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFabricCapacityUpdate; + }); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacityUpdateProperties.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacityUpdateProperties.java new file mode 100644 index 0000000000000..6ed1486465820 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/FabricCapacityUpdateProperties.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The updatable properties of the FabricCapacity. + */ +@Fluent +public final class FabricCapacityUpdateProperties implements JsonSerializable { + /* + * The capacity administration + */ + private CapacityAdministration administration; + + /** + * Creates an instance of FabricCapacityUpdateProperties class. + */ + public FabricCapacityUpdateProperties() { + } + + /** + * Get the administration property: The capacity administration. + * + * @return the administration value. + */ + public CapacityAdministration administration() { + return this.administration; + } + + /** + * Set the administration property: The capacity administration. + * + * @param administration the administration value to set. + * @return the FabricCapacityUpdateProperties object itself. + */ + public FabricCapacityUpdateProperties withAdministration(CapacityAdministration administration) { + this.administration = administration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (administration() != null) { + administration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("administration", this.administration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FabricCapacityUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FabricCapacityUpdateProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the FabricCapacityUpdateProperties. + */ + public static FabricCapacityUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FabricCapacityUpdateProperties deserializedFabricCapacityUpdateProperties + = new FabricCapacityUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("administration".equals(fieldName)) { + deserializedFabricCapacityUpdateProperties.administration = CapacityAdministration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFabricCapacityUpdateProperties; + }); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/Operation.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/Operation.java new file mode 100644 index 0000000000000..0002137b8dee5 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.resourcemanager.fabric.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 Azure Resource Manager/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: Extensible 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.fabric.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/OperationDisplay.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/OperationDisplay.java new file mode 100644 index 0000000000000..4d04d0a178b21 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for and operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + private 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/Operations.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/Operations.java new file mode 100644 index 0000000000000..92c60dae9bc5b --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/Origin.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/Origin.java new file mode 100644 index 0000000000000..ba9af76cbe821 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.core.util.ExpandableStringEnum; +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. + */ + 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/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/ProvisioningState.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/ProvisioningState.java new file mode 100644 index 0000000000000..fd2d906e72653 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/ProvisioningState.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of the Fabric capacity resource. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Static value Succeeded for ProvisioningState. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ProvisioningState. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for ProvisioningState. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Static value Deleting for ProvisioningState. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Provisioning for ProvisioningState. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * Static value Updating for ProvisioningState. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/ResourceState.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/ResourceState.java new file mode 100644 index 0000000000000..eb34b933b1fe1 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/ResourceState.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The state of the Fabric capacity resource. + */ +public final class ResourceState extends ExpandableStringEnum { + /** + * Static value Active for ResourceState. + */ + public static final ResourceState ACTIVE = fromString("Active"); + + /** + * Static value Provisioning for ResourceState. + */ + public static final ResourceState PROVISIONING = fromString("Provisioning"); + + /** + * Static value Failed for ResourceState. + */ + public static final ResourceState FAILED = fromString("Failed"); + + /** + * Static value Updating for ResourceState. + */ + public static final ResourceState UPDATING = fromString("Updating"); + + /** + * Static value Deleting for ResourceState. + */ + public static final ResourceState DELETING = fromString("Deleting"); + + /** + * Static value Suspending for ResourceState. + */ + public static final ResourceState SUSPENDING = fromString("Suspending"); + + /** + * Static value Suspended for ResourceState. + */ + public static final ResourceState SUSPENDED = fromString("Suspended"); + + /** + * Static value Pausing for ResourceState. + */ + public static final ResourceState PAUSING = fromString("Pausing"); + + /** + * Static value Paused for ResourceState. + */ + public static final ResourceState PAUSED = fromString("Paused"); + + /** + * Static value Resuming for ResourceState. + */ + public static final ResourceState RESUMING = fromString("Resuming"); + + /** + * Static value Scaling for ResourceState. + */ + public static final ResourceState SCALING = fromString("Scaling"); + + /** + * Static value Preparing for ResourceState. + */ + public static final ResourceState PREPARING = fromString("Preparing"); + + /** + * Creates a new instance of ResourceState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ResourceState() { + } + + /** + * Creates or finds a ResourceState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceState. + */ + public static ResourceState fromString(String name) { + return fromString(name, ResourceState.class); + } + + /** + * Gets known ResourceState values. + * + * @return known ResourceState values. + */ + public static Collection values() { + return values(ResourceState.class); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/RpSku.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/RpSku.java new file mode 100644 index 0000000000000..5af1bd192719a --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/RpSku.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Represents the SKU name and Azure pricing tier for Microsoft Fabric capacity resource. + */ +@Fluent +public final class RpSku implements JsonSerializable { + /* + * The name of the SKU level. + */ + private String name; + + /* + * The name of the Azure pricing tier to which the SKU applies. + */ + private RpSkuTier tier; + + /** + * Creates an instance of RpSku class. + */ + public RpSku() { + } + + /** + * Get the name property: The name of the SKU level. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the SKU level. + * + * @param name the name value to set. + * @return the RpSku object itself. + */ + public RpSku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: The name of the Azure pricing tier to which the SKU applies. + * + * @return the tier value. + */ + public RpSkuTier tier() { + return this.tier; + } + + /** + * Set the tier property: The name of the Azure pricing tier to which the SKU applies. + * + * @param tier the tier value to set. + * @return the RpSku object itself. + */ + public RpSku withTier(RpSkuTier tier) { + this.tier = tier; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property name in model RpSku")); + } + if (tier() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property tier in model RpSku")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RpSku.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("tier", this.tier == null ? null : this.tier.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RpSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RpSku if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RpSku. + */ + public static RpSku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RpSku deserializedRpSku = new RpSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedRpSku.name = reader.getString(); + } else if ("tier".equals(fieldName)) { + deserializedRpSku.tier = RpSkuTier.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedRpSku; + }); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/RpSkuDetailsForExistingResource.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/RpSkuDetailsForExistingResource.java new file mode 100644 index 0000000000000..1601f0b5203f6 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/RpSkuDetailsForExistingResource.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.resourcemanager.fabric.fluent.models.RpSkuDetailsForExistingResourceInner; + +/** + * An immutable client-side representation of RpSkuDetailsForExistingResource. + */ +public interface RpSkuDetailsForExistingResource { + /** + * Gets the resourceType property: The resource type. + * + * @return the resourceType value. + */ + String resourceType(); + + /** + * Gets the sku property: The SKU details. + * + * @return the sku value. + */ + RpSku sku(); + + /** + * Gets the inner com.azure.resourcemanager.fabric.fluent.models.RpSkuDetailsForExistingResourceInner object. + * + * @return the inner object. + */ + RpSkuDetailsForExistingResourceInner innerModel(); +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/RpSkuDetailsForNewResource.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/RpSkuDetailsForNewResource.java new file mode 100644 index 0000000000000..261bd312a63c2 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/RpSkuDetailsForNewResource.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.resourcemanager.fabric.fluent.models.RpSkuDetailsForNewResourceInner; +import java.util.List; + +/** + * An immutable client-side representation of RpSkuDetailsForNewResource. + */ +public interface RpSkuDetailsForNewResource { + /** + * Gets the resourceType property: The resource type. + * + * @return the resourceType value. + */ + String resourceType(); + + /** + * Gets the name property: The SKU's name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the locations property: The list of available locations for the SKU. + * + * @return the locations value. + */ + List locations(); + + /** + * Gets the inner com.azure.resourcemanager.fabric.fluent.models.RpSkuDetailsForNewResourceInner object. + * + * @return the inner object. + */ + RpSkuDetailsForNewResourceInner innerModel(); +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/RpSkuTier.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/RpSkuTier.java new file mode 100644 index 0000000000000..30d29726564a2 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/RpSkuTier.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The name of the Azure pricing tier to which the SKU applies. + */ +public final class RpSkuTier extends ExpandableStringEnum { + /** + * Static value Fabric for RpSkuTier. + */ + public static final RpSkuTier FABRIC = fromString("Fabric"); + + /** + * Creates a new instance of RpSkuTier value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RpSkuTier() { + } + + /** + * Creates or finds a RpSkuTier from its string representation. + * + * @param name a name to look for. + * @return the corresponding RpSkuTier. + */ + public static RpSkuTier fromString(String name) { + return fromString(name, RpSkuTier.class); + } + + /** + * Gets known RpSkuTier values. + * + * @return known RpSkuTier values. + */ + public static Collection values() { + return values(RpSkuTier.class); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/package-info.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/package-info.java new file mode 100644 index 0000000000000..166ea2f62a432 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/models/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for Fabric. + */ +package com.azure.resourcemanager.fabric.models; diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/package-info.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/package-info.java new file mode 100644 index 0000000000000..88065c5805895 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/com/azure/resourcemanager/fabric/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for Fabric. + */ +package com.azure.resourcemanager.fabric; diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/java/module-info.java b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/module-info.java new file mode 100644 index 0000000000000..36964ed9b03f0 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/java/module-info.java @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.resourcemanager.fabric { + requires transitive com.azure.core.management; + exports com.azure.resourcemanager.fabric; + exports com.azure.resourcemanager.fabric.fluent; + exports com.azure.resourcemanager.fabric.fluent.models; + exports com.azure.resourcemanager.fabric.models; + opens com.azure.resourcemanager.fabric.fluent.models to com.azure.core; + opens com.azure.resourcemanager.fabric.models to com.azure.core; + opens com.azure.resourcemanager.fabric.implementation.models to com.azure.core; +} \ No newline at end of file diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-fabric/proxy-config.json b/sdk/fabric/azure-resourcemanager-fabric/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-fabric/proxy-config.json new file mode 100644 index 0000000000000..acd23787d0f3d --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-fabric/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.fabric.implementation.FabricCapacitiesClientImpl$FabricCapacitiesService"],["com.azure.resourcemanager.fabric.implementation.OperationsClientImpl$OperationsService"]] \ No newline at end of file diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-fabric/reflect-config.json b/sdk/fabric/azure-resourcemanager-fabric/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-fabric/reflect-config.json new file mode 100644 index 0000000000000..0637a088a01e8 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-fabric/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesCheckNameAvailabilitySamples.java b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesCheckNameAvailabilitySamples.java new file mode 100644 index 0000000000000..fd152c5d60507 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesCheckNameAvailabilitySamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.resourcemanager.fabric.models.CheckNameAvailabilityRequest; + +/** + * Samples for FabricCapacities CheckNameAvailability. + */ +public final class FabricCapacitiesCheckNameAvailabilitySamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_CheckNameAvailability.json + */ + /** + * Sample code: Check name availability of a capacity. + * + * @param manager Entry point to FabricManager. + */ + public static void checkNameAvailabilityOfACapacity(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities() + .checkNameAvailabilityWithResponse("westcentralus", + new CheckNameAvailabilityRequest().withName("azsdktest").withType("Microsoft.Fabric/capacities"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesCreateOrUpdateSamples.java b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..cc1ff69e1635c --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesCreateOrUpdateSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.resourcemanager.fabric.models.CapacityAdministration; +import com.azure.resourcemanager.fabric.models.FabricCapacityProperties; +import com.azure.resourcemanager.fabric.models.RpSku; +import com.azure.resourcemanager.fabric.models.RpSkuTier; +import java.util.Arrays; + +/** + * Samples for FabricCapacities CreateOrUpdate. + */ +public final class FabricCapacitiesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_CreateOrUpdate.json + */ + /** + * Sample code: Create or update a capacity. + * + * @param manager Entry point to FabricManager. + */ + public static void createOrUpdateACapacity(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities() + .define("azsdktest") + .withRegion("westcentralus") + .withExistingResourceGroup("TestRG") + .withProperties(new FabricCapacityProperties().withAdministration(new CapacityAdministration() + .withMembers(Arrays.asList("azsdktest@microsoft.com", "azsdktest2@microsoft.com")))) + .withSku(new RpSku().withName("F2").withTier(RpSkuTier.FABRIC)) + .create(); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesDeleteSamples.java b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesDeleteSamples.java new file mode 100644 index 0000000000000..5aa75c97b8499 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +/** + * Samples for FabricCapacities Delete. + */ +public final class FabricCapacitiesDeleteSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_Delete.json + */ + /** + * Sample code: Delete a capacity. + * + * @param manager Entry point to FabricManager. + */ + public static void deleteACapacity(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities().delete("TestRG", "azsdktest", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesGetByResourceGroupSamples.java b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..e225417a6ec5a --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +/** + * Samples for FabricCapacities GetByResourceGroup. + */ +public final class FabricCapacitiesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_Get.json + */ + /** + * Sample code: Get a capacity. + * + * @param manager Entry point to FabricManager. + */ + public static void getACapacity(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities() + .getByResourceGroupWithResponse("TestRG", "azsdktest", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListByResourceGroupSamples.java b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..f987c72285c03 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +/** + * Samples for FabricCapacities ListByResourceGroup. + */ +public final class FabricCapacitiesListByResourceGroupSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_ListByResourceGroup.json + */ + /** + * Sample code: List capacities by resource group. + * + * @param manager Entry point to FabricManager. + */ + public static void listCapacitiesByResourceGroup(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities().listByResourceGroup("TestRG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSamples.java b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSamples.java new file mode 100644 index 0000000000000..3bf1cbd31e5a0 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +/** + * Samples for FabricCapacities List. + */ +public final class FabricCapacitiesListSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_ListBySubscription.json + */ + /** + * Sample code: List capacities by subscription. + * + * @param manager Entry point to FabricManager. + */ + public static void listCapacitiesBySubscription(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSkusForCapacitySamples.java b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSkusForCapacitySamples.java new file mode 100644 index 0000000000000..7c01fbc8cc8b6 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSkusForCapacitySamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +/** + * Samples for FabricCapacities ListSkusForCapacity. + */ +public final class FabricCapacitiesListSkusForCapacitySamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_ListSkusForCapacity.json + */ + /** + * Sample code: List eligible SKUs for an existing capacity. + * + * @param manager Entry point to FabricManager. + */ + public static void listEligibleSKUsForAnExistingCapacity(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities().listSkusForCapacity("TestRG", "azsdktest", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSkusSamples.java b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSkusSamples.java new file mode 100644 index 0000000000000..5bfc607aed8da --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSkusSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +/** + * Samples for FabricCapacities ListSkus. + */ +public final class FabricCapacitiesListSkusSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_ListSkus.json + */ + /** + * Sample code: List eligible SKUs for a new capacity. + * + * @param manager Entry point to FabricManager. + */ + public static void listEligibleSKUsForANewCapacity(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities().listSkus(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesResumeSamples.java b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesResumeSamples.java new file mode 100644 index 0000000000000..fc73f5981d834 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesResumeSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +/** + * Samples for FabricCapacities Resume. + */ +public final class FabricCapacitiesResumeSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_Resume.json + */ + /** + * Sample code: Resume capacity. + * + * @param manager Entry point to FabricManager. + */ + public static void resumeCapacity(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities().resume("TestRG", "azsdktest", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesSuspendSamples.java b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesSuspendSamples.java new file mode 100644 index 0000000000000..4a3d17f226510 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesSuspendSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +/** + * Samples for FabricCapacities Suspend. + */ +public final class FabricCapacitiesSuspendSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_Suspend.json + */ + /** + * Sample code: Suspend capacity. + * + * @param manager Entry point to FabricManager. + */ + public static void suspendCapacity(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.fabricCapacities().suspend("TestRG", "azsdktest", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesUpdateSamples.java b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesUpdateSamples.java new file mode 100644 index 0000000000000..827d1766478f0 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesUpdateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.resourcemanager.fabric.models.CapacityAdministration; +import com.azure.resourcemanager.fabric.models.FabricCapacity; +import com.azure.resourcemanager.fabric.models.FabricCapacityUpdateProperties; +import com.azure.resourcemanager.fabric.models.RpSku; +import com.azure.resourcemanager.fabric.models.RpSkuTier; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for FabricCapacities Update. + */ +public final class FabricCapacitiesUpdateSamples { + /* + * x-ms-original-file: 2023-11-01/FabricCapacities_Update.json + */ + /** + * Sample code: Update capacity properties. + * + * @param manager Entry point to FabricManager. + */ + public static void updateCapacityProperties(com.azure.resourcemanager.fabric.FabricManager manager) { + FabricCapacity resource = manager.fabricCapacities() + .getByResourceGroupWithResponse("TestRG", "azsdktest", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("testKey", "fakeTokenPlaceholder")) + .withSku(new RpSku().withName("F8").withTier(RpSkuTier.FABRIC)) + .withProperties(new FabricCapacityUpdateProperties().withAdministration( + new CapacityAdministration().withMembers(Arrays.asList("azsdktest2@microsoft.com")))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/OperationsListSamples.java b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..2926e0ff459c1 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/samples/java/com/azure/resourcemanager/fabric/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2023-11-01/Operations_List.json + */ + /** + * Sample code: List operations. + * + * @param manager Entry point to FabricManager. + */ + public static void listOperations(com.azure.resourcemanager.fabric.FabricManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/CapacityAdministrationTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/CapacityAdministrationTests.java new file mode 100644 index 0000000000000..2a5a6a127a29d --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/CapacityAdministrationTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.fabric.models.CapacityAdministration; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class CapacityAdministrationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CapacityAdministration model = BinaryData.fromString("{\"members\":[\"jywif\",\"qes\",\"agdfmglzlh\"]}") + .toObject(CapacityAdministration.class); + Assertions.assertEquals("jywif", model.members().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CapacityAdministration model + = new CapacityAdministration().withMembers(Arrays.asList("jywif", "qes", "agdfmglzlh")); + model = BinaryData.fromObject(model).toObject(CapacityAdministration.class); + Assertions.assertEquals("jywif", model.members().get(0)); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/CheckNameAvailabilityRequestTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/CheckNameAvailabilityRequestTests.java new file mode 100644 index 0000000000000..9d03d57dc9fbf --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/CheckNameAvailabilityRequestTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.fabric.models.CheckNameAvailabilityRequest; +import org.junit.jupiter.api.Assertions; + +public final class CheckNameAvailabilityRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CheckNameAvailabilityRequest model = BinaryData.fromString("{\"name\":\"xgispemvtzfkufu\",\"type\":\"jofxqe\"}") + .toObject(CheckNameAvailabilityRequest.class); + Assertions.assertEquals("xgispemvtzfkufu", model.name()); + Assertions.assertEquals("jofxqe", model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CheckNameAvailabilityRequest model + = new CheckNameAvailabilityRequest().withName("xgispemvtzfkufu").withType("jofxqe"); + model = BinaryData.fromObject(model).toObject(CheckNameAvailabilityRequest.class); + Assertions.assertEquals("xgispemvtzfkufu", model.name()); + Assertions.assertEquals("jofxqe", model.type()); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/CheckNameAvailabilityResponseInnerTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/CheckNameAvailabilityResponseInnerTests.java new file mode 100644 index 0000000000000..7a15181cf5d62 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/CheckNameAvailabilityResponseInnerTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.fabric.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.fabric.models.CheckNameAvailabilityReason; +import org.junit.jupiter.api.Assertions; + +public final class CheckNameAvailabilityResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CheckNameAvailabilityResponseInner model + = BinaryData.fromString("{\"nameAvailable\":false,\"reason\":\"Invalid\",\"message\":\"jhqjbasvmsmjqul\"}") + .toObject(CheckNameAvailabilityResponseInner.class); + Assertions.assertEquals(false, model.nameAvailable()); + Assertions.assertEquals(CheckNameAvailabilityReason.INVALID, model.reason()); + Assertions.assertEquals("jhqjbasvmsmjqul", model.message()); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesCheckNameAvailabilityWithResponseMockTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesCheckNameAvailabilityWithResponseMockTests.java new file mode 100644 index 0000000000000..92791cf66ce24 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesCheckNameAvailabilityWithResponseMockTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.fabric.FabricManager; +import com.azure.resourcemanager.fabric.models.CheckNameAvailabilityReason; +import com.azure.resourcemanager.fabric.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.fabric.models.CheckNameAvailabilityResponse; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FabricCapacitiesCheckNameAvailabilityWithResponseMockTests { + @Test + public void testCheckNameAvailabilityWithResponse() throws Exception { + String responseStr = "{\"nameAvailable\":false,\"reason\":\"Invalid\",\"message\":\"uhrzayvvt\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + FabricManager manager = FabricManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + CheckNameAvailabilityResponse response = manager.fabricCapacities() + .checkNameAvailabilityWithResponse("wpyeicxmqciwqvh", + new CheckNameAvailabilityRequest().withName("ixuigdtopbobj").withType("hm"), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(false, response.nameAvailable()); + Assertions.assertEquals(CheckNameAvailabilityReason.INVALID, response.reason()); + Assertions.assertEquals("uhrzayvvt", response.message()); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesCreateOrUpdateMockTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesCreateOrUpdateMockTests.java new file mode 100644 index 0000000000000..619b5a48ecf97 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesCreateOrUpdateMockTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.fabric.FabricManager; +import com.azure.resourcemanager.fabric.models.CapacityAdministration; +import com.azure.resourcemanager.fabric.models.FabricCapacity; +import com.azure.resourcemanager.fabric.models.FabricCapacityProperties; +import com.azure.resourcemanager.fabric.models.RpSku; +import com.azure.resourcemanager.fabric.models.RpSkuTier; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FabricCapacitiesCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"state\":\"Resuming\",\"administration\":{\"members\":[\"xhejjzzvdud\",\"wdslfhotwmcy\",\"pwlbjnpg\"]}},\"sku\":{\"name\":\"cftadeh\",\"tier\":\"Fabric\"},\"location\":\"tyfsoppusuesn\",\"tags\":{\"avo\":\"ej\",\"vudwx\":\"xzdmohctb\"},\"id\":\"ndnvo\",\"name\":\"gujjugwdkcglh\",\"type\":\"lazjdyggdtjixhbk\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + FabricManager manager = FabricManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + FabricCapacity response = manager.fabricCapacities() + .define("fsxlzevgbmqjqa") + .withRegion("c") + .withExistingResourceGroup("ocpecfvmmco") + .withProperties(new FabricCapacityProperties().withAdministration(new CapacityAdministration() + .withMembers(Arrays.asList("vkwlzuvccfwnf", "bacfionlebxetq", "tzxdpnqbqqwx", "jfeallnwsub")))) + .withSku(new RpSku().withName("snjampmng").withTier(RpSkuTier.FABRIC)) + .withTags(mapOf("cbonqvpk", "wooc", "f", "lrxnjeaseiphe", "dlwtgrhpdj", "okeyyienj")) + .create(); + + Assertions.assertEquals("tyfsoppusuesn", response.location()); + Assertions.assertEquals("ej", response.tags().get("avo")); + Assertions.assertEquals("xhejjzzvdud", response.properties().administration().members().get(0)); + Assertions.assertEquals("cftadeh", response.sku().name()); + Assertions.assertEquals(RpSkuTier.FABRIC, response.sku().tier()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesGetByResourceGroupWithResponseMockTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 0000000000000..b267542156c8e --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.fabric.FabricManager; +import com.azure.resourcemanager.fabric.models.FabricCapacity; +import com.azure.resourcemanager.fabric.models.RpSkuTier; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FabricCapacitiesGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Updating\",\"state\":\"Active\",\"administration\":{\"members\":[\"h\",\"oosflnr\",\"sfqpteehz\",\"vypyqrimzinpv\"]}},\"sku\":{\"name\":\"wjdk\",\"tier\":\"Fabric\"},\"location\":\"oodqxhcrm\",\"tags\":{\"fiyipjxsqwpgrj\":\"jtckwhdso\",\"vsnb\":\"znorcj\"},\"id\":\"xqabnmocpcysh\",\"name\":\"rzafbljjgpbtoqcj\",\"type\":\"klj\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + FabricManager manager = FabricManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + FabricCapacity response = manager.fabricCapacities() + .getByResourceGroupWithResponse("cs", "ewmdw", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("oodqxhcrm", response.location()); + Assertions.assertEquals("jtckwhdso", response.tags().get("fiyipjxsqwpgrj")); + Assertions.assertEquals("h", response.properties().administration().members().get(0)); + Assertions.assertEquals("wjdk", response.sku().name()); + Assertions.assertEquals(RpSkuTier.FABRIC, response.sku().tier()); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListByResourceGroupMockTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListByResourceGroupMockTests.java new file mode 100644 index 0000000000000..82895f9936905 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListByResourceGroupMockTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.fabric.FabricManager; +import com.azure.resourcemanager.fabric.models.FabricCapacity; +import com.azure.resourcemanager.fabric.models.RpSkuTier; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FabricCapacitiesListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"state\":\"Updating\",\"administration\":{\"members\":[\"ulpkudjkrl\",\"hbzhfepg\",\"gqexzlocxs\"]}},\"sku\":{\"name\":\"paierh\",\"tier\":\"Fabric\"},\"location\":\"sglumma\",\"tags\":{\"nbdxk\":\"aodxo\"},\"id\":\"pxokajionp\",\"name\":\"mexgstxgcp\",\"type\":\"dg\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + FabricManager manager = FabricManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.fabricCapacities().listByResourceGroup("vbqid", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("sglumma", response.iterator().next().location()); + Assertions.assertEquals("aodxo", response.iterator().next().tags().get("nbdxk")); + Assertions.assertEquals("ulpkudjkrl", + response.iterator().next().properties().administration().members().get(0)); + Assertions.assertEquals("paierh", response.iterator().next().sku().name()); + Assertions.assertEquals(RpSkuTier.FABRIC, response.iterator().next().sku().tier()); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListMockTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListMockTests.java new file mode 100644 index 0000000000000..38f6bbf85cead --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListMockTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.fabric.FabricManager; +import com.azure.resourcemanager.fabric.models.FabricCapacity; +import com.azure.resourcemanager.fabric.models.RpSkuTier; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FabricCapacitiesListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Provisioning\",\"state\":\"Preparing\",\"administration\":{\"members\":[\"vdjwzrlovm\",\"lwhijcoejctbzaq\",\"qsycbkbfkgu\"]}},\"sku\":{\"name\":\"dkexxppofm\",\"tier\":\"Fabric\"},\"location\":\"c\",\"tags\":{\"xhvpmoue\":\"gddtocj\"},\"id\":\"hd\",\"name\":\"xibqeojnx\",\"type\":\"bzv\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + FabricManager manager = FabricManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.fabricCapacities().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("c", response.iterator().next().location()); + Assertions.assertEquals("gddtocj", response.iterator().next().tags().get("xhvpmoue")); + Assertions.assertEquals("vdjwzrlovm", + response.iterator().next().properties().administration().members().get(0)); + Assertions.assertEquals("dkexxppofm", response.iterator().next().sku().name()); + Assertions.assertEquals(RpSkuTier.FABRIC, response.iterator().next().sku().tier()); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSkusForCapacityMockTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSkusForCapacityMockTests.java new file mode 100644 index 0000000000000..aa606c288fd62 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSkusForCapacityMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.fabric.FabricManager; +import com.azure.resourcemanager.fabric.models.RpSkuDetailsForExistingResource; +import com.azure.resourcemanager.fabric.models.RpSkuTier; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FabricCapacitiesListSkusForCapacityMockTests { + @Test + public void testListSkusForCapacity() throws Exception { + String responseStr + = "{\"value\":[{\"resourceType\":\"xlefgugnxkrx\",\"sku\":{\"name\":\"qmi\",\"tier\":\"Fabric\"}}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + FabricManager manager = FabricManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.fabricCapacities().listSkusForCapacity("gvdfgiotkftutq", "ln", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("xlefgugnxkrx", response.iterator().next().resourceType()); + Assertions.assertEquals("qmi", response.iterator().next().sku().name()); + Assertions.assertEquals(RpSkuTier.FABRIC, response.iterator().next().sku().tier()); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSkusMockTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSkusMockTests.java new file mode 100644 index 0000000000000..78ff0ea407b00 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesListSkusMockTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.fabric.FabricManager; +import com.azure.resourcemanager.fabric.models.RpSkuDetailsForNewResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FabricCapacitiesListSkusMockTests { + @Test + public void testListSkus() throws Exception { + String responseStr + = "{\"value\":[{\"resourceType\":\"thz\",\"name\":\"vqdra\",\"locations\":[\"jybige\",\"oqfbowskanyk\",\"zlcuiywgqywgndrv\",\"nhzgpphrcgyn\"]}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + FabricManager manager = FabricManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.fabricCapacities().listSkus(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("thz", response.iterator().next().resourceType()); + Assertions.assertEquals("vqdra", response.iterator().next().name()); + Assertions.assertEquals("jybige", response.iterator().next().locations().get(0)); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesResumeMockTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesResumeMockTests.java new file mode 100644 index 0000000000000..48af94563aae8 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesResumeMockTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.fabric.FabricManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FabricCapacitiesResumeMockTests { + @Test + public void testResume() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + FabricManager manager = FabricManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.fabricCapacities().resume("dntwndeicbtw", "pzaoqvuhr", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesSuspendMockTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesSuspendMockTests.java new file mode 100644 index 0000000000000..7bcf31fad81bf --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacitiesSuspendMockTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.fabric.FabricManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FabricCapacitiesSuspendMockTests { + @Test + public void testSuspend() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + FabricManager manager = FabricManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.fabricCapacities().suspend("cffcyddglmj", "hjq", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityInnerTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityInnerTests.java new file mode 100644 index 0000000000000..07bcec03cddb5 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityInnerTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.fabric.fluent.models.FabricCapacityInner; +import com.azure.resourcemanager.fabric.models.CapacityAdministration; +import com.azure.resourcemanager.fabric.models.FabricCapacityProperties; +import com.azure.resourcemanager.fabric.models.RpSku; +import com.azure.resourcemanager.fabric.models.RpSkuTier; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class FabricCapacityInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FabricCapacityInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Canceled\",\"state\":\"Provisioning\",\"administration\":{\"members\":[\"vgjxpybczm\"]}},\"sku\":{\"name\":\"hmtzopbsphrup\",\"tier\":\"Fabric\"},\"location\":\"sybbejhph\",\"tags\":{\"bmtqioq\":\"msxaobhd\",\"p\":\"zehtbmu\",\"hwlrx\":\"wnoi\"},\"id\":\"bqsoqijg\",\"name\":\"dmbpazlobcufpdz\",\"type\":\"rbt\"}") + .toObject(FabricCapacityInner.class); + Assertions.assertEquals("sybbejhph", model.location()); + Assertions.assertEquals("msxaobhd", model.tags().get("bmtqioq")); + Assertions.assertEquals("vgjxpybczm", model.properties().administration().members().get(0)); + Assertions.assertEquals("hmtzopbsphrup", model.sku().name()); + Assertions.assertEquals(RpSkuTier.FABRIC, model.sku().tier()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FabricCapacityInner model = new FabricCapacityInner().withLocation("sybbejhph") + .withTags(mapOf("bmtqioq", "msxaobhd", "p", "zehtbmu", "hwlrx", "wnoi")) + .withProperties(new FabricCapacityProperties() + .withAdministration(new CapacityAdministration().withMembers(Arrays.asList("vgjxpybczm")))) + .withSku(new RpSku().withName("hmtzopbsphrup").withTier(RpSkuTier.FABRIC)); + model = BinaryData.fromObject(model).toObject(FabricCapacityInner.class); + Assertions.assertEquals("sybbejhph", model.location()); + Assertions.assertEquals("msxaobhd", model.tags().get("bmtqioq")); + Assertions.assertEquals("vgjxpybczm", model.properties().administration().members().get(0)); + Assertions.assertEquals("hmtzopbsphrup", model.sku().name()); + Assertions.assertEquals(RpSkuTier.FABRIC, model.sku().tier()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityListResultTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityListResultTests.java new file mode 100644 index 0000000000000..85e5101016a39 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityListResultTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.fabric.implementation.models.FabricCapacityListResult; +import com.azure.resourcemanager.fabric.models.RpSkuTier; +import org.junit.jupiter.api.Assertions; + +public final class FabricCapacityListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FabricCapacityListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\",\"state\":\"Suspending\",\"administration\":{\"members\":[\"ukcdmparcryuanzw\",\"xzdxtayrlhmwh\",\"pmrqobm\"]}},\"sku\":{\"name\":\"u\",\"tier\":\"Fabric\"},\"location\":\"ryrtihfxtijbpzv\",\"tags\":{\"ihanuf\":\"zsymglzufcyzkohd\",\"ifpikxwczby\":\"fcbjysagithxqha\",\"rkxvdum\":\"cnpqxuhivyqniwby\"},\"id\":\"grtfwvu\",\"name\":\"xgaudccs\",\"type\":\"h\"},{\"properties\":{\"provisioningState\":\"Updating\",\"state\":\"Updating\",\"administration\":{\"members\":[\"j\",\"kryhtnapczwlokj\"]}},\"sku\":{\"name\":\"emkkvnipjox\",\"tier\":\"Fabric\"},\"location\":\"chgejspodm\",\"tags\":{\"o\":\"zyde\",\"wixjsprozvcp\":\"wyahuxinpmqnja\",\"atscmd\":\"tegjvwmf\",\"zkrwfn\":\"pjhulsuuvmkj\"},\"id\":\"iodjp\",\"name\":\"lwejdpv\",\"type\":\"ryo\"},{\"properties\":{\"provisioningState\":\"Updating\",\"state\":\"Scaling\",\"administration\":{\"members\":[\"ctazakljlahbcryf\",\"dfdosygexp\",\"ojakhmsbzjhcrze\",\"dphlxaolt\"]}},\"sku\":{\"name\":\"qtrgqjbpfzfsinzg\",\"tier\":\"Fabric\"},\"location\":\"jrwzox\",\"tags\":{\"fpjkjlxofp\":\"felluwfzitonpe\",\"uybbkpodep\":\"vhpfxxypininmay\"},\"id\":\"oginuvamiheognar\",\"name\":\"zxtheotusivyevcc\",\"type\":\"qi\"}],\"nextLink\":\"hungbwjzrnf\"}") + .toObject(FabricCapacityListResult.class); + Assertions.assertEquals("ryrtihfxtijbpzv", model.value().get(0).location()); + Assertions.assertEquals("zsymglzufcyzkohd", model.value().get(0).tags().get("ihanuf")); + Assertions.assertEquals("ukcdmparcryuanzw", + model.value().get(0).properties().administration().members().get(0)); + Assertions.assertEquals("u", model.value().get(0).sku().name()); + Assertions.assertEquals(RpSkuTier.FABRIC, model.value().get(0).sku().tier()); + Assertions.assertEquals("hungbwjzrnf", model.nextLink()); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityPropertiesTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityPropertiesTests.java new file mode 100644 index 0000000000000..29623940b7ac2 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityPropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.fabric.models.CapacityAdministration; +import com.azure.resourcemanager.fabric.models.FabricCapacityProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class FabricCapacityPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FabricCapacityProperties model = BinaryData.fromString( + "{\"provisioningState\":\"Provisioning\",\"state\":\"Resuming\",\"administration\":{\"members\":[\"glhqg\",\"ufo\"]}}") + .toObject(FabricCapacityProperties.class); + Assertions.assertEquals("glhqg", model.administration().members().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FabricCapacityProperties model = new FabricCapacityProperties() + .withAdministration(new CapacityAdministration().withMembers(Arrays.asList("glhqg", "ufo"))); + model = BinaryData.fromObject(model).toObject(FabricCapacityProperties.class); + Assertions.assertEquals("glhqg", model.administration().members().get(0)); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityUpdatePropertiesTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityUpdatePropertiesTests.java new file mode 100644 index 0000000000000..8f448ec235fbf --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityUpdatePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.fabric.models.CapacityAdministration; +import com.azure.resourcemanager.fabric.models.FabricCapacityUpdateProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class FabricCapacityUpdatePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FabricCapacityUpdateProperties model + = BinaryData.fromString("{\"administration\":{\"members\":[\"flusarhmof\",\"qhsmyurkdtml\",\"he\"]}}") + .toObject(FabricCapacityUpdateProperties.class); + Assertions.assertEquals("flusarhmof", model.administration().members().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FabricCapacityUpdateProperties model = new FabricCapacityUpdateProperties().withAdministration( + new CapacityAdministration().withMembers(Arrays.asList("flusarhmof", "qhsmyurkdtml", "he"))); + model = BinaryData.fromObject(model).toObject(FabricCapacityUpdateProperties.class); + Assertions.assertEquals("flusarhmof", model.administration().members().get(0)); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityUpdateTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityUpdateTests.java new file mode 100644 index 0000000000000..e0d2e6e1724d0 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/FabricCapacityUpdateTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.fabric.models.CapacityAdministration; +import com.azure.resourcemanager.fabric.models.FabricCapacityUpdate; +import com.azure.resourcemanager.fabric.models.FabricCapacityUpdateProperties; +import com.azure.resourcemanager.fabric.models.RpSku; +import com.azure.resourcemanager.fabric.models.RpSkuTier; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class FabricCapacityUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FabricCapacityUpdate model = BinaryData.fromString( + "{\"sku\":{\"name\":\"to\",\"tier\":\"Fabric\"},\"tags\":{\"kfo\":\"ouajpsqucmpoyf\"},\"properties\":{\"administration\":{\"members\":[\"gjofjd\",\"eqsrdeupewnwreit\"]}}}") + .toObject(FabricCapacityUpdate.class); + Assertions.assertEquals("to", model.sku().name()); + Assertions.assertEquals(RpSkuTier.FABRIC, model.sku().tier()); + Assertions.assertEquals("ouajpsqucmpoyf", model.tags().get("kfo")); + Assertions.assertEquals("gjofjd", model.properties().administration().members().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FabricCapacityUpdate model + = new FabricCapacityUpdate().withSku(new RpSku().withName("to").withTier(RpSkuTier.FABRIC)) + .withTags(mapOf("kfo", "ouajpsqucmpoyf")) + .withProperties(new FabricCapacityUpdateProperties().withAdministration( + new CapacityAdministration().withMembers(Arrays.asList("gjofjd", "eqsrdeupewnwreit")))); + model = BinaryData.fromObject(model).toObject(FabricCapacityUpdate.class); + Assertions.assertEquals("to", model.sku().name()); + Assertions.assertEquals(RpSkuTier.FABRIC, model.sku().tier()); + Assertions.assertEquals("ouajpsqucmpoyf", model.tags().get("kfo")); + Assertions.assertEquals("gjofjd", model.properties().administration().members().get(0)); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/OperationDisplayTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/OperationDisplayTests.java new file mode 100644 index 0000000000000..c3d150e963ad8 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/OperationDisplayTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.fabric.models.OperationDisplay; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = BinaryData.fromString( + "{\"provider\":\"isdkfthwxmnteiw\",\"resource\":\"pvkmijcmmxdcuf\",\"operation\":\"srp\",\"description\":\"zidnsezcxtbzsgfy\"}") + .toObject(OperationDisplay.class); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/OperationInnerTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/OperationInnerTests.java new file mode 100644 index 0000000000000..690f45e9741b8 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/OperationInnerTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.fabric.fluent.models.OperationInner; +import com.azure.resourcemanager.fabric.models.ActionType; +import org.junit.jupiter.api.Assertions; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = BinaryData.fromString( + "{\"name\":\"uhmuouqfprwzwbn\",\"isDataAction\":true,\"display\":{\"provider\":\"wu\",\"resource\":\"gazxuf\",\"operation\":\"uckyf\",\"description\":\"rfidfvzwdz\"},\"origin\":\"system\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); + Assertions.assertEquals(ActionType.INTERNAL, model.actionType()); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/OperationListResultTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/OperationListResultTests.java new file mode 100644 index 0000000000000..55511d200d49f --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/OperationListResultTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.fabric.implementation.models.OperationListResult; +import com.azure.resourcemanager.fabric.models.ActionType; +import org.junit.jupiter.api.Assertions; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = BinaryData.fromString( + "{\"value\":[{\"name\":\"ktapspwgcuertu\",\"isDataAction\":true,\"display\":{\"provider\":\"vqwhbmdgbbjfd\",\"resource\":\"mbmbexppbh\",\"operation\":\"qrolfpf\",\"description\":\"algbquxigjyjg\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"hr\",\"isDataAction\":true,\"display\":{\"provider\":\"erkujys\",\"resource\":\"eju\",\"operation\":\"qawrlyxwj\",\"description\":\"prbnwbxgjvtbv\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}],\"nextLink\":\"nruj\"}") + .toObject(OperationListResult.class); + Assertions.assertEquals(ActionType.INTERNAL, model.value().get(0).actionType()); + Assertions.assertEquals("nruj", model.nextLink()); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/OperationsListMockTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/OperationsListMockTests.java new file mode 100644 index 0000000000000..b34b669970830 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/OperationsListMockTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.fabric.FabricManager; +import com.azure.resourcemanager.fabric.models.ActionType; +import com.azure.resourcemanager.fabric.models.Operation; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"name\":\"fqweykhmene\",\"isDataAction\":false,\"display\":{\"provider\":\"fwhybcibvy\",\"resource\":\"c\",\"operation\":\"tynnaamdectehfi\",\"description\":\"cj\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + FabricManager manager = FabricManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals(ActionType.INTERNAL, response.iterator().next().actionType()); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuDetailsForExistingResourceInnerTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuDetailsForExistingResourceInnerTests.java new file mode 100644 index 0000000000000..2a1b34aa7b5d9 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuDetailsForExistingResourceInnerTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.fabric.fluent.models.RpSkuDetailsForExistingResourceInner; +import com.azure.resourcemanager.fabric.models.RpSkuTier; +import org.junit.jupiter.api.Assertions; + +public final class RpSkuDetailsForExistingResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RpSkuDetailsForExistingResourceInner model = BinaryData + .fromString("{\"resourceType\":\"yqduujit\",\"sku\":{\"name\":\"jczdzevndh\",\"tier\":\"Fabric\"}}") + .toObject(RpSkuDetailsForExistingResourceInner.class); + Assertions.assertEquals("yqduujit", model.resourceType()); + Assertions.assertEquals("jczdzevndh", model.sku().name()); + Assertions.assertEquals(RpSkuTier.FABRIC, model.sku().tier()); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuDetailsForNewResourceInnerTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuDetailsForNewResourceInnerTests.java new file mode 100644 index 0000000000000..e80eb90b8b4c0 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuDetailsForNewResourceInnerTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.fabric.fluent.models.RpSkuDetailsForNewResourceInner; +import org.junit.jupiter.api.Assertions; + +public final class RpSkuDetailsForNewResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RpSkuDetailsForNewResourceInner model = BinaryData.fromString( + "{\"resourceType\":\"gakeqsr\",\"name\":\"yb\",\"locations\":[\"qedqytbciqfoufl\",\"mnkzsmod\",\"glougpbk\",\"tmut\"]}") + .toObject(RpSkuDetailsForNewResourceInner.class); + Assertions.assertEquals("gakeqsr", model.resourceType()); + Assertions.assertEquals("yb", model.name()); + Assertions.assertEquals("qedqytbciqfoufl", model.locations().get(0)); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuEnumerationForExistingResourceResultTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuEnumerationForExistingResourceResultTests.java new file mode 100644 index 0000000000000..f3eea86b6ccb7 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuEnumerationForExistingResourceResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.fabric.implementation.models.RpSkuEnumerationForExistingResourceResult; +import com.azure.resourcemanager.fabric.models.RpSkuTier; +import org.junit.jupiter.api.Assertions; + +public final class RpSkuEnumerationForExistingResourceResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RpSkuEnumerationForExistingResourceResult model = BinaryData.fromString( + "{\"value\":[{\"resourceType\":\"sntnbybkzgcw\",\"sku\":{\"name\":\"wclxxwrl\",\"tier\":\"Fabric\"}},{\"resourceType\":\"ouskcqvkocrc\",\"sku\":{\"name\":\"dkwt\",\"tier\":\"Fabric\"}},{\"resourceType\":\"xbnjbiksq\",\"sku\":{\"name\":\"gls\",\"tier\":\"Fabric\"}},{\"resourceType\":\"inqpjwnzll\",\"sku\":{\"name\":\"fmppe\",\"tier\":\"Fabric\"}}],\"nextLink\":\"mgxsab\"}") + .toObject(RpSkuEnumerationForExistingResourceResult.class); + Assertions.assertEquals("sntnbybkzgcw", model.value().get(0).resourceType()); + Assertions.assertEquals("wclxxwrl", model.value().get(0).sku().name()); + Assertions.assertEquals(RpSkuTier.FABRIC, model.value().get(0).sku().tier()); + Assertions.assertEquals("mgxsab", model.nextLink()); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuEnumerationForNewResourceResultTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuEnumerationForNewResourceResultTests.java new file mode 100644 index 0000000000000..81dacd182bea6 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuEnumerationForNewResourceResultTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.fabric.implementation.models.RpSkuEnumerationForNewResourceResult; +import org.junit.jupiter.api.Assertions; + +public final class RpSkuEnumerationForNewResourceResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RpSkuEnumerationForNewResourceResult model = BinaryData.fromString( + "{\"value\":[{\"resourceType\":\"pdappds\",\"name\":\"dkvwrwjfe\",\"locations\":[\"nhutjeltmrldhugj\"]},{\"resourceType\":\"zdatqxhocdg\",\"name\":\"ablgphuticndvk\",\"locations\":[\"zwyiftyhxhur\",\"k\",\"tyxolniwpwc\",\"kjfkg\"]},{\"resourceType\":\"awxklr\",\"name\":\"plwckbas\",\"locations\":[\"pnddhsgcbacphejk\",\"tynqgoul\",\"ndlik\"]}],\"nextLink\":\"qkgfgibma\"}") + .toObject(RpSkuEnumerationForNewResourceResult.class); + Assertions.assertEquals("pdappds", model.value().get(0).resourceType()); + Assertions.assertEquals("dkvwrwjfe", model.value().get(0).name()); + Assertions.assertEquals("nhutjeltmrldhugj", model.value().get(0).locations().get(0)); + Assertions.assertEquals("qkgfgibma", model.nextLink()); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuTests.java b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuTests.java new file mode 100644 index 0000000000000..e62e41169f326 --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/src/test/java/com/azure/resourcemanager/fabric/generated/RpSkuTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.fabric.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.fabric.models.RpSku; +import com.azure.resourcemanager.fabric.models.RpSkuTier; +import org.junit.jupiter.api.Assertions; + +public final class RpSkuTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RpSku model = BinaryData.fromString("{\"name\":\"xrifkwmrvkts\",\"tier\":\"Fabric\"}").toObject(RpSku.class); + Assertions.assertEquals("xrifkwmrvkts", model.name()); + Assertions.assertEquals(RpSkuTier.FABRIC, model.tier()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RpSku model = new RpSku().withName("xrifkwmrvkts").withTier(RpSkuTier.FABRIC); + model = BinaryData.fromObject(model).toObject(RpSku.class); + Assertions.assertEquals("xrifkwmrvkts", model.name()); + Assertions.assertEquals(RpSkuTier.FABRIC, model.tier()); + } +} diff --git a/sdk/fabric/azure-resourcemanager-fabric/tsp-location.yaml b/sdk/fabric/azure-resourcemanager-fabric/tsp-location.yaml new file mode 100644 index 0000000000000..973b0de82e26d --- /dev/null +++ b/sdk/fabric/azure-resourcemanager-fabric/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/fabric/Microsoft.Fabric.Management +commit: 46b386376ab0d53228a7f366d28e44bac8d592c3 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/fabric/ci.yml b/sdk/fabric/ci.yml new file mode 100644 index 0000000000000..e689ddcad0a6b --- /dev/null +++ b/sdk/fabric/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/fabric/ci.yml + - sdk/fabric/azure-resourcemanager-fabric/ + exclude: + - sdk/fabric/pom.xml + - sdk/fabric/azure-resourcemanager-fabric/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/fabric/ci.yml + - sdk/fabric/azure-resourcemanager-fabric/ + exclude: + - sdk/fabric/pom.xml + - sdk/fabric/azure-resourcemanager-fabric/pom.xml + +parameters: + - name: release_azureresourcemanagerfabric + displayName: azure-resourcemanager-fabric + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: fabric + Artifacts: + - name: azure-resourcemanager-fabric + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerfabric + releaseInBatch: ${{ parameters.release_azureresourcemanagerfabric }} diff --git a/sdk/fabric/pom.xml b/sdk/fabric/pom.xml new file mode 100644 index 0000000000000..16648e24c07e6 --- /dev/null +++ b/sdk/fabric/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-fabric-service + pom + 1.0.0 + + + azure-resourcemanager-fabric + + From f662c1c7785e8c8d1f993227863610210859183d Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Fri, 20 Sep 2024 05:56:11 +0000 Subject: [PATCH 2/3] [Automation] Generate Fluent Lite from TypeSpec fabric --- sdk/fabric/azure-resourcemanager-fabric/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/fabric/azure-resourcemanager-fabric/CHANGELOG.md b/sdk/fabric/azure-resourcemanager-fabric/CHANGELOG.md index ecf4edd592cb3..2c5612185d889 100644 --- a/sdk/fabric/azure-resourcemanager-fabric/CHANGELOG.md +++ b/sdk/fabric/azure-resourcemanager-fabric/CHANGELOG.md @@ -3,3 +3,7 @@ ## 1.0.0-beta.1 (2024-09-20) - Azure Resource Manager Fabric client library for Java. This package contains Microsoft Azure SDK for Fabric Management SDK. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +### Features Added + +- Initial release for the azure-resourcemanager-fabric Java SDK. From a9f78addca56a6b6355e0a39cdf69bf1f3bd51a1 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Mon, 23 Sep 2024 10:33:34 +0800 Subject: [PATCH 3/3] Update CHANGELOG.md --- sdk/fabric/azure-resourcemanager-fabric/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/fabric/azure-resourcemanager-fabric/CHANGELOG.md b/sdk/fabric/azure-resourcemanager-fabric/CHANGELOG.md index 2c5612185d889..f74397d72626a 100644 --- a/sdk/fabric/azure-resourcemanager-fabric/CHANGELOG.md +++ b/sdk/fabric/azure-resourcemanager-fabric/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.1 (2024-09-20) +## 1.0.0-beta.1 (2024-09-23) - Azure Resource Manager Fabric client library for Java. This package contains Microsoft Azure SDK for Fabric Management SDK. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).