From bfec5800a1fa083d0672f9bc6f75c48d2af2c150 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Fri, 4 Sep 2026 23:06:05 +0000 Subject: [PATCH] Configurations: 'specification/edgeoperator/resource-manager/Microsoft.EdgeOperator/SystemReadiness/tspconfig.yaml', and CommitSHA: '0cfc001947bf7e61161800e8d8fbfe9aa01cc0e4' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6792092 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 8 + .../README.md | 102 ++++++ .../SAMPLE.md | 53 +++ .../pom.xml | 74 ++++ .../edgeoperator/EdgeOperatorManager.java | 300 ++++++++++++++++ .../fluent/EdgeOperatorManagementClient.java | 62 ++++ .../edgeoperator/fluent/OperationsClient.java | 40 +++ .../SystemReadinessOperationsClient.java | 38 ++ .../fluent/models/OperationInner.java | 150 ++++++++ .../fluent/models/SystemReadinessInner.java | 151 ++++++++ .../fluent/models/package-info.java | 10 + .../edgeoperator/fluent/package-info.java | 10 + .../EdgeOperatorManagementClientBuilder.java | 138 ++++++++ .../EdgeOperatorManagementClientImpl.java | 324 ++++++++++++++++++ .../implementation/OperationImpl.java | 51 +++ .../implementation/OperationsClientImpl.java | 242 +++++++++++++ .../implementation/OperationsImpl.java | 45 +++ .../implementation/ResourceManagerUtils.java | 195 +++++++++++ .../implementation/SystemReadinessImpl.java | 50 +++ .../SystemReadinessOperationsClientImpl.java | 134 ++++++++ .../SystemReadinessOperationsImpl.java | 51 +++ .../models/OperationListResult.java | 96 ++++++ .../implementation/package-info.java | 10 + .../edgeoperator/models/ActionType.java | 46 +++ .../edgeoperator/models/Operation.java | 58 ++++ .../edgeoperator/models/OperationDisplay.java | 128 +++++++ .../edgeoperator/models/Operations.java | 35 ++ .../edgeoperator/models/Origin.java | 57 +++ .../edgeoperator/models/SystemReadiness.java | 55 +++ .../models/SystemReadinessCategory.java | 118 +++++++ .../models/SystemReadinessOperations.java | 33 ++ .../models/SystemReadinessProperties.java | 95 +++++ .../edgeoperator/models/package-info.java | 10 + .../edgeoperator/package-info.java | 10 + .../src/main/java/module-info.java | 16 + ...resourcemanager-edgeoperator_metadata.json | 1 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + ...re-resourcemanager-edgeoperator.properties | 1 + .../generated/OperationsListSamples.java | 22 ++ .../SystemReadinessOperationsGetSamples.java | 23 ++ .../generated/OperationDisplayTests.java | 17 + .../generated/OperationInnerTests.java | 17 + .../generated/OperationListResultTests.java | 19 + .../generated/OperationsListMockTests.java | 36 ++ .../SystemReadinessCategoryTests.java | 21 ++ .../generated/SystemReadinessInnerTests.java | 17 + ...essOperationsGetWithResponseMockTests.java | 36 ++ .../SystemReadinessPropertiesTests.java | 17 + .../tsp-location.yaml | 4 + sdk/edgeoperator/ci.yml | 46 +++ sdk/edgeoperator/pom.xml | 15 + 54 files changed, 3291 insertions(+) create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/CHANGELOG.md create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/README.md create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/SAMPLE.md create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/pom.xml create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/EdgeOperatorManager.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/EdgeOperatorManagementClient.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/OperationsClient.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/SystemReadinessOperationsClient.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/models/OperationInner.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/models/SystemReadinessInner.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/models/package-info.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/package-info.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/EdgeOperatorManagementClientBuilder.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/EdgeOperatorManagementClientImpl.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/OperationImpl.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/OperationsClientImpl.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/OperationsImpl.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/ResourceManagerUtils.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/SystemReadinessImpl.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/SystemReadinessOperationsClientImpl.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/SystemReadinessOperationsImpl.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/models/OperationListResult.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/package-info.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/ActionType.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/Operation.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/OperationDisplay.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/Operations.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/Origin.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadiness.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadinessCategory.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadinessOperations.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadinessProperties.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/package-info.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/package-info.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/module-info.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/resources/META-INF/azure-resourcemanager-edgeoperator_metadata.json create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-edgeoperator/proxy-config.json create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-edgeoperator/reflect-config.json create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/resources/azure-resourcemanager-edgeoperator.properties create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/samples/java/com/azure/resourcemanager/edgeoperator/generated/OperationsListSamples.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/samples/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessOperationsGetSamples.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/OperationDisplayTests.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/OperationInnerTests.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/OperationListResultTests.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/OperationsListMockTests.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessCategoryTests.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessInnerTests.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessOperationsGetWithResponseMockTests.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessPropertiesTests.java create mode 100644 sdk/edgeoperator/azure-resourcemanager-edgeoperator/tsp-location.yaml create mode 100644 sdk/edgeoperator/ci.yml create mode 100644 sdk/edgeoperator/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index c607b94d06bd..93ad57d0e4ba 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -542,6 +542,7 @@ com.azure.resourcemanager:azure-resourcemanager-containerserviceaimanager;1.0.0- com.azure.resourcemanager:azure-resourcemanager-redhatopenshifthcp;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-storagesync;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-resources-policy;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-edgeoperator;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.2;2.0.0-beta.2 diff --git a/pom.xml b/pom.xml index e549b4a0c858..e3305515c84b 100644 --- a/pom.xml +++ b/pom.xml @@ -113,6 +113,7 @@ sdk/dynatrace sdk/easm sdk/edgeactions + sdk/edgeoperator sdk/edgeorder sdk/edgezones sdk/education diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/CHANGELOG.md b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/CHANGELOG.md new file mode 100644 index 000000000000..804d5c79215e --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2026-09-04) + +- Azure Resource Manager EdgeOperator client library for Java. This package contains Microsoft Azure SDK for EdgeOperator Management SDK. Microsoft.EdgeOperator Resource Provider management API for Azure Local Disconnected Operations (ALDO) system readiness. Package api-version 2026-06-01-preview. 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-edgeoperator Java SDK. diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/README.md b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/README.md new file mode 100644 index 000000000000..b423797a75fe --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager EdgeOperator client library for Java + +Azure Resource Manager EdgeOperator client library for Java. + +This package contains Microsoft Azure SDK for EdgeOperator Management SDK. Microsoft.EdgeOperator Resource Provider management API for Azure Local Disconnected Operations (ALDO) system readiness. Package api-version 2026-06-01-preview. 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-edgeoperator;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-edgeoperator + 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(); +EdgeOperatorManager manager = EdgeOperatorManager + .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/edgeoperator/azure-resourcemanager-edgeoperator/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/edgeoperator/azure-resourcemanager-edgeoperator/SAMPLE.md b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/SAMPLE.md new file mode 100644 index 000000000000..52824a976170 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/SAMPLE.md @@ -0,0 +1,53 @@ +# Code snippets and samples + + +## Operations + +- [List](#operations_list) + +## SystemReadinessOperations + +- [Get](#systemreadinessoperations_get) +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2026-06-01-preview/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to EdgeOperatorManager. + */ + public static void operationsList(com.azure.resourcemanager.edgeoperator.EdgeOperatorManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### SystemReadinessOperations_Get + +```java +/** + * Samples for SystemReadinessOperations Get. + */ +public final class SystemReadinessOperationsGetSamples { + /* + * x-ms-original-file: 2026-06-01-preview/SystemReadinessOperations_Get.json + */ + /** + * Sample code: SystemReadinessOperations_Get. + * + * @param manager Entry point to EdgeOperatorManager. + */ + public static void + systemReadinessOperationsGet(com.azure.resourcemanager.edgeoperator.EdgeOperatorManager manager) { + manager.systemReadinessOperations().getWithResponse(com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/pom.xml b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/pom.xml new file mode 100644 index 000000000000..e14bdc8103c0 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/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-edgeoperator + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for EdgeOperator Management + This package contains Microsoft Azure SDK for EdgeOperator Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft.EdgeOperator Resource Provider management API for Azure Local Disconnected Operations (ALDO) system readiness. Package api-version 2026-06-01-preview. + 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.59.1 + + + com.azure + azure-core-management + 1.19.7 + + + com.azure + azure-core-test + 1.27.0-beta.18 + test + + + com.azure + azure-identity + 1.18.5 + test + + + diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/EdgeOperatorManager.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/EdgeOperatorManager.java new file mode 100644 index 000000000000..f7314a72a64e --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/EdgeOperatorManager.java @@ -0,0 +1,300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgeoperator; + +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.edgeoperator.fluent.EdgeOperatorManagementClient; +import com.azure.resourcemanager.edgeoperator.implementation.EdgeOperatorManagementClientBuilder; +import com.azure.resourcemanager.edgeoperator.implementation.OperationsImpl; +import com.azure.resourcemanager.edgeoperator.implementation.SystemReadinessOperationsImpl; +import com.azure.resourcemanager.edgeoperator.models.Operations; +import com.azure.resourcemanager.edgeoperator.models.SystemReadinessOperations; +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 EdgeOperatorManager. + * Microsoft.EdgeOperator Resource Provider management API for Azure Local Disconnected Operations (ALDO) system + * readiness. + */ +public final class EdgeOperatorManager { + private Operations operations; + + private SystemReadinessOperations systemReadinessOperations; + + private final EdgeOperatorManagementClient clientObject; + + private EdgeOperatorManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new EdgeOperatorManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of EdgeOperator service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the EdgeOperator service API instance. + */ + public static EdgeOperatorManager 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 EdgeOperator service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the EdgeOperator service API instance. + */ + public static EdgeOperatorManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new EdgeOperatorManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create EdgeOperatorManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new EdgeOperatorManager.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-edgeoperator.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 EdgeOperator service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the EdgeOperator service API instance. + */ + public EdgeOperatorManager 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.edgeoperator") + .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 EdgeOperatorManager(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 SystemReadinessOperations. + * + * @return Resource collection API of SystemReadinessOperations. + */ + public SystemReadinessOperations systemReadinessOperations() { + if (this.systemReadinessOperations == null) { + this.systemReadinessOperations + = new SystemReadinessOperationsImpl(clientObject.getSystemReadinessOperations(), this); + } + return systemReadinessOperations; + } + + /** + * Gets wrapped service client EdgeOperatorManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + * + * @return Wrapped service client EdgeOperatorManagementClient. + */ + public EdgeOperatorManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/EdgeOperatorManagementClient.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/EdgeOperatorManagementClient.java new file mode 100644 index 000000000000..da26f49d8285 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/EdgeOperatorManagementClient.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.edgeoperator.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for EdgeOperatorManagementClient class. + */ +public interface EdgeOperatorManagementClient { + /** + * 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 SystemReadinessOperationsClient object to access its operations. + * + * @return the SystemReadinessOperationsClient object. + */ + SystemReadinessOperationsClient getSystemReadinessOperations(); +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/OperationsClient.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/OperationsClient.java new file mode 100644 index 000000000000..0f8bda79613d --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/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.edgeoperator.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.edgeoperator.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/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/SystemReadinessOperationsClient.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/SystemReadinessOperationsClient.java new file mode 100644 index 000000000000..12205402477c --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/SystemReadinessOperationsClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgeoperator.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.edgeoperator.fluent.models.SystemReadinessInner; + +/** + * An instance of this class provides access to all the operations defined in SystemReadinessOperationsClient. + */ +public interface SystemReadinessOperationsClient { + /** + * Gets the Azure Local Disconnected Operations (ALDO) system readiness status. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Azure Local Disconnected Operations (ALDO) system readiness status along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(Context context); + + /** + * Gets the Azure Local Disconnected Operations (ALDO) system readiness status. + * + * @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 Azure Local Disconnected Operations (ALDO) system readiness status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SystemReadinessInner get(); +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/models/OperationInner.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/models/OperationInner.java new file mode 100644 index 000000000000..806f64a2d9b5 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/models/OperationInner.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgeoperator.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.edgeoperator.models.ActionType; +import com.azure.resourcemanager.edgeoperator.models.OperationDisplay; +import com.azure.resourcemanager.edgeoperator.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + * Resource Manager/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + private OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/models/SystemReadinessInner.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/models/SystemReadinessInner.java new file mode 100644 index 000000000000..05314e3067a4 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/models/SystemReadinessInner.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgeoperator.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.edgeoperator.models.SystemReadinessProperties; +import java.io.IOException; + +/** + * The system readiness status for Azure Local Disconnected Operations (ALDO). + * Reports whether the ALDO system is ready. This is a read-only singleton resource — the only + * accepted resource name is `default`. + * + * The subscription in the request path must be the Operator subscription. This subscription is used + * only for the access check: the resource provider verifies it on every request, and only operators + * have access to the Operator subscription and can therefore invoke the Microsoft.EdgeOperator APIs. + * Requests scoped to any other subscription are rejected. + */ +@Immutable +public final class SystemReadinessInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private SystemReadinessProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SystemReadinessInner class. + */ + private SystemReadinessInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public SystemReadinessProperties properties() { + return this.properties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SystemReadinessInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SystemReadinessInner 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 SystemReadinessInner. + */ + public static SystemReadinessInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SystemReadinessInner deserializedSystemReadinessInner = new SystemReadinessInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSystemReadinessInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSystemReadinessInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSystemReadinessInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSystemReadinessInner.properties = SystemReadinessProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSystemReadinessInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSystemReadinessInner; + }); + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/models/package-info.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/models/package-info.java new file mode 100644 index 000000000000..484fa9bc22c2 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/models/package-info.java @@ -0,0 +1,10 @@ +// 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 EdgeOperator. + * Microsoft.EdgeOperator Resource Provider management API for Azure Local Disconnected Operations (ALDO) system + * readiness. + */ +package com.azure.resourcemanager.edgeoperator.fluent.models; diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/package-info.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/package-info.java new file mode 100644 index 000000000000..449fe37e1f65 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/fluent/package-info.java @@ -0,0 +1,10 @@ +// 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 EdgeOperator. + * Microsoft.EdgeOperator Resource Provider management API for Azure Local Disconnected Operations (ALDO) system + * readiness. + */ +package com.azure.resourcemanager.edgeoperator.fluent; diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/EdgeOperatorManagementClientBuilder.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/EdgeOperatorManagementClientBuilder.java new file mode 100644 index 000000000000..1bf1f1583ddf --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/EdgeOperatorManagementClientBuilder.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.edgeoperator.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 EdgeOperatorManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { EdgeOperatorManagementClientImpl.class }) +public final class EdgeOperatorManagementClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the EdgeOperatorManagementClientBuilder. + */ + public EdgeOperatorManagementClientBuilder 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 EdgeOperatorManagementClientBuilder. + */ + public EdgeOperatorManagementClientBuilder 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 EdgeOperatorManagementClientBuilder. + */ + public EdgeOperatorManagementClientBuilder 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 EdgeOperatorManagementClientBuilder. + */ + public EdgeOperatorManagementClientBuilder 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 EdgeOperatorManagementClientBuilder. + */ + public EdgeOperatorManagementClientBuilder 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 EdgeOperatorManagementClientBuilder. + */ + public EdgeOperatorManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of EdgeOperatorManagementClientImpl with the provided parameters. + * + * @return an instance of EdgeOperatorManagementClientImpl. + */ + public EdgeOperatorManagementClientImpl 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(); + EdgeOperatorManagementClientImpl client = new EdgeOperatorManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/EdgeOperatorManagementClientImpl.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/EdgeOperatorManagementClientImpl.java new file mode 100644 index 000000000000..412adc6b12ec --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/EdgeOperatorManagementClientImpl.java @@ -0,0 +1,324 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgeoperator.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.edgeoperator.fluent.EdgeOperatorManagementClient; +import com.azure.resourcemanager.edgeoperator.fluent.OperationsClient; +import com.azure.resourcemanager.edgeoperator.fluent.SystemReadinessOperationsClient; +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 EdgeOperatorManagementClientImpl type. + */ +@ServiceClient(builder = EdgeOperatorManagementClientBuilder.class) +public final class EdgeOperatorManagementClientImpl implements EdgeOperatorManagementClient { + /** + * 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 SystemReadinessOperationsClient object to access its operations. + */ + private final SystemReadinessOperationsClient systemReadinessOperations; + + /** + * Gets the SystemReadinessOperationsClient object to access its operations. + * + * @return the SystemReadinessOperationsClient object. + */ + public SystemReadinessOperationsClient getSystemReadinessOperations() { + return this.systemReadinessOperations; + } + + /** + * Initializes an instance of EdgeOperatorManagementClient 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. + */ + EdgeOperatorManagementClientImpl(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 = "2026-06-01-preview"; + this.operations = new OperationsClientImpl(this); + this.systemReadinessOperations = new SystemReadinessOperationsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? new byte[0] : 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(EdgeOperatorManagementClientImpl.class); +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/OperationImpl.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/OperationImpl.java new file mode 100644 index 000000000000..974f5946c477 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/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.edgeoperator.implementation; + +import com.azure.resourcemanager.edgeoperator.fluent.models.OperationInner; +import com.azure.resourcemanager.edgeoperator.models.ActionType; +import com.azure.resourcemanager.edgeoperator.models.Operation; +import com.azure.resourcemanager.edgeoperator.models.OperationDisplay; +import com.azure.resourcemanager.edgeoperator.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.edgeoperator.EdgeOperatorManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.edgeoperator.EdgeOperatorManager 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.edgeoperator.EdgeOperatorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/OperationsClientImpl.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..0d70c40239dc --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/OperationsClientImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgeoperator.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.edgeoperator.fluent.OperationsClient; +import com.azure.resourcemanager.edgeoperator.fluent.models.OperationInner; +import com.azure.resourcemanager.edgeoperator.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 EdgeOperatorManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(EdgeOperatorManagementClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for EdgeOperatorManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "EdgeOperatorManagementClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.EdgeOperator/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.EdgeOperator/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/OperationsImpl.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/OperationsImpl.java new file mode 100644 index 000000000000..dffc54c52526 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/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.edgeoperator.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.edgeoperator.fluent.OperationsClient; +import com.azure.resourcemanager.edgeoperator.fluent.models.OperationInner; +import com.azure.resourcemanager.edgeoperator.models.Operation; +import com.azure.resourcemanager.edgeoperator.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.edgeoperator.EdgeOperatorManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.edgeoperator.EdgeOperatorManager 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.edgeoperator.EdgeOperatorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/ResourceManagerUtils.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..7fb32a5df213 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/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.edgeoperator.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/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/SystemReadinessImpl.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/SystemReadinessImpl.java new file mode 100644 index 000000000000..84ab3956df8a --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/SystemReadinessImpl.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.edgeoperator.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.edgeoperator.fluent.models.SystemReadinessInner; +import com.azure.resourcemanager.edgeoperator.models.SystemReadiness; +import com.azure.resourcemanager.edgeoperator.models.SystemReadinessProperties; + +public final class SystemReadinessImpl implements SystemReadiness { + private SystemReadinessInner innerObject; + + private final com.azure.resourcemanager.edgeoperator.EdgeOperatorManager serviceManager; + + SystemReadinessImpl(SystemReadinessInner innerObject, + com.azure.resourcemanager.edgeoperator.EdgeOperatorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemReadinessProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SystemReadinessInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.edgeoperator.EdgeOperatorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/SystemReadinessOperationsClientImpl.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/SystemReadinessOperationsClientImpl.java new file mode 100644 index 000000000000..67fd5398907a --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/SystemReadinessOperationsClientImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgeoperator.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.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.edgeoperator.fluent.SystemReadinessOperationsClient; +import com.azure.resourcemanager.edgeoperator.fluent.models.SystemReadinessInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SystemReadinessOperationsClient. + */ +public final class SystemReadinessOperationsClientImpl implements SystemReadinessOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SystemReadinessOperationsService service; + + /** + * The service client containing this operation class. + */ + private final EdgeOperatorManagementClientImpl client; + + /** + * Initializes an instance of SystemReadinessOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SystemReadinessOperationsClientImpl(EdgeOperatorManagementClientImpl client) { + this.service = RestProxy.create(SystemReadinessOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for EdgeOperatorManagementClientSystemReadinessOperations to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "EdgeOperatorManagementClientSystemReadinessOperations") + public interface SystemReadinessOperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOperator/systemReadiness/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.EdgeOperator/systemReadiness/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the Azure Local Disconnected Operations (ALDO) system readiness status. + * + * @throws 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 Azure Local Disconnected Operations (ALDO) system readiness status along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Azure Local Disconnected Operations (ALDO) system readiness status. + * + * @throws 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 Azure Local Disconnected Operations (ALDO) system readiness status on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync() { + return getWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the Azure Local Disconnected Operations (ALDO) system readiness status. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Azure Local Disconnected Operations (ALDO) system readiness status along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + accept, context); + } + + /** + * Gets the Azure Local Disconnected Operations (ALDO) system readiness status. + * + * @throws 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 Azure Local Disconnected Operations (ALDO) system readiness status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SystemReadinessInner get() { + return getWithResponse(Context.NONE).getValue(); + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/SystemReadinessOperationsImpl.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/SystemReadinessOperationsImpl.java new file mode 100644 index 000000000000..28529e681107 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/SystemReadinessOperationsImpl.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.edgeoperator.implementation; + +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.edgeoperator.fluent.SystemReadinessOperationsClient; +import com.azure.resourcemanager.edgeoperator.fluent.models.SystemReadinessInner; +import com.azure.resourcemanager.edgeoperator.models.SystemReadiness; +import com.azure.resourcemanager.edgeoperator.models.SystemReadinessOperations; + +public final class SystemReadinessOperationsImpl implements SystemReadinessOperations { + private static final ClientLogger LOGGER = new ClientLogger(SystemReadinessOperationsImpl.class); + + private final SystemReadinessOperationsClient innerClient; + + private final com.azure.resourcemanager.edgeoperator.EdgeOperatorManager serviceManager; + + public SystemReadinessOperationsImpl(SystemReadinessOperationsClient innerClient, + com.azure.resourcemanager.edgeoperator.EdgeOperatorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(Context context) { + Response inner = this.serviceClient().getWithResponse(context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SystemReadinessImpl(inner.getValue(), this.manager())); + } + + public SystemReadiness get() { + SystemReadinessInner inner = this.serviceClient().get(); + if (inner != null) { + return new SystemReadinessImpl(inner, this.manager()); + } else { + return null; + } + } + + private SystemReadinessOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.edgeoperator.EdgeOperatorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/models/OperationListResult.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..7f49ade5885c --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/models/OperationListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgeoperator.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.edgeoperator.fluent.models.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/package-info.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/package-info.java new file mode 100644 index 000000000000..adad84353e91 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/implementation/package-info.java @@ -0,0 +1,10 @@ +// 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 EdgeOperator. + * Microsoft.EdgeOperator Resource Provider management API for Azure Local Disconnected Operations (ALDO) system + * readiness. + */ +package com.azure.resourcemanager.edgeoperator.implementation; diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/ActionType.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/ActionType.java new file mode 100644 index 000000000000..3c5110a03d06 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/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.edgeoperator.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/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/Operation.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/Operation.java new file mode 100644 index 000000000000..ab3db25134bc --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/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.edgeoperator.models; + +import com.azure.resourcemanager.edgeoperator.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.edgeoperator.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/OperationDisplay.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/OperationDisplay.java new file mode 100644 index 000000000000..84eed000aed6 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgeoperator.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 an operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + private OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/Operations.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/Operations.java new file mode 100644 index 000000000000..34f5cc9fc360 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/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.edgeoperator.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/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/Origin.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/Origin.java new file mode 100644 index 000000000000..c7ad1a102de3 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/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.edgeoperator.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/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadiness.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadiness.java new file mode 100644 index 000000000000..15ea77f45704 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadiness.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgeoperator.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.edgeoperator.fluent.models.SystemReadinessInner; + +/** + * An immutable client-side representation of SystemReadiness. + */ +public interface SystemReadiness { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + SystemReadinessProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.edgeoperator.fluent.models.SystemReadinessInner object. + * + * @return the inner object. + */ + SystemReadinessInner innerModel(); +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadinessCategory.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadinessCategory.java new file mode 100644 index 000000000000..b9f8dfae04b9 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadinessCategory.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgeoperator.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; + +/** + * The readiness state reported for a single provider-defined category. + */ +@Immutable +public final class SystemReadinessCategory implements JsonSerializable { + /* + * The provider-defined name of the readiness category (for example, `services`, `diagnostics`, `identity`, + * `networking`). Categories may be added, renamed, or removed without an API-version change and must be treated as + * an open string. + */ + private String categoryName; + + /* + * The readiness percentage reported by the category, from 0 (not ready) to 100 (fully ready). + */ + private int readinessPercentage; + + /* + * The error messages reported for the category. The list is empty when no specific errors are available. + */ + private List errorMessageDetails; + + /** + * Creates an instance of SystemReadinessCategory class. + */ + private SystemReadinessCategory() { + } + + /** + * Get the categoryName property: The provider-defined name of the readiness category (for example, `services`, + * `diagnostics`, `identity`, `networking`). Categories may be added, renamed, or removed without an API-version + * change and must be treated as an open string. + * + * @return the categoryName value. + */ + public String categoryName() { + return this.categoryName; + } + + /** + * Get the readinessPercentage property: The readiness percentage reported by the category, from 0 (not ready) to + * 100 (fully ready). + * + * @return the readinessPercentage value. + */ + public int readinessPercentage() { + return this.readinessPercentage; + } + + /** + * Get the errorMessageDetails property: The error messages reported for the category. The list is empty when no + * specific errors are available. + * + * @return the errorMessageDetails value. + */ + public List errorMessageDetails() { + return this.errorMessageDetails; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("categoryName", this.categoryName); + jsonWriter.writeIntField("readinessPercentage", this.readinessPercentage); + jsonWriter.writeArrayField("errorMessageDetails", this.errorMessageDetails, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SystemReadinessCategory from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SystemReadinessCategory 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 SystemReadinessCategory. + */ + public static SystemReadinessCategory fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SystemReadinessCategory deserializedSystemReadinessCategory = new SystemReadinessCategory(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("categoryName".equals(fieldName)) { + deserializedSystemReadinessCategory.categoryName = reader.getString(); + } else if ("readinessPercentage".equals(fieldName)) { + deserializedSystemReadinessCategory.readinessPercentage = reader.getInt(); + } else if ("errorMessageDetails".equals(fieldName)) { + List errorMessageDetails = reader.readArray(reader1 -> reader1.getString()); + deserializedSystemReadinessCategory.errorMessageDetails = errorMessageDetails; + } else { + reader.skipChildren(); + } + } + + return deserializedSystemReadinessCategory; + }); + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadinessOperations.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadinessOperations.java new file mode 100644 index 000000000000..5d396165ac4b --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadinessOperations.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgeoperator.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of SystemReadinessOperations. + */ +public interface SystemReadinessOperations { + /** + * Gets the Azure Local Disconnected Operations (ALDO) system readiness status. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Azure Local Disconnected Operations (ALDO) system readiness status along with {@link Response}. + */ + Response getWithResponse(Context context); + + /** + * Gets the Azure Local Disconnected Operations (ALDO) system readiness status. + * + * @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 Azure Local Disconnected Operations (ALDO) system readiness status. + */ + SystemReadiness get(); +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadinessProperties.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadinessProperties.java new file mode 100644 index 000000000000..d1baecf509c4 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadinessProperties.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgeoperator.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; + +/** + * The readiness state of the Azure Local Disconnected Operations (ALDO) system. + * All fields are computed by the resource provider and are read-only. + */ +@Immutable +public final class SystemReadinessProperties implements JsonSerializable { + /* + * Indicates whether the system is ready. `true` when every readiness category has reported 100 percent. + */ + private boolean systemReady; + + /* + * The readiness state reported for each provider-defined category. + */ + private List categories; + + /** + * Creates an instance of SystemReadinessProperties class. + */ + private SystemReadinessProperties() { + } + + /** + * Get the systemReady property: Indicates whether the system is ready. `true` when every readiness category has + * reported 100 percent. + * + * @return the systemReady value. + */ + public boolean systemReady() { + return this.systemReady; + } + + /** + * Get the categories property: The readiness state reported for each provider-defined category. + * + * @return the categories value. + */ + public List categories() { + return this.categories; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SystemReadinessProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SystemReadinessProperties 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 SystemReadinessProperties. + */ + public static SystemReadinessProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SystemReadinessProperties deserializedSystemReadinessProperties = new SystemReadinessProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("systemReady".equals(fieldName)) { + deserializedSystemReadinessProperties.systemReady = reader.getBoolean(); + } else if ("categories".equals(fieldName)) { + List categories + = reader.readArray(reader1 -> SystemReadinessCategory.fromJson(reader1)); + deserializedSystemReadinessProperties.categories = categories; + } else { + reader.skipChildren(); + } + } + + return deserializedSystemReadinessProperties; + }); + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/package-info.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/package-info.java new file mode 100644 index 000000000000..bb8897c4e562 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/models/package-info.java @@ -0,0 +1,10 @@ +// 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 EdgeOperator. + * Microsoft.EdgeOperator Resource Provider management API for Azure Local Disconnected Operations (ALDO) system + * readiness. + */ +package com.azure.resourcemanager.edgeoperator.models; diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/package-info.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/package-info.java new file mode 100644 index 000000000000..930c2be651b3 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/com/azure/resourcemanager/edgeoperator/package-info.java @@ -0,0 +1,10 @@ +// 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 EdgeOperator. + * Microsoft.EdgeOperator Resource Provider management API for Azure Local Disconnected Operations (ALDO) system + * readiness. + */ +package com.azure.resourcemanager.edgeoperator; diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/module-info.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/java/module-info.java new file mode 100644 index 000000000000..1a02faec44a8 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/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.edgeoperator { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.edgeoperator; + exports com.azure.resourcemanager.edgeoperator.fluent; + exports com.azure.resourcemanager.edgeoperator.fluent.models; + exports com.azure.resourcemanager.edgeoperator.models; + + opens com.azure.resourcemanager.edgeoperator.fluent.models to com.azure.core; + opens com.azure.resourcemanager.edgeoperator.models to com.azure.core; + opens com.azure.resourcemanager.edgeoperator.implementation.models to com.azure.core; +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/resources/META-INF/azure-resourcemanager-edgeoperator_metadata.json b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/resources/META-INF/azure-resourcemanager-edgeoperator_metadata.json new file mode 100644 index 000000000000..cf2db1137ec0 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/resources/META-INF/azure-resourcemanager-edgeoperator_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersions":{"Microsoft.EdgeOperator":"2026-06-01-preview"},"crossLanguagePackageId":"Microsoft.EdgeOperator","crossLanguageVersion":"8328da92a0f7","crossLanguageDefinitions":{"com.azure.resourcemanager.edgeoperator.fluent.EdgeOperatorManagementClient":"Microsoft.EdgeOperator","com.azure.resourcemanager.edgeoperator.fluent.OperationsClient":"Microsoft.EdgeOperator.Operations","com.azure.resourcemanager.edgeoperator.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","com.azure.resourcemanager.edgeoperator.fluent.SystemReadinessOperationsClient":"Microsoft.EdgeOperator.SystemReadinessOperations","com.azure.resourcemanager.edgeoperator.fluent.SystemReadinessOperationsClient.get":"Microsoft.EdgeOperator.SystemReadinessOperations.get","com.azure.resourcemanager.edgeoperator.fluent.SystemReadinessOperationsClient.getWithResponse":"Microsoft.EdgeOperator.SystemReadinessOperations.get","com.azure.resourcemanager.edgeoperator.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","com.azure.resourcemanager.edgeoperator.fluent.models.SystemReadinessInner":"Microsoft.EdgeOperator.SystemReadiness","com.azure.resourcemanager.edgeoperator.implementation.EdgeOperatorManagementClientBuilder":"Microsoft.EdgeOperator","com.azure.resourcemanager.edgeoperator.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","com.azure.resourcemanager.edgeoperator.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","com.azure.resourcemanager.edgeoperator.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","com.azure.resourcemanager.edgeoperator.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","com.azure.resourcemanager.edgeoperator.models.SystemReadinessCategory":"Microsoft.EdgeOperator.SystemReadinessCategory","com.azure.resourcemanager.edgeoperator.models.SystemReadinessProperties":"Microsoft.EdgeOperator.SystemReadinessProperties"},"generatedFiles":["src/main/java/com/azure/resourcemanager/edgeoperator/EdgeOperatorManager.java","src/main/java/com/azure/resourcemanager/edgeoperator/fluent/EdgeOperatorManagementClient.java","src/main/java/com/azure/resourcemanager/edgeoperator/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/edgeoperator/fluent/SystemReadinessOperationsClient.java","src/main/java/com/azure/resourcemanager/edgeoperator/fluent/models/OperationInner.java","src/main/java/com/azure/resourcemanager/edgeoperator/fluent/models/SystemReadinessInner.java","src/main/java/com/azure/resourcemanager/edgeoperator/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/edgeoperator/fluent/package-info.java","src/main/java/com/azure/resourcemanager/edgeoperator/implementation/EdgeOperatorManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/edgeoperator/implementation/EdgeOperatorManagementClientImpl.java","src/main/java/com/azure/resourcemanager/edgeoperator/implementation/OperationImpl.java","src/main/java/com/azure/resourcemanager/edgeoperator/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/edgeoperator/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/edgeoperator/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/edgeoperator/implementation/SystemReadinessImpl.java","src/main/java/com/azure/resourcemanager/edgeoperator/implementation/SystemReadinessOperationsClientImpl.java","src/main/java/com/azure/resourcemanager/edgeoperator/implementation/SystemReadinessOperationsImpl.java","src/main/java/com/azure/resourcemanager/edgeoperator/implementation/models/OperationListResult.java","src/main/java/com/azure/resourcemanager/edgeoperator/implementation/package-info.java","src/main/java/com/azure/resourcemanager/edgeoperator/models/ActionType.java","src/main/java/com/azure/resourcemanager/edgeoperator/models/Operation.java","src/main/java/com/azure/resourcemanager/edgeoperator/models/OperationDisplay.java","src/main/java/com/azure/resourcemanager/edgeoperator/models/Operations.java","src/main/java/com/azure/resourcemanager/edgeoperator/models/Origin.java","src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadiness.java","src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadinessCategory.java","src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadinessOperations.java","src/main/java/com/azure/resourcemanager/edgeoperator/models/SystemReadinessProperties.java","src/main/java/com/azure/resourcemanager/edgeoperator/models/package-info.java","src/main/java/com/azure/resourcemanager/edgeoperator/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-edgeoperator/proxy-config.json b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-edgeoperator/proxy-config.json new file mode 100644 index 000000000000..7f4d2a2a8606 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-edgeoperator/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.edgeoperator.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.edgeoperator.implementation.SystemReadinessOperationsClientImpl$SystemReadinessOperationsService"]] \ No newline at end of file diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-edgeoperator/reflect-config.json b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-edgeoperator/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-edgeoperator/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/resources/azure-resourcemanager-edgeoperator.properties b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/resources/azure-resourcemanager-edgeoperator.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/main/resources/azure-resourcemanager-edgeoperator.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/samples/java/com/azure/resourcemanager/edgeoperator/generated/OperationsListSamples.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/samples/java/com/azure/resourcemanager/edgeoperator/generated/OperationsListSamples.java new file mode 100644 index 000000000000..454c7d209fb1 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/samples/java/com/azure/resourcemanager/edgeoperator/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgeoperator.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2026-06-01-preview/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to EdgeOperatorManager. + */ + public static void operationsList(com.azure.resourcemanager.edgeoperator.EdgeOperatorManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/samples/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessOperationsGetSamples.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/samples/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessOperationsGetSamples.java new file mode 100644 index 000000000000..bb2d2f412a3a --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/samples/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessOperationsGetSamples.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.edgeoperator.generated; + +/** + * Samples for SystemReadinessOperations Get. + */ +public final class SystemReadinessOperationsGetSamples { + /* + * x-ms-original-file: 2026-06-01-preview/SystemReadinessOperations_Get.json + */ + /** + * Sample code: SystemReadinessOperations_Get. + * + * @param manager Entry point to EdgeOperatorManager. + */ + public static void + systemReadinessOperationsGet(com.azure.resourcemanager.edgeoperator.EdgeOperatorManager manager) { + manager.systemReadinessOperations().getWithResponse(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/OperationDisplayTests.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..45c6429ae474 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/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.edgeoperator.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgeoperator.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/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/OperationInnerTests.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/OperationInnerTests.java new file mode 100644 index 000000000000..899decb17526 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/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.edgeoperator.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgeoperator.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/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/OperationListResultTests.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/OperationListResultTests.java new file mode 100644 index 000000000000..04d0b2590e57 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/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.edgeoperator.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgeoperator.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/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/OperationsListMockTests.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..43f7000be081 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/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.edgeoperator.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.edgeoperator.EdgeOperatorManager; +import com.azure.resourcemanager.edgeoperator.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\":\"ginuvamih\",\"isDataAction\":true,\"display\":{\"provider\":\"rxzxtheo\",\"resource\":\"si\",\"operation\":\"evcciqihnhun\",\"description\":\"wjzrnfygxgisp\"},\"origin\":\"user\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + EdgeOperatorManager manager = EdgeOperatorManager.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/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessCategoryTests.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessCategoryTests.java new file mode 100644 index 000000000000..e1f1f049d25b --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessCategoryTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgeoperator.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgeoperator.models.SystemReadinessCategory; +import org.junit.jupiter.api.Assertions; + +public final class SystemReadinessCategoryTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SystemReadinessCategory model = BinaryData.fromString( + "{\"categoryName\":\"vhpfxxypininmay\",\"readinessPercentage\":419560742,\"errorMessageDetails\":[\"bbkpodep\"]}") + .toObject(SystemReadinessCategory.class); + Assertions.assertEquals("vhpfxxypininmay", model.categoryName()); + Assertions.assertEquals(419560742, model.readinessPercentage()); + Assertions.assertEquals("bbkpodep", model.errorMessageDetails().get(0)); + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessInnerTests.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessInnerTests.java new file mode 100644 index 000000000000..4fb0ccee10ec --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessInnerTests.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.edgeoperator.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgeoperator.fluent.models.SystemReadinessInner; + +public final class SystemReadinessInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SystemReadinessInner model = BinaryData.fromString( + "{\"properties\":{\"systemReady\":true,\"categories\":[{\"categoryName\":\"bpzvgn\",\"readinessPercentage\":2137961352,\"errorMessageDetails\":[\"ymglzufcyz\",\"ohdbihanufh\",\"cbjy\"]},{\"categoryName\":\"a\",\"readinessPercentage\":987241828,\"errorMessageDetails\":[\"hxqh\"]},{\"categoryName\":\"bifpikxwczb\",\"readinessPercentage\":785135180,\"errorMessageDetails\":[\"npqxuh\",\"vyq\",\"iwbybrkxvdumjg\",\"tfwvukxgaudc\"]},{\"categoryName\":\"snhsjcnyejhkryh\",\"readinessPercentage\":761147414,\"errorMessageDetails\":[\"pczwlo\"]}]},\"id\":\"yemkkvnip\",\"name\":\"oxzjnchgejspod\",\"type\":\"ailzydehojwyahu\"}") + .toObject(SystemReadinessInner.class); + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessOperationsGetWithResponseMockTests.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessOperationsGetWithResponseMockTests.java new file mode 100644 index 000000000000..7debe82f48f2 --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessOperationsGetWithResponseMockTests.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.edgeoperator.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.edgeoperator.EdgeOperatorManager; +import com.azure.resourcemanager.edgeoperator.models.SystemReadiness; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SystemReadinessOperationsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"systemReady\":false,\"categories\":[{\"categoryName\":\"fublj\",\"readinessPercentage\":1488023344,\"errorMessageDetails\":[\"qeof\",\"aeqjhqjbasvms\",\"jqul\",\"gsntnbybkzgcwr\"]},{\"categoryName\":\"clxxwrljdo\",\"readinessPercentage\":890604952,\"errorMessageDetails\":[\"cqvkocrcjdkwtn\",\"xbnjbiksq\",\"gls\"]}]},\"id\":\"inqpjwnzll\",\"name\":\"fmppe\",\"type\":\"bvmgxsabkyqduuji\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + EdgeOperatorManager manager = EdgeOperatorManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SystemReadiness response + = manager.systemReadinessOperations().getWithResponse(com.azure.core.util.Context.NONE).getValue(); + + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessPropertiesTests.java b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessPropertiesTests.java new file mode 100644 index 000000000000..97dac13fc1db --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/src/test/java/com/azure/resourcemanager/edgeoperator/generated/SystemReadinessPropertiesTests.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.edgeoperator.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgeoperator.models.SystemReadinessProperties; + +public final class SystemReadinessPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SystemReadinessProperties model = BinaryData.fromString( + "{\"systemReady\":false,\"categories\":[{\"categoryName\":\"pmqnja\",\"readinessPercentage\":956745772,\"errorMessageDetails\":[\"xj\",\"prozvcputegjvwmf\",\"atscmd\",\"pjhulsuuvmkj\"]},{\"categoryName\":\"zkrwfn\",\"readinessPercentage\":1302147866,\"errorMessageDetails\":[\"djpslw\",\"jdpvwryo\",\"psoacctazakljl\"]},{\"categoryName\":\"hbcryffdfdosyge\",\"readinessPercentage\":1094512246,\"errorMessageDetails\":[\"ojakhmsbzjhcrze\",\"dphlxaolt\",\"qtrgqjbpfzfsinzg\",\"f\"]},{\"categoryName\":\"jrwzox\",\"readinessPercentage\":112378599,\"errorMessageDetails\":[\"felluwfzitonpe\",\"fpjkjlxofp\"]}]}") + .toObject(SystemReadinessProperties.class); + } +} diff --git a/sdk/edgeoperator/azure-resourcemanager-edgeoperator/tsp-location.yaml b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/tsp-location.yaml new file mode 100644 index 000000000000..87da6f38bfdd --- /dev/null +++ b/sdk/edgeoperator/azure-resourcemanager-edgeoperator/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/edgeoperator/resource-manager/Microsoft.EdgeOperator/SystemReadiness +commit: 0cfc001947bf7e61161800e8d8fbfe9aa01cc0e4 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/edgeoperator/ci.yml b/sdk/edgeoperator/ci.yml new file mode 100644 index 000000000000..6dd8a6d05fdf --- /dev/null +++ b/sdk/edgeoperator/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/edgeoperator/ci.yml + - sdk/edgeoperator/azure-resourcemanager-edgeoperator/ + exclude: + - sdk/edgeoperator/pom.xml + - sdk/edgeoperator/azure-resourcemanager-edgeoperator/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/edgeoperator/ci.yml + - sdk/edgeoperator/azure-resourcemanager-edgeoperator/ + exclude: + - sdk/edgeoperator/pom.xml + - sdk/edgeoperator/azure-resourcemanager-edgeoperator/pom.xml + +parameters: + - name: release_azureresourcemanageredgeoperator + displayName: azure-resourcemanager-edgeoperator + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: edgeoperator + Artifacts: + - name: azure-resourcemanager-edgeoperator + groupId: com.azure.resourcemanager + safeName: azureresourcemanageredgeoperator + releaseInBatch: ${{ parameters.release_azureresourcemanageredgeoperator }} diff --git a/sdk/edgeoperator/pom.xml b/sdk/edgeoperator/pom.xml new file mode 100644 index 000000000000..880a2ea3c5b1 --- /dev/null +++ b/sdk/edgeoperator/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-edgeoperator-service + pom + 1.0.0 + + + azure-resourcemanager-edgeoperator + +