From fc9a14924bb4a266f86c94ee7eeb07b94f2e3741 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 6 Nov 2025 18:44:56 +0000 Subject: [PATCH 1/3] Configurations: 'specification/computelimit/resource-manager/Microsoft.ComputeLimit/ComputeLimit/tspconfig.yaml', API Version: 2025-08-15, SDK Release Type: stable, and CommitSHA: '257777bd5dd2cec7c658f4517b030ae4d65e0812' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5543510 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 8 + .../README.md | 102 ++++ .../SAMPLE.md | 227 ++++++++ .../pom.xml | 73 +++ .../computelimit/ComputeLimitManager.java | 314 ++++++++++ .../fluent/ComputeLimitClient.java | 69 +++ .../fluent/GuestSubscriptionsClient.java | 125 ++++ .../computelimit/fluent/OperationsClient.java | 40 ++ .../fluent/SharedLimitsClient.java | 126 +++++ .../fluent/models/GuestSubscriptionInner.java | 155 +++++ .../fluent/models/OperationInner.java | 150 +++++ .../fluent/models/SharedLimitInner.java | 155 +++++ .../fluent/models/package-info.java | 9 + .../computelimit/fluent/package-info.java | 9 + .../ComputeLimitClientBuilder.java | 138 +++++ .../ComputeLimitClientImpl.java | 340 +++++++++++ .../implementation/GuestSubscriptionImpl.java | 103 ++++ .../GuestSubscriptionsClientImpl.java | 534 ++++++++++++++++++ .../GuestSubscriptionsImpl.java | 137 +++++ .../implementation/OperationImpl.java | 51 ++ .../implementation/OperationsClientImpl.java | 242 ++++++++ .../implementation/OperationsImpl.java | 45 ++ .../implementation/ResourceManagerUtils.java | 195 +++++++ .../implementation/SharedLimitImpl.java | 99 ++++ .../SharedLimitsClientImpl.java | 527 +++++++++++++++++ .../implementation/SharedLimitsImpl.java | 135 +++++ .../models/GuestSubscriptionListResult.java | 96 ++++ .../models/OperationListResult.java | 96 ++++ .../models/SharedLimitListResult.java | 95 ++++ .../implementation/package-info.java | 9 + .../computelimit/models/ActionType.java | 46 ++ .../models/GuestSubscription.java | 136 +++++ .../models/GuestSubscriptionProperties.java | 74 +++ .../models/GuestSubscriptions.java | 139 +++++ .../computelimit/models/LimitName.java | 91 +++ .../computelimit/models/Operation.java | 58 ++ .../computelimit/models/OperationDisplay.java | 128 +++++ .../computelimit/models/Operations.java | 35 ++ .../computelimit/models/Origin.java | 57 ++ .../models/ResourceProvisioningState.java | 56 ++ .../computelimit/models/SharedLimit.java | 136 +++++ .../models/SharedLimitProperties.java | 122 ++++ .../computelimit/models/SharedLimits.java | 142 +++++ .../computelimit/models/package-info.java | 9 + .../computelimit/package-info.java | 9 + .../src/main/java/module-info.java | 16 + ...nager-computelimit_apiview_properties.json | 38 ++ ...resourcemanager-computelimit_metadata.json | 1 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + ...re-resourcemanager-computelimit.properties | 1 + .../GuestSubscriptionsCreateSamples.java | 28 + .../GuestSubscriptionsDeleteSamples.java | 24 + .../GuestSubscriptionsGetSamples.java | 23 + ...BySubscriptionLocationResourceSamples.java | 23 + .../generated/OperationsListSamples.java | 22 + .../generated/SharedLimitsCreateSamples.java | 28 + .../generated/SharedLimitsDeleteSamples.java | 23 + .../generated/SharedLimitsGetSamples.java | 22 + ...BySubscriptionLocationResourceSamples.java | 23 + .../GuestSubscriptionInnerTests.java | 24 + .../GuestSubscriptionListResultTests.java | 19 + .../GuestSubscriptionPropertiesTests.java | 22 + ...scriptionsCreateWithResponseMockTests.java | 40 ++ ...eByResourceGroupWithResponseMockTests.java | 34 ++ ...SubscriptionsGetWithResponseMockTests.java | 37 ++ ...SubscriptionLocationResourceMockTests.java | 37 ++ .../generated/LimitNameTests.java | 18 + .../generated/OperationDisplayTests.java | 17 + .../generated/OperationInnerTests.java | 17 + .../generated/OperationListResultTests.java | 19 + .../generated/OperationsListMockTests.java | 36 ++ .../generated/SharedLimitInnerTests.java | 24 + .../generated/SharedLimitListResultTests.java | 19 + .../generated/SharedLimitPropertiesTests.java | 23 + ...aredLimitsCreateWithResponseMockTests.java | 40 ++ ...eByResourceGroupWithResponseMockTests.java | 33 ++ .../SharedLimitsGetWithResponseMockTests.java | 36 ++ ...SubscriptionLocationResourceMockTests.java | 37 ++ .../tsp-location.yaml | 4 + sdk/computelimit/ci.yml | 46 ++ sdk/computelimit/pom.xml | 15 + 84 files changed, 6515 insertions(+) create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/CHANGELOG.md create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/README.md create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/SAMPLE.md create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/pom.xml create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/ComputeLimitManager.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/ComputeLimitClient.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/GuestSubscriptionsClient.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/OperationsClient.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/SharedLimitsClient.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/models/GuestSubscriptionInner.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/models/OperationInner.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/models/SharedLimitInner.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/models/package-info.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/package-info.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/ComputeLimitClientBuilder.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/ComputeLimitClientImpl.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/GuestSubscriptionImpl.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/GuestSubscriptionsClientImpl.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/GuestSubscriptionsImpl.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/OperationImpl.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/OperationsClientImpl.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/OperationsImpl.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/ResourceManagerUtils.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/SharedLimitImpl.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/SharedLimitsClientImpl.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/SharedLimitsImpl.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/models/GuestSubscriptionListResult.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/models/OperationListResult.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/models/SharedLimitListResult.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/package-info.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/ActionType.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/GuestSubscription.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/GuestSubscriptionProperties.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/GuestSubscriptions.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/LimitName.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/Operation.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/OperationDisplay.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/Operations.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/Origin.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/ResourceProvisioningState.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/SharedLimit.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/SharedLimitProperties.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/SharedLimits.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/package-info.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/package-info.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/module-info.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/META-INF/azure-resourcemanager-computelimit_apiview_properties.json create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/META-INF/azure-resourcemanager-computelimit_metadata.json create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-computelimit/proxy-config.json create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-computelimit/reflect-config.json create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/azure-resourcemanager-computelimit.properties create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsCreateSamples.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsDeleteSamples.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsGetSamples.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsListBySubscriptionLocationResourceSamples.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/OperationsListSamples.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsCreateSamples.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsDeleteSamples.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsGetSamples.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsListBySubscriptionLocationResourceSamples.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionInnerTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionListResultTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionPropertiesTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsCreateWithResponseMockTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsDeleteByResourceGroupWithResponseMockTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsGetWithResponseMockTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsListBySubscriptionLocationResourceMockTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/LimitNameTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/OperationDisplayTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/OperationInnerTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/OperationListResultTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/OperationsListMockTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitInnerTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitListResultTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitPropertiesTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsCreateWithResponseMockTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsDeleteByResourceGroupWithResponseMockTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsGetWithResponseMockTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsListBySubscriptionLocationResourceMockTests.java create mode 100644 sdk/computelimit/azure-resourcemanager-computelimit/tsp-location.yaml create mode 100644 sdk/computelimit/ci.yml create mode 100644 sdk/computelimit/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 0dbc96b65d27..5b506700b0ed 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -512,6 +512,7 @@ com.azure.resourcemanager:azure-resourcemanager-azurestackhci-vm;1.0.0-beta.1;1. com.azure.resourcemanager:azure-resourcemanager-workloadorchestration;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-disconnectedoperations;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-compute-recommender;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-computelimit;1.0.0;1.0.0 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 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.2;2.0.0-beta.2 diff --git a/pom.xml b/pom.xml index 05e3cac5cadb..8c702d55c621 100644 --- a/pom.xml +++ b/pom.xml @@ -52,6 +52,7 @@ sdk/communication sdk/compute sdk/computefleet + sdk/computelimit sdk/computeschedule sdk/confidentialledger sdk/confluent diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/CHANGELOG.md b/sdk/computelimit/azure-resourcemanager-computelimit/CHANGELOG.md new file mode 100644 index 000000000000..28667282bd87 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0 (2025-11-06) + +- Azure Resource Manager ComputeLimit client library for Java. This package contains Microsoft Azure SDK for ComputeLimit Management SDK. Microsoft Azure Compute Limit Resource Provider. Package api-version 2025-08-15. 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-computelimit Java SDK. diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/README.md b/sdk/computelimit/azure-resourcemanager-computelimit/README.md new file mode 100644 index 000000000000..08a4f012120f --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager ComputeLimit client library for Java + +Azure Resource Manager ComputeLimit client library for Java. + +This package contains Microsoft Azure SDK for ComputeLimit Management SDK. Microsoft Azure Compute Limit Resource Provider. Package api-version 2025-08-15. 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-computelimit;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-computelimit + 1.0.0 + +``` +[//]: # ({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(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ComputeLimitManager manager = ComputeLimitManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` 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/computelimit/azure-resourcemanager-computelimit/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/ diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/SAMPLE.md b/sdk/computelimit/azure-resourcemanager-computelimit/SAMPLE.md new file mode 100644 index 000000000000..ab824a3708d1 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/SAMPLE.md @@ -0,0 +1,227 @@ +# Code snippets and samples + + +## GuestSubscriptions + +- [Create](#guestsubscriptions_create) +- [Delete](#guestsubscriptions_delete) +- [Get](#guestsubscriptions_get) +- [ListBySubscriptionLocationResource](#guestsubscriptions_listbysubscriptionlocationresource) + +## Operations + +- [List](#operations_list) + +## SharedLimits + +- [Create](#sharedlimits_create) +- [Delete](#sharedlimits_delete) +- [Get](#sharedlimits_get) +- [ListBySubscriptionLocationResource](#sharedlimits_listbysubscriptionlocationresource) +### GuestSubscriptions_Create + +```java +import com.azure.resourcemanager.computelimit.models.GuestSubscriptionProperties; + +/** + * Samples for GuestSubscriptions Create. + */ +public final class GuestSubscriptionsCreateSamples { + /* + * x-ms-original-file: 2025-08-15/GuestSubscriptions_Create.json + */ + /** + * Sample code: Create a guest subscription. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void createAGuestSubscription(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.guestSubscriptions() + .define("11111111-1111-1111-1111-111111111111") + .withExistingLocation("eastus") + .withProperties(new GuestSubscriptionProperties()) + .create(); + } +} +``` + +### GuestSubscriptions_Delete + +```java +/** + * Samples for GuestSubscriptions Delete. + */ +public final class GuestSubscriptionsDeleteSamples { + /* + * x-ms-original-file: 2025-08-15/GuestSubscriptions_Delete.json + */ + /** + * Sample code: Delete a guest subscription. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void deleteAGuestSubscription(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.guestSubscriptions() + .deleteByResourceGroupWithResponse("eastus", "11111111-1111-1111-1111-111111111111", + com.azure.core.util.Context.NONE); + } +} +``` + +### GuestSubscriptions_Get + +```java +/** + * Samples for GuestSubscriptions Get. + */ +public final class GuestSubscriptionsGetSamples { + /* + * x-ms-original-file: 2025-08-15/GuestSubscriptions_Get.json + */ + /** + * Sample code: Get a guest subscription. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void getAGuestSubscription(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.guestSubscriptions() + .getWithResponse("eastus", "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); + } +} +``` + +### GuestSubscriptions_ListBySubscriptionLocationResource + +```java +/** + * Samples for GuestSubscriptions ListBySubscriptionLocationResource. + */ +public final class GuestSubscriptionsListBySubscriptionLocationResourceSamples { + /* + * x-ms-original-file: 2025-08-15/GuestSubscriptions_List.json + */ + /** + * Sample code: List guest subscriptions for a scope. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void + listGuestSubscriptionsForAScope(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.guestSubscriptions().listBySubscriptionLocationResource("eastus", com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-08-15/Operations_List.json + */ + /** + * Sample code: List operations. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void listOperations(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### SharedLimits_Create + +```java +import com.azure.resourcemanager.computelimit.models.SharedLimitProperties; + +/** + * Samples for SharedLimits Create. + */ +public final class SharedLimitsCreateSamples { + /* + * x-ms-original-file: 2025-08-15/SharedLimits_Create.json + */ + /** + * Sample code: Create a shared limit. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void createASharedLimit(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.sharedLimits() + .define("StandardDSv3Family") + .withExistingLocation("eastus") + .withProperties(new SharedLimitProperties()) + .create(); + } +} +``` + +### SharedLimits_Delete + +```java +/** + * Samples for SharedLimits Delete. + */ +public final class SharedLimitsDeleteSamples { + /* + * x-ms-original-file: 2025-08-15/SharedLimits_Delete.json + */ + /** + * Sample code: Delete a shared limit. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void deleteASharedLimit(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.sharedLimits() + .deleteByResourceGroupWithResponse("eastus", "StandardDSv3Family", com.azure.core.util.Context.NONE); + } +} +``` + +### SharedLimits_Get + +```java +/** + * Samples for SharedLimits Get. + */ +public final class SharedLimitsGetSamples { + /* + * x-ms-original-file: 2025-08-15/SharedLimits_Get.json + */ + /** + * Sample code: Get a shared limit. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void getASharedLimit(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.sharedLimits().getWithResponse("eastus", "StandardDSv3Family", com.azure.core.util.Context.NONE); + } +} +``` + +### SharedLimits_ListBySubscriptionLocationResource + +```java +/** + * Samples for SharedLimits ListBySubscriptionLocationResource. + */ +public final class SharedLimitsListBySubscriptionLocationResourceSamples { + /* + * x-ms-original-file: 2025-08-15/SharedLimits_List.json + */ + /** + * Sample code: List all shared limits for a scope. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void + listAllSharedLimitsForAScope(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.sharedLimits().listBySubscriptionLocationResource("eastus", com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/pom.xml b/sdk/computelimit/azure-resourcemanager-computelimit/pom.xml new file mode 100644 index 000000000000..fc438c4bb3cb --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/pom.xml @@ -0,0 +1,73 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-computelimit + 1.0.0 + jar + + Microsoft Azure SDK for ComputeLimit Management + This package contains Microsoft Azure SDK for ComputeLimit Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft Azure Compute Limit Resource Provider. Package api-version 2025-08-15. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + + + + com.azure + azure-core + 1.57.0 + + + com.azure + azure-core-management + 1.19.2 + + + com.azure + azure-core-test + 1.27.0-beta.13 + test + + + com.azure + azure-identity + 1.18.1 + test + + + diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/ComputeLimitManager.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/ComputeLimitManager.java new file mode 100644 index 000000000000..b77ac1d00a54 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/ComputeLimitManager.java @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit; + +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.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.computelimit.fluent.ComputeLimitClient; +import com.azure.resourcemanager.computelimit.implementation.ComputeLimitClientBuilder; +import com.azure.resourcemanager.computelimit.implementation.GuestSubscriptionsImpl; +import com.azure.resourcemanager.computelimit.implementation.OperationsImpl; +import com.azure.resourcemanager.computelimit.implementation.SharedLimitsImpl; +import com.azure.resourcemanager.computelimit.models.GuestSubscriptions; +import com.azure.resourcemanager.computelimit.models.Operations; +import com.azure.resourcemanager.computelimit.models.SharedLimits; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to ComputeLimitManager. + * Microsoft Azure Compute Limit Resource Provider. + */ +public final class ComputeLimitManager { + private Operations operations; + + private GuestSubscriptions guestSubscriptions; + + private SharedLimits sharedLimits; + + private final ComputeLimitClient clientObject; + + private ComputeLimitManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new ComputeLimitClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of ComputeLimit service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ComputeLimit service API instance. + */ + public static ComputeLimitManager 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 ComputeLimit service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the ComputeLimit service API instance. + */ + public static ComputeLimitManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ComputeLimitManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ComputeLimitManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ComputeLimitManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-computelimit.properties"); + + 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 ComputeLimit service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ComputeLimit service API instance. + */ + public ComputeLimitManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.computelimit") + .append("/") + .append(clientVersion); + 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 BearerTokenAuthenticationPolicy(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 ComputeLimitManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of GuestSubscriptions. It manages GuestSubscription. + * + * @return Resource collection API of GuestSubscriptions. + */ + public GuestSubscriptions guestSubscriptions() { + if (this.guestSubscriptions == null) { + this.guestSubscriptions = new GuestSubscriptionsImpl(clientObject.getGuestSubscriptions(), this); + } + return guestSubscriptions; + } + + /** + * Gets the resource collection API of SharedLimits. It manages SharedLimit. + * + * @return Resource collection API of SharedLimits. + */ + public SharedLimits sharedLimits() { + if (this.sharedLimits == null) { + this.sharedLimits = new SharedLimitsImpl(clientObject.getSharedLimits(), this); + } + return sharedLimits; + } + + /** + * Gets wrapped service client ComputeLimitClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client ComputeLimitClient. + */ + public ComputeLimitClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/ComputeLimitClient.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/ComputeLimitClient.java new file mode 100644 index 000000000000..bcfdb86405c1 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/ComputeLimitClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for ComputeLimitClient class. + */ +public interface ComputeLimitClient { + /** + * 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 OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the GuestSubscriptionsClient object to access its operations. + * + * @return the GuestSubscriptionsClient object. + */ + GuestSubscriptionsClient getGuestSubscriptions(); + + /** + * Gets the SharedLimitsClient object to access its operations. + * + * @return the SharedLimitsClient object. + */ + SharedLimitsClient getSharedLimits(); +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/GuestSubscriptionsClient.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/GuestSubscriptionsClient.java new file mode 100644 index 000000000000..56dd1dbf30f5 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/GuestSubscriptionsClient.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.computelimit.fluent.models.GuestSubscriptionInner; + +/** + * An instance of this class provides access to all the operations defined in GuestSubscriptionsClient. + */ +public interface GuestSubscriptionsClient { + /** + * Gets the properties of a guest subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @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 properties of a guest subscription along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String location, String guestSubscriptionId, Context context); + + /** + * Gets the properties of a guest subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @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 properties of a guest subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GuestSubscriptionInner get(String location, String guestSubscriptionId); + + /** + * Adds a subscription as a guest to consume the compute limits shared by the host subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @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 guest subscription that consumes shared compute limits along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String location, String guestSubscriptionId, + GuestSubscriptionInner resource, Context context); + + /** + * Adds a subscription as a guest to consume the compute limits shared by the host subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @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 guest subscription that consumes shared compute limits. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GuestSubscriptionInner create(String location, String guestSubscriptionId, GuestSubscriptionInner resource); + + /** + * Deletes a subscription as a guest to stop consuming the compute limits shared by the host subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String location, String guestSubscriptionId, Context context); + + /** + * Deletes a subscription as a guest to stop consuming the compute limits shared by the host subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @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 location, String guestSubscriptionId); + + /** + * Lists all guest subscriptions in a location. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GuestSubscription list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscriptionLocationResource(String location); + + /** + * Lists all guest subscriptions in a location. + * + * @param location The name of the Azure region. + * @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 GuestSubscription list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscriptionLocationResource(String location, Context context); +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/OperationsClient.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/OperationsClient.java new file mode 100644 index 000000000000..a4504249dbc3 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/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.computelimit.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.computelimit.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/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/SharedLimitsClient.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/SharedLimitsClient.java new file mode 100644 index 000000000000..1f3288498033 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/SharedLimitsClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.computelimit.fluent.models.SharedLimitInner; + +/** + * An instance of this class provides access to all the operations defined in SharedLimitsClient. + */ +public interface SharedLimitsClient { + /** + * Gets the properties of a compute limit shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @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 properties of a compute limit shared by the host subscription with its guest subscriptions along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String location, String name, Context context); + + /** + * Gets the properties of a compute limit shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @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 properties of a compute limit shared by the host subscription with its guest subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharedLimitInner get(String location, String name); + + /** + * Enables sharing of a compute limit by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @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 compute limits shared by the subscription along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String location, String name, SharedLimitInner resource, + Context context); + + /** + * Enables sharing of a compute limit by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @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 compute limits shared by the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SharedLimitInner create(String location, String name, SharedLimitInner resource); + + /** + * Disables sharing of a compute limit by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String location, String name, Context context); + + /** + * Disables sharing of a compute limit by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @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 location, String name); + + /** + * Lists all compute limits shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a SharedLimit list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscriptionLocationResource(String location); + + /** + * Lists all compute limits shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @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 SharedLimit list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscriptionLocationResource(String location, Context context); +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/models/GuestSubscriptionInner.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/models/GuestSubscriptionInner.java new file mode 100644 index 000000000000..269948d40d66 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/models/GuestSubscriptionInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.computelimit.models.GuestSubscriptionProperties; +import java.io.IOException; + +/** + * Guest subscription that consumes shared compute limits. + */ +@Fluent +public final class GuestSubscriptionInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private GuestSubscriptionProperties properties; + + /* + * 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 GuestSubscriptionInner class. + */ + public GuestSubscriptionInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public GuestSubscriptionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the GuestSubscriptionInner object itself. + */ + public GuestSubscriptionInner withProperties(GuestSubscriptionProperties properties) { + this.properties = properties; + 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 JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GuestSubscriptionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GuestSubscriptionInner 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 GuestSubscriptionInner. + */ + public static GuestSubscriptionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GuestSubscriptionInner deserializedGuestSubscriptionInner = new GuestSubscriptionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGuestSubscriptionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGuestSubscriptionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGuestSubscriptionInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedGuestSubscriptionInner.properties = GuestSubscriptionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedGuestSubscriptionInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGuestSubscriptionInner; + }); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/models/OperationInner.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/models/OperationInner.java new file mode 100644 index 000000000000..86a4c771e911 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/models/OperationInner.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.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.computelimit.models.ActionType; +import com.azure.resourcemanager.computelimit.models.OperationDisplay; +import com.azure.resourcemanager.computelimit.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * 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; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/models/SharedLimitInner.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/models/SharedLimitInner.java new file mode 100644 index 000000000000..31486962c945 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/models/SharedLimitInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.computelimit.models.SharedLimitProperties; +import java.io.IOException; + +/** + * Compute limits shared by the subscription. + */ +@Fluent +public final class SharedLimitInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private SharedLimitProperties properties; + + /* + * 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 SharedLimitInner class. + */ + public SharedLimitInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public SharedLimitProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the SharedLimitInner object itself. + */ + public SharedLimitInner withProperties(SharedLimitProperties properties) { + this.properties = properties; + 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 JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SharedLimitInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SharedLimitInner 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 SharedLimitInner. + */ + public static SharedLimitInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SharedLimitInner deserializedSharedLimitInner = new SharedLimitInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSharedLimitInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSharedLimitInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSharedLimitInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSharedLimitInner.properties = SharedLimitProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSharedLimitInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSharedLimitInner; + }); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/models/package-info.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/models/package-info.java new file mode 100644 index 000000000000..3538bc3ea79f --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// 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 ComputeLimit. + * Microsoft Azure Compute Limit Resource Provider. + */ +package com.azure.resourcemanager.computelimit.fluent.models; diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/package-info.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/package-info.java new file mode 100644 index 000000000000..d7fe88db77dc --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/fluent/package-info.java @@ -0,0 +1,9 @@ +// 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 ComputeLimit. + * Microsoft Azure Compute Limit Resource Provider. + */ +package com.azure.resourcemanager.computelimit.fluent; diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/ComputeLimitClientBuilder.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/ComputeLimitClientBuilder.java new file mode 100644 index 000000000000..5a97b3de97f5 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/ComputeLimitClientBuilder.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.computelimit.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 ComputeLimitClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { ComputeLimitClientImpl.class }) +public final class ComputeLimitClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the ComputeLimitClientBuilder. + */ + public ComputeLimitClientBuilder 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 ComputeLimitClientBuilder. + */ + public ComputeLimitClientBuilder 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 ComputeLimitClientBuilder. + */ + public ComputeLimitClientBuilder 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 ComputeLimitClientBuilder. + */ + public ComputeLimitClientBuilder 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 ComputeLimitClientBuilder. + */ + public ComputeLimitClientBuilder 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 ComputeLimitClientBuilder. + */ + public ComputeLimitClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ComputeLimitClientImpl with the provided parameters. + * + * @return an instance of ComputeLimitClientImpl. + */ + public ComputeLimitClientImpl 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(); + ComputeLimitClientImpl client = new ComputeLimitClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/ComputeLimitClientImpl.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/ComputeLimitClientImpl.java new file mode 100644 index 000000000000..05db610b8e1a --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/ComputeLimitClientImpl.java @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.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.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +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.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.computelimit.fluent.ComputeLimitClient; +import com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient; +import com.azure.resourcemanager.computelimit.fluent.OperationsClient; +import com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient; +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 ComputeLimitClientImpl type. + */ +@ServiceClient(builder = ComputeLimitClientBuilder.class) +public final class ComputeLimitClientImpl implements ComputeLimitClient { + /** + * 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 OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The GuestSubscriptionsClient object to access its operations. + */ + private final GuestSubscriptionsClient guestSubscriptions; + + /** + * Gets the GuestSubscriptionsClient object to access its operations. + * + * @return the GuestSubscriptionsClient object. + */ + public GuestSubscriptionsClient getGuestSubscriptions() { + return this.guestSubscriptions; + } + + /** + * The SharedLimitsClient object to access its operations. + */ + private final SharedLimitsClient sharedLimits; + + /** + * Gets the SharedLimitsClient object to access its operations. + * + * @return the SharedLimitsClient object. + */ + public SharedLimitsClient getSharedLimits() { + return this.sharedLimits; + } + + /** + * Initializes an instance of ComputeLimitClient 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. + */ + ComputeLimitClientImpl(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 = "2025-08-15"; + this.operations = new OperationsClientImpl(this); + this.guestSubscriptions = new GuestSubscriptionsClientImpl(this); + this.sharedLimits = new SharedLimitsClientImpl(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 long running operation result. + * + * @param activationResponse the response of activation operation. + * @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 SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.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(ComputeLimitClientImpl.class); +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/GuestSubscriptionImpl.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/GuestSubscriptionImpl.java new file mode 100644 index 000000000000..f656bc4edf3a --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/GuestSubscriptionImpl.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.computelimit.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.computelimit.fluent.models.GuestSubscriptionInner; +import com.azure.resourcemanager.computelimit.models.GuestSubscription; +import com.azure.resourcemanager.computelimit.models.GuestSubscriptionProperties; + +public final class GuestSubscriptionImpl implements GuestSubscription, GuestSubscription.Definition { + private GuestSubscriptionInner innerObject; + + private final com.azure.resourcemanager.computelimit.ComputeLimitManager serviceManager; + + GuestSubscriptionImpl(GuestSubscriptionInner innerObject, + com.azure.resourcemanager.computelimit.ComputeLimitManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public GuestSubscriptionProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public GuestSubscriptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.computelimit.ComputeLimitManager manager() { + return this.serviceManager; + } + + private String location; + + private String guestSubscriptionId; + + public GuestSubscriptionImpl withExistingLocation(String location) { + this.location = location; + return this; + } + + public GuestSubscription create() { + this.innerObject = serviceManager.serviceClient() + .getGuestSubscriptions() + .createWithResponse(location, guestSubscriptionId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public GuestSubscription create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getGuestSubscriptions() + .createWithResponse(location, guestSubscriptionId, this.innerModel(), context) + .getValue(); + return this; + } + + GuestSubscriptionImpl(String name, com.azure.resourcemanager.computelimit.ComputeLimitManager serviceManager) { + this.innerObject = new GuestSubscriptionInner(); + this.serviceManager = serviceManager; + this.guestSubscriptionId = name; + } + + public GuestSubscription refresh() { + this.innerObject = serviceManager.serviceClient() + .getGuestSubscriptions() + .getWithResponse(location, guestSubscriptionId, Context.NONE) + .getValue(); + return this; + } + + public GuestSubscription refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getGuestSubscriptions() + .getWithResponse(location, guestSubscriptionId, context) + .getValue(); + return this; + } + + public GuestSubscriptionImpl withProperties(GuestSubscriptionProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/GuestSubscriptionsClientImpl.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/GuestSubscriptionsClientImpl.java new file mode 100644 index 000000000000..cb8d5017873f --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/GuestSubscriptionsClientImpl.java @@ -0,0 +1,534 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient; +import com.azure.resourcemanager.computelimit.fluent.models.GuestSubscriptionInner; +import com.azure.resourcemanager.computelimit.implementation.models.GuestSubscriptionListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in GuestSubscriptionsClient. + */ +public final class GuestSubscriptionsClientImpl implements GuestSubscriptionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final GuestSubscriptionsService service; + + /** + * The service client containing this operation class. + */ + private final ComputeLimitClientImpl client; + + /** + * Initializes an instance of GuestSubscriptionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GuestSubscriptionsClientImpl(ComputeLimitClientImpl client) { + this.service = RestProxy.create(GuestSubscriptionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeLimitClientGuestSubscriptions to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ComputeLimitClientGuestSubscriptions") + public interface GuestSubscriptionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeLimit/locations/{location}/guestSubscriptions/{guestSubscriptionId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("guestSubscriptionId") String guestSubscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeLimit/locations/{location}/guestSubscriptions/{guestSubscriptionId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("guestSubscriptionId") String guestSubscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeLimit/locations/{location}/guestSubscriptions/{guestSubscriptionId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("guestSubscriptionId") String guestSubscriptionId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") GuestSubscriptionInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeLimit/locations/{location}/guestSubscriptions/{guestSubscriptionId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("guestSubscriptionId") String guestSubscriptionId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") GuestSubscriptionInner resource, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeLimit/locations/{location}/guestSubscriptions/{guestSubscriptionId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("guestSubscriptionId") String guestSubscriptionId, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeLimit/locations/{location}/guestSubscriptions/{guestSubscriptionId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @PathParam("location") String location, + @PathParam("guestSubscriptionId") String guestSubscriptionId, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeLimit/locations/{location}/guestSubscriptions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionLocationResource( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @PathParam("location") String location, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeLimit/locations/{location}/guestSubscriptions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionLocationResourceSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @PathParam("location") String location, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionLocationResourceNext( + @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) + Response listBySubscriptionLocationResourceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the properties of a guest subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 properties of a guest subscription along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, String guestSubscriptionId) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, guestSubscriptionId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the properties of a guest subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 properties of a guest subscription on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String location, String guestSubscriptionId) { + return getWithResponseAsync(location, guestSubscriptionId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the properties of a guest subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @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 properties of a guest subscription along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String location, String guestSubscriptionId, + Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + location, guestSubscriptionId, accept, context); + } + + /** + * Gets the properties of a guest subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 properties of a guest subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GuestSubscriptionInner get(String location, String guestSubscriptionId) { + return getWithResponse(location, guestSubscriptionId, Context.NONE).getValue(); + } + + /** + * Adds a subscription as a guest to consume the compute limits shared by the host subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @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 guest subscription that consumes shared compute limits along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String location, String guestSubscriptionId, + GuestSubscriptionInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, guestSubscriptionId, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Adds a subscription as a guest to consume the compute limits shared by the host subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @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 guest subscription that consumes shared compute limits on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String location, String guestSubscriptionId, + GuestSubscriptionInner resource) { + return createWithResponseAsync(location, guestSubscriptionId, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Adds a subscription as a guest to consume the compute limits shared by the host subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @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 guest subscription that consumes shared compute limits along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String location, String guestSubscriptionId, + GuestSubscriptionInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, guestSubscriptionId, contentType, accept, resource, context); + } + + /** + * Adds a subscription as a guest to consume the compute limits shared by the host subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @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 guest subscription that consumes shared compute limits. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GuestSubscriptionInner create(String location, String guestSubscriptionId, GuestSubscriptionInner resource) { + return createWithResponse(location, guestSubscriptionId, resource, Context.NONE).getValue(); + } + + /** + * Deletes a subscription as a guest to stop consuming the compute limits shared by the host subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 location, String guestSubscriptionId) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, guestSubscriptionId, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a subscription as a guest to stop consuming the compute limits shared by the host subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 location, String guestSubscriptionId) { + return deleteWithResponseAsync(location, guestSubscriptionId).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a subscription as a guest to stop consuming the compute limits shared by the host subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String location, String guestSubscriptionId, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, guestSubscriptionId, context); + } + + /** + * Deletes a subscription as a guest to stop consuming the compute limits shared by the host subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 location, String guestSubscriptionId) { + deleteWithResponse(location, guestSubscriptionId, Context.NONE); + } + + /** + * Lists all guest subscriptions in a location. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GuestSubscription list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySubscriptionLocationResourceSinglePageAsync(String location) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySubscriptionLocationResource(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), location, 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())); + } + + /** + * Lists all guest subscriptions in a location. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GuestSubscription list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionLocationResourceAsync(String location) { + return new PagedFlux<>(() -> listBySubscriptionLocationResourceSinglePageAsync(location), + nextLink -> listBySubscriptionLocationResourceNextSinglePageAsync(nextLink)); + } + + /** + * Lists all guest subscriptions in a location. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GuestSubscription list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionLocationResourceSinglePage(String location) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionLocationResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all guest subscriptions in a location. + * + * @param location The name of the Azure region. + * @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 GuestSubscription list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionLocationResourceSinglePage(String location, + Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionLocationResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all guest subscriptions in a location. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GuestSubscription list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscriptionLocationResource(String location) { + return new PagedIterable<>(() -> listBySubscriptionLocationResourceSinglePage(location), + nextLink -> listBySubscriptionLocationResourceNextSinglePage(nextLink)); + } + + /** + * Lists all guest subscriptions in a location. + * + * @param location The name of the Azure region. + * @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 GuestSubscription list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscriptionLocationResource(String location, Context context) { + return new PagedIterable<>(() -> listBySubscriptionLocationResourceSinglePage(location, context), + nextLink -> listBySubscriptionLocationResourceNextSinglePage(nextLink, context)); + } + + /** + * 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 GuestSubscription list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySubscriptionLocationResourceNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySubscriptionLocationResourceNext(nextLink, this.client.getEndpoint(), + accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 GuestSubscription list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionLocationResourceNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res = service.listBySubscriptionLocationResourceNextSync(nextLink, + this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 GuestSubscription list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionLocationResourceNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionLocationResourceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/GuestSubscriptionsImpl.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/GuestSubscriptionsImpl.java new file mode 100644 index 000000000000..9c59eb64da13 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/GuestSubscriptionsImpl.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.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.computelimit.fluent.GuestSubscriptionsClient; +import com.azure.resourcemanager.computelimit.fluent.models.GuestSubscriptionInner; +import com.azure.resourcemanager.computelimit.models.GuestSubscription; +import com.azure.resourcemanager.computelimit.models.GuestSubscriptions; + +public final class GuestSubscriptionsImpl implements GuestSubscriptions { + private static final ClientLogger LOGGER = new ClientLogger(GuestSubscriptionsImpl.class); + + private final GuestSubscriptionsClient innerClient; + + private final com.azure.resourcemanager.computelimit.ComputeLimitManager serviceManager; + + public GuestSubscriptionsImpl(GuestSubscriptionsClient innerClient, + com.azure.resourcemanager.computelimit.ComputeLimitManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String location, String guestSubscriptionId, Context context) { + Response inner + = this.serviceClient().getWithResponse(location, guestSubscriptionId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GuestSubscriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public GuestSubscription get(String location, String guestSubscriptionId) { + GuestSubscriptionInner inner = this.serviceClient().get(location, guestSubscriptionId); + if (inner != null) { + return new GuestSubscriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String location, String guestSubscriptionId, + Context context) { + return this.serviceClient().deleteWithResponse(location, guestSubscriptionId, context); + } + + public void deleteByResourceGroup(String location, String guestSubscriptionId) { + this.serviceClient().delete(location, guestSubscriptionId); + } + + public PagedIterable listBySubscriptionLocationResource(String location) { + PagedIterable inner = this.serviceClient().listBySubscriptionLocationResource(location); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GuestSubscriptionImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscriptionLocationResource(String location, Context context) { + PagedIterable inner + = this.serviceClient().listBySubscriptionLocationResource(location, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GuestSubscriptionImpl(inner1, this.manager())); + } + + public GuestSubscription getById(String id) { + String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); + if (location == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String guestSubscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "guestSubscriptions"); + if (guestSubscriptionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'guestSubscriptions'.", id))); + } + return this.getWithResponse(location, guestSubscriptionId, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); + if (location == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String guestSubscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "guestSubscriptions"); + if (guestSubscriptionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'guestSubscriptions'.", id))); + } + return this.getWithResponse(location, guestSubscriptionId, context); + } + + public void deleteById(String id) { + String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); + if (location == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String guestSubscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "guestSubscriptions"); + if (guestSubscriptionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'guestSubscriptions'.", id))); + } + this.deleteByResourceGroupWithResponse(location, guestSubscriptionId, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); + if (location == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String guestSubscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "guestSubscriptions"); + if (guestSubscriptionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'guestSubscriptions'.", id))); + } + return this.deleteByResourceGroupWithResponse(location, guestSubscriptionId, context); + } + + private GuestSubscriptionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.computelimit.ComputeLimitManager manager() { + return this.serviceManager; + } + + public GuestSubscriptionImpl define(String name) { + return new GuestSubscriptionImpl(name, this.manager()); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/OperationImpl.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/OperationImpl.java new file mode 100644 index 000000000000..55acfaf46888 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/OperationImpl.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.computelimit.implementation; + +import com.azure.resourcemanager.computelimit.fluent.models.OperationInner; +import com.azure.resourcemanager.computelimit.models.ActionType; +import com.azure.resourcemanager.computelimit.models.Operation; +import com.azure.resourcemanager.computelimit.models.OperationDisplay; +import com.azure.resourcemanager.computelimit.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.computelimit.ComputeLimitManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.computelimit.ComputeLimitManager 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.computelimit.ComputeLimitManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/OperationsClientImpl.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..f4ffb96a475a --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/OperationsClientImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.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.computelimit.fluent.OperationsClient; +import com.azure.resourcemanager.computelimit.fluent.models.OperationInner; +import com.azure.resourcemanager.computelimit.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 ComputeLimitClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ComputeLimitClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeLimitClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ComputeLimitClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.ComputeLimit/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("/providers/Microsoft.ComputeLimit/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@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() { + 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. + * + * @throws 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. + * + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * 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) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/OperationsImpl.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/OperationsImpl.java new file mode 100644 index 000000000000..898b0c78e390 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/OperationsImpl.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.computelimit.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.computelimit.fluent.OperationsClient; +import com.azure.resourcemanager.computelimit.fluent.models.OperationInner; +import com.azure.resourcemanager.computelimit.models.Operation; +import com.azure.resourcemanager.computelimit.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.computelimit.ComputeLimitManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.computelimit.ComputeLimitManager 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.computelimit.ComputeLimitManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/ResourceManagerUtils.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..7f2914092d0b --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/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.computelimit.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/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/SharedLimitImpl.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/SharedLimitImpl.java new file mode 100644 index 000000000000..9a887d411747 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/SharedLimitImpl.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.computelimit.fluent.models.SharedLimitInner; +import com.azure.resourcemanager.computelimit.models.SharedLimit; +import com.azure.resourcemanager.computelimit.models.SharedLimitProperties; + +public final class SharedLimitImpl implements SharedLimit, SharedLimit.Definition { + private SharedLimitInner innerObject; + + private final com.azure.resourcemanager.computelimit.ComputeLimitManager serviceManager; + + SharedLimitImpl(SharedLimitInner innerObject, + com.azure.resourcemanager.computelimit.ComputeLimitManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SharedLimitProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SharedLimitInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.computelimit.ComputeLimitManager manager() { + return this.serviceManager; + } + + private String location; + + private String name; + + public SharedLimitImpl withExistingLocation(String location) { + this.location = location; + return this; + } + + public SharedLimit create() { + this.innerObject = serviceManager.serviceClient() + .getSharedLimits() + .createWithResponse(location, name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SharedLimit create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSharedLimits() + .createWithResponse(location, name, this.innerModel(), context) + .getValue(); + return this; + } + + SharedLimitImpl(String name, com.azure.resourcemanager.computelimit.ComputeLimitManager serviceManager) { + this.innerObject = new SharedLimitInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public SharedLimit refresh() { + this.innerObject + = serviceManager.serviceClient().getSharedLimits().getWithResponse(location, name, Context.NONE).getValue(); + return this; + } + + public SharedLimit refresh(Context context) { + this.innerObject + = serviceManager.serviceClient().getSharedLimits().getWithResponse(location, name, context).getValue(); + return this; + } + + public SharedLimitImpl withProperties(SharedLimitProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/SharedLimitsClientImpl.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/SharedLimitsClientImpl.java new file mode 100644 index 000000000000..efe651bb434b --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/SharedLimitsClientImpl.java @@ -0,0 +1,527 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient; +import com.azure.resourcemanager.computelimit.fluent.models.SharedLimitInner; +import com.azure.resourcemanager.computelimit.implementation.models.SharedLimitListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SharedLimitsClient. + */ +public final class SharedLimitsClientImpl implements SharedLimitsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SharedLimitsService service; + + /** + * The service client containing this operation class. + */ + private final ComputeLimitClientImpl client; + + /** + * Initializes an instance of SharedLimitsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SharedLimitsClientImpl(ComputeLimitClientImpl client) { + this.service + = RestProxy.create(SharedLimitsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ComputeLimitClientSharedLimits to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ComputeLimitClientSharedLimits") + public interface SharedLimitsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeLimit/locations/{location}/sharedLimits/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("name") String name, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeLimit/locations/{location}/sharedLimits/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("name") String name, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeLimit/locations/{location}/sharedLimits/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SharedLimitInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeLimit/locations/{location}/sharedLimits/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SharedLimitInner resource, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeLimit/locations/{location}/sharedLimits/{name}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("name") String name, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeLimit/locations/{location}/sharedLimits/{name}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @PathParam("location") String location, + @PathParam("name") String name, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeLimit/locations/{location}/sharedLimits") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionLocationResource(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeLimit/locations/{location}/sharedLimits") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionLocationResourceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionLocationResourceNext( + @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) + Response listBySubscriptionLocationResourceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the properties of a compute limit shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 properties of a compute limit shared by the host subscription with its guest subscriptions along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, String name) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, name, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the properties of a compute limit shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 properties of a compute limit shared by the host subscription with its guest subscriptions on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String location, String name) { + return getWithResponseAsync(location, name).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the properties of a compute limit shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @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 properties of a compute limit shared by the host subscription with its guest subscriptions along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String location, String name, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + location, name, accept, context); + } + + /** + * Gets the properties of a compute limit shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 properties of a compute limit shared by the host subscription with its guest subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharedLimitInner get(String location, String name) { + return getWithResponse(location, name, Context.NONE).getValue(); + } + + /** + * Enables sharing of a compute limit by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @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 compute limits shared by the subscription along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String location, String name, + SharedLimitInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, name, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Enables sharing of a compute limit by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @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 compute limits shared by the subscription on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String location, String name, SharedLimitInner resource) { + return createWithResponseAsync(location, name, resource).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Enables sharing of a compute limit by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @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 compute limits shared by the subscription along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String location, String name, SharedLimitInner resource, + Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, name, contentType, accept, resource, context); + } + + /** + * Enables sharing of a compute limit by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @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 compute limits shared by the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SharedLimitInner create(String location, String name, SharedLimitInner resource) { + return createWithResponse(location, name, resource, Context.NONE).getValue(); + } + + /** + * Disables sharing of a compute limit by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 location, String name) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, name, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Disables sharing of a compute limit by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 location, String name) { + return deleteWithResponseAsync(location, name).flatMap(ignored -> Mono.empty()); + } + + /** + * Disables sharing of a compute limit by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String location, String name, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, name, context); + } + + /** + * Disables sharing of a compute limit by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 location, String name) { + deleteWithResponse(location, name, Context.NONE); + } + + /** + * Lists all compute limits shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a SharedLimit list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionLocationResourceSinglePageAsync(String location) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySubscriptionLocationResource(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), location, 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())); + } + + /** + * Lists all compute limits shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a SharedLimit list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionLocationResourceAsync(String location) { + return new PagedFlux<>(() -> listBySubscriptionLocationResourceSinglePageAsync(location), + nextLink -> listBySubscriptionLocationResourceNextSinglePageAsync(nextLink)); + } + + /** + * Lists all compute limits shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a SharedLimit list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionLocationResourceSinglePage(String location) { + final String accept = "application/json"; + Response res = service.listBySubscriptionLocationResourceSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), location, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all compute limits shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @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 SharedLimit list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionLocationResourceSinglePage(String location, + Context context) { + final String accept = "application/json"; + Response res = service.listBySubscriptionLocationResourceSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), location, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all compute limits shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a SharedLimit list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscriptionLocationResource(String location) { + return new PagedIterable<>(() -> listBySubscriptionLocationResourceSinglePage(location), + nextLink -> listBySubscriptionLocationResourceNextSinglePage(nextLink)); + } + + /** + * Lists all compute limits shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @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 SharedLimit list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscriptionLocationResource(String location, Context context) { + return new PagedIterable<>(() -> listBySubscriptionLocationResourceSinglePage(location, context), + nextLink -> listBySubscriptionLocationResourceNextSinglePage(nextLink, context)); + } + + /** + * 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 SharedLimit list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySubscriptionLocationResourceNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySubscriptionLocationResourceNext(nextLink, this.client.getEndpoint(), + accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 SharedLimit list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionLocationResourceNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res = service.listBySubscriptionLocationResourceNextSync(nextLink, + this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 SharedLimit list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionLocationResourceNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionLocationResourceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/SharedLimitsImpl.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/SharedLimitsImpl.java new file mode 100644 index 000000000000..1dc5a5df351b --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/SharedLimitsImpl.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.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.computelimit.fluent.SharedLimitsClient; +import com.azure.resourcemanager.computelimit.fluent.models.SharedLimitInner; +import com.azure.resourcemanager.computelimit.models.SharedLimit; +import com.azure.resourcemanager.computelimit.models.SharedLimits; + +public final class SharedLimitsImpl implements SharedLimits { + private static final ClientLogger LOGGER = new ClientLogger(SharedLimitsImpl.class); + + private final SharedLimitsClient innerClient; + + private final com.azure.resourcemanager.computelimit.ComputeLimitManager serviceManager; + + public SharedLimitsImpl(SharedLimitsClient innerClient, + com.azure.resourcemanager.computelimit.ComputeLimitManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String location, String name, Context context) { + Response inner = this.serviceClient().getWithResponse(location, name, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SharedLimitImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SharedLimit get(String location, String name) { + SharedLimitInner inner = this.serviceClient().get(location, name); + if (inner != null) { + return new SharedLimitImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String location, String name, Context context) { + return this.serviceClient().deleteWithResponse(location, name, context); + } + + public void deleteByResourceGroup(String location, String name) { + this.serviceClient().delete(location, name); + } + + public PagedIterable listBySubscriptionLocationResource(String location) { + PagedIterable inner = this.serviceClient().listBySubscriptionLocationResource(location); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SharedLimitImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscriptionLocationResource(String location, Context context) { + PagedIterable inner + = this.serviceClient().listBySubscriptionLocationResource(location, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SharedLimitImpl(inner1, this.manager())); + } + + public SharedLimit getById(String id) { + String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); + if (location == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String name = ResourceManagerUtils.getValueFromIdByName(id, "sharedLimits"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sharedLimits'.", id))); + } + return this.getWithResponse(location, name, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); + if (location == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String name = ResourceManagerUtils.getValueFromIdByName(id, "sharedLimits"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sharedLimits'.", id))); + } + return this.getWithResponse(location, name, context); + } + + public void deleteById(String id) { + String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); + if (location == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String name = ResourceManagerUtils.getValueFromIdByName(id, "sharedLimits"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sharedLimits'.", id))); + } + this.deleteByResourceGroupWithResponse(location, name, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); + if (location == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String name = ResourceManagerUtils.getValueFromIdByName(id, "sharedLimits"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'sharedLimits'.", id))); + } + return this.deleteByResourceGroupWithResponse(location, name, context); + } + + private SharedLimitsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.computelimit.ComputeLimitManager manager() { + return this.serviceManager; + } + + public SharedLimitImpl define(String name) { + return new SharedLimitImpl(name, this.manager()); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/models/GuestSubscriptionListResult.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/models/GuestSubscriptionListResult.java new file mode 100644 index 000000000000..4be1e27bc037 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/models/GuestSubscriptionListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.implementation.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.computelimit.fluent.models.GuestSubscriptionInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a GuestSubscription list operation. + */ +@Immutable +public final class GuestSubscriptionListResult implements JsonSerializable { + /* + * The GuestSubscription items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of GuestSubscriptionListResult class. + */ + private GuestSubscriptionListResult() { + } + + /** + * Get the value property: The GuestSubscription 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; + } + + /** + * {@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 GuestSubscriptionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GuestSubscriptionListResult 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 GuestSubscriptionListResult. + */ + public static GuestSubscriptionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GuestSubscriptionListResult deserializedGuestSubscriptionListResult = new GuestSubscriptionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> GuestSubscriptionInner.fromJson(reader1)); + deserializedGuestSubscriptionListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedGuestSubscriptionListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGuestSubscriptionListResult; + }); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/models/OperationListResult.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..30f261d471d0 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/models/OperationListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.implementation.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.computelimit.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; + } + + /** + * {@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/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/models/SharedLimitListResult.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/models/SharedLimitListResult.java new file mode 100644 index 000000000000..ee0e9ab096f5 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/models/SharedLimitListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.implementation.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.computelimit.fluent.models.SharedLimitInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a SharedLimit list operation. + */ +@Immutable +public final class SharedLimitListResult implements JsonSerializable { + /* + * The SharedLimit items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of SharedLimitListResult class. + */ + private SharedLimitListResult() { + } + + /** + * Get the value property: The SharedLimit 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; + } + + /** + * {@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 SharedLimitListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SharedLimitListResult 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 SharedLimitListResult. + */ + public static SharedLimitListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SharedLimitListResult deserializedSharedLimitListResult = new SharedLimitListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> SharedLimitInner.fromJson(reader1)); + deserializedSharedLimitListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSharedLimitListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSharedLimitListResult; + }); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/package-info.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/package-info.java new file mode 100644 index 000000000000..da11a91bc3e2 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/implementation/package-info.java @@ -0,0 +1,9 @@ +// 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 ComputeLimit. + * Microsoft Azure Compute Limit Resource Provider. + */ +package com.azure.resourcemanager.computelimit.implementation; diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/ActionType.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/ActionType.java new file mode 100644 index 000000000000..e6a177f70fd2 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/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.computelimit.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 { + /** + * Actions are for internal-only APIs. + */ + 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/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/GuestSubscription.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/GuestSubscription.java new file mode 100644 index 000000000000..a47ff3cfa4d7 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/GuestSubscription.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.computelimit.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.computelimit.fluent.models.GuestSubscriptionInner; + +/** + * An immutable client-side representation of GuestSubscription. + */ +public interface GuestSubscription { + /** + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + GuestSubscriptionProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.computelimit.fluent.models.GuestSubscriptionInner object. + * + * @return the inner object. + */ + GuestSubscriptionInner innerModel(); + + /** + * The entirety of the GuestSubscription definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The GuestSubscription definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the GuestSubscription definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the GuestSubscription definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies location. + * + * @param location The name of the Azure region. + * @return the next definition stage. + */ + WithCreate withExistingLocation(String location); + } + + /** + * The stage of the GuestSubscription definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + GuestSubscription create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + GuestSubscription create(Context context); + } + + /** + * The stage of the GuestSubscription 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. + */ + WithCreate withProperties(GuestSubscriptionProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + GuestSubscription refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + GuestSubscription refresh(Context context); +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/GuestSubscriptionProperties.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/GuestSubscriptionProperties.java new file mode 100644 index 000000000000..2727dffa1f99 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/GuestSubscriptionProperties.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.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; + +/** + * Properties for guest subscription. + */ +@Immutable +public final class GuestSubscriptionProperties implements JsonSerializable { + /* + * The provisioning state of the resource. + */ + private ResourceProvisioningState provisioningState; + + /** + * Creates an instance of GuestSubscriptionProperties class. + */ + public GuestSubscriptionProperties() { + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GuestSubscriptionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GuestSubscriptionProperties 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 GuestSubscriptionProperties. + */ + public static GuestSubscriptionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GuestSubscriptionProperties deserializedGuestSubscriptionProperties = new GuestSubscriptionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedGuestSubscriptionProperties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedGuestSubscriptionProperties; + }); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/GuestSubscriptions.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/GuestSubscriptions.java new file mode 100644 index 000000000000..1be02c43d5e4 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/GuestSubscriptions.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.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 GuestSubscriptions. + */ +public interface GuestSubscriptions { + /** + * Gets the properties of a guest subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @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 properties of a guest subscription along with {@link Response}. + */ + Response getWithResponse(String location, String guestSubscriptionId, Context context); + + /** + * Gets the properties of a guest subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @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 properties of a guest subscription. + */ + GuestSubscription get(String location, String guestSubscriptionId); + + /** + * Deletes a subscription as a guest to stop consuming the compute limits shared by the host subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String location, String guestSubscriptionId, Context context); + + /** + * Deletes a subscription as a guest to stop consuming the compute limits shared by the host subscription. + * + * @param location The name of the Azure region. + * @param guestSubscriptionId The name of the GuestSubscription. + * @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 location, String guestSubscriptionId); + + /** + * Lists all guest subscriptions in a location. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GuestSubscription list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscriptionLocationResource(String location); + + /** + * Lists all guest subscriptions in a location. + * + * @param location The name of the Azure region. + * @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 GuestSubscription list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscriptionLocationResource(String location, Context context); + + /** + * Gets the properties of a guest subscription. + * + * @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 the properties of a guest subscription along with {@link Response}. + */ + GuestSubscription getById(String id); + + /** + * Gets the properties of a guest subscription. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a guest subscription along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a subscription as a guest to stop consuming the compute limits shared by the host subscription. + * + * @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); + + /** + * Deletes a subscription as a guest to stop consuming the compute limits shared by the host subscription. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new GuestSubscription resource. + * + * @param name resource name. + * @return the first stage of the new GuestSubscription definition. + */ + GuestSubscription.DefinitionStages.Blank define(String name); +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/LimitName.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/LimitName.java new file mode 100644 index 000000000000..61e1f9694700 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/LimitName.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.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; + +/** + * Properties of the limit name. + */ +@Immutable +public final class LimitName implements JsonSerializable { + /* + * The limit name. + */ + private String value; + + /* + * The localized limit name. + */ + private String localizedValue; + + /** + * Creates an instance of LimitName class. + */ + private LimitName() { + } + + /** + * Get the value property: The limit name. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Get the localizedValue property: The localized limit name. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LimitName from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LimitName 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 LimitName. + */ + public static LimitName fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LimitName deserializedLimitName = new LimitName(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedLimitName.value = reader.getString(); + } else if ("localizedValue".equals(fieldName)) { + deserializedLimitName.localizedValue = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLimitName; + }); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/Operation.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/Operation.java new file mode 100644 index 000000000000..e52e25af9821 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/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.computelimit.models; + +import com.azure.resourcemanager.computelimit.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.computelimit.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/OperationDisplay.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/OperationDisplay.java new file mode 100644 index 000000000000..00c1557a1c6b --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.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; + } + + /** + * {@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/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/Operations.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/Operations.java new file mode 100644 index 000000000000..306d027c1356 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/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.computelimit.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/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/Origin.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/Origin.java new file mode 100644 index 000000000000..4410429e26f5 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/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.computelimit.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 { + /** + * Indicates the operation is initiated by a user. + */ + public static final Origin USER = fromString("user"); + + /** + * Indicates the operation is initiated by a system. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Indicates the operation is initiated by a user or system. + */ + 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/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/ResourceProvisioningState.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/ResourceProvisioningState.java new file mode 100644 index 000000000000..ed3a7c29c2e3 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/ResourceProvisioningState.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of a resource type. + */ +public final class ResourceProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ResourceProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ResourceProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ResourceProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ResourceProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ResourceProvisioningState() { + } + + /** + * Creates or finds a ResourceProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceProvisioningState. + */ + public static ResourceProvisioningState fromString(String name) { + return fromString(name, ResourceProvisioningState.class); + } + + /** + * Gets known ResourceProvisioningState values. + * + * @return known ResourceProvisioningState values. + */ + public static Collection values() { + return values(ResourceProvisioningState.class); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/SharedLimit.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/SharedLimit.java new file mode 100644 index 000000000000..11e40a989521 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/SharedLimit.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.computelimit.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.computelimit.fluent.models.SharedLimitInner; + +/** + * An immutable client-side representation of SharedLimit. + */ +public interface SharedLimit { + /** + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + SharedLimitProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.computelimit.fluent.models.SharedLimitInner object. + * + * @return the inner object. + */ + SharedLimitInner innerModel(); + + /** + * The entirety of the SharedLimit definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The SharedLimit definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SharedLimit definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the SharedLimit definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies location. + * + * @param location The name of the Azure region. + * @return the next definition stage. + */ + WithCreate withExistingLocation(String location); + } + + /** + * The stage of the SharedLimit definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + SharedLimit create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SharedLimit create(Context context); + } + + /** + * The stage of the SharedLimit 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. + */ + WithCreate withProperties(SharedLimitProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SharedLimit refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SharedLimit refresh(Context context); +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/SharedLimitProperties.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/SharedLimitProperties.java new file mode 100644 index 000000000000..62853f04f966 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/SharedLimitProperties.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.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; + +/** + * Properties of the compute shared limit. + */ +@Immutable +public final class SharedLimitProperties implements JsonSerializable { + /* + * The limit name properties. + */ + private LimitName resourceName; + + /* + * The maximum permitted usage of the resource. + */ + private Integer limit; + + /* + * The quota units, such as Count. + */ + private String unit; + + /* + * The provisioning state of the resource. + */ + private ResourceProvisioningState provisioningState; + + /** + * Creates an instance of SharedLimitProperties class. + */ + public SharedLimitProperties() { + } + + /** + * Get the resourceName property: The limit name properties. + * + * @return the resourceName value. + */ + public LimitName resourceName() { + return this.resourceName; + } + + /** + * Get the limit property: The maximum permitted usage of the resource. + * + * @return the limit value. + */ + public Integer limit() { + return this.limit; + } + + /** + * Get the unit property: The quota units, such as Count. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SharedLimitProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SharedLimitProperties 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 SharedLimitProperties. + */ + public static SharedLimitProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SharedLimitProperties deserializedSharedLimitProperties = new SharedLimitProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceName".equals(fieldName)) { + deserializedSharedLimitProperties.resourceName = LimitName.fromJson(reader); + } else if ("limit".equals(fieldName)) { + deserializedSharedLimitProperties.limit = reader.getNullable(JsonReader::getInt); + } else if ("unit".equals(fieldName)) { + deserializedSharedLimitProperties.unit = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedSharedLimitProperties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSharedLimitProperties; + }); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/SharedLimits.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/SharedLimits.java new file mode 100644 index 000000000000..7c1fb289c779 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/SharedLimits.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.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 SharedLimits. + */ +public interface SharedLimits { + /** + * Gets the properties of a compute limit shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @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 properties of a compute limit shared by the host subscription with its guest subscriptions along with + * {@link Response}. + */ + Response getWithResponse(String location, String name, Context context); + + /** + * Gets the properties of a compute limit shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @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 properties of a compute limit shared by the host subscription with its guest subscriptions. + */ + SharedLimit get(String location, String name); + + /** + * Disables sharing of a compute limit by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String location, String name, Context context); + + /** + * Disables sharing of a compute limit by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @param name The name of the SharedLimit. + * @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 location, String name); + + /** + * Lists all compute limits shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a SharedLimit list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscriptionLocationResource(String location); + + /** + * Lists all compute limits shared by the host subscription with its guest subscriptions. + * + * @param location The name of the Azure region. + * @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 SharedLimit list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscriptionLocationResource(String location, Context context); + + /** + * Gets the properties of a compute limit shared by the host subscription with its guest subscriptions. + * + * @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 the properties of a compute limit shared by the host subscription with its guest subscriptions along with + * {@link Response}. + */ + SharedLimit getById(String id); + + /** + * Gets the properties of a compute limit shared by the host subscription with its guest subscriptions. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of a compute limit shared by the host subscription with its guest subscriptions along with + * {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Disables sharing of a compute limit by the host subscription with its guest subscriptions. + * + * @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); + + /** + * Disables sharing of a compute limit by the host subscription with its guest subscriptions. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SharedLimit resource. + * + * @param name resource name. + * @return the first stage of the new SharedLimit definition. + */ + SharedLimit.DefinitionStages.Blank define(String name); +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/package-info.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/package-info.java new file mode 100644 index 000000000000..85526d279c07 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/models/package-info.java @@ -0,0 +1,9 @@ +// 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 ComputeLimit. + * Microsoft Azure Compute Limit Resource Provider. + */ +package com.azure.resourcemanager.computelimit.models; diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/package-info.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/package-info.java new file mode 100644 index 000000000000..aedef628c2c5 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/com/azure/resourcemanager/computelimit/package-info.java @@ -0,0 +1,9 @@ +// 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 ComputeLimit. + * Microsoft Azure Compute Limit Resource Provider. + */ +package com.azure.resourcemanager.computelimit; diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/module-info.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/module-info.java new file mode 100644 index 000000000000..f44a9c0aaa70 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/java/module-info.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.resourcemanager.computelimit { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.computelimit; + exports com.azure.resourcemanager.computelimit.fluent; + exports com.azure.resourcemanager.computelimit.fluent.models; + exports com.azure.resourcemanager.computelimit.models; + + opens com.azure.resourcemanager.computelimit.fluent.models to com.azure.core; + opens com.azure.resourcemanager.computelimit.models to com.azure.core; + opens com.azure.resourcemanager.computelimit.implementation.models to com.azure.core; +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/META-INF/azure-resourcemanager-computelimit_apiview_properties.json b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/META-INF/azure-resourcemanager-computelimit_apiview_properties.json new file mode 100644 index 000000000000..0314751eb5ad --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/META-INF/azure-resourcemanager-computelimit_apiview_properties.json @@ -0,0 +1,38 @@ +{ + "flavor": "azure", + "CrossLanguageDefinitionId": { + "com.azure.resourcemanager.computelimit.fluent.ComputeLimitClient": "Microsoft.ComputeLimit", + "com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient": "Microsoft.ComputeLimit.GuestSubscriptions", + "com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient.create": "Microsoft.ComputeLimit.GuestSubscriptions.create", + "com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient.createWithResponse": "Microsoft.ComputeLimit.GuestSubscriptions.create", + "com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient.delete": "Microsoft.ComputeLimit.GuestSubscriptions.delete", + "com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient.deleteWithResponse": "Microsoft.ComputeLimit.GuestSubscriptions.delete", + "com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient.get": "Microsoft.ComputeLimit.GuestSubscriptions.get", + "com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient.getWithResponse": "Microsoft.ComputeLimit.GuestSubscriptions.get", + "com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient.listBySubscriptionLocationResource": "Microsoft.ComputeLimit.GuestSubscriptions.listBySubscriptionLocationResource", + "com.azure.resourcemanager.computelimit.fluent.OperationsClient": "Microsoft.ComputeLimit.Operations", + "com.azure.resourcemanager.computelimit.fluent.OperationsClient.list": "Azure.ResourceManager.Operations.list", + "com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient": "Microsoft.ComputeLimit.SharedLimits", + "com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient.create": "Microsoft.ComputeLimit.SharedLimits.create", + "com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient.createWithResponse": "Microsoft.ComputeLimit.SharedLimits.create", + "com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient.delete": "Microsoft.ComputeLimit.SharedLimits.delete", + "com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient.deleteWithResponse": "Microsoft.ComputeLimit.SharedLimits.delete", + "com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient.get": "Microsoft.ComputeLimit.SharedLimits.get", + "com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient.getWithResponse": "Microsoft.ComputeLimit.SharedLimits.get", + "com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient.listBySubscriptionLocationResource": "Microsoft.ComputeLimit.SharedLimits.listBySubscriptionLocationResource", + "com.azure.resourcemanager.computelimit.fluent.models.GuestSubscriptionInner": "Microsoft.ComputeLimit.GuestSubscription", + "com.azure.resourcemanager.computelimit.fluent.models.OperationInner": "Azure.ResourceManager.CommonTypes.Operation", + "com.azure.resourcemanager.computelimit.fluent.models.SharedLimitInner": "Microsoft.ComputeLimit.SharedLimit", + "com.azure.resourcemanager.computelimit.implementation.ComputeLimitClientBuilder": "Microsoft.ComputeLimit", + "com.azure.resourcemanager.computelimit.implementation.models.GuestSubscriptionListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.computelimit.implementation.models.OperationListResult": "Azure.ResourceManager.CommonTypes.OperationListResult", + "com.azure.resourcemanager.computelimit.implementation.models.SharedLimitListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.computelimit.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "com.azure.resourcemanager.computelimit.models.GuestSubscriptionProperties": "Microsoft.ComputeLimit.GuestSubscriptionProperties", + "com.azure.resourcemanager.computelimit.models.LimitName": "Microsoft.ComputeLimit.LimitName", + "com.azure.resourcemanager.computelimit.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "com.azure.resourcemanager.computelimit.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "com.azure.resourcemanager.computelimit.models.ResourceProvisioningState": "Azure.ResourceManager.ResourceProvisioningState", + "com.azure.resourcemanager.computelimit.models.SharedLimitProperties": "Microsoft.ComputeLimit.SharedLimitProperties" + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/META-INF/azure-resourcemanager-computelimit_metadata.json b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/META-INF/azure-resourcemanager-computelimit_metadata.json new file mode 100644 index 000000000000..96fe1b431d64 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/META-INF/azure-resourcemanager-computelimit_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersion":"2025-08-15","crossLanguageDefinitions":{"com.azure.resourcemanager.computelimit.fluent.ComputeLimitClient":"Microsoft.ComputeLimit","com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient":"Microsoft.ComputeLimit.GuestSubscriptions","com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient.create":"Microsoft.ComputeLimit.GuestSubscriptions.create","com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient.createWithResponse":"Microsoft.ComputeLimit.GuestSubscriptions.create","com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient.delete":"Microsoft.ComputeLimit.GuestSubscriptions.delete","com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient.deleteWithResponse":"Microsoft.ComputeLimit.GuestSubscriptions.delete","com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient.get":"Microsoft.ComputeLimit.GuestSubscriptions.get","com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient.getWithResponse":"Microsoft.ComputeLimit.GuestSubscriptions.get","com.azure.resourcemanager.computelimit.fluent.GuestSubscriptionsClient.listBySubscriptionLocationResource":"Microsoft.ComputeLimit.GuestSubscriptions.listBySubscriptionLocationResource","com.azure.resourcemanager.computelimit.fluent.OperationsClient":"Microsoft.ComputeLimit.Operations","com.azure.resourcemanager.computelimit.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient":"Microsoft.ComputeLimit.SharedLimits","com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient.create":"Microsoft.ComputeLimit.SharedLimits.create","com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient.createWithResponse":"Microsoft.ComputeLimit.SharedLimits.create","com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient.delete":"Microsoft.ComputeLimit.SharedLimits.delete","com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient.deleteWithResponse":"Microsoft.ComputeLimit.SharedLimits.delete","com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient.get":"Microsoft.ComputeLimit.SharedLimits.get","com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient.getWithResponse":"Microsoft.ComputeLimit.SharedLimits.get","com.azure.resourcemanager.computelimit.fluent.SharedLimitsClient.listBySubscriptionLocationResource":"Microsoft.ComputeLimit.SharedLimits.listBySubscriptionLocationResource","com.azure.resourcemanager.computelimit.fluent.models.GuestSubscriptionInner":"Microsoft.ComputeLimit.GuestSubscription","com.azure.resourcemanager.computelimit.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","com.azure.resourcemanager.computelimit.fluent.models.SharedLimitInner":"Microsoft.ComputeLimit.SharedLimit","com.azure.resourcemanager.computelimit.implementation.ComputeLimitClientBuilder":"Microsoft.ComputeLimit","com.azure.resourcemanager.computelimit.implementation.models.GuestSubscriptionListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.computelimit.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","com.azure.resourcemanager.computelimit.implementation.models.SharedLimitListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.computelimit.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","com.azure.resourcemanager.computelimit.models.GuestSubscriptionProperties":"Microsoft.ComputeLimit.GuestSubscriptionProperties","com.azure.resourcemanager.computelimit.models.LimitName":"Microsoft.ComputeLimit.LimitName","com.azure.resourcemanager.computelimit.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","com.azure.resourcemanager.computelimit.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","com.azure.resourcemanager.computelimit.models.ResourceProvisioningState":"Azure.ResourceManager.ResourceProvisioningState","com.azure.resourcemanager.computelimit.models.SharedLimitProperties":"Microsoft.ComputeLimit.SharedLimitProperties"},"generatedFiles":["src/main/java/com/azure/resourcemanager/computelimit/ComputeLimitManager.java","src/main/java/com/azure/resourcemanager/computelimit/fluent/ComputeLimitClient.java","src/main/java/com/azure/resourcemanager/computelimit/fluent/GuestSubscriptionsClient.java","src/main/java/com/azure/resourcemanager/computelimit/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/computelimit/fluent/SharedLimitsClient.java","src/main/java/com/azure/resourcemanager/computelimit/fluent/models/GuestSubscriptionInner.java","src/main/java/com/azure/resourcemanager/computelimit/fluent/models/OperationInner.java","src/main/java/com/azure/resourcemanager/computelimit/fluent/models/SharedLimitInner.java","src/main/java/com/azure/resourcemanager/computelimit/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/computelimit/fluent/package-info.java","src/main/java/com/azure/resourcemanager/computelimit/implementation/ComputeLimitClientBuilder.java","src/main/java/com/azure/resourcemanager/computelimit/implementation/ComputeLimitClientImpl.java","src/main/java/com/azure/resourcemanager/computelimit/implementation/GuestSubscriptionImpl.java","src/main/java/com/azure/resourcemanager/computelimit/implementation/GuestSubscriptionsClientImpl.java","src/main/java/com/azure/resourcemanager/computelimit/implementation/GuestSubscriptionsImpl.java","src/main/java/com/azure/resourcemanager/computelimit/implementation/OperationImpl.java","src/main/java/com/azure/resourcemanager/computelimit/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/computelimit/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/computelimit/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/computelimit/implementation/SharedLimitImpl.java","src/main/java/com/azure/resourcemanager/computelimit/implementation/SharedLimitsClientImpl.java","src/main/java/com/azure/resourcemanager/computelimit/implementation/SharedLimitsImpl.java","src/main/java/com/azure/resourcemanager/computelimit/implementation/models/GuestSubscriptionListResult.java","src/main/java/com/azure/resourcemanager/computelimit/implementation/models/OperationListResult.java","src/main/java/com/azure/resourcemanager/computelimit/implementation/models/SharedLimitListResult.java","src/main/java/com/azure/resourcemanager/computelimit/implementation/package-info.java","src/main/java/com/azure/resourcemanager/computelimit/models/ActionType.java","src/main/java/com/azure/resourcemanager/computelimit/models/GuestSubscription.java","src/main/java/com/azure/resourcemanager/computelimit/models/GuestSubscriptionProperties.java","src/main/java/com/azure/resourcemanager/computelimit/models/GuestSubscriptions.java","src/main/java/com/azure/resourcemanager/computelimit/models/LimitName.java","src/main/java/com/azure/resourcemanager/computelimit/models/Operation.java","src/main/java/com/azure/resourcemanager/computelimit/models/OperationDisplay.java","src/main/java/com/azure/resourcemanager/computelimit/models/Operations.java","src/main/java/com/azure/resourcemanager/computelimit/models/Origin.java","src/main/java/com/azure/resourcemanager/computelimit/models/ResourceProvisioningState.java","src/main/java/com/azure/resourcemanager/computelimit/models/SharedLimit.java","src/main/java/com/azure/resourcemanager/computelimit/models/SharedLimitProperties.java","src/main/java/com/azure/resourcemanager/computelimit/models/SharedLimits.java","src/main/java/com/azure/resourcemanager/computelimit/models/package-info.java","src/main/java/com/azure/resourcemanager/computelimit/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-computelimit/proxy-config.json b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-computelimit/proxy-config.json new file mode 100644 index 000000000000..31d42060d9dd --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-computelimit/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.computelimit.implementation.GuestSubscriptionsClientImpl$GuestSubscriptionsService"],["com.azure.resourcemanager.computelimit.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.computelimit.implementation.SharedLimitsClientImpl$SharedLimitsService"]] \ No newline at end of file diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-computelimit/reflect-config.json b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-computelimit/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-computelimit/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/azure-resourcemanager-computelimit.properties b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/azure-resourcemanager-computelimit.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/main/resources/azure-resourcemanager-computelimit.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsCreateSamples.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsCreateSamples.java new file mode 100644 index 000000000000..f63048609e3f --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsCreateSamples.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.computelimit.generated; + +import com.azure.resourcemanager.computelimit.models.GuestSubscriptionProperties; + +/** + * Samples for GuestSubscriptions Create. + */ +public final class GuestSubscriptionsCreateSamples { + /* + * x-ms-original-file: 2025-08-15/GuestSubscriptions_Create.json + */ + /** + * Sample code: Create a guest subscription. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void createAGuestSubscription(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.guestSubscriptions() + .define("11111111-1111-1111-1111-111111111111") + .withExistingLocation("eastus") + .withProperties(new GuestSubscriptionProperties()) + .create(); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsDeleteSamples.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsDeleteSamples.java new file mode 100644 index 000000000000..8feea3e2f2be --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.generated; + +/** + * Samples for GuestSubscriptions Delete. + */ +public final class GuestSubscriptionsDeleteSamples { + /* + * x-ms-original-file: 2025-08-15/GuestSubscriptions_Delete.json + */ + /** + * Sample code: Delete a guest subscription. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void deleteAGuestSubscription(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.guestSubscriptions() + .deleteByResourceGroupWithResponse("eastus", "11111111-1111-1111-1111-111111111111", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsGetSamples.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsGetSamples.java new file mode 100644 index 000000000000..d0ad7032e1cd --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsGetSamples.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.computelimit.generated; + +/** + * Samples for GuestSubscriptions Get. + */ +public final class GuestSubscriptionsGetSamples { + /* + * x-ms-original-file: 2025-08-15/GuestSubscriptions_Get.json + */ + /** + * Sample code: Get a guest subscription. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void getAGuestSubscription(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.guestSubscriptions() + .getWithResponse("eastus", "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsListBySubscriptionLocationResourceSamples.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsListBySubscriptionLocationResourceSamples.java new file mode 100644 index 000000000000..266fcac71fbc --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsListBySubscriptionLocationResourceSamples.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.computelimit.generated; + +/** + * Samples for GuestSubscriptions ListBySubscriptionLocationResource. + */ +public final class GuestSubscriptionsListBySubscriptionLocationResourceSamples { + /* + * x-ms-original-file: 2025-08-15/GuestSubscriptions_List.json + */ + /** + * Sample code: List guest subscriptions for a scope. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void + listGuestSubscriptionsForAScope(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.guestSubscriptions().listBySubscriptionLocationResource("eastus", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/OperationsListSamples.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/OperationsListSamples.java new file mode 100644 index 000000000000..20fc786b9b1b --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/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.computelimit.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-08-15/Operations_List.json + */ + /** + * Sample code: List operations. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void listOperations(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsCreateSamples.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsCreateSamples.java new file mode 100644 index 000000000000..99cabc0dcdd3 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsCreateSamples.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.computelimit.generated; + +import com.azure.resourcemanager.computelimit.models.SharedLimitProperties; + +/** + * Samples for SharedLimits Create. + */ +public final class SharedLimitsCreateSamples { + /* + * x-ms-original-file: 2025-08-15/SharedLimits_Create.json + */ + /** + * Sample code: Create a shared limit. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void createASharedLimit(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.sharedLimits() + .define("StandardDSv3Family") + .withExistingLocation("eastus") + .withProperties(new SharedLimitProperties()) + .create(); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsDeleteSamples.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsDeleteSamples.java new file mode 100644 index 000000000000..488f41e8e5f8 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsDeleteSamples.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.computelimit.generated; + +/** + * Samples for SharedLimits Delete. + */ +public final class SharedLimitsDeleteSamples { + /* + * x-ms-original-file: 2025-08-15/SharedLimits_Delete.json + */ + /** + * Sample code: Delete a shared limit. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void deleteASharedLimit(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.sharedLimits() + .deleteByResourceGroupWithResponse("eastus", "StandardDSv3Family", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsGetSamples.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsGetSamples.java new file mode 100644 index 000000000000..cb58d0f2c6b3 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsGetSamples.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.computelimit.generated; + +/** + * Samples for SharedLimits Get. + */ +public final class SharedLimitsGetSamples { + /* + * x-ms-original-file: 2025-08-15/SharedLimits_Get.json + */ + /** + * Sample code: Get a shared limit. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void getASharedLimit(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.sharedLimits().getWithResponse("eastus", "StandardDSv3Family", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsListBySubscriptionLocationResourceSamples.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsListBySubscriptionLocationResourceSamples.java new file mode 100644 index 000000000000..1d239b10abc9 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/samples/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsListBySubscriptionLocationResourceSamples.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.computelimit.generated; + +/** + * Samples for SharedLimits ListBySubscriptionLocationResource. + */ +public final class SharedLimitsListBySubscriptionLocationResourceSamples { + /* + * x-ms-original-file: 2025-08-15/SharedLimits_List.json + */ + /** + * Sample code: List all shared limits for a scope. + * + * @param manager Entry point to ComputeLimitManager. + */ + public static void + listAllSharedLimitsForAScope(com.azure.resourcemanager.computelimit.ComputeLimitManager manager) { + manager.sharedLimits().listBySubscriptionLocationResource("eastus", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionInnerTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionInnerTests.java new file mode 100644 index 000000000000..64d50ae36ca6 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionInnerTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.computelimit.fluent.models.GuestSubscriptionInner; +import com.azure.resourcemanager.computelimit.models.GuestSubscriptionProperties; + +public final class GuestSubscriptionInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GuestSubscriptionInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Canceled\"},\"id\":\"pzvgnwzsymglzufc\",\"name\":\"zk\",\"type\":\"hdbihan\"}") + .toObject(GuestSubscriptionInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GuestSubscriptionInner model = new GuestSubscriptionInner().withProperties(new GuestSubscriptionProperties()); + model = BinaryData.fromObject(model).toObject(GuestSubscriptionInner.class); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionListResultTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionListResultTests.java new file mode 100644 index 000000000000..613f1131708e --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionListResultTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.computelimit.implementation.models.GuestSubscriptionListResult; +import org.junit.jupiter.api.Assertions; + +public final class GuestSubscriptionListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GuestSubscriptionListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\"},\"id\":\"s\",\"name\":\"git\",\"type\":\"xqhabi\"},{\"properties\":{\"provisioningState\":\"Canceled\"},\"id\":\"wczbys\",\"name\":\"npqxuh\",\"type\":\"vyq\"},{\"properties\":{\"provisioningState\":\"Failed\"},\"id\":\"br\",\"name\":\"xvd\",\"type\":\"mjgr\"},{\"properties\":{\"provisioningState\":\"Failed\"},\"id\":\"k\",\"name\":\"gaudcc\",\"type\":\"nhsjcnyej\"}],\"nextLink\":\"ryhtnapczwlokjy\"}") + .toObject(GuestSubscriptionListResult.class); + Assertions.assertEquals("ryhtnapczwlokjy", model.nextLink()); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionPropertiesTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionPropertiesTests.java new file mode 100644 index 000000000000..337996a66cc7 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionPropertiesTests.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.computelimit.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.computelimit.models.GuestSubscriptionProperties; + +public final class GuestSubscriptionPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GuestSubscriptionProperties model + = BinaryData.fromString("{\"provisioningState\":\"Failed\"}").toObject(GuestSubscriptionProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GuestSubscriptionProperties model = new GuestSubscriptionProperties(); + model = BinaryData.fromObject(model).toObject(GuestSubscriptionProperties.class); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsCreateWithResponseMockTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsCreateWithResponseMockTests.java new file mode 100644 index 000000000000..3f90db38c35f --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsCreateWithResponseMockTests.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.computelimit.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.computelimit.ComputeLimitManager; +import com.azure.resourcemanager.computelimit.models.GuestSubscription; +import com.azure.resourcemanager.computelimit.models.GuestSubscriptionProperties; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class GuestSubscriptionsCreateWithResponseMockTests { + @Test + public void testCreateWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\"},\"id\":\"ujitcjcz\",\"name\":\"zevndhkrwpdappds\",\"type\":\"dkvwrwjfe\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ComputeLimitManager manager = ComputeLimitManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + GuestSubscription response = manager.guestSubscriptions() + .define("gls") + .withExistingLocation("biksq") + .withProperties(new GuestSubscriptionProperties()) + .create(); + + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsDeleteByResourceGroupWithResponseMockTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsDeleteByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..65456dae126b --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsDeleteByResourceGroupWithResponseMockTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.computelimit.ComputeLimitManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class GuestSubscriptionsDeleteByResourceGroupWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ComputeLimitManager manager = ComputeLimitManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.guestSubscriptions() + .deleteByResourceGroupWithResponse("v", "smjqulngsntnbyb", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsGetWithResponseMockTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsGetWithResponseMockTests.java new file mode 100644 index 000000000000..f4668d73b29e --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsGetWithResponseMockTests.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.computelimit.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.computelimit.ComputeLimitManager; +import com.azure.resourcemanager.computelimit.models.GuestSubscription; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class GuestSubscriptionsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Canceled\"},\"id\":\"vtz\",\"name\":\"kufubljo\",\"type\":\"xqeofjaeqjhqjba\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ComputeLimitManager manager = ComputeLimitManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + GuestSubscription response = manager.guestSubscriptions() + .getWithResponse("hungbwjzrnf", "gxg", com.azure.core.util.Context.NONE) + .getValue(); + + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsListBySubscriptionLocationResourceMockTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsListBySubscriptionLocationResourceMockTests.java new file mode 100644 index 000000000000..de3d4adfeda7 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/GuestSubscriptionsListBySubscriptionLocationResourceMockTests.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.computelimit.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.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.computelimit.ComputeLimitManager; +import com.azure.resourcemanager.computelimit.models.GuestSubscription; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class GuestSubscriptionsListBySubscriptionLocationResourceMockTests { + @Test + public void testListBySubscriptionLocationResource() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\"},\"id\":\"rljdouskcqv\",\"name\":\"ocrcjdk\",\"type\":\"tnhxbn\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ComputeLimitManager manager = ComputeLimitManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.guestSubscriptions() + .listBySubscriptionLocationResource("zgcwrw", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/LimitNameTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/LimitNameTests.java new file mode 100644 index 000000000000..df0f7458d65c --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/LimitNameTests.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.computelimit.models.LimitName; +import org.junit.jupiter.api.Assertions; + +public final class LimitNameTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LimitName model = BinaryData.fromString("{\"value\":\"lwejdpv\",\"localizedValue\":\"yoqpsoaccta\"}") + .toObject(LimitName.class); + Assertions.assertEquals("lwejdpv", model.value()); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/OperationDisplayTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..8cc6936fcdcd --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/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.computelimit.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.computelimit.models.OperationDisplay; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = BinaryData.fromString( + "{\"provider\":\"cdm\",\"resource\":\"rcryuanzwuxzdxta\",\"operation\":\"lhmwhfpmrqobm\",\"description\":\"kknryrtihf\"}") + .toObject(OperationDisplay.class); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/OperationInnerTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/OperationInnerTests.java new file mode 100644 index 000000000000..f88787809d3c --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/OperationInnerTests.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.computelimit.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.computelimit.fluent.models.OperationInner; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = BinaryData.fromString( + "{\"name\":\"nygj\",\"isDataAction\":true,\"display\":{\"provider\":\"eqsrdeupewnwreit\",\"resource\":\"yflusarhmofc\",\"operation\":\"smy\",\"description\":\"kdtmlxhekuk\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/OperationListResultTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/OperationListResultTests.java new file mode 100644 index 000000000000..4121a64f7838 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/OperationListResultTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.computelimit.implementation.models.OperationListResult; +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\":\"hq\",\"isDataAction\":true,\"display\":{\"provider\":\"pybczmehmtzopb\",\"resource\":\"h\",\"operation\":\"pidgsybbejhphoyc\",\"description\":\"xaobhdxbmtqioqjz\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"fpownoizhwlr\",\"isDataAction\":false,\"display\":{\"provider\":\"oqijgkdmbpaz\",\"resource\":\"bc\",\"operation\":\"pdznrbtcqqjnqgl\",\"description\":\"gnufoooj\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"esaagdfm\",\"isDataAction\":true,\"display\":{\"provider\":\"j\",\"resource\":\"ifkwmrvktsizntoc\",\"operation\":\"a\",\"description\":\"ajpsquc\"},\"origin\":\"system\",\"actionType\":\"Internal\"}],\"nextLink\":\"kfo\"}") + .toObject(OperationListResult.class); + Assertions.assertEquals("kfo", model.nextLink()); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/OperationsListMockTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..d733409d4d20 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/OperationsListMockTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.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.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.computelimit.ComputeLimitManager; +import com.azure.resourcemanager.computelimit.models.Operation; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +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\":\"luwfzitonpeqfpjk\",\"isDataAction\":true,\"display\":{\"provider\":\"pdvhpfxxypin\",\"resource\":\"mayhuybbkpodepoo\",\"operation\":\"nuvamiheogna\",\"description\":\"zxtheotusivyevcc\"},\"origin\":\"user\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ComputeLimitManager manager = ComputeLimitManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitInnerTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitInnerTests.java new file mode 100644 index 000000000000..eda6396895ca --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitInnerTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.computelimit.fluent.models.SharedLimitInner; +import com.azure.resourcemanager.computelimit.models.SharedLimitProperties; + +public final class SharedLimitInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SharedLimitInner model = BinaryData.fromString( + "{\"properties\":{\"resourceName\":{\"value\":\"kvnipjoxz\",\"localizedValue\":\"chgejspodm\"},\"limit\":1543997460,\"unit\":\"ydehoj\",\"provisioningState\":\"Canceled\"},\"id\":\"uxinpmqnjaq\",\"name\":\"ixjsprozvcputeg\",\"type\":\"vwmf\"}") + .toObject(SharedLimitInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SharedLimitInner model = new SharedLimitInner().withProperties(new SharedLimitProperties()); + model = BinaryData.fromObject(model).toObject(SharedLimitInner.class); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitListResultTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitListResultTests.java new file mode 100644 index 000000000000..4cf7132f2d6b --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitListResultTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.computelimit.implementation.models.SharedLimitListResult; +import org.junit.jupiter.api.Assertions; + +public final class SharedLimitListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SharedLimitListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"resourceName\":{\"value\":\"j\",\"localizedValue\":\"hbcryffdfdosyge\"},\"limit\":1743197151,\"unit\":\"jakhmsbzjh\",\"provisioningState\":\"Succeeded\"},\"id\":\"vdphlxaolthqtr\",\"name\":\"qjbpfzfsin\",\"type\":\"gvfcj\"}],\"nextLink\":\"zoxxjtf\"}") + .toObject(SharedLimitListResult.class); + Assertions.assertEquals("zoxxjtf", model.nextLink()); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitPropertiesTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitPropertiesTests.java new file mode 100644 index 000000000000..b1dbc8dead94 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitPropertiesTests.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.computelimit.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.computelimit.models.SharedLimitProperties; + +public final class SharedLimitPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SharedLimitProperties model = BinaryData.fromString( + "{\"resourceName\":{\"value\":\"t\",\"localizedValue\":\"mdvpjhulsu\"},\"limit\":90442475,\"unit\":\"jozkrwfndiod\",\"provisioningState\":\"Canceled\"}") + .toObject(SharedLimitProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SharedLimitProperties model = new SharedLimitProperties(); + model = BinaryData.fromObject(model).toObject(SharedLimitProperties.class); + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsCreateWithResponseMockTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsCreateWithResponseMockTests.java new file mode 100644 index 000000000000..27f53c499d42 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsCreateWithResponseMockTests.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.computelimit.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.computelimit.ComputeLimitManager; +import com.azure.resourcemanager.computelimit.models.SharedLimit; +import com.azure.resourcemanager.computelimit.models.SharedLimitProperties; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SharedLimitsCreateWithResponseMockTests { + @Test + public void testCreateWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"resourceName\":{\"value\":\"yjgzjaoyfhrtxiln\",\"localizedValue\":\"kujysvlejuvfq\"},\"limit\":1135390068,\"unit\":\"yxwjkcp\",\"provisioningState\":\"Canceled\"},\"id\":\"b\",\"name\":\"gjvtbv\",\"type\":\"ysszdnrujqguh\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ComputeLimitManager manager = ComputeLimitManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SharedLimit response = manager.sharedLimits() + .define("modmglougpb") + .withExistingLocation("iqfouflmmnkz") + .withProperties(new SharedLimitProperties()) + .create(); + + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsDeleteByResourceGroupWithResponseMockTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsDeleteByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..edbb30d559e9 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsDeleteByResourceGroupWithResponseMockTests.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.computelimit.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.computelimit.ComputeLimitManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SharedLimitsDeleteByResourceGroupWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ComputeLimitManager manager = ComputeLimitManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.sharedLimits().deleteByResourceGroupWithResponse("kjfkg", "awxklr", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsGetWithResponseMockTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsGetWithResponseMockTests.java new file mode 100644 index 000000000000..ede1d772a190 --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsGetWithResponseMockTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computelimit.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.computelimit.ComputeLimitManager; +import com.azure.resourcemanager.computelimit.models.SharedLimit; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SharedLimitsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"resourceName\":{\"value\":\"rl\",\"localizedValue\":\"ugjzzdatqxhocdge\"},\"limit\":1293628182,\"unit\":\"phut\",\"provisioningState\":\"Succeeded\"},\"id\":\"vkaozwyiftyhxhur\",\"name\":\"k\",\"type\":\"tyxolniwpwc\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ComputeLimitManager manager = ComputeLimitManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SharedLimit response + = manager.sharedLimits().getWithResponse("snhu", "je", com.azure.core.util.Context.NONE).getValue(); + + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsListBySubscriptionLocationResourceMockTests.java b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsListBySubscriptionLocationResourceMockTests.java new file mode 100644 index 000000000000..961c1ca5c66a --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/src/test/java/com/azure/resourcemanager/computelimit/generated/SharedLimitsListBySubscriptionLocationResourceMockTests.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.computelimit.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.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.computelimit.ComputeLimitManager; +import com.azure.resourcemanager.computelimit.models.SharedLimit; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SharedLimitsListBySubscriptionLocationResourceMockTests { + @Test + public void testListBySubscriptionLocationResource() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"resourceName\":{\"value\":\"nddhsgcbacph\",\"localizedValue\":\"koty\"},\"limit\":757698897,\"unit\":\"ulzndlikwyqk\",\"provisioningState\":\"Succeeded\"},\"id\":\"bmadgak\",\"name\":\"qsrxybzqqed\",\"type\":\"ytb\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ComputeLimitManager manager = ComputeLimitManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.sharedLimits().listBySubscriptionLocationResource("plwckbas", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/tsp-location.yaml b/sdk/computelimit/azure-resourcemanager-computelimit/tsp-location.yaml new file mode 100644 index 000000000000..db509f5ecc4a --- /dev/null +++ b/sdk/computelimit/azure-resourcemanager-computelimit/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/computelimit/resource-manager/Microsoft.ComputeLimit/ComputeLimit +commit: 257777bd5dd2cec7c658f4517b030ae4d65e0812 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/computelimit/ci.yml b/sdk/computelimit/ci.yml new file mode 100644 index 000000000000..5d01a8ae2ee1 --- /dev/null +++ b/sdk/computelimit/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/computelimit/ci.yml + - sdk/computelimit/azure-resourcemanager-computelimit/ + exclude: + - sdk/computelimit/pom.xml + - sdk/computelimit/azure-resourcemanager-computelimit/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/computelimit/ci.yml + - sdk/computelimit/azure-resourcemanager-computelimit/ + exclude: + - sdk/computelimit/pom.xml + - sdk/computelimit/azure-resourcemanager-computelimit/pom.xml + +parameters: + - name: release_azureresourcemanagercomputelimit + displayName: azure-resourcemanager-computelimit + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: computelimit + Artifacts: + - name: azure-resourcemanager-computelimit + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercomputelimit + releaseInBatch: ${{ parameters.release_azureresourcemanagercomputelimit }} diff --git a/sdk/computelimit/pom.xml b/sdk/computelimit/pom.xml new file mode 100644 index 000000000000..30049459d375 --- /dev/null +++ b/sdk/computelimit/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-computelimit-service + pom + 1.0.0 + + + azure-resourcemanager-computelimit + + From 2d16e9bd3197864b26ae2096bacfae050f30d44e Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Tue, 11 Nov 2025 02:05:09 +0000 Subject: [PATCH 2/3] Configurations: 'specification/computelimit/resource-manager/Microsoft.ComputeLimit/ComputeLimit/tspconfig.yaml', API Version: 2025-08-15, SDK Release Type: beta, and CommitSHA: '1d3ac611f503e05650fb85520582b06140d2599e' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5556338 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../azure-resourcemanager-computelimit/CHANGELOG.md | 3 ++- .../azure-resourcemanager-computelimit/tsp-location.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/CHANGELOG.md b/sdk/computelimit/azure-resourcemanager-computelimit/CHANGELOG.md index 28667282bd87..c9bdfb7acbb5 100644 --- a/sdk/computelimit/azure-resourcemanager-computelimit/CHANGELOG.md +++ b/sdk/computelimit/azure-resourcemanager-computelimit/CHANGELOG.md @@ -1,8 +1,9 @@ # Release History -## 1.0.0 (2025-11-06) +## 1.0.0 (2025-11-11) - Azure Resource Manager ComputeLimit client library for Java. This package contains Microsoft Azure SDK for ComputeLimit Management SDK. Microsoft Azure Compute Limit Resource Provider. Package api-version 2025-08-15. 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-computelimit Java SDK. + diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/tsp-location.yaml b/sdk/computelimit/azure-resourcemanager-computelimit/tsp-location.yaml index db509f5ecc4a..6ea453978a76 100644 --- a/sdk/computelimit/azure-resourcemanager-computelimit/tsp-location.yaml +++ b/sdk/computelimit/azure-resourcemanager-computelimit/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/computelimit/resource-manager/Microsoft.ComputeLimit/ComputeLimit -commit: 257777bd5dd2cec7c658f4517b030ae4d65e0812 +commit: 1d3ac611f503e05650fb85520582b06140d2599e repo: Azure/azure-rest-api-specs additionalDirectories: From f20a272333ec1dac31c57e93d4eb9542de3dd3b7 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Tue, 11 Nov 2025 10:13:45 +0800 Subject: [PATCH 3/3] switch to beta --- eng/versioning/version_client.txt | 2 +- .../azure-resourcemanager-computelimit/CHANGELOG.md | 2 +- sdk/computelimit/azure-resourcemanager-computelimit/README.md | 2 +- sdk/computelimit/azure-resourcemanager-computelimit/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 5b506700b0ed..bad77647a13e 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -512,7 +512,7 @@ com.azure.resourcemanager:azure-resourcemanager-azurestackhci-vm;1.0.0-beta.1;1. com.azure.resourcemanager:azure-resourcemanager-workloadorchestration;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-disconnectedoperations;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-compute-recommender;1.0.0-beta.1;1.0.0-beta.2 -com.azure.resourcemanager:azure-resourcemanager-computelimit;1.0.0;1.0.0 +com.azure.resourcemanager:azure-resourcemanager-computelimit;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 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.2;2.0.0-beta.2 diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/CHANGELOG.md b/sdk/computelimit/azure-resourcemanager-computelimit/CHANGELOG.md index c9bdfb7acbb5..2f36be980a7b 100644 --- a/sdk/computelimit/azure-resourcemanager-computelimit/CHANGELOG.md +++ b/sdk/computelimit/azure-resourcemanager-computelimit/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0 (2025-11-11) +## 1.0.0-beta.1 (2025-11-11) - Azure Resource Manager ComputeLimit client library for Java. This package contains Microsoft Azure SDK for ComputeLimit Management SDK. Microsoft Azure Compute Limit Resource Provider. Package api-version 2025-08-15. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Features Added diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/README.md b/sdk/computelimit/azure-resourcemanager-computelimit/README.md index 08a4f012120f..79f527144d67 100644 --- a/sdk/computelimit/azure-resourcemanager-computelimit/README.md +++ b/sdk/computelimit/azure-resourcemanager-computelimit/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-computelimit - 1.0.0 + 1.0.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/computelimit/azure-resourcemanager-computelimit/pom.xml b/sdk/computelimit/azure-resourcemanager-computelimit/pom.xml index fc438c4bb3cb..aef5c1cbd529 100644 --- a/sdk/computelimit/azure-resourcemanager-computelimit/pom.xml +++ b/sdk/computelimit/azure-resourcemanager-computelimit/pom.xml @@ -14,7 +14,7 @@ com.azure.resourcemanager azure-resourcemanager-computelimit - 1.0.0 + 1.0.0-beta.1 jar Microsoft Azure SDK for ComputeLimit Management