From 477a7e3dae035a41b93e274998a40816d36e22c0 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 31 Mar 2025 18:39:06 +0000 Subject: [PATCH] CodeGen from PR 33586 in Azure/azure-rest-api-specs Merge 62b9bdccffef720abb98542aeacba00972fadb9d into a2cf44d885881e99850cbdb0d86b817c5489def2 --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 8 + .../README.md | 102 ++ .../SAMPLE.md | 284 ++++ .../pom.xml | 74 + .../AgriculturePlatformManager.java | 297 ++++ .../fluent/AgriServicesClient.java | 306 ++++ .../fluent/AgriculturePlatformMgmtClient.java | 62 + .../fluent/OperationsClient.java | 40 + .../models/AgriServiceResourceInner.java | 256 +++ .../AvailableAgriSolutionListResultInner.java | 99 ++ .../fluent/models/OperationInner.java | 159 ++ .../fluent/models/package-info.java | 8 + .../fluent/package-info.java | 8 + .../AgriServiceResourceImpl.java | 226 +++ .../AgriServicesClientImpl.java | 1456 +++++++++++++++++ .../implementation/AgriServicesImpl.java | 173 ++ .../AgriculturePlatformMgmtClientBuilder.java | 138 ++ .../AgriculturePlatformMgmtClientImpl.java | 304 ++++ .../AvailableAgriSolutionListResultImpl.java | 40 + .../implementation/OperationImpl.java | 51 + .../implementation/OperationsClientImpl.java | 235 +++ .../implementation/OperationsImpl.java | 45 + .../implementation/ResourceManagerUtils.java | 195 +++ .../models/AgriServiceResourceListResult.java | 115 ++ .../models/OperationListResult.java | 113 ++ .../implementation/package-info.java | 8 + .../models/ActionType.java | 46 + .../models/AgriServiceConfig.java | 177 ++ .../models/AgriServiceResource.java | 354 ++++ .../models/AgriServiceResourceProperties.java | 204 +++ .../models/AgriServiceResourceUpdate.java | 189 +++ .../AgriServiceResourceUpdateProperties.java | 168 ++ .../models/AgriServices.java | 184 +++ .../models/AuthCredentialsKind.java | 51 + .../AvailableAgriSolutionListResult.java | 28 + .../models/DataConnectorCredentialMap.java | 136 ++ .../models/DataConnectorCredentials.java | 207 +++ .../DataManagerForAgricultureSolution.java | 275 ++++ .../models/InstalledSolutionMap.java | 135 ++ .../ManagedOnBehalfOfConfiguration.java | 89 + .../models/ManagedServiceIdentity.java | 176 ++ .../models/ManagedServiceIdentityType.java | 62 + .../models/MarketPlaceOfferDetails.java | 113 ++ .../models/MoboBrokerResource.java | 87 + .../agricultureplatform/models/Operation.java | 58 + .../models/OperationDisplay.java | 136 ++ .../models/Operations.java | 35 + .../agricultureplatform/models/Origin.java | 57 + .../models/ProvisioningState.java | 76 + .../agricultureplatform/models/Sku.java | 223 +++ .../agricultureplatform/models/SkuTier.java | 67 + .../agricultureplatform/models/Solution.java | 233 +++ .../models/UserAssignedIdentity.java | 97 ++ .../models/package-info.java | 8 + .../agricultureplatform/package-info.java | 8 + .../src/main/java/module-info.java | 16 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + ...urcemanager-agricultureplatform.properties | 1 + .../AgriServiceCreateOrUpdateSamples.java | 68 + .../generated/AgriServiceDeleteSamples.java | 23 + .../AgriServiceGetByResourceGroupSamples.java | 23 + ...iServiceListAvailableSolutionsSamples.java | 24 + ...AgriServiceListByResourceGroupSamples.java | 23 + .../generated/AgriServiceListSamples.java | 23 + .../generated/AgriServiceUpdateSamples.java | 69 + .../generated/OperationsListSamples.java | 23 + ...ailableSolutionsWithResponseMockTests.java | 50 + ...lableAgriSolutionListResultInnerTests.java | 30 + ...ataManagerForAgricultureSolutionTests.java | 28 + .../ManagedOnBehalfOfConfigurationTests.java | 17 + .../ManagedServiceIdentityTests.java | 44 + .../MarketPlaceOfferDetailsTests.java | 20 + .../generated/MoboBrokerResourceTests.java | 16 + .../generated/OperationDisplayTests.java | 17 + .../generated/OperationInnerTests.java | 17 + .../generated/OperationListResultTests.java | 19 + .../generated/OperationsListMockTests.java | 36 + .../generated/SkuTests.java | 39 + .../generated/SolutionTests.java | 41 + .../generated/UserAssignedIdentityTests.java | 22 + .../tsp-location.yaml | 4 + sdk/agricultureplatform/ci.yml | 46 + sdk/agricultureplatform/pom.xml | 15 + 86 files changed, 9239 insertions(+) create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/CHANGELOG.md create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/README.md create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/SAMPLE.md create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/pom.xml create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/AgriculturePlatformManager.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/AgriServicesClient.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/AgriculturePlatformMgmtClient.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/OperationsClient.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/models/AgriServiceResourceInner.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/models/AvailableAgriSolutionListResultInner.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/models/OperationInner.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/models/package-info.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/package-info.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriServiceResourceImpl.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriServicesClientImpl.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriServicesImpl.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriculturePlatformMgmtClientBuilder.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriculturePlatformMgmtClientImpl.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AvailableAgriSolutionListResultImpl.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/OperationImpl.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/OperationsClientImpl.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/OperationsImpl.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/ResourceManagerUtils.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/models/AgriServiceResourceListResult.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/models/OperationListResult.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/package-info.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ActionType.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceConfig.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceResource.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceResourceProperties.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceResourceUpdate.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceResourceUpdateProperties.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServices.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AuthCredentialsKind.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AvailableAgriSolutionListResult.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/DataConnectorCredentialMap.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/DataConnectorCredentials.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/DataManagerForAgricultureSolution.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/InstalledSolutionMap.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ManagedOnBehalfOfConfiguration.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ManagedServiceIdentity.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ManagedServiceIdentityType.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/MarketPlaceOfferDetails.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/MoboBrokerResource.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/Operation.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/OperationDisplay.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/Operations.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/Origin.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ProvisioningState.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/Sku.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/SkuTier.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/Solution.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/UserAssignedIdentity.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/package-info.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/package-info.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/module-info.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-agricultureplatform/proxy-config.json create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-agricultureplatform/reflect-config.json create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/resources/azure-resourcemanager-agricultureplatform.properties create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceCreateOrUpdateSamples.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceDeleteSamples.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceGetByResourceGroupSamples.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceListAvailableSolutionsSamples.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceListByResourceGroupSamples.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceListSamples.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceUpdateSamples.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/OperationsListSamples.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServicesListAvailableSolutionsWithResponseMockTests.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/AvailableAgriSolutionListResultInnerTests.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/DataManagerForAgricultureSolutionTests.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/ManagedOnBehalfOfConfigurationTests.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/ManagedServiceIdentityTests.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/MarketPlaceOfferDetailsTests.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/MoboBrokerResourceTests.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/OperationDisplayTests.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/OperationInnerTests.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/OperationListResultTests.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/OperationsListMockTests.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/SkuTests.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/SolutionTests.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/UserAssignedIdentityTests.java create mode 100644 sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/tsp-location.yaml create mode 100644 sdk/agricultureplatform/ci.yml create mode 100644 sdk/agricultureplatform/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 6ed7a9a70c04..65877e54f027 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -473,6 +473,7 @@ com.azure.resourcemanager:azure-resourcemanager-databasewatcher;1.0.0-beta.1;1.0 com.azure.resourcemanager:azure-resourcemanager-durabletask;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-arizeaiobservabilityeval;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-weightsandbiases;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-agricultureplatform;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.1;2.0.0-beta.1 diff --git a/pom.xml b/pom.xml index d4acc28f0b0f..151f783883f7 100644 --- a/pom.xml +++ b/pom.xml @@ -12,6 +12,7 @@ common/perf-test-core eng/code-quality-reports sdk/advisor + sdk/agricultureplatform sdk/agrifood sdk/ai sdk/alertsmanagement diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/CHANGELOG.md b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/CHANGELOG.md new file mode 100644 index 000000000000..3994b4ed98a9 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2025-03-31) + +- Azure Resource Manager Agriculture Platform client library for Java. This package contains Microsoft Azure SDK for Agriculture Platform Management SDK. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-agricultureplatform Java SDK. diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/README.md b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/README.md new file mode 100644 index 000000000000..dbbccfa06344 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Agriculture Platform client library for Java + +Azure Resource Manager Agriculture Platform client library for Java. + +This package contains Microsoft Azure SDK for Agriculture Platform Management SDK. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-agricultureplatform;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-agricultureplatform + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +AgriculturePlatformManager manager = AgriculturePlatformManager + .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/agricultureplatform/azure-resourcemanager-agricultureplatform/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/agricultureplatform/azure-resourcemanager-agricultureplatform/SAMPLE.md b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/SAMPLE.md new file mode 100644 index 000000000000..9484df61146b --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/SAMPLE.md @@ -0,0 +1,284 @@ +# Code snippets and samples + + +## AgriService + +- [CreateOrUpdate](#agriservice_createorupdate) +- [Delete](#agriservice_delete) +- [GetByResourceGroup](#agriservice_getbyresourcegroup) +- [List](#agriservice_list) +- [ListAvailableSolutions](#agriservice_listavailablesolutions) +- [ListByResourceGroup](#agriservice_listbyresourcegroup) +- [Update](#agriservice_update) + +## Operations + +- [List](#operations_list) +### AgriService_CreateOrUpdate + +```java +import com.azure.resourcemanager.agricultureplatform.models.AgriServiceConfig; +import com.azure.resourcemanager.agricultureplatform.models.AgriServiceResourceProperties; +import com.azure.resourcemanager.agricultureplatform.models.DataConnectorCredentialMap; +import com.azure.resourcemanager.agricultureplatform.models.DataConnectorCredentials; +import com.azure.resourcemanager.agricultureplatform.models.InstalledSolutionMap; +import com.azure.resourcemanager.agricultureplatform.models.ManagedServiceIdentity; +import com.azure.resourcemanager.agricultureplatform.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.agricultureplatform.models.Sku; +import com.azure.resourcemanager.agricultureplatform.models.SkuTier; +import com.azure.resourcemanager.agricultureplatform.models.Solution; +import com.azure.resourcemanager.agricultureplatform.models.UserAssignedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for AgriService CreateOrUpdate. + */ +public final class AgriServiceCreateOrUpdateSamples { + /* + * x-ms-original-file: 2024-06-01-preview/AgriService_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: AgriService_CreateOrUpdate. + * + * @param manager Entry point to AgriculturePlatformManager. + */ + public static void + agriServiceCreateOrUpdate(com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager) { + manager.agriServices() + .define("abc123") + .withRegion("pkneuknooprpqirnugzwbkiie") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("key137", "fakeTokenPlaceholder")) + .withProperties(new AgriServiceResourceProperties().withConfig(new AgriServiceConfig()) + .withDataConnectorCredentials(Arrays.asList(new DataConnectorCredentialMap() + .withKey("fakeTokenPlaceholder") + .withValue(new DataConnectorCredentials().withClientId("dce298a8-1eec-481a-a8f9-a3cd5a8257b2")))) + .withInstalledSolutions(Arrays.asList(new InstalledSolutionMap().withKey("fakeTokenPlaceholder") + .withValue(new Solution().withApplicationName("bayerAgPowered.cwum"))))) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("key4955", new UserAssignedIdentity()))) + .withSku(new Sku().withName("kfl") + .withTier(SkuTier.FREE) + .withSize("r") + .withFamily("xerdhxyjwrypvxphavgrtjphtohf") + .withCapacity(20)) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### AgriService_Delete + +```java +/** + * Samples for AgriService GetByResourceGroup. + */ +public final class AgriServiceGetByResourceGroupSamples { + /* + * x-ms-original-file: 2024-06-01-preview/AgriService_Get_MaximumSet_Gen.json + */ + /** + * Sample code: AgriService_Get. + * + * @param manager Entry point to AgriculturePlatformManager. + */ + public static void + agriServiceGet(com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager) { + manager.agriServices().getByResourceGroupWithResponse("rgopenapi", "abc123", com.azure.core.util.Context.NONE); + } +} +``` + +### AgriService_GetByResourceGroup + +```java +/** + * Samples for AgriService ListAvailableSolutions. + */ +public final class AgriServiceListAvailableSolutionsSamples { + /* + * x-ms-original-file: 2024-06-01-preview/AgriService_ListAvailableSolutions_MaximumSet_Gen.json + */ + /** + * Sample code: AgriService_ListAvailableSolutions. + * + * @param manager Entry point to AgriculturePlatformManager. + */ + public static void agriServiceListAvailableSolutions( + com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager) { + manager.agriServices() + .listAvailableSolutionsWithResponse("rgopenapi", "abc123", com.azure.core.util.Context.NONE); + } +} +``` + +### AgriService_List + +```java +import com.azure.resourcemanager.agricultureplatform.models.AgriServiceConfig; +import com.azure.resourcemanager.agricultureplatform.models.AgriServiceResource; +import com.azure.resourcemanager.agricultureplatform.models.AgriServiceResourceUpdateProperties; +import com.azure.resourcemanager.agricultureplatform.models.DataConnectorCredentialMap; +import com.azure.resourcemanager.agricultureplatform.models.DataConnectorCredentials; +import com.azure.resourcemanager.agricultureplatform.models.InstalledSolutionMap; +import com.azure.resourcemanager.agricultureplatform.models.ManagedServiceIdentity; +import com.azure.resourcemanager.agricultureplatform.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.agricultureplatform.models.Sku; +import com.azure.resourcemanager.agricultureplatform.models.SkuTier; +import com.azure.resourcemanager.agricultureplatform.models.Solution; +import com.azure.resourcemanager.agricultureplatform.models.UserAssignedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for AgriService Update. + */ +public final class AgriServiceUpdateSamples { + /* + * x-ms-original-file: 2024-06-01-preview/AgriService_Update_MaximumSet_Gen.json + */ + /** + * Sample code: AgriService_Update. + * + * @param manager Entry point to AgriculturePlatformManager. + */ + public static void + agriServiceUpdate(com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager) { + AgriServiceResource resource = manager.agriServices() + .getByResourceGroupWithResponse("rgopenapi", "abc123", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key9006", "fakeTokenPlaceholder")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("key4771", new UserAssignedIdentity()))) + .withSku(new Sku().withName("tbdtdfffkar") + .withTier(SkuTier.FREE) + .withSize("iusaqqj") + .withFamily("hxojswlgs") + .withCapacity(22)) + .withProperties(new AgriServiceResourceUpdateProperties().withConfig(new AgriServiceConfig()) + .withDataConnectorCredentials(Arrays.asList(new DataConnectorCredentialMap() + .withKey("fakeTokenPlaceholder") + .withValue(new DataConnectorCredentials().withClientId("dce298a8-1eec-481a-a8f9-a3cd5a8257b2")))) + .withInstalledSolutions(Arrays.asList(new InstalledSolutionMap().withKey("fakeTokenPlaceholder") + .withValue(new Solution().withApplicationName("bayerAgPowered.cwum"))))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### AgriService_ListAvailableSolutions + +```java +/** + * Samples for AgriService Delete. + */ +public final class AgriServiceDeleteSamples { + /* + * x-ms-original-file: 2024-06-01-preview/AgriService_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: AgriService_Delete. + * + * @param manager Entry point to AgriculturePlatformManager. + */ + public static void + agriServiceDelete(com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager) { + manager.agriServices().delete("rgopenapi", "abc123", com.azure.core.util.Context.NONE); + } +} +``` + +### AgriService_ListByResourceGroup + +```java +/** + * Samples for AgriService ListByResourceGroup. + */ +public final class AgriServiceListByResourceGroupSamples { + /* + * x-ms-original-file: 2024-06-01-preview/AgriService_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: AgriService_ListByResourceGroup. + * + * @param manager Entry point to AgriculturePlatformManager. + */ + public static void agriServiceListByResourceGroup( + com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager) { + manager.agriServices().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} +``` + +### AgriService_Update + +```java +/** + * Samples for AgriService List. + */ +public final class AgriServiceListSamples { + /* + * x-ms-original-file: 2024-06-01-preview/AgriService_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: AgriService_ListBySubscription. + * + * @param manager Entry point to AgriculturePlatformManager. + */ + public static void agriServiceListBySubscription( + com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager) { + manager.agriServices().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2024-06-01-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to AgriculturePlatformManager. + */ + public static void + operationsList(com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/pom.xml b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/pom.xml new file mode 100644 index 000000000000..9339e1b9a2b2 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-agricultureplatform + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Agriculture Platform Management + This package contains Microsoft Azure SDK for Agriculture Platform Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.55.3 + + + com.azure + azure-core-management + 1.17.0 + + + com.azure + azure-core-test + 1.27.0-beta.8 + test + + + com.azure + azure-identity + 1.15.4 + test + + + diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/AgriculturePlatformManager.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/AgriculturePlatformManager.java new file mode 100644 index 000000000000..d94c7fb959d4 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/AgriculturePlatformManager.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform; + +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.agricultureplatform.fluent.AgriculturePlatformMgmtClient; +import com.azure.resourcemanager.agricultureplatform.implementation.AgriServicesImpl; +import com.azure.resourcemanager.agricultureplatform.implementation.AgriculturePlatformMgmtClientBuilder; +import com.azure.resourcemanager.agricultureplatform.implementation.OperationsImpl; +import com.azure.resourcemanager.agricultureplatform.models.AgriServices; +import com.azure.resourcemanager.agricultureplatform.models.Operations; +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 AgriculturePlatformManager. + */ +public final class AgriculturePlatformManager { + private Operations operations; + + private AgriServices agriServices; + + private final AgriculturePlatformMgmtClient clientObject; + + private AgriculturePlatformManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new AgriculturePlatformMgmtClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Agriculture Platform service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Agriculture Platform service API instance. + */ + public static AgriculturePlatformManager 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 Agriculture Platform service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Agriculture Platform service API instance. + */ + public static AgriculturePlatformManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new AgriculturePlatformManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create AgriculturePlatformManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new AgriculturePlatformManager.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-agricultureplatform.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 Agriculture Platform service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Agriculture Platform service API instance. + */ + public AgriculturePlatformManager 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.agricultureplatform") + .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 AgriculturePlatformManager(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 AgriServices. It manages AgriServiceResource. + * + * @return Resource collection API of AgriServices. + */ + public AgriServices agriServices() { + if (this.agriServices == null) { + this.agriServices = new AgriServicesImpl(clientObject.getAgriServices(), this); + } + return agriServices; + } + + /** + * Gets wrapped service client AgriculturePlatformMgmtClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client AgriculturePlatformMgmtClient. + */ + public AgriculturePlatformMgmtClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/AgriServicesClient.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/AgriServicesClient.java new file mode 100644 index 000000000000..d69e25efdea2 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/AgriServicesClient.java @@ -0,0 +1,306 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.agricultureplatform.fluent.models.AgriServiceResourceInner; +import com.azure.resourcemanager.agricultureplatform.fluent.models.AvailableAgriSolutionListResultInner; +import com.azure.resourcemanager.agricultureplatform.models.AgriServiceResourceUpdate; + +/** + * An instance of this class provides access to all the operations defined in AgriServicesClient. + */ +public interface AgriServicesClient { + /** + * Get a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a AgriServiceResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String agriServiceResourceName, Context context); + + /** + * Get a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 AgriServiceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AgriServiceResourceInner getByResourceGroup(String resourceGroupName, String agriServiceResourceName); + + /** + * Create a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of schema of the AgriService resource from + * Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AgriServiceResourceInner> beginCreateOrUpdate( + String resourceGroupName, String agriServiceResourceName, AgriServiceResourceInner resource); + + /** + * Create a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of schema of the AgriService resource from + * Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AgriServiceResourceInner> beginCreateOrUpdate( + String resourceGroupName, String agriServiceResourceName, AgriServiceResourceInner resource, Context context); + + /** + * Create a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @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 schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AgriServiceResourceInner createOrUpdate(String resourceGroupName, String agriServiceResourceName, + AgriServiceResourceInner resource); + + /** + * Create a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @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 schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AgriServiceResourceInner createOrUpdate(String resourceGroupName, String agriServiceResourceName, + AgriServiceResourceInner resource, Context context); + + /** + * Update a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of schema of the AgriService resource from + * Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AgriServiceResourceInner> beginUpdate(String resourceGroupName, + String agriServiceResourceName, AgriServiceResourceUpdate properties); + + /** + * Update a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of schema of the AgriService resource from + * Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AgriServiceResourceInner> beginUpdate(String resourceGroupName, + String agriServiceResourceName, AgriServiceResourceUpdate properties, Context context); + + /** + * Update a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AgriServiceResourceInner update(String resourceGroupName, String agriServiceResourceName, + AgriServiceResourceUpdate properties); + + /** + * Update a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AgriServiceResourceInner update(String resourceGroupName, String agriServiceResourceName, + AgriServiceResourceUpdate properties, Context context); + + /** + * Delete a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String agriServiceResourceName); + + /** + * Delete a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String agriServiceResourceName, + Context context); + + /** + * Delete a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String agriServiceResourceName); + + /** + * Delete a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String agriServiceResourceName, Context context); + + /** + * List AgriServiceResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List AgriServiceResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List AgriServiceResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List AgriServiceResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Returns the list of available agri solutions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of available agri solutions along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listAvailableSolutionsWithResponse(String resourceGroupName, + String agriServiceResourceName, Context context); + + /** + * Returns the list of available agri solutions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 list of available agri solutions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AvailableAgriSolutionListResultInner listAvailableSolutions(String resourceGroupName, + String agriServiceResourceName); +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/AgriculturePlatformMgmtClient.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/AgriculturePlatformMgmtClient.java new file mode 100644 index 000000000000..2fcaa4202f73 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/AgriculturePlatformMgmtClient.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for AgriculturePlatformMgmtClient class. + */ +public interface AgriculturePlatformMgmtClient { + /** + * 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 AgriServicesClient object to access its operations. + * + * @return the AgriServicesClient object. + */ + AgriServicesClient getAgriServices(); +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/OperationsClient.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/OperationsClient.java new file mode 100644 index 000000000000..e5a31436dde9 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/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.agricultureplatform.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.agricultureplatform.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/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/models/AgriServiceResourceInner.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/models/AgriServiceResourceInner.java new file mode 100644 index 000000000000..c808cdba61ba --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/models/AgriServiceResourceInner.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +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.agricultureplatform.models.AgriServiceResourceProperties; +import com.azure.resourcemanager.agricultureplatform.models.ManagedServiceIdentity; +import com.azure.resourcemanager.agricultureplatform.models.Sku; +import java.io.IOException; +import java.util.Map; + +/** + * Schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider. + */ +@Fluent +public final class AgriServiceResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private AgriServiceResourceProperties properties; + + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /* + * The SKU (Stock Keeping Unit) assigned to this resource. + */ + private Sku sku; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AgriServiceResourceInner class. + */ + public AgriServiceResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public AgriServiceResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the AgriServiceResourceInner object itself. + */ + public AgriServiceResourceInner withProperties(AgriServiceResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the AgriServiceResourceInner object itself. + */ + public AgriServiceResourceInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the sku property: The SKU (Stock Keeping Unit) assigned to this resource. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU (Stock Keeping Unit) assigned to this resource. + * + * @param sku the sku value to set. + * @return the AgriServiceResourceInner object itself. + */ + public AgriServiceResourceInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public AgriServiceResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AgriServiceResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (identity() != null) { + identity().validate(); + } + if (sku() != null) { + sku().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeJsonField("sku", this.sku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgriServiceResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgriServiceResourceInner 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 AgriServiceResourceInner. + */ + public static AgriServiceResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgriServiceResourceInner deserializedAgriServiceResourceInner = new AgriServiceResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAgriServiceResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAgriServiceResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAgriServiceResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedAgriServiceResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedAgriServiceResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedAgriServiceResourceInner.properties = AgriServiceResourceProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedAgriServiceResourceInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("sku".equals(fieldName)) { + deserializedAgriServiceResourceInner.sku = Sku.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedAgriServiceResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAgriServiceResourceInner; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/models/AvailableAgriSolutionListResultInner.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/models/AvailableAgriSolutionListResultInner.java new file mode 100644 index 000000000000..4f0c70c2dd9d --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/models/AvailableAgriSolutionListResultInner.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.agricultureplatform.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.agricultureplatform.models.DataManagerForAgricultureSolution; +import java.io.IOException; +import java.util.List; + +/** + * The list of available agri solutions. + */ +@Immutable +public final class AvailableAgriSolutionListResultInner + implements JsonSerializable { + /* + * Agri solutions list. + */ + private List solutions; + + /** + * Creates an instance of AvailableAgriSolutionListResultInner class. + */ + private AvailableAgriSolutionListResultInner() { + } + + /** + * Get the solutions property: Agri solutions list. + * + * @return the solutions value. + */ + public List solutions() { + return this.solutions; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (solutions() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property solutions in model AvailableAgriSolutionListResultInner")); + } else { + solutions().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AvailableAgriSolutionListResultInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("solutions", this.solutions, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AvailableAgriSolutionListResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AvailableAgriSolutionListResultInner 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 AvailableAgriSolutionListResultInner. + */ + public static AvailableAgriSolutionListResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AvailableAgriSolutionListResultInner deserializedAvailableAgriSolutionListResultInner + = new AvailableAgriSolutionListResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("solutions".equals(fieldName)) { + List solutions + = reader.readArray(reader1 -> DataManagerForAgricultureSolution.fromJson(reader1)); + deserializedAvailableAgriSolutionListResultInner.solutions = solutions; + } else { + reader.skipChildren(); + } + } + + return deserializedAvailableAgriSolutionListResultInner; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/models/OperationInner.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/models/OperationInner.java new file mode 100644 index 000000000000..a3e1525e45bd --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/models/OperationInner.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.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.agricultureplatform.models.ActionType; +import com.azure.resourcemanager.agricultureplatform.models.OperationDisplay; +import com.azure.resourcemanager.agricultureplatform.models.Origin; +import java.io.IOException; + +/** + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + * Resource Manager/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + private OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.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/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/models/package-info.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/models/package-info.java new file mode 100644 index 000000000000..ca9514837536 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/models/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for AgriculturePlatform. + */ +package com.azure.resourcemanager.agricultureplatform.fluent.models; diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/package-info.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/package-info.java new file mode 100644 index 000000000000..907dba900fad --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/fluent/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for AgriculturePlatform. + */ +package com.azure.resourcemanager.agricultureplatform.fluent; diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriServiceResourceImpl.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriServiceResourceImpl.java new file mode 100644 index 000000000000..4b2e6177e41d --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriServiceResourceImpl.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.agricultureplatform.fluent.models.AgriServiceResourceInner; +import com.azure.resourcemanager.agricultureplatform.models.AgriServiceResource; +import com.azure.resourcemanager.agricultureplatform.models.AgriServiceResourceProperties; +import com.azure.resourcemanager.agricultureplatform.models.AgriServiceResourceUpdate; +import com.azure.resourcemanager.agricultureplatform.models.AgriServiceResourceUpdateProperties; +import com.azure.resourcemanager.agricultureplatform.models.AvailableAgriSolutionListResult; +import com.azure.resourcemanager.agricultureplatform.models.ManagedServiceIdentity; +import com.azure.resourcemanager.agricultureplatform.models.Sku; +import java.util.Collections; +import java.util.Map; + +public final class AgriServiceResourceImpl + implements AgriServiceResource, AgriServiceResource.Definition, AgriServiceResource.Update { + private AgriServiceResourceInner innerObject; + + private final com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public AgriServiceResourceProperties properties() { + return this.innerModel().properties(); + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public AgriServiceResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String agriServiceResourceName; + + private AgriServiceResourceUpdate updateProperties; + + public AgriServiceResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public AgriServiceResource create() { + this.innerObject = serviceManager.serviceClient() + .getAgriServices() + .createOrUpdate(resourceGroupName, agriServiceResourceName, this.innerModel(), Context.NONE); + return this; + } + + public AgriServiceResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAgriServices() + .createOrUpdate(resourceGroupName, agriServiceResourceName, this.innerModel(), context); + return this; + } + + AgriServiceResourceImpl(String name, + com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager serviceManager) { + this.innerObject = new AgriServiceResourceInner(); + this.serviceManager = serviceManager; + this.agriServiceResourceName = name; + } + + public AgriServiceResourceImpl update() { + this.updateProperties = new AgriServiceResourceUpdate(); + return this; + } + + public AgriServiceResource apply() { + this.innerObject = serviceManager.serviceClient() + .getAgriServices() + .update(resourceGroupName, agriServiceResourceName, updateProperties, Context.NONE); + return this; + } + + public AgriServiceResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAgriServices() + .update(resourceGroupName, agriServiceResourceName, updateProperties, context); + return this; + } + + AgriServiceResourceImpl(AgriServiceResourceInner innerObject, + com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.agriServiceResourceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "agriServices"); + } + + public AgriServiceResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getAgriServices() + .getByResourceGroupWithResponse(resourceGroupName, agriServiceResourceName, Context.NONE) + .getValue(); + return this; + } + + public AgriServiceResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAgriServices() + .getByResourceGroupWithResponse(resourceGroupName, agriServiceResourceName, context) + .getValue(); + return this; + } + + public Response listAvailableSolutionsWithResponse(Context context) { + return serviceManager.agriServices() + .listAvailableSolutionsWithResponse(resourceGroupName, agriServiceResourceName, context); + } + + public AvailableAgriSolutionListResult listAvailableSolutions() { + return serviceManager.agriServices().listAvailableSolutions(resourceGroupName, agriServiceResourceName); + } + + public AgriServiceResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AgriServiceResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AgriServiceResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public AgriServiceResourceImpl withProperties(AgriServiceResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public AgriServiceResourceImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateProperties.withIdentity(identity); + return this; + } + } + + public AgriServiceResourceImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateProperties.withSku(sku); + return this; + } + } + + public AgriServiceResourceImpl withProperties(AgriServiceResourceUpdateProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriServicesClientImpl.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriServicesClientImpl.java new file mode 100644 index 000000000000..c3e8c848f2f1 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriServicesClientImpl.java @@ -0,0 +1,1456 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.agricultureplatform.fluent.AgriServicesClient; +import com.azure.resourcemanager.agricultureplatform.fluent.models.AgriServiceResourceInner; +import com.azure.resourcemanager.agricultureplatform.fluent.models.AvailableAgriSolutionListResultInner; +import com.azure.resourcemanager.agricultureplatform.implementation.models.AgriServiceResourceListResult; +import com.azure.resourcemanager.agricultureplatform.models.AgriServiceResourceUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in AgriServicesClient. + */ +public final class AgriServicesClientImpl implements AgriServicesClient { + /** + * The proxy service used to perform REST calls. + */ + private final AgriServicesService service; + + /** + * The service client containing this operation class. + */ + private final AgriculturePlatformMgmtClientImpl client; + + /** + * Initializes an instance of AgriServicesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AgriServicesClientImpl(AgriculturePlatformMgmtClientImpl client) { + this.service + = RestProxy.create(AgriServicesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AgriculturePlatformMgmtClientAgriServices to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AgriculturePlatformM") + public interface AgriServicesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("agriServiceResourceName") String agriServiceResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("agriServiceResourceName") String agriServiceResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AgriServiceResourceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("agriServiceResourceName") String agriServiceResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AgriServiceResourceUpdate properties, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("agriServiceResourceName") String agriServiceResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AgriculturePlatform/agriServices") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName}/listAvailableSolutions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAvailableSolutions( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("agriServiceResourceName") String agriServiceResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 AgriServiceResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String agriServiceResourceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (agriServiceResourceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter agriServiceResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, agriServiceResourceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @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 AgriServiceResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String agriServiceResourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (agriServiceResourceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter agriServiceResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, agriServiceResourceName, accept, context); + } + + /** + * Get a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 AgriServiceResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String agriServiceResourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, agriServiceResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @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 AgriServiceResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String agriServiceResourceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, agriServiceResourceName, context).block(); + } + + /** + * Get a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 AgriServiceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AgriServiceResourceInner getByResourceGroup(String resourceGroupName, String agriServiceResourceName) { + return getByResourceGroupWithResponse(resourceGroupName, agriServiceResourceName, Context.NONE).getValue(); + } + + /** + * Create a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @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 schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String agriServiceResourceName, AgriServiceResourceInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (agriServiceResourceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter agriServiceResourceName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, agriServiceResourceName, contentType, accept, + resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @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 schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String agriServiceResourceName, AgriServiceResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (agriServiceResourceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter agriServiceResourceName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, agriServiceResourceName, contentType, accept, resource, + context); + } + + /** + * Create a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of schema of the AgriService resource from + * Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AgriServiceResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String agriServiceResourceName, AgriServiceResourceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, agriServiceResourceName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), AgriServiceResourceInner.class, AgriServiceResourceInner.class, + this.client.getContext()); + } + + /** + * Create a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of schema of the AgriService resource from + * Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AgriServiceResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String agriServiceResourceName, AgriServiceResourceInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, agriServiceResourceName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), AgriServiceResourceInner.class, AgriServiceResourceInner.class, context); + } + + /** + * Create a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of schema of the AgriService resource from + * Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AgriServiceResourceInner> beginCreateOrUpdate( + String resourceGroupName, String agriServiceResourceName, AgriServiceResourceInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, agriServiceResourceName, resource).getSyncPoller(); + } + + /** + * Create a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of schema of the AgriService resource from + * Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AgriServiceResourceInner> beginCreateOrUpdate( + String resourceGroupName, String agriServiceResourceName, AgriServiceResourceInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, agriServiceResourceName, resource, context) + .getSyncPoller(); + } + + /** + * Create a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @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 schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String agriServiceResourceName, + AgriServiceResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, agriServiceResourceName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @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 schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String agriServiceResourceName, + AgriServiceResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, agriServiceResourceName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @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 schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AgriServiceResourceInner createOrUpdate(String resourceGroupName, String agriServiceResourceName, + AgriServiceResourceInner resource) { + return createOrUpdateAsync(resourceGroupName, agriServiceResourceName, resource).block(); + } + + /** + * Create a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @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 schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AgriServiceResourceInner createOrUpdate(String resourceGroupName, String agriServiceResourceName, + AgriServiceResourceInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, agriServiceResourceName, resource, context).block(); + } + + /** + * Update a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String agriServiceResourceName, AgriServiceResourceUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (agriServiceResourceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter agriServiceResourceName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, agriServiceResourceName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String agriServiceResourceName, AgriServiceResourceUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (agriServiceResourceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter agriServiceResourceName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, agriServiceResourceName, contentType, accept, properties, context); + } + + /** + * Update a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of schema of the AgriService resource from + * Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AgriServiceResourceInner> beginUpdateAsync( + String resourceGroupName, String agriServiceResourceName, AgriServiceResourceUpdate properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, agriServiceResourceName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), AgriServiceResourceInner.class, AgriServiceResourceInner.class, + this.client.getContext()); + } + + /** + * Update a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of schema of the AgriService resource from + * Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AgriServiceResourceInner> beginUpdateAsync( + String resourceGroupName, String agriServiceResourceName, AgriServiceResourceUpdate properties, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, agriServiceResourceName, properties, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), AgriServiceResourceInner.class, AgriServiceResourceInner.class, context); + } + + /** + * Update a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of schema of the AgriService resource from + * Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AgriServiceResourceInner> + beginUpdate(String resourceGroupName, String agriServiceResourceName, AgriServiceResourceUpdate properties) { + return this.beginUpdateAsync(resourceGroupName, agriServiceResourceName, properties).getSyncPoller(); + } + + /** + * Update a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of schema of the AgriService resource from + * Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AgriServiceResourceInner> beginUpdate( + String resourceGroupName, String agriServiceResourceName, AgriServiceResourceUpdate properties, + Context context) { + return this.beginUpdateAsync(resourceGroupName, agriServiceResourceName, properties, context).getSyncPoller(); + } + + /** + * Update a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String agriServiceResourceName, + AgriServiceResourceUpdate properties) { + return beginUpdateAsync(resourceGroupName, agriServiceResourceName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String agriServiceResourceName, + AgriServiceResourceUpdate properties, Context context) { + return beginUpdateAsync(resourceGroupName, agriServiceResourceName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AgriServiceResourceInner update(String resourceGroupName, String agriServiceResourceName, + AgriServiceResourceUpdate properties) { + return updateAsync(resourceGroupName, agriServiceResourceName, properties).block(); + } + + /** + * Update a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AgriServiceResourceInner update(String resourceGroupName, String agriServiceResourceName, + AgriServiceResourceUpdate properties, Context context) { + return updateAsync(resourceGroupName, agriServiceResourceName, properties, context).block(); + } + + /** + * Delete a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String agriServiceResourceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (agriServiceResourceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter agriServiceResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, agriServiceResourceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String agriServiceResourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (agriServiceResourceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter agriServiceResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, agriServiceResourceName, accept, context); + } + + /** + * Delete a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String agriServiceResourceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, agriServiceResourceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String agriServiceResourceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, agriServiceResourceName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String agriServiceResourceName) { + return this.beginDeleteAsync(resourceGroupName, agriServiceResourceName).getSyncPoller(); + } + + /** + * Delete a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String agriServiceResourceName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, agriServiceResourceName, context).getSyncPoller(); + } + + /** + * Delete a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String agriServiceResourceName) { + return beginDeleteAsync(resourceGroupName, agriServiceResourceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String agriServiceResourceName, Context context) { + return beginDeleteAsync(resourceGroupName, agriServiceResourceName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String agriServiceResourceName) { + deleteAsync(resourceGroupName, agriServiceResourceName).block(); + } + + /** + * Delete a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String agriServiceResourceName, Context context) { + deleteAsync(resourceGroupName, agriServiceResourceName, context).block(); + } + + /** + * List AgriServiceResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List AgriServiceResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List AgriServiceResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List AgriServiceResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List AgriServiceResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List AgriServiceResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List AgriServiceResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List AgriServiceResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List AgriServiceResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List AgriServiceResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List AgriServiceResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List AgriServiceResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Returns the list of available agri solutions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 list of available agri solutions along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listAvailableSolutionsWithResponseAsync(String resourceGroupName, String agriServiceResourceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (agriServiceResourceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter agriServiceResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listAvailableSolutions(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, agriServiceResourceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns the list of available agri solutions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @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 list of available agri solutions along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAvailableSolutionsWithResponseAsync( + String resourceGroupName, String agriServiceResourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (agriServiceResourceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter agriServiceResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listAvailableSolutions(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, agriServiceResourceName, accept, context); + } + + /** + * Returns the list of available agri solutions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 list of available agri solutions on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAvailableSolutionsAsync(String resourceGroupName, + String agriServiceResourceName) { + return listAvailableSolutionsWithResponseAsync(resourceGroupName, agriServiceResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns the list of available agri solutions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @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 list of available agri solutions along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listAvailableSolutionsWithResponse(String resourceGroupName, + String agriServiceResourceName, Context context) { + return listAvailableSolutionsWithResponseAsync(resourceGroupName, agriServiceResourceName, context).block(); + } + + /** + * Returns the list of available agri solutions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 list of available agri solutions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AvailableAgriSolutionListResultInner listAvailableSolutions(String resourceGroupName, + String agriServiceResourceName) { + return listAvailableSolutionsWithResponse(resourceGroupName, agriServiceResourceName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 AgriServiceResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * 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 AgriServiceResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 AgriServiceResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriServicesImpl.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriServicesImpl.java new file mode 100644 index 000000000000..14b474069982 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriServicesImpl.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.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.agricultureplatform.fluent.AgriServicesClient; +import com.azure.resourcemanager.agricultureplatform.fluent.models.AgriServiceResourceInner; +import com.azure.resourcemanager.agricultureplatform.fluent.models.AvailableAgriSolutionListResultInner; +import com.azure.resourcemanager.agricultureplatform.models.AgriServiceResource; +import com.azure.resourcemanager.agricultureplatform.models.AgriServices; +import com.azure.resourcemanager.agricultureplatform.models.AvailableAgriSolutionListResult; + +public final class AgriServicesImpl implements AgriServices { + private static final ClientLogger LOGGER = new ClientLogger(AgriServicesImpl.class); + + private final AgriServicesClient innerClient; + + private final com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager serviceManager; + + public AgriServicesImpl(AgriServicesClient innerClient, + com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String agriServiceResourceName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, agriServiceResourceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AgriServiceResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AgriServiceResource getByResourceGroup(String resourceGroupName, String agriServiceResourceName) { + AgriServiceResourceInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, agriServiceResourceName); + if (inner != null) { + return new AgriServiceResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String agriServiceResourceName) { + this.serviceClient().delete(resourceGroupName, agriServiceResourceName); + } + + public void delete(String resourceGroupName, String agriServiceResourceName, Context context) { + this.serviceClient().delete(resourceGroupName, agriServiceResourceName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AgriServiceResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AgriServiceResourceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AgriServiceResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AgriServiceResourceImpl(inner1, this.manager())); + } + + public Response listAvailableSolutionsWithResponse(String resourceGroupName, + String agriServiceResourceName, Context context) { + Response inner = this.serviceClient() + .listAvailableSolutionsWithResponse(resourceGroupName, agriServiceResourceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AvailableAgriSolutionListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AvailableAgriSolutionListResult listAvailableSolutions(String resourceGroupName, + String agriServiceResourceName) { + AvailableAgriSolutionListResultInner inner + = this.serviceClient().listAvailableSolutions(resourceGroupName, agriServiceResourceName); + if (inner != null) { + return new AvailableAgriSolutionListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public AgriServiceResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String agriServiceResourceName = ResourceManagerUtils.getValueFromIdByName(id, "agriServices"); + if (agriServiceResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'agriServices'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, agriServiceResourceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String agriServiceResourceName = ResourceManagerUtils.getValueFromIdByName(id, "agriServices"); + if (agriServiceResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'agriServices'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, agriServiceResourceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String agriServiceResourceName = ResourceManagerUtils.getValueFromIdByName(id, "agriServices"); + if (agriServiceResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'agriServices'.", id))); + } + this.delete(resourceGroupName, agriServiceResourceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String agriServiceResourceName = ResourceManagerUtils.getValueFromIdByName(id, "agriServices"); + if (agriServiceResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'agriServices'.", id))); + } + this.delete(resourceGroupName, agriServiceResourceName, context); + } + + private AgriServicesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager() { + return this.serviceManager; + } + + public AgriServiceResourceImpl define(String name) { + return new AgriServiceResourceImpl(name, this.manager()); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriculturePlatformMgmtClientBuilder.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriculturePlatformMgmtClientBuilder.java new file mode 100644 index 000000000000..29dce8654ad8 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriculturePlatformMgmtClientBuilder.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.agricultureplatform.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 AgriculturePlatformMgmtClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { AgriculturePlatformMgmtClientImpl.class }) +public final class AgriculturePlatformMgmtClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the AgriculturePlatformMgmtClientBuilder. + */ + public AgriculturePlatformMgmtClientBuilder 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 AgriculturePlatformMgmtClientBuilder. + */ + public AgriculturePlatformMgmtClientBuilder 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 AgriculturePlatformMgmtClientBuilder. + */ + public AgriculturePlatformMgmtClientBuilder 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 AgriculturePlatformMgmtClientBuilder. + */ + public AgriculturePlatformMgmtClientBuilder 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 AgriculturePlatformMgmtClientBuilder. + */ + public AgriculturePlatformMgmtClientBuilder 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 AgriculturePlatformMgmtClientBuilder. + */ + public AgriculturePlatformMgmtClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of AgriculturePlatformMgmtClientImpl with the provided parameters. + * + * @return an instance of AgriculturePlatformMgmtClientImpl. + */ + public AgriculturePlatformMgmtClientImpl 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(); + AgriculturePlatformMgmtClientImpl client = new AgriculturePlatformMgmtClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriculturePlatformMgmtClientImpl.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriculturePlatformMgmtClientImpl.java new file mode 100644 index 000000000000..8f01a229fcae --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AgriculturePlatformMgmtClientImpl.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.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.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.agricultureplatform.fluent.AgriServicesClient; +import com.azure.resourcemanager.agricultureplatform.fluent.AgriculturePlatformMgmtClient; +import com.azure.resourcemanager.agricultureplatform.fluent.OperationsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the AgriculturePlatformMgmtClientImpl type. + */ +@ServiceClient(builder = AgriculturePlatformMgmtClientBuilder.class) +public final class AgriculturePlatformMgmtClientImpl implements AgriculturePlatformMgmtClient { + /** + * 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 AgriServicesClient object to access its operations. + */ + private final AgriServicesClient agriServices; + + /** + * Gets the AgriServicesClient object to access its operations. + * + * @return the AgriServicesClient object. + */ + public AgriServicesClient getAgriServices() { + return this.agriServices; + } + + /** + * Initializes an instance of AgriculturePlatformMgmtClient 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. + */ + AgriculturePlatformMgmtClientImpl(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 = "2024-06-01-preview"; + this.operations = new OperationsClientImpl(this); + this.agriServices = new AgriServicesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AgriculturePlatformMgmtClientImpl.class); +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AvailableAgriSolutionListResultImpl.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AvailableAgriSolutionListResultImpl.java new file mode 100644 index 000000000000..d8e43c2a0871 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/AvailableAgriSolutionListResultImpl.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.agricultureplatform.implementation; + +import com.azure.resourcemanager.agricultureplatform.fluent.models.AvailableAgriSolutionListResultInner; +import com.azure.resourcemanager.agricultureplatform.models.AvailableAgriSolutionListResult; +import com.azure.resourcemanager.agricultureplatform.models.DataManagerForAgricultureSolution; +import java.util.Collections; +import java.util.List; + +public final class AvailableAgriSolutionListResultImpl implements AvailableAgriSolutionListResult { + private AvailableAgriSolutionListResultInner innerObject; + + private final com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager serviceManager; + + AvailableAgriSolutionListResultImpl(AvailableAgriSolutionListResultInner innerObject, + com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List solutions() { + List inner = this.innerModel().solutions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public AvailableAgriSolutionListResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/OperationImpl.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/OperationImpl.java new file mode 100644 index 000000000000..53ef6eb2100d --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/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.agricultureplatform.implementation; + +import com.azure.resourcemanager.agricultureplatform.fluent.models.OperationInner; +import com.azure.resourcemanager.agricultureplatform.models.ActionType; +import com.azure.resourcemanager.agricultureplatform.models.Operation; +import com.azure.resourcemanager.agricultureplatform.models.OperationDisplay; +import com.azure.resourcemanager.agricultureplatform.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager 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.agricultureplatform.AgriculturePlatformManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/OperationsClientImpl.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..f817b7a1a547 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/OperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.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.agricultureplatform.fluent.OperationsClient; +import com.azure.resourcemanager.agricultureplatform.fluent.models.OperationInner; +import com.azure.resourcemanager.agricultureplatform.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 AgriculturePlatformMgmtClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(AgriculturePlatformMgmtClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AgriculturePlatformMgmtClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AgriculturePlatformM") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.AgriculturePlatform/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/OperationsImpl.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/OperationsImpl.java new file mode 100644 index 000000000000..49e39180abb3 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/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.agricultureplatform.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.agricultureplatform.fluent.OperationsClient; +import com.azure.resourcemanager.agricultureplatform.fluent.models.OperationInner; +import com.azure.resourcemanager.agricultureplatform.models.Operation; +import com.azure.resourcemanager.agricultureplatform.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.agricultureplatform.AgriculturePlatformManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager 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.agricultureplatform.AgriculturePlatformManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/ResourceManagerUtils.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..237a3a41cf30 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/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.agricultureplatform.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/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/models/AgriServiceResourceListResult.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/models/AgriServiceResourceListResult.java new file mode 100644 index 000000000000..dc94edbbe68d --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/models/AgriServiceResourceListResult.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.agricultureplatform.fluent.models.AgriServiceResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a AgriServiceResource list operation. + */ +@Immutable +public final class AgriServiceResourceListResult implements JsonSerializable { + /* + * The AgriServiceResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of AgriServiceResourceListResult class. + */ + private AgriServiceResourceListResult() { + } + + /** + * Get the value property: The AgriServiceResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model AgriServiceResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AgriServiceResourceListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgriServiceResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgriServiceResourceListResult 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 AgriServiceResourceListResult. + */ + public static AgriServiceResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgriServiceResourceListResult deserializedAgriServiceResourceListResult + = new AgriServiceResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> AgriServiceResourceInner.fromJson(reader1)); + deserializedAgriServiceResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAgriServiceResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAgriServiceResourceListResult; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/models/OperationListResult.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..caa76f64c517 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/models/OperationListResult.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.agricultureplatform.fluent.models.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model OperationListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperationListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/package-info.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/package-info.java new file mode 100644 index 000000000000..42bf05b7fdfe --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/implementation/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for AgriculturePlatform. + */ +package com.azure.resourcemanager.agricultureplatform.implementation; diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ActionType.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ActionType.java new file mode 100644 index 000000000000..c496d950d3fe --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/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.agricultureplatform.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/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceConfig.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceConfig.java new file mode 100644 index 000000000000..99b6b8de18e1 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceConfig.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.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; + +/** + * Config of the AgriService resource instance. + */ +@Immutable +public final class AgriServiceConfig implements JsonSerializable { + /* + * Instance URI of the AgriService instance. + */ + private String instanceUri; + + /* + * Version of AgriService instance. + */ + private String version; + + /* + * App service resource Id. + */ + private String appServiceResourceId; + + /* + * Cosmos Db resource Id. + */ + private String cosmosDbResourceId; + + /* + * Storage account resource Id. + */ + private String storageAccountResourceId; + + /* + * Key vault resource Id. + */ + private String keyVaultResourceId; + + /* + * Redis cache resource Id. + */ + private String redisCacheResourceId; + + /** + * Creates an instance of AgriServiceConfig class. + */ + public AgriServiceConfig() { + } + + /** + * Get the instanceUri property: Instance URI of the AgriService instance. + * + * @return the instanceUri value. + */ + public String instanceUri() { + return this.instanceUri; + } + + /** + * Get the version property: Version of AgriService instance. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Get the appServiceResourceId property: App service resource Id. + * + * @return the appServiceResourceId value. + */ + public String appServiceResourceId() { + return this.appServiceResourceId; + } + + /** + * Get the cosmosDbResourceId property: Cosmos Db resource Id. + * + * @return the cosmosDbResourceId value. + */ + public String cosmosDbResourceId() { + return this.cosmosDbResourceId; + } + + /** + * Get the storageAccountResourceId property: Storage account resource Id. + * + * @return the storageAccountResourceId value. + */ + public String storageAccountResourceId() { + return this.storageAccountResourceId; + } + + /** + * Get the keyVaultResourceId property: Key vault resource Id. + * + * @return the keyVaultResourceId value. + */ + public String keyVaultResourceId() { + return this.keyVaultResourceId; + } + + /** + * Get the redisCacheResourceId property: Redis cache resource Id. + * + * @return the redisCacheResourceId value. + */ + public String redisCacheResourceId() { + return this.redisCacheResourceId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgriServiceConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgriServiceConfig 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 AgriServiceConfig. + */ + public static AgriServiceConfig fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgriServiceConfig deserializedAgriServiceConfig = new AgriServiceConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("instanceUri".equals(fieldName)) { + deserializedAgriServiceConfig.instanceUri = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedAgriServiceConfig.version = reader.getString(); + } else if ("appServiceResourceId".equals(fieldName)) { + deserializedAgriServiceConfig.appServiceResourceId = reader.getString(); + } else if ("cosmosDbResourceId".equals(fieldName)) { + deserializedAgriServiceConfig.cosmosDbResourceId = reader.getString(); + } else if ("storageAccountResourceId".equals(fieldName)) { + deserializedAgriServiceConfig.storageAccountResourceId = reader.getString(); + } else if ("keyVaultResourceId".equals(fieldName)) { + deserializedAgriServiceConfig.keyVaultResourceId = reader.getString(); + } else if ("redisCacheResourceId".equals(fieldName)) { + deserializedAgriServiceConfig.redisCacheResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAgriServiceConfig; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceResource.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceResource.java new file mode 100644 index 000000000000..396f32d77c59 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceResource.java @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.agricultureplatform.fluent.models.AgriServiceResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of AgriServiceResource. + */ +public interface AgriServiceResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + AgriServiceResourceProperties properties(); + + /** + * Gets the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the sku property: The SKU (Stock Keeping Unit) assigned to this resource. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.agricultureplatform.fluent.models.AgriServiceResourceInner object. + * + * @return the inner object. + */ + AgriServiceResourceInner innerModel(); + + /** + * The entirety of the AgriServiceResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The AgriServiceResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the AgriServiceResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the AgriServiceResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the AgriServiceResource definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the AgriServiceResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties, + DefinitionStages.WithIdentity, DefinitionStages.WithSku { + /** + * Executes the create request. + * + * @return the created resource. + */ + AgriServiceResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AgriServiceResource create(Context context); + } + + /** + * The stage of the AgriServiceResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the AgriServiceResource 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(AgriServiceResourceProperties properties); + } + + /** + * The stage of the AgriServiceResource definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + + /** + * The stage of the AgriServiceResource definition allowing to specify sku. + */ + interface WithSku { + /** + * Specifies the sku property: The SKU (Stock Keeping Unit) assigned to this resource.. + * + * @param sku The SKU (Stock Keeping Unit) assigned to this resource. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + } + + /** + * Begins update for the AgriServiceResource resource. + * + * @return the stage of resource update. + */ + AgriServiceResource.Update update(); + + /** + * The template for AgriServiceResource update. + */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithSku, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + AgriServiceResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + AgriServiceResource apply(Context context); + } + + /** + * The AgriServiceResource update stages. + */ + interface UpdateStages { + /** + * The stage of the AgriServiceResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the AgriServiceResource update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + + /** + * The stage of the AgriServiceResource update allowing to specify sku. + */ + interface WithSku { + /** + * Specifies the sku property: The SKU (Stock Keeping Unit) assigned to this resource.. + * + * @param sku The SKU (Stock Keeping Unit) assigned to this resource. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + + /** + * The stage of the AgriServiceResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(AgriServiceResourceUpdateProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AgriServiceResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AgriServiceResource refresh(Context context); + + /** + * Returns the list of available agri solutions. + * + * @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 list of available agri solutions along with {@link Response}. + */ + Response listAvailableSolutionsWithResponse(Context context); + + /** + * Returns the list of available agri solutions. + * + * @throws com.azure.core.management.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 list of available agri solutions. + */ + AvailableAgriSolutionListResult listAvailableSolutions(); +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceResourceProperties.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceResourceProperties.java new file mode 100644 index 000000000000..dcb5d3030a85 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceResourceProperties.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Details of the Agriculture AgriDataManager. + */ +@Fluent +public final class AgriServiceResourceProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * Config of the AgriService instance. + */ + private AgriServiceConfig config; + + /* + * Managed On Behalf Of Configuration. + */ + private ManagedOnBehalfOfConfiguration managedOnBehalfOfConfiguration; + + /* + * Data connector credentials of AgriService instance. + */ + private List dataConnectorCredentials; + + /* + * AgriService installed solutions. + */ + private List installedSolutions; + + /** + * Creates an instance of AgriServiceResourceProperties class. + */ + public AgriServiceResourceProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the config property: Config of the AgriService instance. + * + * @return the config value. + */ + public AgriServiceConfig config() { + return this.config; + } + + /** + * Set the config property: Config of the AgriService instance. + * + * @param config the config value to set. + * @return the AgriServiceResourceProperties object itself. + */ + public AgriServiceResourceProperties withConfig(AgriServiceConfig config) { + this.config = config; + return this; + } + + /** + * Get the managedOnBehalfOfConfiguration property: Managed On Behalf Of Configuration. + * + * @return the managedOnBehalfOfConfiguration value. + */ + public ManagedOnBehalfOfConfiguration managedOnBehalfOfConfiguration() { + return this.managedOnBehalfOfConfiguration; + } + + /** + * Get the dataConnectorCredentials property: Data connector credentials of AgriService instance. + * + * @return the dataConnectorCredentials value. + */ + public List dataConnectorCredentials() { + return this.dataConnectorCredentials; + } + + /** + * Set the dataConnectorCredentials property: Data connector credentials of AgriService instance. + * + * @param dataConnectorCredentials the dataConnectorCredentials value to set. + * @return the AgriServiceResourceProperties object itself. + */ + public AgriServiceResourceProperties + withDataConnectorCredentials(List dataConnectorCredentials) { + this.dataConnectorCredentials = dataConnectorCredentials; + return this; + } + + /** + * Get the installedSolutions property: AgriService installed solutions. + * + * @return the installedSolutions value. + */ + public List installedSolutions() { + return this.installedSolutions; + } + + /** + * Set the installedSolutions property: AgriService installed solutions. + * + * @param installedSolutions the installedSolutions value to set. + * @return the AgriServiceResourceProperties object itself. + */ + public AgriServiceResourceProperties withInstalledSolutions(List installedSolutions) { + this.installedSolutions = installedSolutions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (config() != null) { + config().validate(); + } + if (managedOnBehalfOfConfiguration() != null) { + managedOnBehalfOfConfiguration().validate(); + } + if (dataConnectorCredentials() != null) { + dataConnectorCredentials().forEach(e -> e.validate()); + } + if (installedSolutions() != null) { + installedSolutions().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("config", this.config); + jsonWriter.writeArrayField("dataConnectorCredentials", this.dataConnectorCredentials, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("installedSolutions", this.installedSolutions, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgriServiceResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgriServiceResourceProperties 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 AgriServiceResourceProperties. + */ + public static AgriServiceResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgriServiceResourceProperties deserializedAgriServiceResourceProperties + = new AgriServiceResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedAgriServiceResourceProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("config".equals(fieldName)) { + deserializedAgriServiceResourceProperties.config = AgriServiceConfig.fromJson(reader); + } else if ("managedOnBehalfOfConfiguration".equals(fieldName)) { + deserializedAgriServiceResourceProperties.managedOnBehalfOfConfiguration + = ManagedOnBehalfOfConfiguration.fromJson(reader); + } else if ("dataConnectorCredentials".equals(fieldName)) { + List dataConnectorCredentials + = reader.readArray(reader1 -> DataConnectorCredentialMap.fromJson(reader1)); + deserializedAgriServiceResourceProperties.dataConnectorCredentials = dataConnectorCredentials; + } else if ("installedSolutions".equals(fieldName)) { + List installedSolutions + = reader.readArray(reader1 -> InstalledSolutionMap.fromJson(reader1)); + deserializedAgriServiceResourceProperties.installedSolutions = installedSolutions; + } else { + reader.skipChildren(); + } + } + + return deserializedAgriServiceResourceProperties; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceResourceUpdate.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceResourceUpdate.java new file mode 100644 index 000000000000..51edfea387c7 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceResourceUpdate.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The type used for update operations of the AgriServiceResource. + */ +@Fluent +public final class AgriServiceResourceUpdate implements JsonSerializable { + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /* + * The SKU (Stock Keeping Unit) assigned to this resource. + */ + private Sku sku; + + /* + * Resource tags. + */ + private Map tags; + + /* + * The resource-specific properties for this resource. + */ + private AgriServiceResourceUpdateProperties properties; + + /** + * Creates an instance of AgriServiceResourceUpdate class. + */ + public AgriServiceResourceUpdate() { + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the AgriServiceResourceUpdate object itself. + */ + public AgriServiceResourceUpdate withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the sku property: The SKU (Stock Keeping Unit) assigned to this resource. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU (Stock Keeping Unit) assigned to this resource. + * + * @param sku the sku value to set. + * @return the AgriServiceResourceUpdate object itself. + */ + public AgriServiceResourceUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the AgriServiceResourceUpdate object itself. + */ + public AgriServiceResourceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public AgriServiceResourceUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the AgriServiceResourceUpdate object itself. + */ + public AgriServiceResourceUpdate withProperties(AgriServiceResourceUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeJsonField("sku", this.sku); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgriServiceResourceUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgriServiceResourceUpdate 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 AgriServiceResourceUpdate. + */ + public static AgriServiceResourceUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgriServiceResourceUpdate deserializedAgriServiceResourceUpdate = new AgriServiceResourceUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identity".equals(fieldName)) { + deserializedAgriServiceResourceUpdate.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("sku".equals(fieldName)) { + deserializedAgriServiceResourceUpdate.sku = Sku.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedAgriServiceResourceUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedAgriServiceResourceUpdate.properties + = AgriServiceResourceUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAgriServiceResourceUpdate; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceResourceUpdateProperties.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceResourceUpdateProperties.java new file mode 100644 index 000000000000..27de92274728 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServiceResourceUpdateProperties.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The updatable properties of the AgriServiceResource. + */ +@Fluent +public final class AgriServiceResourceUpdateProperties + implements JsonSerializable { + /* + * Config of the AgriService instance. + */ + private AgriServiceConfig config; + + /* + * Data connector credentials of AgriService instance. + */ + private List dataConnectorCredentials; + + /* + * AgriService installed solutions. + */ + private List installedSolutions; + + /** + * Creates an instance of AgriServiceResourceUpdateProperties class. + */ + public AgriServiceResourceUpdateProperties() { + } + + /** + * Get the config property: Config of the AgriService instance. + * + * @return the config value. + */ + public AgriServiceConfig config() { + return this.config; + } + + /** + * Set the config property: Config of the AgriService instance. + * + * @param config the config value to set. + * @return the AgriServiceResourceUpdateProperties object itself. + */ + public AgriServiceResourceUpdateProperties withConfig(AgriServiceConfig config) { + this.config = config; + return this; + } + + /** + * Get the dataConnectorCredentials property: Data connector credentials of AgriService instance. + * + * @return the dataConnectorCredentials value. + */ + public List dataConnectorCredentials() { + return this.dataConnectorCredentials; + } + + /** + * Set the dataConnectorCredentials property: Data connector credentials of AgriService instance. + * + * @param dataConnectorCredentials the dataConnectorCredentials value to set. + * @return the AgriServiceResourceUpdateProperties object itself. + */ + public AgriServiceResourceUpdateProperties + withDataConnectorCredentials(List dataConnectorCredentials) { + this.dataConnectorCredentials = dataConnectorCredentials; + return this; + } + + /** + * Get the installedSolutions property: AgriService installed solutions. + * + * @return the installedSolutions value. + */ + public List installedSolutions() { + return this.installedSolutions; + } + + /** + * Set the installedSolutions property: AgriService installed solutions. + * + * @param installedSolutions the installedSolutions value to set. + * @return the AgriServiceResourceUpdateProperties object itself. + */ + public AgriServiceResourceUpdateProperties withInstalledSolutions(List installedSolutions) { + this.installedSolutions = installedSolutions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (config() != null) { + config().validate(); + } + if (dataConnectorCredentials() != null) { + dataConnectorCredentials().forEach(e -> e.validate()); + } + if (installedSolutions() != null) { + installedSolutions().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("config", this.config); + jsonWriter.writeArrayField("dataConnectorCredentials", this.dataConnectorCredentials, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("installedSolutions", this.installedSolutions, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgriServiceResourceUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgriServiceResourceUpdateProperties 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 AgriServiceResourceUpdateProperties. + */ + public static AgriServiceResourceUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgriServiceResourceUpdateProperties deserializedAgriServiceResourceUpdateProperties + = new AgriServiceResourceUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("config".equals(fieldName)) { + deserializedAgriServiceResourceUpdateProperties.config = AgriServiceConfig.fromJson(reader); + } else if ("dataConnectorCredentials".equals(fieldName)) { + List dataConnectorCredentials + = reader.readArray(reader1 -> DataConnectorCredentialMap.fromJson(reader1)); + deserializedAgriServiceResourceUpdateProperties.dataConnectorCredentials = dataConnectorCredentials; + } else if ("installedSolutions".equals(fieldName)) { + List installedSolutions + = reader.readArray(reader1 -> InstalledSolutionMap.fromJson(reader1)); + deserializedAgriServiceResourceUpdateProperties.installedSolutions = installedSolutions; + } else { + reader.skipChildren(); + } + } + + return deserializedAgriServiceResourceUpdateProperties; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServices.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServices.java new file mode 100644 index 000000000000..d683190dbd91 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AgriServices.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.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 AgriServices. + */ +public interface AgriServices { + /** + * Get a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a AgriServiceResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String agriServiceResourceName, Context context); + + /** + * Get a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 AgriServiceResource. + */ + AgriServiceResource getByResourceGroup(String resourceGroupName, String agriServiceResourceName); + + /** + * Delete a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String agriServiceResourceName); + + /** + * Delete a AgriServiceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String agriServiceResourceName, Context context); + + /** + * List AgriServiceResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List AgriServiceResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List AgriServiceResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List AgriServiceResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AgriServiceResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Returns the list of available agri solutions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of available agri solutions along with {@link Response}. + */ + Response listAvailableSolutionsWithResponse(String resourceGroupName, + String agriServiceResourceName, Context context); + + /** + * Returns the list of available agri solutions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param agriServiceResourceName The name of the AgriService resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 list of available agri solutions. + */ + AvailableAgriSolutionListResult listAvailableSolutions(String resourceGroupName, String agriServiceResourceName); + + /** + * Get a AgriServiceResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a AgriServiceResource along with {@link Response}. + */ + AgriServiceResource getById(String id); + + /** + * Get a AgriServiceResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a AgriServiceResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a AgriServiceResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a AgriServiceResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AgriServiceResource resource. + * + * @param name resource name. + * @return the first stage of the new AgriServiceResource definition. + */ + AgriServiceResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AuthCredentialsKind.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AuthCredentialsKind.java new file mode 100644 index 000000000000..ff470df33971 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AuthCredentialsKind.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.agricultureplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Types of different kind of Data connector auth credentials supported. + */ +public final class AuthCredentialsKind extends ExpandableStringEnum { + /** + * OAuth Client Credential type. + */ + public static final AuthCredentialsKind OAUTH_CLIENT_CREDENTIALS = fromString("OAuthClientCredentials"); + + /** + * API Key Auth Credential type. + */ + public static final AuthCredentialsKind API_KEY_AUTH_CREDENTIALS = fromString("ApiKeyAuthCredentials"); + + /** + * Creates a new instance of AuthCredentialsKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AuthCredentialsKind() { + } + + /** + * Creates or finds a AuthCredentialsKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding AuthCredentialsKind. + */ + public static AuthCredentialsKind fromString(String name) { + return fromString(name, AuthCredentialsKind.class); + } + + /** + * Gets known AuthCredentialsKind values. + * + * @return known AuthCredentialsKind values. + */ + public static Collection values() { + return values(AuthCredentialsKind.class); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AvailableAgriSolutionListResult.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AvailableAgriSolutionListResult.java new file mode 100644 index 000000000000..6850c74741f2 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/AvailableAgriSolutionListResult.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.agricultureplatform.models; + +import com.azure.resourcemanager.agricultureplatform.fluent.models.AvailableAgriSolutionListResultInner; +import java.util.List; + +/** + * An immutable client-side representation of AvailableAgriSolutionListResult. + */ +public interface AvailableAgriSolutionListResult { + /** + * Gets the solutions property: Agri solutions list. + * + * @return the solutions value. + */ + List solutions(); + + /** + * Gets the inner com.azure.resourcemanager.agricultureplatform.fluent.models.AvailableAgriSolutionListResultInner + * object. + * + * @return the inner object. + */ + AvailableAgriSolutionListResultInner innerModel(); +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/DataConnectorCredentialMap.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/DataConnectorCredentialMap.java new file mode 100644 index 000000000000..e4c3f9829af3 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/DataConnectorCredentialMap.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.agricultureplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Mapping of data connector credentials. + */ +@Fluent +public final class DataConnectorCredentialMap implements JsonSerializable { + /* + * The key representing the credential. + */ + private String key; + + /* + * The data connector credential value. + */ + private DataConnectorCredentials value; + + /** + * Creates an instance of DataConnectorCredentialMap class. + */ + public DataConnectorCredentialMap() { + } + + /** + * Get the key property: The key representing the credential. + * + * @return the key value. + */ + public String key() { + return this.key; + } + + /** + * Set the key property: The key representing the credential. + * + * @param key the key value to set. + * @return the DataConnectorCredentialMap object itself. + */ + public DataConnectorCredentialMap withKey(String key) { + this.key = key; + return this; + } + + /** + * Get the value property: The data connector credential value. + * + * @return the value value. + */ + public DataConnectorCredentials value() { + return this.value; + } + + /** + * Set the value property: The data connector credential value. + * + * @param value the value value to set. + * @return the DataConnectorCredentialMap object itself. + */ + public DataConnectorCredentialMap withValue(DataConnectorCredentials value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (key() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property key in model DataConnectorCredentialMap")); + } + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model DataConnectorCredentialMap")); + } else { + value().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DataConnectorCredentialMap.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("key", this.key); + jsonWriter.writeJsonField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataConnectorCredentialMap from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataConnectorCredentialMap 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 DataConnectorCredentialMap. + */ + public static DataConnectorCredentialMap fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataConnectorCredentialMap deserializedDataConnectorCredentialMap = new DataConnectorCredentialMap(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("key".equals(fieldName)) { + deserializedDataConnectorCredentialMap.key = reader.getString(); + } else if ("value".equals(fieldName)) { + deserializedDataConnectorCredentialMap.value = DataConnectorCredentials.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDataConnectorCredentialMap; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/DataConnectorCredentials.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/DataConnectorCredentials.java new file mode 100644 index 000000000000..c842e7375fed --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/DataConnectorCredentials.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties related to an AgriService data connector. + */ +@Fluent +public final class DataConnectorCredentials implements JsonSerializable { + /* + * Type of credential. + */ + private AuthCredentialsKind kind; + + /* + * Client Id associated with the provider, if type of credentials is OAuthClientCredentials. + */ + private String clientId; + + /* + * Uri of the key vault + */ + private String keyVaultUri; + + /* + * Name of the key vault key. + */ + private String keyName; + + /* + * Version of the key vault key. + */ + private String keyVersion; + + /** + * Creates an instance of DataConnectorCredentials class. + */ + public DataConnectorCredentials() { + } + + /** + * Get the kind property: Type of credential. + * + * @return the kind value. + */ + public AuthCredentialsKind kind() { + return this.kind; + } + + /** + * Set the kind property: Type of credential. + * + * @param kind the kind value to set. + * @return the DataConnectorCredentials object itself. + */ + public DataConnectorCredentials withKind(AuthCredentialsKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the clientId property: Client Id associated with the provider, if type of credentials is + * OAuthClientCredentials. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the clientId property: Client Id associated with the provider, if type of credentials is + * OAuthClientCredentials. + * + * @param clientId the clientId value to set. + * @return the DataConnectorCredentials object itself. + */ + public DataConnectorCredentials withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the keyVaultUri property: Uri of the key vault. + * + * @return the keyVaultUri value. + */ + public String keyVaultUri() { + return this.keyVaultUri; + } + + /** + * Set the keyVaultUri property: Uri of the key vault. + * + * @param keyVaultUri the keyVaultUri value to set. + * @return the DataConnectorCredentials object itself. + */ + public DataConnectorCredentials withKeyVaultUri(String keyVaultUri) { + this.keyVaultUri = keyVaultUri; + return this; + } + + /** + * Get the keyName property: Name of the key vault key. + * + * @return the keyName value. + */ + public String keyName() { + return this.keyName; + } + + /** + * Set the keyName property: Name of the key vault key. + * + * @param keyName the keyName value to set. + * @return the DataConnectorCredentials object itself. + */ + public DataConnectorCredentials withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get the keyVersion property: Version of the key vault key. + * + * @return the keyVersion value. + */ + public String keyVersion() { + return this.keyVersion; + } + + /** + * Set the keyVersion property: Version of the key vault key. + * + * @param keyVersion the keyVersion value to set. + * @return the DataConnectorCredentials object itself. + */ + public DataConnectorCredentials withKeyVersion(String keyVersion) { + this.keyVersion = keyVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeStringField("clientId", this.clientId); + jsonWriter.writeStringField("keyVaultUri", this.keyVaultUri); + jsonWriter.writeStringField("keyName", this.keyName); + jsonWriter.writeStringField("keyVersion", this.keyVersion); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataConnectorCredentials from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataConnectorCredentials 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 DataConnectorCredentials. + */ + public static DataConnectorCredentials fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataConnectorCredentials deserializedDataConnectorCredentials = new DataConnectorCredentials(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedDataConnectorCredentials.kind = AuthCredentialsKind.fromString(reader.getString()); + } else if ("clientId".equals(fieldName)) { + deserializedDataConnectorCredentials.clientId = reader.getString(); + } else if ("keyVaultUri".equals(fieldName)) { + deserializedDataConnectorCredentials.keyVaultUri = reader.getString(); + } else if ("keyName".equals(fieldName)) { + deserializedDataConnectorCredentials.keyName = reader.getString(); + } else if ("keyVersion".equals(fieldName)) { + deserializedDataConnectorCredentials.keyVersion = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDataConnectorCredentials; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/DataManagerForAgricultureSolution.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/DataManagerForAgricultureSolution.java new file mode 100644 index 000000000000..139d270f73b7 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/DataManagerForAgricultureSolution.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Data Manager for Agriculture solution. + */ +@Immutable +public final class DataManagerForAgricultureSolution implements JsonSerializable { + /* + * Partner Id. + */ + private String partnerId; + + /* + * Solution Id. + */ + private String solutionId; + + /* + * Partner tenant Id. + */ + private String partnerTenantId; + + /* + * Data access scopes. + */ + private List dataAccessScopes; + + /* + * Marketplace offer details. + */ + private MarketPlaceOfferDetails marketPlaceOfferDetails; + + /* + * Saas application Id. + */ + private String saasApplicationId; + + /* + * Entra application Id used to access azure data manager for agriculture instance. + */ + private String accessAzureDataManagerForAgricultureApplicationId; + + /* + * Entra application name used to access azure data manager for agriculture instance. + */ + private String accessAzureDataManagerForAgricultureApplicationName; + + /* + * Whether solution inference will validate input. + */ + private boolean isValidateInput; + + /** + * Creates an instance of DataManagerForAgricultureSolution class. + */ + private DataManagerForAgricultureSolution() { + } + + /** + * Get the partnerId property: Partner Id. + * + * @return the partnerId value. + */ + public String partnerId() { + return this.partnerId; + } + + /** + * Get the solutionId property: Solution Id. + * + * @return the solutionId value. + */ + public String solutionId() { + return this.solutionId; + } + + /** + * Get the partnerTenantId property: Partner tenant Id. + * + * @return the partnerTenantId value. + */ + public String partnerTenantId() { + return this.partnerTenantId; + } + + /** + * Get the dataAccessScopes property: Data access scopes. + * + * @return the dataAccessScopes value. + */ + public List dataAccessScopes() { + return this.dataAccessScopes; + } + + /** + * Get the marketPlaceOfferDetails property: Marketplace offer details. + * + * @return the marketPlaceOfferDetails value. + */ + public MarketPlaceOfferDetails marketPlaceOfferDetails() { + return this.marketPlaceOfferDetails; + } + + /** + * Get the saasApplicationId property: Saas application Id. + * + * @return the saasApplicationId value. + */ + public String saasApplicationId() { + return this.saasApplicationId; + } + + /** + * Get the accessAzureDataManagerForAgricultureApplicationId property: Entra application Id used to access azure + * data manager for agriculture instance. + * + * @return the accessAzureDataManagerForAgricultureApplicationId value. + */ + public String accessAzureDataManagerForAgricultureApplicationId() { + return this.accessAzureDataManagerForAgricultureApplicationId; + } + + /** + * Get the accessAzureDataManagerForAgricultureApplicationName property: Entra application name used to access azure + * data manager for agriculture instance. + * + * @return the accessAzureDataManagerForAgricultureApplicationName value. + */ + public String accessAzureDataManagerForAgricultureApplicationName() { + return this.accessAzureDataManagerForAgricultureApplicationName; + } + + /** + * Get the isValidateInput property: Whether solution inference will validate input. + * + * @return the isValidateInput value. + */ + public boolean isValidateInput() { + return this.isValidateInput; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (partnerId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property partnerId in model DataManagerForAgricultureSolution")); + } + if (solutionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property solutionId in model DataManagerForAgricultureSolution")); + } + if (partnerTenantId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property partnerTenantId in model DataManagerForAgricultureSolution")); + } + if (dataAccessScopes() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property dataAccessScopes in model DataManagerForAgricultureSolution")); + } + if (marketPlaceOfferDetails() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property marketPlaceOfferDetails in model DataManagerForAgricultureSolution")); + } else { + marketPlaceOfferDetails().validate(); + } + if (saasApplicationId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property saasApplicationId in model DataManagerForAgricultureSolution")); + } + if (accessAzureDataManagerForAgricultureApplicationId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property accessAzureDataManagerForAgricultureApplicationId in model DataManagerForAgricultureSolution")); + } + if (accessAzureDataManagerForAgricultureApplicationName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property accessAzureDataManagerForAgricultureApplicationName in model DataManagerForAgricultureSolution")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DataManagerForAgricultureSolution.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("partnerId", this.partnerId); + jsonWriter.writeStringField("solutionId", this.solutionId); + jsonWriter.writeStringField("partnerTenantId", this.partnerTenantId); + jsonWriter.writeArrayField("dataAccessScopes", this.dataAccessScopes, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("marketPlaceOfferDetails", this.marketPlaceOfferDetails); + jsonWriter.writeStringField("saasApplicationId", this.saasApplicationId); + jsonWriter.writeStringField("accessAzureDataManagerForAgricultureApplicationId", + this.accessAzureDataManagerForAgricultureApplicationId); + jsonWriter.writeStringField("accessAzureDataManagerForAgricultureApplicationName", + this.accessAzureDataManagerForAgricultureApplicationName); + jsonWriter.writeBooleanField("isValidateInput", this.isValidateInput); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataManagerForAgricultureSolution from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataManagerForAgricultureSolution 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 DataManagerForAgricultureSolution. + */ + public static DataManagerForAgricultureSolution fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataManagerForAgricultureSolution deserializedDataManagerForAgricultureSolution + = new DataManagerForAgricultureSolution(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("partnerId".equals(fieldName)) { + deserializedDataManagerForAgricultureSolution.partnerId = reader.getString(); + } else if ("solutionId".equals(fieldName)) { + deserializedDataManagerForAgricultureSolution.solutionId = reader.getString(); + } else if ("partnerTenantId".equals(fieldName)) { + deserializedDataManagerForAgricultureSolution.partnerTenantId = reader.getString(); + } else if ("dataAccessScopes".equals(fieldName)) { + List dataAccessScopes = reader.readArray(reader1 -> reader1.getString()); + deserializedDataManagerForAgricultureSolution.dataAccessScopes = dataAccessScopes; + } else if ("marketPlaceOfferDetails".equals(fieldName)) { + deserializedDataManagerForAgricultureSolution.marketPlaceOfferDetails + = MarketPlaceOfferDetails.fromJson(reader); + } else if ("saasApplicationId".equals(fieldName)) { + deserializedDataManagerForAgricultureSolution.saasApplicationId = reader.getString(); + } else if ("accessAzureDataManagerForAgricultureApplicationId".equals(fieldName)) { + deserializedDataManagerForAgricultureSolution.accessAzureDataManagerForAgricultureApplicationId + = reader.getString(); + } else if ("accessAzureDataManagerForAgricultureApplicationName".equals(fieldName)) { + deserializedDataManagerForAgricultureSolution.accessAzureDataManagerForAgricultureApplicationName + = reader.getString(); + } else if ("isValidateInput".equals(fieldName)) { + deserializedDataManagerForAgricultureSolution.isValidateInput = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + + return deserializedDataManagerForAgricultureSolution; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/InstalledSolutionMap.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/InstalledSolutionMap.java new file mode 100644 index 000000000000..ac4f17aad229 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/InstalledSolutionMap.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.agricultureplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Mapping of installed solutions. + */ +@Fluent +public final class InstalledSolutionMap implements JsonSerializable { + /* + * The key representing the installed solution. + */ + private String key; + + /* + * The installed solution value. + */ + private Solution value; + + /** + * Creates an instance of InstalledSolutionMap class. + */ + public InstalledSolutionMap() { + } + + /** + * Get the key property: The key representing the installed solution. + * + * @return the key value. + */ + public String key() { + return this.key; + } + + /** + * Set the key property: The key representing the installed solution. + * + * @param key the key value to set. + * @return the InstalledSolutionMap object itself. + */ + public InstalledSolutionMap withKey(String key) { + this.key = key; + return this; + } + + /** + * Get the value property: The installed solution value. + * + * @return the value value. + */ + public Solution value() { + return this.value; + } + + /** + * Set the value property: The installed solution value. + * + * @param value the value value to set. + * @return the InstalledSolutionMap object itself. + */ + public InstalledSolutionMap withValue(Solution value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (key() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property key in model InstalledSolutionMap")); + } + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model InstalledSolutionMap")); + } else { + value().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(InstalledSolutionMap.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("key", this.key); + jsonWriter.writeJsonField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InstalledSolutionMap from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InstalledSolutionMap 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 InstalledSolutionMap. + */ + public static InstalledSolutionMap fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InstalledSolutionMap deserializedInstalledSolutionMap = new InstalledSolutionMap(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("key".equals(fieldName)) { + deserializedInstalledSolutionMap.key = reader.getString(); + } else if ("value".equals(fieldName)) { + deserializedInstalledSolutionMap.value = Solution.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedInstalledSolutionMap; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ManagedOnBehalfOfConfiguration.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ManagedOnBehalfOfConfiguration.java new file mode 100644 index 000000000000..8b5892e81b34 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ManagedOnBehalfOfConfiguration.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Configuration of the managed on behalf of resource. + */ +@Immutable +public final class ManagedOnBehalfOfConfiguration implements JsonSerializable { + /* + * Associated MoboBrokerResources. + */ + private List moboBrokerResources; + + /** + * Creates an instance of ManagedOnBehalfOfConfiguration class. + */ + private ManagedOnBehalfOfConfiguration() { + } + + /** + * Get the moboBrokerResources property: Associated MoboBrokerResources. + * + * @return the moboBrokerResources value. + */ + public List moboBrokerResources() { + return this.moboBrokerResources; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (moboBrokerResources() != null) { + moboBrokerResources().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedOnBehalfOfConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedOnBehalfOfConfiguration 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 ManagedOnBehalfOfConfiguration. + */ + public static ManagedOnBehalfOfConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedOnBehalfOfConfiguration deserializedManagedOnBehalfOfConfiguration + = new ManagedOnBehalfOfConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("moboBrokerResources".equals(fieldName)) { + List moboBrokerResources + = reader.readArray(reader1 -> MoboBrokerResource.fromJson(reader1)); + deserializedManagedOnBehalfOfConfiguration.moboBrokerResources = moboBrokerResources; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedOnBehalfOfConfiguration; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ManagedServiceIdentity.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..c6f582ae5f3b --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ManagedServiceIdentity.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Managed service identity (system assigned and/or user assigned identities). + */ +@Fluent +public final class ManagedServiceIdentity implements JsonSerializable { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + private String principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + private String tenantId; + + /* + * The type of managed identity assigned to this resource. + */ + private ManagedServiceIdentityType type; + + /* + * The identities assigned to this resource by the user. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of managed identity assigned to this resource. + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of managed identity assigned to this resource. + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property type in model ManagedServiceIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedServiceIdentity. + */ + public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("principalId".equals(fieldName)) { + deserializedManagedServiceIdentity.principalId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId = reader.getString(); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ManagedServiceIdentityType.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..436c3c1df67b --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ManagedServiceIdentityType.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** + * No managed identity. + */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** + * System assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * User assigned managed identity. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * System and user assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED + = fromString("SystemAssigned,UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/MarketPlaceOfferDetails.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/MarketPlaceOfferDetails.java new file mode 100644 index 000000000000..fddd9b210148 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/MarketPlaceOfferDetails.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Marketplace offer details of Agri solution. + */ +@Immutable +public final class MarketPlaceOfferDetails implements JsonSerializable { + /* + * Saas offer Id. + */ + private String saasOfferId; + + /* + * Publisher Id. + */ + private String publisherId; + + /** + * Creates an instance of MarketPlaceOfferDetails class. + */ + private MarketPlaceOfferDetails() { + } + + /** + * Get the saasOfferId property: Saas offer Id. + * + * @return the saasOfferId value. + */ + public String saasOfferId() { + return this.saasOfferId; + } + + /** + * Get the publisherId property: Publisher Id. + * + * @return the publisherId value. + */ + public String publisherId() { + return this.publisherId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (saasOfferId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property saasOfferId in model MarketPlaceOfferDetails")); + } + if (publisherId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property publisherId in model MarketPlaceOfferDetails")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MarketPlaceOfferDetails.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("saasOfferId", this.saasOfferId); + jsonWriter.writeStringField("publisherId", this.publisherId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MarketPlaceOfferDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MarketPlaceOfferDetails 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 MarketPlaceOfferDetails. + */ + public static MarketPlaceOfferDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MarketPlaceOfferDetails deserializedMarketPlaceOfferDetails = new MarketPlaceOfferDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("saasOfferId".equals(fieldName)) { + deserializedMarketPlaceOfferDetails.saasOfferId = reader.getString(); + } else if ("publisherId".equals(fieldName)) { + deserializedMarketPlaceOfferDetails.publisherId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMarketPlaceOfferDetails; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/MoboBrokerResource.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/MoboBrokerResource.java new file mode 100644 index 000000000000..b081f37a79c8 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/MoboBrokerResource.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.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; + +/** + * MoboBroker resource. + */ +@Immutable +public final class MoboBrokerResource implements JsonSerializable { + /* + * The fully qualified resource ID of the MoboBroker resource. + * Example: + * `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{ + * resourceType}/{resourceName}` + */ + private String id; + + /** + * Creates an instance of MoboBrokerResource class. + */ + private MoboBrokerResource() { + } + + /** + * Get the id property: The fully qualified resource ID of the MoboBroker resource. + * Example: + * `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}`. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MoboBrokerResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MoboBrokerResource 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 MoboBrokerResource. + */ + public static MoboBrokerResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MoboBrokerResource deserializedMoboBrokerResource = new MoboBrokerResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMoboBrokerResource.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMoboBrokerResource; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/Operation.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/Operation.java new file mode 100644 index 000000000000..0d6eb8ce3977 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/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.agricultureplatform.models; + +import com.azure.resourcemanager.agricultureplatform.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.agricultureplatform.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/OperationDisplay.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/OperationDisplay.java new file mode 100644 index 000000000000..c2b64747259b --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for and operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + private OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/Operations.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/Operations.java new file mode 100644 index 000000000000..38ecb98a7830 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/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.agricultureplatform.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/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/Origin.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/Origin.java new file mode 100644 index 000000000000..681be5e4ed9b --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/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.agricultureplatform.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/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ProvisioningState.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ProvisioningState.java new file mode 100644 index 000000000000..2c9c4e6a7d50 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/ProvisioningState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of the current operation. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * The resource is being provisioned. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * The resource is updating. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * The resource is being deleted. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * The resource create request has been accepted. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/Sku.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/Sku.java new file mode 100644 index 000000000000..506e96f21e6a --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/Sku.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The resource model definition representing SKU. + */ +@Fluent +public final class Sku implements JsonSerializable { + /* + * The name of the SKU. Ex - P3. It is typically a letter+number code + */ + private String name; + + /* + * This field is required to be implemented by the Resource Provider if the service has more than one tier, but is + * not required on a PUT. + */ + private SkuTier tier; + + /* + * The SKU size. When the name field is the combination of tier and some other value, this would be the standalone + * code. + */ + private String size; + + /* + * If the service has different generations of hardware, for the same SKU, then that can be captured here. + */ + private String family; + + /* + * If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible + * for the resource this may be omitted. + */ + private Integer capacity; + + /** + * Creates an instance of Sku class. + */ + public Sku() { + } + + /** + * Get the name property: The name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @param name the name value to set. + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: This field is required to be implemented by the Resource Provider if the service has more + * than one tier, but is not required on a PUT. + * + * @return the tier value. + */ + public SkuTier tier() { + return this.tier; + } + + /** + * Set the tier property: This field is required to be implemented by the Resource Provider if the service has more + * than one tier, but is not required on a PUT. + * + * @param tier the tier value to set. + * @return the Sku object itself. + */ + public Sku withTier(SkuTier tier) { + this.tier = tier; + return this; + } + + /** + * Get the size property: The SKU size. When the name field is the combination of tier and some other value, this + * would be the standalone code. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: The SKU size. When the name field is the combination of tier and some other value, this + * would be the standalone code. + * + * @param size the size value to set. + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the family property: If the service has different generations of hardware, for the same SKU, then that can be + * captured here. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: If the service has different generations of hardware, for the same SKU, then that can be + * captured here. + * + * @param family the family value to set. + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the capacity property: If the SKU supports scale out/in then the capacity integer should be included. If + * scale out/in is not possible for the resource this may be omitted. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: If the SKU supports scale out/in then the capacity integer should be included. If + * scale out/in is not possible for the resource this may be omitted. + * + * @param capacity the capacity value to set. + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property name in model Sku")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Sku.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("tier", this.tier == null ? null : this.tier.toString()); + jsonWriter.writeStringField("size", this.size); + jsonWriter.writeStringField("family", this.family); + jsonWriter.writeNumberField("capacity", this.capacity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Sku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Sku 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 Sku. + */ + public static Sku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Sku deserializedSku = new Sku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSku.name = reader.getString(); + } else if ("tier".equals(fieldName)) { + deserializedSku.tier = SkuTier.fromString(reader.getString()); + } else if ("size".equals(fieldName)) { + deserializedSku.size = reader.getString(); + } else if ("family".equals(fieldName)) { + deserializedSku.family = reader.getString(); + } else if ("capacity".equals(fieldName)) { + deserializedSku.capacity = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedSku; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/SkuTier.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/SkuTier.java new file mode 100644 index 000000000000..6028b9aed7db --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/SkuTier.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.models; + +/** + * This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not + * required on a PUT. + */ +public enum SkuTier { + /** + * The Free service tier. + */ + FREE("Free"), + + /** + * The Basic service tier. + */ + BASIC("Basic"), + + /** + * The Standard service tier. + */ + STANDARD("Standard"), + + /** + * The Premium service tier. + */ + PREMIUM("Premium"); + + /** + * The actual serialized value for a SkuTier instance. + */ + private final String value; + + SkuTier(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SkuTier instance. + * + * @param value the serialized value to parse. + * @return the parsed SkuTier object, or null if unable to parse. + */ + public static SkuTier fromString(String value) { + if (value == null) { + return null; + } + SkuTier[] items = SkuTier.values(); + for (SkuTier item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/Solution.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/Solution.java new file mode 100644 index 000000000000..3458c541f136 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/Solution.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Installed data manager for Agriculture solution detail. + */ +@Fluent +public final class Solution implements JsonSerializable { + /* + * Application name of the solution. + */ + private String applicationName; + + /* + * Partner Id. + */ + private String partnerId; + + /* + * Marketplace publisher Id. + */ + private String marketPlacePublisherId; + + /* + * Saas subscription Id. + */ + private String saasSubscriptionId; + + /* + * Saas subscription name. + */ + private String saasSubscriptionName; + + /* + * Plan Id. + */ + private String planId; + + /** + * Creates an instance of Solution class. + */ + public Solution() { + } + + /** + * Get the applicationName property: Application name of the solution. + * + * @return the applicationName value. + */ + public String applicationName() { + return this.applicationName; + } + + /** + * Set the applicationName property: Application name of the solution. + * + * @param applicationName the applicationName value to set. + * @return the Solution object itself. + */ + public Solution withApplicationName(String applicationName) { + this.applicationName = applicationName; + return this; + } + + /** + * Get the partnerId property: Partner Id. + * + * @return the partnerId value. + */ + public String partnerId() { + return this.partnerId; + } + + /** + * Set the partnerId property: Partner Id. + * + * @param partnerId the partnerId value to set. + * @return the Solution object itself. + */ + public Solution withPartnerId(String partnerId) { + this.partnerId = partnerId; + return this; + } + + /** + * Get the marketPlacePublisherId property: Marketplace publisher Id. + * + * @return the marketPlacePublisherId value. + */ + public String marketPlacePublisherId() { + return this.marketPlacePublisherId; + } + + /** + * Set the marketPlacePublisherId property: Marketplace publisher Id. + * + * @param marketPlacePublisherId the marketPlacePublisherId value to set. + * @return the Solution object itself. + */ + public Solution withMarketPlacePublisherId(String marketPlacePublisherId) { + this.marketPlacePublisherId = marketPlacePublisherId; + return this; + } + + /** + * Get the saasSubscriptionId property: Saas subscription Id. + * + * @return the saasSubscriptionId value. + */ + public String saasSubscriptionId() { + return this.saasSubscriptionId; + } + + /** + * Set the saasSubscriptionId property: Saas subscription Id. + * + * @param saasSubscriptionId the saasSubscriptionId value to set. + * @return the Solution object itself. + */ + public Solution withSaasSubscriptionId(String saasSubscriptionId) { + this.saasSubscriptionId = saasSubscriptionId; + return this; + } + + /** + * Get the saasSubscriptionName property: Saas subscription name. + * + * @return the saasSubscriptionName value. + */ + public String saasSubscriptionName() { + return this.saasSubscriptionName; + } + + /** + * Set the saasSubscriptionName property: Saas subscription name. + * + * @param saasSubscriptionName the saasSubscriptionName value to set. + * @return the Solution object itself. + */ + public Solution withSaasSubscriptionName(String saasSubscriptionName) { + this.saasSubscriptionName = saasSubscriptionName; + return this; + } + + /** + * Get the planId property: Plan Id. + * + * @return the planId value. + */ + public String planId() { + return this.planId; + } + + /** + * Set the planId property: Plan Id. + * + * @param planId the planId value to set. + * @return the Solution object itself. + */ + public Solution withPlanId(String planId) { + this.planId = planId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("applicationName", this.applicationName); + jsonWriter.writeStringField("partnerId", this.partnerId); + jsonWriter.writeStringField("marketPlacePublisherId", this.marketPlacePublisherId); + jsonWriter.writeStringField("saasSubscriptionId", this.saasSubscriptionId); + jsonWriter.writeStringField("saasSubscriptionName", this.saasSubscriptionName); + jsonWriter.writeStringField("planId", this.planId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Solution from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Solution 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 Solution. + */ + public static Solution fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Solution deserializedSolution = new Solution(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("applicationName".equals(fieldName)) { + deserializedSolution.applicationName = reader.getString(); + } else if ("partnerId".equals(fieldName)) { + deserializedSolution.partnerId = reader.getString(); + } else if ("marketPlacePublisherId".equals(fieldName)) { + deserializedSolution.marketPlacePublisherId = reader.getString(); + } else if ("saasSubscriptionId".equals(fieldName)) { + deserializedSolution.saasSubscriptionId = reader.getString(); + } else if ("saasSubscriptionName".equals(fieldName)) { + deserializedSolution.saasSubscriptionName = reader.getString(); + } else if ("planId".equals(fieldName)) { + deserializedSolution.planId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSolution; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/UserAssignedIdentity.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..038a7680d8c1 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/UserAssignedIdentity.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.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; + +/** + * User assigned identity properties. + */ +@Immutable +public final class UserAssignedIdentity implements JsonSerializable { + /* + * The client ID of the assigned identity. + */ + private String clientId; + + /* + * The principal ID of the assigned identity. + */ + private String principalId; + + /** + * Creates an instance of UserAssignedIdentity class. + */ + public UserAssignedIdentity() { + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the UserAssignedIdentity. + */ + public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId = reader.getString(); + } else if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentity.principalId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/package-info.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/package-info.java new file mode 100644 index 000000000000..0730a7920163 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/models/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for AgriculturePlatform. + */ +package com.azure.resourcemanager.agricultureplatform.models; diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/package-info.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/package-info.java new file mode 100644 index 000000000000..f4d972017813 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/com/azure/resourcemanager/agricultureplatform/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for AgriculturePlatform. + */ +package com.azure.resourcemanager.agricultureplatform; diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/module-info.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/java/module-info.java new file mode 100644 index 000000000000..eea7f1bd1727 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/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.agricultureplatform { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.agricultureplatform; + exports com.azure.resourcemanager.agricultureplatform.fluent; + exports com.azure.resourcemanager.agricultureplatform.fluent.models; + exports com.azure.resourcemanager.agricultureplatform.models; + + opens com.azure.resourcemanager.agricultureplatform.fluent.models to com.azure.core; + opens com.azure.resourcemanager.agricultureplatform.models to com.azure.core; + opens com.azure.resourcemanager.agricultureplatform.implementation.models to com.azure.core; +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-agricultureplatform/proxy-config.json b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-agricultureplatform/proxy-config.json new file mode 100644 index 000000000000..45b7cb4ae6bd --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-agricultureplatform/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.agricultureplatform.implementation.AgriServicesClientImpl$AgriServicesService"],["com.azure.resourcemanager.agricultureplatform.implementation.OperationsClientImpl$OperationsService"]] \ No newline at end of file diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-agricultureplatform/reflect-config.json b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-agricultureplatform/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-agricultureplatform/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/resources/azure-resourcemanager-agricultureplatform.properties b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/resources/azure-resourcemanager-agricultureplatform.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/main/resources/azure-resourcemanager-agricultureplatform.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceCreateOrUpdateSamples.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceCreateOrUpdateSamples.java new file mode 100644 index 000000000000..5f3980670532 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceCreateOrUpdateSamples.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.generated; + +import com.azure.resourcemanager.agricultureplatform.models.AgriServiceConfig; +import com.azure.resourcemanager.agricultureplatform.models.AgriServiceResourceProperties; +import com.azure.resourcemanager.agricultureplatform.models.DataConnectorCredentialMap; +import com.azure.resourcemanager.agricultureplatform.models.DataConnectorCredentials; +import com.azure.resourcemanager.agricultureplatform.models.InstalledSolutionMap; +import com.azure.resourcemanager.agricultureplatform.models.ManagedServiceIdentity; +import com.azure.resourcemanager.agricultureplatform.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.agricultureplatform.models.Sku; +import com.azure.resourcemanager.agricultureplatform.models.SkuTier; +import com.azure.resourcemanager.agricultureplatform.models.Solution; +import com.azure.resourcemanager.agricultureplatform.models.UserAssignedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for AgriService CreateOrUpdate. + */ +public final class AgriServiceCreateOrUpdateSamples { + /* + * x-ms-original-file: 2024-06-01-preview/AgriService_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: AgriService_CreateOrUpdate. + * + * @param manager Entry point to AgriculturePlatformManager. + */ + public static void + agriServiceCreateOrUpdate(com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager) { + manager.agriServices() + .define("abc123") + .withRegion("pkneuknooprpqirnugzwbkiie") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("key137", "fakeTokenPlaceholder")) + .withProperties(new AgriServiceResourceProperties().withConfig(new AgriServiceConfig()) + .withDataConnectorCredentials(Arrays.asList(new DataConnectorCredentialMap() + .withKey("fakeTokenPlaceholder") + .withValue(new DataConnectorCredentials().withClientId("dce298a8-1eec-481a-a8f9-a3cd5a8257b2")))) + .withInstalledSolutions(Arrays.asList(new InstalledSolutionMap().withKey("fakeTokenPlaceholder") + .withValue(new Solution().withApplicationName("bayerAgPowered.cwum"))))) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("key4955", new UserAssignedIdentity()))) + .withSku(new Sku().withName("kfl") + .withTier(SkuTier.FREE) + .withSize("r") + .withFamily("xerdhxyjwrypvxphavgrtjphtohf") + .withCapacity(20)) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceDeleteSamples.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceDeleteSamples.java new file mode 100644 index 000000000000..e8d9d6f559f9 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceDeleteSamples.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.agricultureplatform.generated; + +/** + * Samples for AgriService Delete. + */ +public final class AgriServiceDeleteSamples { + /* + * x-ms-original-file: 2024-06-01-preview/AgriService_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: AgriService_Delete. + * + * @param manager Entry point to AgriculturePlatformManager. + */ + public static void + agriServiceDelete(com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager) { + manager.agriServices().delete("rgopenapi", "abc123", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceGetByResourceGroupSamples.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceGetByResourceGroupSamples.java new file mode 100644 index 000000000000..3aac74a35021 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceGetByResourceGroupSamples.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.agricultureplatform.generated; + +/** + * Samples for AgriService GetByResourceGroup. + */ +public final class AgriServiceGetByResourceGroupSamples { + /* + * x-ms-original-file: 2024-06-01-preview/AgriService_Get_MaximumSet_Gen.json + */ + /** + * Sample code: AgriService_Get. + * + * @param manager Entry point to AgriculturePlatformManager. + */ + public static void + agriServiceGet(com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager) { + manager.agriServices().getByResourceGroupWithResponse("rgopenapi", "abc123", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceListAvailableSolutionsSamples.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceListAvailableSolutionsSamples.java new file mode 100644 index 000000000000..87f80d2c4918 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceListAvailableSolutionsSamples.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.agricultureplatform.generated; + +/** + * Samples for AgriService ListAvailableSolutions. + */ +public final class AgriServiceListAvailableSolutionsSamples { + /* + * x-ms-original-file: 2024-06-01-preview/AgriService_ListAvailableSolutions_MaximumSet_Gen.json + */ + /** + * Sample code: AgriService_ListAvailableSolutions. + * + * @param manager Entry point to AgriculturePlatformManager. + */ + public static void agriServiceListAvailableSolutions( + com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager) { + manager.agriServices() + .listAvailableSolutionsWithResponse("rgopenapi", "abc123", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceListByResourceGroupSamples.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceListByResourceGroupSamples.java new file mode 100644 index 000000000000..7dd3f64c38a6 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceListByResourceGroupSamples.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.agricultureplatform.generated; + +/** + * Samples for AgriService ListByResourceGroup. + */ +public final class AgriServiceListByResourceGroupSamples { + /* + * x-ms-original-file: 2024-06-01-preview/AgriService_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: AgriService_ListByResourceGroup. + * + * @param manager Entry point to AgriculturePlatformManager. + */ + public static void agriServiceListByResourceGroup( + com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager) { + manager.agriServices().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceListSamples.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceListSamples.java new file mode 100644 index 000000000000..21bac41cc22e --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceListSamples.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.agricultureplatform.generated; + +/** + * Samples for AgriService List. + */ +public final class AgriServiceListSamples { + /* + * x-ms-original-file: 2024-06-01-preview/AgriService_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: AgriService_ListBySubscription. + * + * @param manager Entry point to AgriculturePlatformManager. + */ + public static void agriServiceListBySubscription( + com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager) { + manager.agriServices().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceUpdateSamples.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceUpdateSamples.java new file mode 100644 index 000000000000..a9faf9276d0a --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServiceUpdateSamples.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.agricultureplatform.generated; + +import com.azure.resourcemanager.agricultureplatform.models.AgriServiceConfig; +import com.azure.resourcemanager.agricultureplatform.models.AgriServiceResource; +import com.azure.resourcemanager.agricultureplatform.models.AgriServiceResourceUpdateProperties; +import com.azure.resourcemanager.agricultureplatform.models.DataConnectorCredentialMap; +import com.azure.resourcemanager.agricultureplatform.models.DataConnectorCredentials; +import com.azure.resourcemanager.agricultureplatform.models.InstalledSolutionMap; +import com.azure.resourcemanager.agricultureplatform.models.ManagedServiceIdentity; +import com.azure.resourcemanager.agricultureplatform.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.agricultureplatform.models.Sku; +import com.azure.resourcemanager.agricultureplatform.models.SkuTier; +import com.azure.resourcemanager.agricultureplatform.models.Solution; +import com.azure.resourcemanager.agricultureplatform.models.UserAssignedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for AgriService Update. + */ +public final class AgriServiceUpdateSamples { + /* + * x-ms-original-file: 2024-06-01-preview/AgriService_Update_MaximumSet_Gen.json + */ + /** + * Sample code: AgriService_Update. + * + * @param manager Entry point to AgriculturePlatformManager. + */ + public static void + agriServiceUpdate(com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager) { + AgriServiceResource resource = manager.agriServices() + .getByResourceGroupWithResponse("rgopenapi", "abc123", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key9006", "fakeTokenPlaceholder")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("key4771", new UserAssignedIdentity()))) + .withSku(new Sku().withName("tbdtdfffkar") + .withTier(SkuTier.FREE) + .withSize("iusaqqj") + .withFamily("hxojswlgs") + .withCapacity(22)) + .withProperties(new AgriServiceResourceUpdateProperties().withConfig(new AgriServiceConfig()) + .withDataConnectorCredentials(Arrays.asList(new DataConnectorCredentialMap() + .withKey("fakeTokenPlaceholder") + .withValue(new DataConnectorCredentials().withClientId("dce298a8-1eec-481a-a8f9-a3cd5a8257b2")))) + .withInstalledSolutions(Arrays.asList(new InstalledSolutionMap().withKey("fakeTokenPlaceholder") + .withValue(new Solution().withApplicationName("bayerAgPowered.cwum"))))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/OperationsListSamples.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/OperationsListSamples.java new file mode 100644 index 000000000000..255690b6d06f --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/samples/java/com/azure/resourcemanager/agricultureplatform/generated/OperationsListSamples.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.agricultureplatform.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2024-06-01-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to AgriculturePlatformManager. + */ + public static void + operationsList(com.azure.resourcemanager.agricultureplatform.AgriculturePlatformManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServicesListAvailableSolutionsWithResponseMockTests.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServicesListAvailableSolutionsWithResponseMockTests.java new file mode 100644 index 000000000000..d6c5b21149a7 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/AgriServicesListAvailableSolutionsWithResponseMockTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.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.agricultureplatform.AgriculturePlatformManager; +import com.azure.resourcemanager.agricultureplatform.models.AvailableAgriSolutionListResult; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class AgriServicesListAvailableSolutionsWithResponseMockTests { + @Test + public void testListAvailableSolutionsWithResponse() throws Exception { + String responseStr + = "{\"solutions\":[{\"partnerId\":\"dndnvow\",\"solutionId\":\"ujjugwdkcglh\",\"partnerTenantId\":\"lazjdyggdtjixhbk\",\"dataAccessScopes\":[\"fqweykhmene\",\"fyexfwhy\",\"cibvyvdcsitynn\",\"amdecte\"],\"marketPlaceOfferDetails\":{\"saasOfferId\":\"f\",\"publisherId\":\"qsc\"},\"saasApplicationId\":\"eypvhezrkg\",\"accessAzureDataManagerForAgricultureApplicationId\":\"hcjrefovgmk\",\"accessAzureDataManagerForAgricultureApplicationName\":\"sle\",\"isValidateInput\":false}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AgriculturePlatformManager manager = AgriculturePlatformManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + AvailableAgriSolutionListResult response = manager.agriServices() + .listAvailableSolutionsWithResponse("ppusuesnzwdejba", "orxzdmohctbqvud", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("dndnvow", response.solutions().get(0).partnerId()); + Assertions.assertEquals("ujjugwdkcglh", response.solutions().get(0).solutionId()); + Assertions.assertEquals("lazjdyggdtjixhbk", response.solutions().get(0).partnerTenantId()); + Assertions.assertEquals("fqweykhmene", response.solutions().get(0).dataAccessScopes().get(0)); + Assertions.assertEquals("f", response.solutions().get(0).marketPlaceOfferDetails().saasOfferId()); + Assertions.assertEquals("qsc", response.solutions().get(0).marketPlaceOfferDetails().publisherId()); + Assertions.assertEquals("eypvhezrkg", response.solutions().get(0).saasApplicationId()); + Assertions.assertEquals("hcjrefovgmk", + response.solutions().get(0).accessAzureDataManagerForAgricultureApplicationId()); + Assertions.assertEquals("sle", + response.solutions().get(0).accessAzureDataManagerForAgricultureApplicationName()); + Assertions.assertEquals(false, response.solutions().get(0).isValidateInput()); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/AvailableAgriSolutionListResultInnerTests.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/AvailableAgriSolutionListResultInnerTests.java new file mode 100644 index 000000000000..c88929fa07d4 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/AvailableAgriSolutionListResultInnerTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.agricultureplatform.fluent.models.AvailableAgriSolutionListResultInner; +import org.junit.jupiter.api.Assertions; + +public final class AvailableAgriSolutionListResultInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AvailableAgriSolutionListResultInner model = BinaryData.fromString( + "{\"solutions\":[{\"partnerId\":\"sszdnru\",\"solutionId\":\"qguhmuo\",\"partnerTenantId\":\"qfprwzwbn\",\"dataAccessScopes\":[\"itnwuizgazxufi\",\"uckyf\"],\"marketPlaceOfferDetails\":{\"saasOfferId\":\"hr\",\"publisherId\":\"idf\"},\"saasApplicationId\":\"zwdzuh\",\"accessAzureDataManagerForAgricultureApplicationId\":\"ymwisdkft\",\"accessAzureDataManagerForAgricultureApplicationName\":\"wxmnteiwao\",\"isValidateInput\":true},{\"partnerId\":\"km\",\"solutionId\":\"jcmmxdcufufsrp\",\"partnerTenantId\":\"mzidnsezcxtb\",\"dataAccessScopes\":[\"gfycc\",\"newmdwzjeiachbo\",\"sflnrosfqp\"],\"marketPlaceOfferDetails\":{\"saasOfferId\":\"eeh\",\"publisherId\":\"zvypyqrimzinp\"},\"saasApplicationId\":\"swjdkirso\",\"accessAzureDataManagerForAgricultureApplicationId\":\"dqxhcrmnohjtckwh\",\"accessAzureDataManagerForAgricultureApplicationName\":\"soifiyipjxsqw\",\"isValidateInput\":false},{\"partnerId\":\"rjb\",\"solutionId\":\"norcjxvsnbyxqab\",\"partnerTenantId\":\"mocpc\",\"dataAccessScopes\":[\"hurzafblj\",\"gpbtoqcjmklj\",\"vbqid\",\"qajzyulpkudjkr\"],\"marketPlaceOfferDetails\":{\"saasOfferId\":\"khbzhfepgzg\",\"publisherId\":\"e\"},\"saasApplicationId\":\"zloc\",\"accessAzureDataManagerForAgricultureApplicationId\":\"scpai\",\"accessAzureDataManagerForAgricultureApplicationName\":\"rhhbcs\",\"isValidateInput\":false},{\"partnerId\":\"ummajtjaod\",\"solutionId\":\"obnbdxkqpxokaj\",\"partnerTenantId\":\"onpimexgstxg\",\"dataAccessScopes\":[\"odgmaajrmvdjwz\"],\"marketPlaceOfferDetails\":{\"saasOfferId\":\"lovmclwhijcoe\",\"publisherId\":\"ctbzaq\"},\"saasApplicationId\":\"qsycbkbfkgu\",\"accessAzureDataManagerForAgricultureApplicationId\":\"dkexxppofm\",\"accessAzureDataManagerForAgricultureApplicationName\":\"axcfjpgddtocjjx\",\"isValidateInput\":true}]}") + .toObject(AvailableAgriSolutionListResultInner.class); + Assertions.assertEquals("sszdnru", model.solutions().get(0).partnerId()); + Assertions.assertEquals("qguhmuo", model.solutions().get(0).solutionId()); + Assertions.assertEquals("qfprwzwbn", model.solutions().get(0).partnerTenantId()); + Assertions.assertEquals("itnwuizgazxufi", model.solutions().get(0).dataAccessScopes().get(0)); + Assertions.assertEquals("hr", model.solutions().get(0).marketPlaceOfferDetails().saasOfferId()); + Assertions.assertEquals("idf", model.solutions().get(0).marketPlaceOfferDetails().publisherId()); + Assertions.assertEquals("zwdzuh", model.solutions().get(0).saasApplicationId()); + Assertions.assertEquals("ymwisdkft", + model.solutions().get(0).accessAzureDataManagerForAgricultureApplicationId()); + Assertions.assertEquals("wxmnteiwao", + model.solutions().get(0).accessAzureDataManagerForAgricultureApplicationName()); + Assertions.assertEquals(true, model.solutions().get(0).isValidateInput()); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/DataManagerForAgricultureSolutionTests.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/DataManagerForAgricultureSolutionTests.java new file mode 100644 index 000000000000..ff4570d5b1ee --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/DataManagerForAgricultureSolutionTests.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.agricultureplatform.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.agricultureplatform.models.DataManagerForAgricultureSolution; +import org.junit.jupiter.api.Assertions; + +public final class DataManagerForAgricultureSolutionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataManagerForAgricultureSolution model = BinaryData.fromString( + "{\"partnerId\":\"pmouexhdz\",\"solutionId\":\"i\",\"partnerTenantId\":\"qeojnxqbzvddntw\",\"dataAccessScopes\":[\"eic\",\"twnpzaoqvuhrhcf\",\"cyddglmjthjqk\"],\"marketPlaceOfferDetails\":{\"saasOfferId\":\"pyeicxm\",\"publisherId\":\"ciwqvhk\"},\"saasApplicationId\":\"ixuigdtopbobj\",\"accessAzureDataManagerForAgricultureApplicationId\":\"ghmewuam\",\"accessAzureDataManagerForAgricultureApplicationName\":\"uhrzayvvt\",\"isValidateInput\":true}") + .toObject(DataManagerForAgricultureSolution.class); + Assertions.assertEquals("pmouexhdz", model.partnerId()); + Assertions.assertEquals("i", model.solutionId()); + Assertions.assertEquals("qeojnxqbzvddntw", model.partnerTenantId()); + Assertions.assertEquals("eic", model.dataAccessScopes().get(0)); + Assertions.assertEquals("pyeicxm", model.marketPlaceOfferDetails().saasOfferId()); + Assertions.assertEquals("ciwqvhk", model.marketPlaceOfferDetails().publisherId()); + Assertions.assertEquals("ixuigdtopbobj", model.saasApplicationId()); + Assertions.assertEquals("ghmewuam", model.accessAzureDataManagerForAgricultureApplicationId()); + Assertions.assertEquals("uhrzayvvt", model.accessAzureDataManagerForAgricultureApplicationName()); + Assertions.assertEquals(true, model.isValidateInput()); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/ManagedOnBehalfOfConfigurationTests.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/ManagedOnBehalfOfConfigurationTests.java new file mode 100644 index 000000000000..9f0fe2b698f5 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/ManagedOnBehalfOfConfigurationTests.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.agricultureplatform.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.agricultureplatform.models.ManagedOnBehalfOfConfiguration; + +public final class ManagedOnBehalfOfConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedOnBehalfOfConfiguration model = BinaryData.fromString( + "{\"moboBrokerResources\":[{\"id\":\"yahux\"},{\"id\":\"npmqnjaqwixjspro\"},{\"id\":\"vcputegj\"},{\"id\":\"wmfdatscmdvpjhul\"}]}") + .toObject(ManagedOnBehalfOfConfiguration.class); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/ManagedServiceIdentityTests.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/ManagedServiceIdentityTests.java new file mode 100644 index 000000000000..992ba622a8f8 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/ManagedServiceIdentityTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.agricultureplatform.models.ManagedServiceIdentity; +import com.azure.resourcemanager.agricultureplatform.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.agricultureplatform.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedServiceIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedServiceIdentity model = BinaryData.fromString( + "{\"principalId\":\"fxxypininmayhuy\",\"tenantId\":\"kpode\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"qi\":{\"clientId\":\"nuvamiheogna\",\"principalId\":\"zxtheotusivyevcc\"},\"ljofxqeofjaeqjh\":{\"clientId\":\"hungbwjzrnf\",\"principalId\":\"xgispemvtzfkufu\"},\"smjqulngsntnbyb\":{\"clientId\":\"b\",\"principalId\":\"v\"}}}") + .toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedServiceIdentity model = new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("qi", new UserAssignedIdentity(), "ljofxqeofjaeqjh", + new UserAssignedIdentity(), "smjqulngsntnbyb", new UserAssignedIdentity())); + model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/MarketPlaceOfferDetailsTests.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/MarketPlaceOfferDetailsTests.java new file mode 100644 index 000000000000..649733d49c60 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/MarketPlaceOfferDetailsTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.agricultureplatform.models.MarketPlaceOfferDetails; +import org.junit.jupiter.api.Assertions; + +public final class MarketPlaceOfferDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MarketPlaceOfferDetails model + = BinaryData.fromString("{\"saasOfferId\":\"vdfgiotk\",\"publisherId\":\"tutqxlngxlefgug\"}") + .toObject(MarketPlaceOfferDetails.class); + Assertions.assertEquals("vdfgiotk", model.saasOfferId()); + Assertions.assertEquals("tutqxlngxlefgug", model.publisherId()); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/MoboBrokerResourceTests.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/MoboBrokerResourceTests.java new file mode 100644 index 000000000000..076bc81aefd5 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/MoboBrokerResourceTests.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. + +package com.azure.resourcemanager.agricultureplatform.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.agricultureplatform.models.MoboBrokerResource; + +public final class MoboBrokerResourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MoboBrokerResource model + = BinaryData.fromString("{\"id\":\"uuvmkjozkrwfnd\"}").toObject(MoboBrokerResource.class); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/OperationDisplayTests.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..f89f580a84bd --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/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.agricultureplatform.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.agricultureplatform.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/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/OperationInnerTests.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/OperationInnerTests.java new file mode 100644 index 000000000000..1e936faa9acf --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/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.agricultureplatform.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.agricultureplatform.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/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/OperationListResultTests.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/OperationListResultTests.java new file mode 100644 index 000000000000..2f56d3464441 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/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.agricultureplatform.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.agricultureplatform.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/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/OperationsListMockTests.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..161213f52e0b --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/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.agricultureplatform.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.agricultureplatform.AgriculturePlatformManager; +import com.azure.resourcemanager.agricultureplatform.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\":\"krxd\",\"isDataAction\":false,\"display\":{\"provider\":\"thz\",\"resource\":\"qdrabhjybigehoqf\",\"operation\":\"wska\",\"description\":\"ktzlcuiywg\"},\"origin\":\"user\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AgriculturePlatformManager manager = AgriculturePlatformManager.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/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/SkuTests.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/SkuTests.java new file mode 100644 index 000000000000..6253e94d3d7e --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/SkuTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.agricultureplatform.models.Sku; +import com.azure.resourcemanager.agricultureplatform.models.SkuTier; +import org.junit.jupiter.api.Assertions; + +public final class SkuTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Sku model = BinaryData.fromString( + "{\"name\":\"douskcqvkocrcjdk\",\"tier\":\"Free\",\"size\":\"xbnjbiksq\",\"family\":\"lssai\",\"capacity\":229383056}") + .toObject(Sku.class); + Assertions.assertEquals("douskcqvkocrcjdk", model.name()); + Assertions.assertEquals(SkuTier.FREE, model.tier()); + Assertions.assertEquals("xbnjbiksq", model.size()); + Assertions.assertEquals("lssai", model.family()); + Assertions.assertEquals(229383056, model.capacity()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Sku model = new Sku().withName("douskcqvkocrcjdk") + .withTier(SkuTier.FREE) + .withSize("xbnjbiksq") + .withFamily("lssai") + .withCapacity(229383056); + model = BinaryData.fromObject(model).toObject(Sku.class); + Assertions.assertEquals("douskcqvkocrcjdk", model.name()); + Assertions.assertEquals(SkuTier.FREE, model.tier()); + Assertions.assertEquals("xbnjbiksq", model.size()); + Assertions.assertEquals("lssai", model.family()); + Assertions.assertEquals(229383056, model.capacity()); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/SolutionTests.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/SolutionTests.java new file mode 100644 index 000000000000..87571444daa1 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/SolutionTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.agricultureplatform.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.agricultureplatform.models.Solution; +import org.junit.jupiter.api.Assertions; + +public final class SolutionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Solution model = BinaryData.fromString( + "{\"applicationName\":\"ygexpaojakhmsb\",\"partnerId\":\"hcrzevd\",\"marketPlacePublisherId\":\"lxaolthqtrgqjbp\",\"saasSubscriptionId\":\"fsinzgvfcjrwzoxx\",\"saasSubscriptionName\":\"felluwfzitonpe\",\"planId\":\"pjkjlxofpdv\"}") + .toObject(Solution.class); + Assertions.assertEquals("ygexpaojakhmsb", model.applicationName()); + Assertions.assertEquals("hcrzevd", model.partnerId()); + Assertions.assertEquals("lxaolthqtrgqjbp", model.marketPlacePublisherId()); + Assertions.assertEquals("fsinzgvfcjrwzoxx", model.saasSubscriptionId()); + Assertions.assertEquals("felluwfzitonpe", model.saasSubscriptionName()); + Assertions.assertEquals("pjkjlxofpdv", model.planId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Solution model = new Solution().withApplicationName("ygexpaojakhmsb") + .withPartnerId("hcrzevd") + .withMarketPlacePublisherId("lxaolthqtrgqjbp") + .withSaasSubscriptionId("fsinzgvfcjrwzoxx") + .withSaasSubscriptionName("felluwfzitonpe") + .withPlanId("pjkjlxofpdv"); + model = BinaryData.fromObject(model).toObject(Solution.class); + Assertions.assertEquals("ygexpaojakhmsb", model.applicationName()); + Assertions.assertEquals("hcrzevd", model.partnerId()); + Assertions.assertEquals("lxaolthqtrgqjbp", model.marketPlacePublisherId()); + Assertions.assertEquals("fsinzgvfcjrwzoxx", model.saasSubscriptionId()); + Assertions.assertEquals("felluwfzitonpe", model.saasSubscriptionName()); + Assertions.assertEquals("pjkjlxofpdv", model.planId()); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/UserAssignedIdentityTests.java b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/UserAssignedIdentityTests.java new file mode 100644 index 000000000000..188da2016108 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/src/test/java/com/azure/resourcemanager/agricultureplatform/generated/UserAssignedIdentityTests.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.agricultureplatform.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.agricultureplatform.models.UserAssignedIdentity; + +public final class UserAssignedIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserAssignedIdentity model = BinaryData.fromString("{\"clientId\":\"gc\",\"principalId\":\"wclxxwrl\"}") + .toObject(UserAssignedIdentity.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserAssignedIdentity model = new UserAssignedIdentity(); + model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); + } +} diff --git a/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/tsp-location.yaml b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/tsp-location.yaml new file mode 100644 index 000000000000..87ad07abe5a3 --- /dev/null +++ b/sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/agricultureplatform/AgriculturePlatform.Management +commit: 54b1384a56710dd114569774b5f90a6b5778bd31 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/agricultureplatform/ci.yml b/sdk/agricultureplatform/ci.yml new file mode 100644 index 000000000000..2155969d73f2 --- /dev/null +++ b/sdk/agricultureplatform/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/agricultureplatform/ci.yml + - sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/ + exclude: + - sdk/agricultureplatform/pom.xml + - sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/agricultureplatform/ci.yml + - sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/ + exclude: + - sdk/agricultureplatform/pom.xml + - sdk/agricultureplatform/azure-resourcemanager-agricultureplatform/pom.xml + +parameters: + - name: release_azureresourcemanageragricultureplatform + displayName: azure-resourcemanager-agricultureplatform + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: agricultureplatform + Artifacts: + - name: azure-resourcemanager-agricultureplatform + groupId: com.azure.resourcemanager + safeName: azureresourcemanageragricultureplatform + releaseInBatch: ${{ parameters.release_azureresourcemanageragricultureplatform }} diff --git a/sdk/agricultureplatform/pom.xml b/sdk/agricultureplatform/pom.xml new file mode 100644 index 000000000000..eb3a6bce57e6 --- /dev/null +++ b/sdk/agricultureplatform/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-agricultureplatform-service + pom + 1.0.0 + + + azure-resourcemanager-agricultureplatform + +