From 106edee674b83c4adba07a1ec024aeec7339c0eb Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 15 Apr 2025 09:53:32 +0000 Subject: [PATCH] CodeGen from PR 33581 in Azure/azure-rest-api-specs Merge efc5c09ac76420e669ba217b83c81ce263ad5453 into cb5ef7fc4cb443bd5f6b21d02cbce41051beb6ae --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 8 + .../README.md | 102 +++++++ .../SAMPLE.md | 41 +++ .../pom.xml | 74 +++++ ...ommonedgesitemanageroperationsManager.java | 283 ++++++++++++++++++ .../fluent/EdgeClient.java | 48 +++ .../fluent/OperationsClient.java | 40 +++ .../fluent/models/OperationInner.java | 159 ++++++++++ .../fluent/models/package-info.java | 8 + .../fluent/package-info.java | 8 + .../implementation/EdgeClientBuilder.java | 122 ++++++++ .../implementation/EdgeClientImpl.java | 272 +++++++++++++++++ .../implementation/OperationImpl.java | 51 ++++ .../implementation/OperationsClientImpl.java | 235 +++++++++++++++ .../implementation/OperationsImpl.java | 45 +++ .../implementation/ResourceManagerUtils.java | 195 ++++++++++++ .../models/OperationListResult.java | 113 +++++++ .../implementation/package-info.java | 8 + .../models/ActionType.java | 46 +++ .../models/Operation.java | 58 ++++ .../models/OperationDisplay.java | 136 +++++++++ .../models/Operations.java | 35 +++ .../models/Origin.java | 57 ++++ .../models/package-info.java | 8 + .../package-info.java | 8 + .../src/main/java/module-info.java | 16 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + ...commonedgesitemanageroperations.properties | 1 + .../generated/OperationsListSamples.java | 36 +++ .../generated/OperationDisplayTests.java | 17 ++ .../generated/OperationInnerTests.java | 17 ++ .../generated/OperationListResultTests.java | 19 ++ .../generated/OperationsListMockTests.java | 36 +++ .../tsp-location.yaml | 4 + sdk/commonedgesitemanageroperations/ci.yml | 46 +++ sdk/commonedgesitemanageroperations/pom.xml | 15 + 39 files changed, 2371 insertions(+) create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/CHANGELOG.md create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/README.md create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/SAMPLE.md create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/pom.xml create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/CommonedgesitemanageroperationsManager.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/EdgeClient.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/OperationsClient.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/models/OperationInner.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/models/package-info.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/package-info.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/EdgeClientBuilder.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/EdgeClientImpl.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/OperationImpl.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/OperationsClientImpl.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/OperationsImpl.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/ResourceManagerUtils.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/models/OperationListResult.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/package-info.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/ActionType.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/Operation.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/OperationDisplay.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/Operations.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/Origin.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/package-info.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/package-info.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/module-info.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonedgesitemanageroperations/proxy-config.json create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonedgesitemanageroperations/reflect-config.json create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/resources/azure-resourcemanager-commonedgesitemanageroperations.properties create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/samples/java/com/azure/resourcemanager/commonedgesitemanageroperations/generated/OperationsListSamples.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/test/java/com/azure/resourcemanager/commonedgesitemanageroperations/generated/OperationDisplayTests.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/test/java/com/azure/resourcemanager/commonedgesitemanageroperations/generated/OperationInnerTests.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/test/java/com/azure/resourcemanager/commonedgesitemanageroperations/generated/OperationListResultTests.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/test/java/com/azure/resourcemanager/commonedgesitemanageroperations/generated/OperationsListMockTests.java create mode 100644 sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/tsp-location.yaml create mode 100644 sdk/commonedgesitemanageroperations/ci.yml create mode 100644 sdk/commonedgesitemanageroperations/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 92dbd2e57617..60a7ce91466c 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -473,6 +473,7 @@ com.azure.resourcemanager:azure-resourcemanager-databasewatcher;1.0.0-beta.1;1.0 com.azure.resourcemanager:azure-resourcemanager-durabletask;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-arizeaiobservabilityeval;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-weightsandbiases;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-commonedgesitemanageroperations;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.1;2.0.0-beta.1 diff --git a/pom.xml b/pom.xml index ff71d092c5bb..b6c531655b72 100644 --- a/pom.xml +++ b/pom.xml @@ -43,6 +43,7 @@ sdk/clientcore sdk/cognitiveservices sdk/commerce + sdk/commonedgesitemanageroperations sdk/communication sdk/computefleet sdk/computeschedule diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/CHANGELOG.md b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/CHANGELOG.md new file mode 100644 index 000000000000..4fb926a9b89b --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2025-04-15) + +- Azure Resource Manager commonedgesitemanageroperations client library for Java. This package contains Microsoft Azure SDK for commonedgesitemanageroperations Management SDK. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-commonedgesitemanageroperations Java SDK. diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/README.md b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/README.md new file mode 100644 index 000000000000..b05e7fef99b4 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager commonedgesitemanageroperations client library for Java + +Azure Resource Manager commonedgesitemanageroperations client library for Java. + +This package contains Microsoft Azure SDK for commonedgesitemanageroperations Management SDK. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-commonedgesitemanageroperations;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-commonedgesitemanageroperations + 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(); +CommonedgesitemanageroperationsManager manager = CommonedgesitemanageroperationsManager + .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/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/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/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/SAMPLE.md b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/SAMPLE.md new file mode 100644 index 000000000000..346b89152f29 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/SAMPLE.md @@ -0,0 +1,41 @@ +# Code snippets and samples + + +## Operations + +- [List](#operations_list) +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2024-02-01-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommonedgesitemanageroperationsManager. + */ + public static void operationsListMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.commonedgesitemanageroperations.CommonedgesitemanageroperationsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2024-02-01-preview/Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet_Gen - generated by [MinimumSet] rule. + * + * @param manager Entry point to CommonedgesitemanageroperationsManager. + */ + public static void operationsListMaximumSetGenGeneratedByMinimumSetRule( + com.azure.resourcemanager.commonedgesitemanageroperations.CommonedgesitemanageroperationsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/pom.xml b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/pom.xml new file mode 100644 index 000000000000..0cabebac9486 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/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-commonedgesitemanageroperations + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for commonedgesitemanageroperations Management + This package contains Microsoft Azure SDK for commonedgesitemanageroperations Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.55.3 + + + com.azure + azure-core-management + 1.17.0 + + + com.azure + azure-core-test + 1.27.0-beta.8 + test + + + com.azure + azure-identity + 1.15.4 + test + + + diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/CommonedgesitemanageroperationsManager.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/CommonedgesitemanageroperationsManager.java new file mode 100644 index 000000000000..db3c60ba3adb --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/CommonedgesitemanageroperationsManager.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commonedgesitemanageroperations; + +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.commonedgesitemanageroperations.fluent.EdgeClient; +import com.azure.resourcemanager.commonedgesitemanageroperations.implementation.EdgeClientBuilder; +import com.azure.resourcemanager.commonedgesitemanageroperations.implementation.OperationsImpl; +import com.azure.resourcemanager.commonedgesitemanageroperations.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to CommonedgesitemanageroperationsManager. + */ +public final class CommonedgesitemanageroperationsManager { + private Operations operations; + + private final EdgeClient clientObject; + + private CommonedgesitemanageroperationsManager(HttpPipeline httpPipeline, AzureProfile profile, + Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new EdgeClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of commonedgesitemanageroperations service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the commonedgesitemanageroperations service API instance. + */ + public static CommonedgesitemanageroperationsManager 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 commonedgesitemanageroperations service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the commonedgesitemanageroperations service API instance. + */ + public static CommonedgesitemanageroperationsManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new CommonedgesitemanageroperationsManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create CommonedgesitemanageroperationsManager with optional + * configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new CommonedgesitemanageroperationsManager.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-commonedgesitemanageroperations.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 commonedgesitemanageroperations service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the commonedgesitemanageroperations service API instance. + */ + public CommonedgesitemanageroperationsManager 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.commonedgesitemanageroperations") + .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 CommonedgesitemanageroperationsManager(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 wrapped service client EdgeClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client EdgeClient. + */ + public EdgeClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/EdgeClient.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/EdgeClient.java new file mode 100644 index 000000000000..d84dccf612bd --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/EdgeClient.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commonedgesitemanageroperations.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for EdgeClient class. + */ +public interface EdgeClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/OperationsClient.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/OperationsClient.java new file mode 100644 index 000000000000..b20089946a31 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/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.commonedgesitemanageroperations.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.commonedgesitemanageroperations.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/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/models/OperationInner.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/models/OperationInner.java new file mode 100644 index 000000000000..de7e69530b2f --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/models/OperationInner.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commonedgesitemanageroperations.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.commonedgesitemanageroperations.models.ActionType; +import com.azure.resourcemanager.commonedgesitemanageroperations.models.OperationDisplay; +import com.azure.resourcemanager.commonedgesitemanageroperations.models.Origin; +import java.io.IOException; + +/** + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + * Resource Manager/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + private OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/models/package-info.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/models/package-info.java new file mode 100644 index 000000000000..db44b8ecbdfa --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/models/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for Edge. + */ +package com.azure.resourcemanager.commonedgesitemanageroperations.fluent.models; diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/package-info.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/package-info.java new file mode 100644 index 000000000000..242f27367414 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/fluent/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for Edge. + */ +package com.azure.resourcemanager.commonedgesitemanageroperations.fluent; diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/EdgeClientBuilder.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/EdgeClientBuilder.java new file mode 100644 index 000000000000..2e87ddfd85fa --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/EdgeClientBuilder.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commonedgesitemanageroperations.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 EdgeClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { EdgeClientImpl.class }) +public final class EdgeClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the EdgeClientBuilder. + */ + public EdgeClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the EdgeClientBuilder. + */ + public EdgeClientBuilder 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 EdgeClientBuilder. + */ + public EdgeClientBuilder 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 EdgeClientBuilder. + */ + public EdgeClientBuilder 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 EdgeClientBuilder. + */ + public EdgeClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of EdgeClientImpl with the provided parameters. + * + * @return an instance of EdgeClientImpl. + */ + public EdgeClientImpl 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(); + EdgeClientImpl client = new EdgeClientImpl(localPipeline, localSerializerAdapter, localDefaultPollInterval, + localEnvironment, localEndpoint); + return client; + } +} diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/EdgeClientImpl.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/EdgeClientImpl.java new file mode 100644 index 000000000000..b30dc76bcaba --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/EdgeClientImpl.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commonedgesitemanageroperations.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.commonedgesitemanageroperations.fluent.EdgeClient; +import com.azure.resourcemanager.commonedgesitemanageroperations.fluent.OperationsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the EdgeClientImpl type. + */ +@ServiceClient(builder = EdgeClientBuilder.class) +public final class EdgeClientImpl implements EdgeClient { + /** + * 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 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; + } + + /** + * Initializes an instance of EdgeClient 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. + */ + EdgeClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, + AzureEnvironment environment, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.apiVersion = "2024-02-01-preview"; + this.operations = new OperationsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EdgeClientImpl.class); +} diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/OperationImpl.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/OperationImpl.java new file mode 100644 index 000000000000..1288e0b62f2b --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/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.commonedgesitemanageroperations.implementation; + +import com.azure.resourcemanager.commonedgesitemanageroperations.fluent.models.OperationInner; +import com.azure.resourcemanager.commonedgesitemanageroperations.models.ActionType; +import com.azure.resourcemanager.commonedgesitemanageroperations.models.Operation; +import com.azure.resourcemanager.commonedgesitemanageroperations.models.OperationDisplay; +import com.azure.resourcemanager.commonedgesitemanageroperations.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.commonedgesitemanageroperations.CommonedgesitemanageroperationsManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.commonedgesitemanageroperations.CommonedgesitemanageroperationsManager 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.commonedgesitemanageroperations.CommonedgesitemanageroperationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/OperationsClientImpl.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..e3ca8d91859e --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/OperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commonedgesitemanageroperations.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.commonedgesitemanageroperations.fluent.OperationsClient; +import com.azure.resourcemanager.commonedgesitemanageroperations.fluent.models.OperationInner; +import com.azure.resourcemanager.commonedgesitemanageroperations.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 EdgeClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(EdgeClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for EdgeClientOperations to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "EdgeClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Edge/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/OperationsImpl.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/OperationsImpl.java new file mode 100644 index 000000000000..14566e3aef28 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/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.commonedgesitemanageroperations.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.commonedgesitemanageroperations.fluent.OperationsClient; +import com.azure.resourcemanager.commonedgesitemanageroperations.fluent.models.OperationInner; +import com.azure.resourcemanager.commonedgesitemanageroperations.models.Operation; +import com.azure.resourcemanager.commonedgesitemanageroperations.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.commonedgesitemanageroperations.CommonedgesitemanageroperationsManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.commonedgesitemanageroperations.CommonedgesitemanageroperationsManager 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.commonedgesitemanageroperations.CommonedgesitemanageroperationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/ResourceManagerUtils.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..cbdc2ffdc187 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/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.commonedgesitemanageroperations.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/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/models/OperationListResult.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..fff04a36ec7c --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/models/OperationListResult.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commonedgesitemanageroperations.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.commonedgesitemanageroperations.fluent.models.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model OperationListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperationListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/package-info.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/package-info.java new file mode 100644 index 000000000000..77f93f45f4fe --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/implementation/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for Edge. + */ +package com.azure.resourcemanager.commonedgesitemanageroperations.implementation; diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/ActionType.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/ActionType.java new file mode 100644 index 000000000000..687be4eaf215 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/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.commonedgesitemanageroperations.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/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/Operation.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/Operation.java new file mode 100644 index 000000000000..7cf23aef346b --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/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.commonedgesitemanageroperations.models; + +import com.azure.resourcemanager.commonedgesitemanageroperations.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.commonedgesitemanageroperations.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/OperationDisplay.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/OperationDisplay.java new file mode 100644 index 000000000000..099f6fd141c1 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.commonedgesitemanageroperations.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for and operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + private OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/Operations.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/Operations.java new file mode 100644 index 000000000000..422dac26aadb --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/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.commonedgesitemanageroperations.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/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/Origin.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/Origin.java new file mode 100644 index 000000000000..e78558440ae1 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/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.commonedgesitemanageroperations.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/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/package-info.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/package-info.java new file mode 100644 index 000000000000..f42536c2719d --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/models/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for Edge. + */ +package com.azure.resourcemanager.commonedgesitemanageroperations.models; diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/package-info.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/package-info.java new file mode 100644 index 000000000000..ec6eab886a8d --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/com/azure/resourcemanager/commonedgesitemanageroperations/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for Edge. + */ +package com.azure.resourcemanager.commonedgesitemanageroperations; diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/module-info.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/java/module-info.java new file mode 100644 index 000000000000..8d90c7e5f4ab --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/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.commonedgesitemanageroperations { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.commonedgesitemanageroperations; + exports com.azure.resourcemanager.commonedgesitemanageroperations.fluent; + exports com.azure.resourcemanager.commonedgesitemanageroperations.fluent.models; + exports com.azure.resourcemanager.commonedgesitemanageroperations.models; + + opens com.azure.resourcemanager.commonedgesitemanageroperations.fluent.models to com.azure.core; + opens com.azure.resourcemanager.commonedgesitemanageroperations.models to com.azure.core; + opens com.azure.resourcemanager.commonedgesitemanageroperations.implementation.models to com.azure.core; +} diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonedgesitemanageroperations/proxy-config.json b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonedgesitemanageroperations/proxy-config.json new file mode 100644 index 000000000000..598d31522068 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonedgesitemanageroperations/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.commonedgesitemanageroperations.implementation.OperationsClientImpl$OperationsService"]] \ No newline at end of file diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonedgesitemanageroperations/reflect-config.json b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonedgesitemanageroperations/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonedgesitemanageroperations/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/resources/azure-resourcemanager-commonedgesitemanageroperations.properties b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/resources/azure-resourcemanager-commonedgesitemanageroperations.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/main/resources/azure-resourcemanager-commonedgesitemanageroperations.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/samples/java/com/azure/resourcemanager/commonedgesitemanageroperations/generated/OperationsListSamples.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/samples/java/com/azure/resourcemanager/commonedgesitemanageroperations/generated/OperationsListSamples.java new file mode 100644 index 000000000000..f43582b23653 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/samples/java/com/azure/resourcemanager/commonedgesitemanageroperations/generated/OperationsListSamples.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.commonedgesitemanageroperations.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2024-02-01-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet_Gen - generated by [MaximumSet] rule. + * + * @param manager Entry point to CommonedgesitemanageroperationsManager. + */ + public static void operationsListMaximumSetGenGeneratedByMaximumSetRule( + com.azure.resourcemanager.commonedgesitemanageroperations.CommonedgesitemanageroperationsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2024-02-01-preview/Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet_Gen - generated by [MinimumSet] rule. + * + * @param manager Entry point to CommonedgesitemanageroperationsManager. + */ + public static void operationsListMaximumSetGenGeneratedByMinimumSetRule( + com.azure.resourcemanager.commonedgesitemanageroperations.CommonedgesitemanageroperationsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/test/java/com/azure/resourcemanager/commonedgesitemanageroperations/generated/OperationDisplayTests.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/test/java/com/azure/resourcemanager/commonedgesitemanageroperations/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..56b409fe2594 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/test/java/com/azure/resourcemanager/commonedgesitemanageroperations/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.commonedgesitemanageroperations.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commonedgesitemanageroperations.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/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/test/java/com/azure/resourcemanager/commonedgesitemanageroperations/generated/OperationInnerTests.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/test/java/com/azure/resourcemanager/commonedgesitemanageroperations/generated/OperationInnerTests.java new file mode 100644 index 000000000000..faf0d79bbfb1 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/test/java/com/azure/resourcemanager/commonedgesitemanageroperations/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.commonedgesitemanageroperations.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commonedgesitemanageroperations.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/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/test/java/com/azure/resourcemanager/commonedgesitemanageroperations/generated/OperationListResultTests.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/test/java/com/azure/resourcemanager/commonedgesitemanageroperations/generated/OperationListResultTests.java new file mode 100644 index 000000000000..2ef0613bf3c6 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/test/java/com/azure/resourcemanager/commonedgesitemanageroperations/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.commonedgesitemanageroperations.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.commonedgesitemanageroperations.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/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/test/java/com/azure/resourcemanager/commonedgesitemanageroperations/generated/OperationsListMockTests.java b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/test/java/com/azure/resourcemanager/commonedgesitemanageroperations/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..08d5301adfe5 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/src/test/java/com/azure/resourcemanager/commonedgesitemanageroperations/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.commonedgesitemanageroperations.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.commonedgesitemanageroperations.CommonedgesitemanageroperationsManager; +import com.azure.resourcemanager.commonedgesitemanageroperations.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\":\"ijbpzvgnwzsymgl\",\"isDataAction\":true,\"display\":{\"provider\":\"zk\",\"resource\":\"dbihanufhfcbj\",\"operation\":\"a\",\"description\":\"th\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + CommonedgesitemanageroperationsManager manager = CommonedgesitemanageroperationsManager.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/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/tsp-location.yaml b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/tsp-location.yaml new file mode 100644 index 000000000000..11d9232228ee --- /dev/null +++ b/sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/edge/Microsoft.Edge.Management +commit: 6e702986ee542ebd38d0ab2e2f2c00ab48a50b45 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/commonedgesitemanageroperations/ci.yml b/sdk/commonedgesitemanageroperations/ci.yml new file mode 100644 index 000000000000..8ef926a1a614 --- /dev/null +++ b/sdk/commonedgesitemanageroperations/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/commonedgesitemanageroperations/ci.yml + - sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/ + exclude: + - sdk/commonedgesitemanageroperations/pom.xml + - sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/commonedgesitemanageroperations/ci.yml + - sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/ + exclude: + - sdk/commonedgesitemanageroperations/pom.xml + - sdk/commonedgesitemanageroperations/azure-resourcemanager-commonedgesitemanageroperations/pom.xml + +parameters: + - name: release_azureresourcemanagercommonedgesitemanageroperations + displayName: azure-resourcemanager-commonedgesitemanageroperations + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: commonedgesitemanageroperations + Artifacts: + - name: azure-resourcemanager-commonedgesitemanageroperations + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercommonedgesitemanageroperations + releaseInBatch: ${{ parameters.release_azureresourcemanagercommonedgesitemanageroperations }} diff --git a/sdk/commonedgesitemanageroperations/pom.xml b/sdk/commonedgesitemanageroperations/pom.xml new file mode 100644 index 000000000000..21bf57ce04fb --- /dev/null +++ b/sdk/commonedgesitemanageroperations/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-commonedgesitemanageroperations-service + pom + 1.0.0 + + + azure-resourcemanager-commonedgesitemanageroperations + +