diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index b04d701dd93c..0179ef93cf01 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -477,6 +477,7 @@ com.azure.resourcemanager:azure-resourcemanager-carbonoptimization;1.0.0-beta.1; com.azure.resourcemanager:azure-resourcemanager-dependencymap;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-portalservicescopilot;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-lambdatesthyperexecute;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-playwright;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 59226c65adf6..7838598ddcaa 100644 --- a/pom.xml +++ b/pom.xml @@ -174,6 +174,7 @@ sdk/peering sdk/personalizer sdk/pineconevectordb + sdk/playwright sdk/playwrighttesting sdk/policyinsights sdk/portalservices diff --git a/sdk/playwright/azure-resourcemanager-playwright/CHANGELOG.md b/sdk/playwright/azure-resourcemanager-playwright/CHANGELOG.md new file mode 100644 index 000000000000..e2d20b264c2f --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2025-04-29) + +- Azure Resource Manager Microsoft Playwright Service client library for Java. This package contains Microsoft Azure SDK for Microsoft Playwright Service Management SDK. Playwright service provides access to Playwright workspace resource and it's operations. 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-playwright Java SDK. diff --git a/sdk/playwright/azure-resourcemanager-playwright/README.md b/sdk/playwright/azure-resourcemanager-playwright/README.md new file mode 100644 index 000000000000..06bf9fe9d542 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Microsoft Playwright Service client library for Java + +Azure Resource Manager Microsoft Playwright Service client library for Java. + +This package contains Microsoft Azure SDK for Microsoft Playwright Service Management SDK. Playwright service provides access to Playwright workspace resource and it's operations. 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-playwright;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-playwright + 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(); +MicrosoftPlaywrightServiceManager manager = MicrosoftPlaywrightServiceManager + .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/playwright/azure-resourcemanager-playwright/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/playwright/azure-resourcemanager-playwright/SAMPLE.md b/sdk/playwright/azure-resourcemanager-playwright/SAMPLE.md new file mode 100644 index 000000000000..39674f3df706 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/SAMPLE.md @@ -0,0 +1,57 @@ +# Code snippets and samples + + +## Operations + +- [List](#operations_list) + +## PlaywrightWorkspaces + +- [CheckNameAvailability](#playwrightworkspaces_checknameavailability) +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-07-01-preview/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to MicrosoftPlaywrightServiceManager. + */ + public static void operationsList(com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### PlaywrightWorkspaces_CheckNameAvailability + +```java +import com.azure.resourcemanager.playwright.models.CheckNameAvailabilityRequest; + +/** + * Samples for PlaywrightWorkspaces CheckNameAvailability. + */ +public final class PlaywrightWorkspacesCheckNameAvailabilitySamples { + /* + * x-ms-original-file: 2025-07-01-preview/PlaywrightWorkspaces_CheckNameAvailability.json + */ + /** + * Sample code: PlaywrightWorkspaces_CheckNameAvailability. + * + * @param manager Entry point to MicrosoftPlaywrightServiceManager. + */ + public static void playwrightWorkspacesCheckNameAvailability( + com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager manager) { + manager.playwrightWorkspaces() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityRequest().withName("dummyName") + .withType("Microsoft.LoadTestService/PlaywrightWorkspaces"), com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/playwright/azure-resourcemanager-playwright/pom.xml b/sdk/playwright/azure-resourcemanager-playwright/pom.xml new file mode 100644 index 000000000000..2670262d57a1 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/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-playwright + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Microsoft Playwright Service Management + This package contains Microsoft Azure SDK for Microsoft Playwright Service Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Playwright service provides access to Playwright workspace resource and it's operations. + 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/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/MicrosoftPlaywrightServiceManager.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/MicrosoftPlaywrightServiceManager.java new file mode 100644 index 000000000000..e95c59ff6cbd --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/MicrosoftPlaywrightServiceManager.java @@ -0,0 +1,300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright; + +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.playwright.fluent.ManagementClient; +import com.azure.resourcemanager.playwright.implementation.ManagementClientBuilder; +import com.azure.resourcemanager.playwright.implementation.OperationsImpl; +import com.azure.resourcemanager.playwright.implementation.PlaywrightWorkspacesImpl; +import com.azure.resourcemanager.playwright.models.Operations; +import com.azure.resourcemanager.playwright.models.PlaywrightWorkspaces; +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 MicrosoftPlaywrightServiceManager. + * Playwright service provides access to Playwright workspace resource and it's operations. + */ +public final class MicrosoftPlaywrightServiceManager { + private Operations operations; + + private PlaywrightWorkspaces playwrightWorkspaces; + + private final ManagementClient clientObject; + + private MicrosoftPlaywrightServiceManager(HttpPipeline httpPipeline, AzureProfile profile, + Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new ManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Microsoft Playwright Service service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Microsoft Playwright Service service API instance. + */ + public static MicrosoftPlaywrightServiceManager 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 Microsoft Playwright Service service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Microsoft Playwright Service service API instance. + */ + public static MicrosoftPlaywrightServiceManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new MicrosoftPlaywrightServiceManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create MicrosoftPlaywrightServiceManager with optional + * configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new MicrosoftPlaywrightServiceManager.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-playwright.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 Microsoft Playwright Service service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Microsoft Playwright Service service API instance. + */ + public MicrosoftPlaywrightServiceManager 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.playwright") + .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 MicrosoftPlaywrightServiceManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of PlaywrightWorkspaces. It manages PlaywrightWorkspace. + * + * @return Resource collection API of PlaywrightWorkspaces. + */ + public PlaywrightWorkspaces playwrightWorkspaces() { + if (this.playwrightWorkspaces == null) { + this.playwrightWorkspaces = new PlaywrightWorkspacesImpl(clientObject.getPlaywrightWorkspaces(), this); + } + return playwrightWorkspaces; + } + + /** + * Gets wrapped service client ManagementClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client ManagementClient. + */ + public ManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/ManagementClient.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/ManagementClient.java new file mode 100644 index 000000000000..13c21c3f80bb --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/ManagementClient.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for ManagementClient class. + */ +public interface ManagementClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the PlaywrightWorkspacesClient object to access its operations. + * + * @return the PlaywrightWorkspacesClient object. + */ + PlaywrightWorkspacesClient getPlaywrightWorkspaces(); +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/OperationsClient.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/OperationsClient.java new file mode 100644 index 000000000000..5f027517512e --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/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.playwright.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.playwright.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/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/PlaywrightWorkspacesClient.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/PlaywrightWorkspacesClient.java new file mode 100644 index 000000000000..42655a6dbd6c --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/PlaywrightWorkspacesClient.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.playwright.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.playwright.fluent.models.PlaywrightWorkspaceInner; +import com.azure.resourcemanager.playwright.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.playwright.models.PlaywrightWorkspaceUpdate; + +/** + * An instance of this class provides access to all the operations defined in PlaywrightWorkspacesClient. + */ +public interface PlaywrightWorkspacesClient { + /** + * Get a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @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 PlaywrightWorkspace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String playwrightWorkspaceName, Context context); + + /** + * Get a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @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 PlaywrightWorkspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PlaywrightWorkspaceInner getByResourceGroup(String resourceGroupName, String playwrightWorkspaceName); + + /** + * Create a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of playwright workspace resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PlaywrightWorkspaceInner> beginCreateOrUpdate( + String resourceGroupName, String playwrightWorkspaceName, PlaywrightWorkspaceInner resource); + + /** + * Create a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of playwright workspace resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PlaywrightWorkspaceInner> beginCreateOrUpdate( + String resourceGroupName, String playwrightWorkspaceName, PlaywrightWorkspaceInner resource, Context context); + + /** + * Create a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return playwright workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PlaywrightWorkspaceInner createOrUpdate(String resourceGroupName, String playwrightWorkspaceName, + PlaywrightWorkspaceInner resource); + + /** + * Create a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return playwright workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PlaywrightWorkspaceInner createOrUpdate(String resourceGroupName, String playwrightWorkspaceName, + PlaywrightWorkspaceInner resource, Context context); + + /** + * Update a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return playwright workspace resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String playwrightWorkspaceName, + PlaywrightWorkspaceUpdate properties, Context context); + + /** + * Update a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return playwright workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PlaywrightWorkspaceInner update(String resourceGroupName, String playwrightWorkspaceName, + PlaywrightWorkspaceUpdate properties); + + /** + * Delete a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String playwrightWorkspaceName); + + /** + * Delete a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String playwrightWorkspaceName, + Context context); + + /** + * Delete a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String playwrightWorkspaceName); + + /** + * Delete a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String playwrightWorkspaceName, Context context); + + /** + * List PlaywrightWorkspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List PlaywrightWorkspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List PlaywrightWorkspace resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List PlaywrightWorkspace resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Implements global CheckNameAvailability operations. + * + * @param body The CheckAvailability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse(CheckNameAvailabilityRequest body, + Context context); + + /** + * Implements global CheckNameAvailability operations. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResponseInner checkNameAvailability(CheckNameAvailabilityRequest body); +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/models/CheckNameAvailabilityResponseInner.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/models/CheckNameAvailabilityResponseInner.java new file mode 100644 index 000000000000..6a2026d17d60 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/models/CheckNameAvailabilityResponseInner.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.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.playwright.models.CheckNameAvailabilityReason; +import java.io.IOException; + +/** + * The check availability result. + */ +@Immutable +public final class CheckNameAvailabilityResponseInner implements JsonSerializable { + /* + * Indicates if the resource name is available. + */ + private Boolean nameAvailable; + + /* + * The reason why the given name is not available. + */ + private CheckNameAvailabilityReason reason; + + /* + * Detailed reason why the given name is not available. + */ + private String message; + + /** + * Creates an instance of CheckNameAvailabilityResponseInner class. + */ + private CheckNameAvailabilityResponseInner() { + } + + /** + * Get the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + public CheckNameAvailabilityReason reason() { + return this.reason; + } + + /** + * Get the message property: Detailed reason why the given name is not available. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("nameAvailable", this.nameAvailable); + jsonWriter.writeStringField("reason", this.reason == null ? null : this.reason.toString()); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckNameAvailabilityResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckNameAvailabilityResponseInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CheckNameAvailabilityResponseInner. + */ + public static CheckNameAvailabilityResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckNameAvailabilityResponseInner deserializedCheckNameAvailabilityResponseInner + = new CheckNameAvailabilityResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nameAvailable".equals(fieldName)) { + deserializedCheckNameAvailabilityResponseInner.nameAvailable + = reader.getNullable(JsonReader::getBoolean); + } else if ("reason".equals(fieldName)) { + deserializedCheckNameAvailabilityResponseInner.reason + = CheckNameAvailabilityReason.fromString(reader.getString()); + } else if ("message".equals(fieldName)) { + deserializedCheckNameAvailabilityResponseInner.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckNameAvailabilityResponseInner; + }); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/models/OperationInner.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/models/OperationInner.java new file mode 100644 index 000000000000..08eec2741bbb --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/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.playwright.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.playwright.models.ActionType; +import com.azure.resourcemanager.playwright.models.OperationDisplay; +import com.azure.resourcemanager.playwright.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/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/models/PlaywrightWorkspaceInner.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/models/PlaywrightWorkspaceInner.java new file mode 100644 index 000000000000..12f89ed674ff --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/models/PlaywrightWorkspaceInner.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.playwright.models.PlaywrightWorkspaceProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Playwright workspace resource. + */ +@Fluent +public final class PlaywrightWorkspaceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private PlaywrightWorkspaceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of PlaywrightWorkspaceInner class. + */ + public PlaywrightWorkspaceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public PlaywrightWorkspaceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the PlaywrightWorkspaceInner object itself. + */ + public PlaywrightWorkspaceInner withProperties(PlaywrightWorkspaceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public PlaywrightWorkspaceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PlaywrightWorkspaceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PlaywrightWorkspaceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PlaywrightWorkspaceInner 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 PlaywrightWorkspaceInner. + */ + public static PlaywrightWorkspaceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PlaywrightWorkspaceInner deserializedPlaywrightWorkspaceInner = new PlaywrightWorkspaceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPlaywrightWorkspaceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPlaywrightWorkspaceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPlaywrightWorkspaceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedPlaywrightWorkspaceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPlaywrightWorkspaceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedPlaywrightWorkspaceInner.properties = PlaywrightWorkspaceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPlaywrightWorkspaceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPlaywrightWorkspaceInner; + }); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/models/package-info.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/models/package-info.java new file mode 100644 index 000000000000..276a6c13e45c --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for MicrosoftPlaywrightService. + * Playwright service provides access to Playwright workspace resource and it's operations. + */ +package com.azure.resourcemanager.playwright.fluent.models; diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/package-info.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/package-info.java new file mode 100644 index 000000000000..3abf56fe1feb --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for MicrosoftPlaywrightService. + * Playwright service provides access to Playwright workspace resource and it's operations. + */ +package com.azure.resourcemanager.playwright.fluent; diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/CheckNameAvailabilityResponseImpl.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/CheckNameAvailabilityResponseImpl.java new file mode 100644 index 000000000000..272ed98ff09d --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/CheckNameAvailabilityResponseImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.implementation; + +import com.azure.resourcemanager.playwright.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.playwright.models.CheckNameAvailabilityReason; +import com.azure.resourcemanager.playwright.models.CheckNameAvailabilityResponse; + +public final class CheckNameAvailabilityResponseImpl implements CheckNameAvailabilityResponse { + private CheckNameAvailabilityResponseInner innerObject; + + private final com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager serviceManager; + + CheckNameAvailabilityResponseImpl(CheckNameAvailabilityResponseInner innerObject, + com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public CheckNameAvailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/ManagementClientBuilder.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/ManagementClientBuilder.java new file mode 100644 index 000000000000..934a6e16288c --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/ManagementClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.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 ManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { ManagementClientImpl.class }) +public final class ManagementClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the ManagementClientBuilder. + */ + public ManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the ManagementClientBuilder. + */ + public ManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ManagementClientBuilder. + */ + public ManagementClientBuilder 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 ManagementClientBuilder. + */ + public ManagementClientBuilder 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 ManagementClientBuilder. + */ + public ManagementClientBuilder 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 ManagementClientBuilder. + */ + public ManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ManagementClientImpl with the provided parameters. + * + * @return an instance of ManagementClientImpl. + */ + public ManagementClientImpl 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(); + ManagementClientImpl client = new ManagementClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/ManagementClientImpl.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/ManagementClientImpl.java new file mode 100644 index 000000000000..4a5faf16891d --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/ManagementClientImpl.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.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.playwright.fluent.ManagementClient; +import com.azure.resourcemanager.playwright.fluent.OperationsClient; +import com.azure.resourcemanager.playwright.fluent.PlaywrightWorkspacesClient; +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 ManagementClientImpl type. + */ +@ServiceClient(builder = ManagementClientBuilder.class) +public final class ManagementClientImpl implements ManagementClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The PlaywrightWorkspacesClient object to access its operations. + */ + private final PlaywrightWorkspacesClient playwrightWorkspaces; + + /** + * Gets the PlaywrightWorkspacesClient object to access its operations. + * + * @return the PlaywrightWorkspacesClient object. + */ + public PlaywrightWorkspacesClient getPlaywrightWorkspaces() { + return this.playwrightWorkspaces; + } + + /** + * Initializes an instance of ManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + ManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, + AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2025-07-01-preview"; + this.operations = new OperationsClientImpl(this); + this.playwrightWorkspaces = new PlaywrightWorkspacesClientImpl(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(ManagementClientImpl.class); +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/OperationImpl.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/OperationImpl.java new file mode 100644 index 000000000000..97ec8b916bc0 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/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.playwright.implementation; + +import com.azure.resourcemanager.playwright.fluent.models.OperationInner; +import com.azure.resourcemanager.playwright.models.ActionType; +import com.azure.resourcemanager.playwright.models.Operation; +import com.azure.resourcemanager.playwright.models.OperationDisplay; +import com.azure.resourcemanager.playwright.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager 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.playwright.MicrosoftPlaywrightServiceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/OperationsClientImpl.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..3536ae2dcc70 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/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.playwright.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.playwright.fluent.OperationsClient; +import com.azure.resourcemanager.playwright.fluent.models.OperationInner; +import com.azure.resourcemanager.playwright.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 ManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ManagementClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagementClientOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ManagementClientOper") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.LoadTestService/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/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/OperationsImpl.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/OperationsImpl.java new file mode 100644 index 000000000000..7b14e293be24 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/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.playwright.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.playwright.fluent.OperationsClient; +import com.azure.resourcemanager.playwright.fluent.models.OperationInner; +import com.azure.resourcemanager.playwright.models.Operation; +import com.azure.resourcemanager.playwright.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.playwright.MicrosoftPlaywrightServiceManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager 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.playwright.MicrosoftPlaywrightServiceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/PlaywrightWorkspaceImpl.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/PlaywrightWorkspaceImpl.java new file mode 100644 index 000000000000..0cfbd5f344c9 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/PlaywrightWorkspaceImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.playwright.fluent.models.PlaywrightWorkspaceInner; +import com.azure.resourcemanager.playwright.models.PlaywrightWorkspace; +import com.azure.resourcemanager.playwright.models.PlaywrightWorkspaceProperties; +import com.azure.resourcemanager.playwright.models.PlaywrightWorkspaceUpdate; +import com.azure.resourcemanager.playwright.models.PlaywrightWorkspaceUpdateProperties; +import java.util.Collections; +import java.util.Map; + +public final class PlaywrightWorkspaceImpl + implements PlaywrightWorkspace, PlaywrightWorkspace.Definition, PlaywrightWorkspace.Update { + private PlaywrightWorkspaceInner innerObject; + + private final com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public PlaywrightWorkspaceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public PlaywrightWorkspaceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String playwrightWorkspaceName; + + private PlaywrightWorkspaceUpdate updateProperties; + + public PlaywrightWorkspaceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public PlaywrightWorkspace create() { + this.innerObject = serviceManager.serviceClient() + .getPlaywrightWorkspaces() + .createOrUpdate(resourceGroupName, playwrightWorkspaceName, this.innerModel(), Context.NONE); + return this; + } + + public PlaywrightWorkspace create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPlaywrightWorkspaces() + .createOrUpdate(resourceGroupName, playwrightWorkspaceName, this.innerModel(), context); + return this; + } + + PlaywrightWorkspaceImpl(String name, + com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager serviceManager) { + this.innerObject = new PlaywrightWorkspaceInner(); + this.serviceManager = serviceManager; + this.playwrightWorkspaceName = name; + } + + public PlaywrightWorkspaceImpl update() { + this.updateProperties = new PlaywrightWorkspaceUpdate(); + return this; + } + + public PlaywrightWorkspace apply() { + this.innerObject = serviceManager.serviceClient() + .getPlaywrightWorkspaces() + .updateWithResponse(resourceGroupName, playwrightWorkspaceName, updateProperties, Context.NONE) + .getValue(); + return this; + } + + public PlaywrightWorkspace apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPlaywrightWorkspaces() + .updateWithResponse(resourceGroupName, playwrightWorkspaceName, updateProperties, context) + .getValue(); + return this; + } + + PlaywrightWorkspaceImpl(PlaywrightWorkspaceInner innerObject, + com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.playwrightWorkspaceName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "playwrightWorkspaces"); + } + + public PlaywrightWorkspace refresh() { + this.innerObject = serviceManager.serviceClient() + .getPlaywrightWorkspaces() + .getByResourceGroupWithResponse(resourceGroupName, playwrightWorkspaceName, Context.NONE) + .getValue(); + return this; + } + + public PlaywrightWorkspace refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPlaywrightWorkspaces() + .getByResourceGroupWithResponse(resourceGroupName, playwrightWorkspaceName, context) + .getValue(); + return this; + } + + public PlaywrightWorkspaceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public PlaywrightWorkspaceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public PlaywrightWorkspaceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public PlaywrightWorkspaceImpl withProperties(PlaywrightWorkspaceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public PlaywrightWorkspaceImpl withProperties(PlaywrightWorkspaceUpdateProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/PlaywrightWorkspacesClientImpl.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/PlaywrightWorkspacesClientImpl.java new file mode 100644 index 000000000000..60ed9c9ee339 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/PlaywrightWorkspacesClientImpl.java @@ -0,0 +1,1324 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.playwright.fluent.PlaywrightWorkspacesClient; +import com.azure.resourcemanager.playwright.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.playwright.fluent.models.PlaywrightWorkspaceInner; +import com.azure.resourcemanager.playwright.implementation.models.PlaywrightWorkspaceListResult; +import com.azure.resourcemanager.playwright.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.playwright.models.PlaywrightWorkspaceUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PlaywrightWorkspacesClient. + */ +public final class PlaywrightWorkspacesClientImpl implements PlaywrightWorkspacesClient { + /** + * The proxy service used to perform REST calls. + */ + private final PlaywrightWorkspacesService service; + + /** + * The service client containing this operation class. + */ + private final ManagementClientImpl client; + + /** + * Initializes an instance of PlaywrightWorkspacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PlaywrightWorkspacesClientImpl(ManagementClientImpl client) { + this.service = RestProxy.create(PlaywrightWorkspacesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagementClientPlaywrightWorkspaces to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ManagementClientPlay") + public interface PlaywrightWorkspacesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/playwrightWorkspaces/{playwrightWorkspaceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("playwrightWorkspaceName") String playwrightWorkspaceName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/playwrightWorkspaces/{playwrightWorkspaceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("playwrightWorkspaceName") String playwrightWorkspaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") PlaywrightWorkspaceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/playwrightWorkspaces/{playwrightWorkspaceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("playwrightWorkspaceName") String playwrightWorkspaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") PlaywrightWorkspaceUpdate properties, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/playwrightWorkspaces/{playwrightWorkspaceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("playwrightWorkspaceName") String playwrightWorkspaceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/playwrightWorkspaces") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/playwrightWorkspaces") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/checkNameAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CheckNameAvailabilityRequest body, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @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 PlaywrightWorkspace along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String playwrightWorkspaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (playwrightWorkspaceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter playwrightWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, playwrightWorkspaceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @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 PlaywrightWorkspace along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String playwrightWorkspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (playwrightWorkspaceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter playwrightWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, playwrightWorkspaceName, accept, context); + } + + /** + * Get a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @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 PlaywrightWorkspace on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String playwrightWorkspaceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, playwrightWorkspaceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @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 PlaywrightWorkspace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String playwrightWorkspaceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, playwrightWorkspaceName, context).block(); + } + + /** + * Get a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @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 PlaywrightWorkspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PlaywrightWorkspaceInner getByResourceGroup(String resourceGroupName, String playwrightWorkspaceName) { + return getByResourceGroupWithResponse(resourceGroupName, playwrightWorkspaceName, Context.NONE).getValue(); + } + + /** + * Create a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return playwright workspace resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String playwrightWorkspaceName, PlaywrightWorkspaceInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (playwrightWorkspaceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter playwrightWorkspaceName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, playwrightWorkspaceName, contentType, accept, + resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return playwright workspace resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String playwrightWorkspaceName, PlaywrightWorkspaceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (playwrightWorkspaceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter playwrightWorkspaceName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, playwrightWorkspaceName, contentType, accept, resource, + context); + } + + /** + * Create a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of playwright workspace resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PlaywrightWorkspaceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String playwrightWorkspaceName, PlaywrightWorkspaceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, playwrightWorkspaceName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), PlaywrightWorkspaceInner.class, PlaywrightWorkspaceInner.class, + this.client.getContext()); + } + + /** + * Create a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of playwright workspace resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PlaywrightWorkspaceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String playwrightWorkspaceName, PlaywrightWorkspaceInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, playwrightWorkspaceName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), PlaywrightWorkspaceInner.class, PlaywrightWorkspaceInner.class, context); + } + + /** + * Create a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of playwright workspace resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PlaywrightWorkspaceInner> beginCreateOrUpdate( + String resourceGroupName, String playwrightWorkspaceName, PlaywrightWorkspaceInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, playwrightWorkspaceName, resource).getSyncPoller(); + } + + /** + * Create a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of playwright workspace resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PlaywrightWorkspaceInner> beginCreateOrUpdate( + String resourceGroupName, String playwrightWorkspaceName, PlaywrightWorkspaceInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, playwrightWorkspaceName, resource, context) + .getSyncPoller(); + } + + /** + * Create a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return playwright workspace resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String playwrightWorkspaceName, + PlaywrightWorkspaceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, playwrightWorkspaceName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return playwright workspace resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String playwrightWorkspaceName, + PlaywrightWorkspaceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, playwrightWorkspaceName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return playwright workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PlaywrightWorkspaceInner createOrUpdate(String resourceGroupName, String playwrightWorkspaceName, + PlaywrightWorkspaceInner resource) { + return createOrUpdateAsync(resourceGroupName, playwrightWorkspaceName, resource).block(); + } + + /** + * Create a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return playwright workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PlaywrightWorkspaceInner createOrUpdate(String resourceGroupName, String playwrightWorkspaceName, + PlaywrightWorkspaceInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, playwrightWorkspaceName, resource, context).block(); + } + + /** + * Update a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return playwright workspace resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String playwrightWorkspaceName, PlaywrightWorkspaceUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (playwrightWorkspaceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter playwrightWorkspaceName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, playwrightWorkspaceName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return playwright workspace resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String playwrightWorkspaceName, PlaywrightWorkspaceUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (playwrightWorkspaceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter playwrightWorkspaceName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, playwrightWorkspaceName, contentType, accept, properties, context); + } + + /** + * Update a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return playwright workspace resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String playwrightWorkspaceName, + PlaywrightWorkspaceUpdate properties) { + return updateWithResponseAsync(resourceGroupName, playwrightWorkspaceName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return playwright workspace resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, + String playwrightWorkspaceName, PlaywrightWorkspaceUpdate properties, Context context) { + return updateWithResponseAsync(resourceGroupName, playwrightWorkspaceName, properties, context).block(); + } + + /** + * Update a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return playwright workspace resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PlaywrightWorkspaceInner update(String resourceGroupName, String playwrightWorkspaceName, + PlaywrightWorkspaceUpdate properties) { + return updateWithResponse(resourceGroupName, playwrightWorkspaceName, properties, Context.NONE).getValue(); + } + + /** + * Delete a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String playwrightWorkspaceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (playwrightWorkspaceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter playwrightWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, playwrightWorkspaceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String playwrightWorkspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (playwrightWorkspaceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter playwrightWorkspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, playwrightWorkspaceName, accept, context); + } + + /** + * Delete a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String playwrightWorkspaceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, playwrightWorkspaceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String playwrightWorkspaceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, playwrightWorkspaceName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String playwrightWorkspaceName) { + return this.beginDeleteAsync(resourceGroupName, playwrightWorkspaceName).getSyncPoller(); + } + + /** + * Delete a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String playwrightWorkspaceName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, playwrightWorkspaceName, context).getSyncPoller(); + } + + /** + * Delete a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String playwrightWorkspaceName) { + return beginDeleteAsync(resourceGroupName, playwrightWorkspaceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String playwrightWorkspaceName, Context context) { + return beginDeleteAsync(resourceGroupName, playwrightWorkspaceName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String playwrightWorkspaceName) { + deleteAsync(resourceGroupName, playwrightWorkspaceName).block(); + } + + /** + * Delete a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String playwrightWorkspaceName, Context context) { + deleteAsync(resourceGroupName, playwrightWorkspaceName, context).block(); + } + + /** + * List PlaywrightWorkspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List PlaywrightWorkspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List PlaywrightWorkspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List PlaywrightWorkspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List PlaywrightWorkspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List PlaywrightWorkspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List PlaywrightWorkspace resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List PlaywrightWorkspace resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List PlaywrightWorkspace resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List PlaywrightWorkspace resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List PlaywrightWorkspace resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List PlaywrightWorkspace resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Implements global CheckNameAvailability operations. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + checkNameAvailabilityWithResponseAsync(CheckNameAvailabilityRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.checkNameAvailability(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements global CheckNameAvailability operations. + * + * @param body The CheckAvailability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + checkNameAvailabilityWithResponseAsync(CheckNameAvailabilityRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.checkNameAvailability(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), contentType, accept, body, context); + } + + /** + * Implements global CheckNameAvailability operations. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync(CheckNameAvailabilityRequest body) { + return checkNameAvailabilityWithResponseAsync(body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Implements global CheckNameAvailability operations. + * + * @param body The CheckAvailability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response + checkNameAvailabilityWithResponse(CheckNameAvailabilityRequest body, Context context) { + return checkNameAvailabilityWithResponseAsync(body, context).block(); + } + + /** + * Implements global CheckNameAvailability operations. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResponseInner checkNameAvailability(CheckNameAvailabilityRequest body) { + return checkNameAvailabilityWithResponse(body, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/PlaywrightWorkspacesImpl.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/PlaywrightWorkspacesImpl.java new file mode 100644 index 000000000000..ec99ab003940 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/PlaywrightWorkspacesImpl.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.playwright.fluent.PlaywrightWorkspacesClient; +import com.azure.resourcemanager.playwright.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.playwright.fluent.models.PlaywrightWorkspaceInner; +import com.azure.resourcemanager.playwright.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.playwright.models.CheckNameAvailabilityResponse; +import com.azure.resourcemanager.playwright.models.PlaywrightWorkspace; +import com.azure.resourcemanager.playwright.models.PlaywrightWorkspaces; + +public final class PlaywrightWorkspacesImpl implements PlaywrightWorkspaces { + private static final ClientLogger LOGGER = new ClientLogger(PlaywrightWorkspacesImpl.class); + + private final PlaywrightWorkspacesClient innerClient; + + private final com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager serviceManager; + + public PlaywrightWorkspacesImpl(PlaywrightWorkspacesClient innerClient, + com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String playwrightWorkspaceName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, playwrightWorkspaceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PlaywrightWorkspaceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PlaywrightWorkspace getByResourceGroup(String resourceGroupName, String playwrightWorkspaceName) { + PlaywrightWorkspaceInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, playwrightWorkspaceName); + if (inner != null) { + return new PlaywrightWorkspaceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String playwrightWorkspaceName) { + this.serviceClient().delete(resourceGroupName, playwrightWorkspaceName); + } + + public void delete(String resourceGroupName, String playwrightWorkspaceName, Context context) { + this.serviceClient().delete(resourceGroupName, playwrightWorkspaceName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PlaywrightWorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PlaywrightWorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PlaywrightWorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PlaywrightWorkspaceImpl(inner1, this.manager())); + } + + public Response checkNameAvailabilityWithResponse(CheckNameAvailabilityRequest body, + Context context) { + Response inner + = this.serviceClient().checkNameAvailabilityWithResponse(body, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CheckNameAvailabilityResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckNameAvailabilityResponse checkNameAvailability(CheckNameAvailabilityRequest body) { + CheckNameAvailabilityResponseInner inner = this.serviceClient().checkNameAvailability(body); + if (inner != null) { + return new CheckNameAvailabilityResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public PlaywrightWorkspace getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String playwrightWorkspaceName = ResourceManagerUtils.getValueFromIdByName(id, "playwrightWorkspaces"); + if (playwrightWorkspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'playwrightWorkspaces'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, playwrightWorkspaceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String playwrightWorkspaceName = ResourceManagerUtils.getValueFromIdByName(id, "playwrightWorkspaces"); + if (playwrightWorkspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'playwrightWorkspaces'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, playwrightWorkspaceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String playwrightWorkspaceName = ResourceManagerUtils.getValueFromIdByName(id, "playwrightWorkspaces"); + if (playwrightWorkspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'playwrightWorkspaces'.", id))); + } + this.delete(resourceGroupName, playwrightWorkspaceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String playwrightWorkspaceName = ResourceManagerUtils.getValueFromIdByName(id, "playwrightWorkspaces"); + if (playwrightWorkspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'playwrightWorkspaces'.", id))); + } + this.delete(resourceGroupName, playwrightWorkspaceName, context); + } + + private PlaywrightWorkspacesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager manager() { + return this.serviceManager; + } + + public PlaywrightWorkspaceImpl define(String name) { + return new PlaywrightWorkspaceImpl(name, this.manager()); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/ResourceManagerUtils.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..c3554b2d53d6 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/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.playwright.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/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/models/OperationListResult.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..10dfec53d8f1 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/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.playwright.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.playwright.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/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/models/PlaywrightWorkspaceListResult.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/models/PlaywrightWorkspaceListResult.java new file mode 100644 index 000000000000..02c70cf49302 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/models/PlaywrightWorkspaceListResult.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.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.playwright.fluent.models.PlaywrightWorkspaceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a PlaywrightWorkspace list operation. + */ +@Immutable +public final class PlaywrightWorkspaceListResult implements JsonSerializable { + /* + * The PlaywrightWorkspace items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of PlaywrightWorkspaceListResult class. + */ + private PlaywrightWorkspaceListResult() { + } + + /** + * Get the value property: The PlaywrightWorkspace 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 PlaywrightWorkspaceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PlaywrightWorkspaceListResult.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 PlaywrightWorkspaceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PlaywrightWorkspaceListResult 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 PlaywrightWorkspaceListResult. + */ + public static PlaywrightWorkspaceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PlaywrightWorkspaceListResult deserializedPlaywrightWorkspaceListResult + = new PlaywrightWorkspaceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PlaywrightWorkspaceInner.fromJson(reader1)); + deserializedPlaywrightWorkspaceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPlaywrightWorkspaceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPlaywrightWorkspaceListResult; + }); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/package-info.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/package-info.java new file mode 100644 index 000000000000..8ef4c8270efc --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for MicrosoftPlaywrightService. + * Playwright service provides access to Playwright workspace resource and it's operations. + */ +package com.azure.resourcemanager.playwright.implementation; diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/ActionType.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/ActionType.java new file mode 100644 index 000000000000..684d280093fc --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/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.playwright.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/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/CheckNameAvailabilityReason.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/CheckNameAvailabilityReason.java new file mode 100644 index 000000000000..9afe10742478 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/CheckNameAvailabilityReason.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Possible reasons for a name not being available. + */ +public final class CheckNameAvailabilityReason extends ExpandableStringEnum { + /** + * Name is invalid. + */ + public static final CheckNameAvailabilityReason INVALID = fromString("Invalid"); + + /** + * Name already exists. + */ + public static final CheckNameAvailabilityReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates a new instance of CheckNameAvailabilityReason value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CheckNameAvailabilityReason() { + } + + /** + * Creates or finds a CheckNameAvailabilityReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding CheckNameAvailabilityReason. + */ + public static CheckNameAvailabilityReason fromString(String name) { + return fromString(name, CheckNameAvailabilityReason.class); + } + + /** + * Gets known CheckNameAvailabilityReason values. + * + * @return known CheckNameAvailabilityReason values. + */ + public static Collection values() { + return values(CheckNameAvailabilityReason.class); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/CheckNameAvailabilityRequest.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/CheckNameAvailabilityRequest.java new file mode 100644 index 000000000000..25c4cb394015 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/CheckNameAvailabilityRequest.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The check availability request body. + */ +@Fluent +public final class CheckNameAvailabilityRequest implements JsonSerializable { + /* + * The name of the resource for which availability needs to be checked. + */ + private String name; + + /* + * The resource type. + */ + private String type; + + /** + * Creates an instance of CheckNameAvailabilityRequest class. + */ + public CheckNameAvailabilityRequest() { + } + + /** + * Get the name property: The name of the resource for which availability needs to be checked. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the resource for which availability needs to be checked. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The resource type. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckNameAvailabilityRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckNameAvailabilityRequest if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CheckNameAvailabilityRequest. + */ + public static CheckNameAvailabilityRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckNameAvailabilityRequest deserializedCheckNameAvailabilityRequest = new CheckNameAvailabilityRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCheckNameAvailabilityRequest.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCheckNameAvailabilityRequest.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckNameAvailabilityRequest; + }); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/CheckNameAvailabilityResponse.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/CheckNameAvailabilityResponse.java new file mode 100644 index 000000000000..2b30e612e980 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/CheckNameAvailabilityResponse.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.models; + +import com.azure.resourcemanager.playwright.fluent.models.CheckNameAvailabilityResponseInner; + +/** + * An immutable client-side representation of CheckNameAvailabilityResponse. + */ +public interface CheckNameAvailabilityResponse { + /** + * Gets the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + CheckNameAvailabilityReason reason(); + + /** + * Gets the message property: Detailed reason why the given name is not available. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.playwright.fluent.models.CheckNameAvailabilityResponseInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResponseInner innerModel(); +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/EnablementStatus.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/EnablementStatus.java new file mode 100644 index 000000000000..7f3ddeb59645 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/EnablementStatus.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.playwright.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The enablement status of a feature. + */ +public final class EnablementStatus extends ExpandableStringEnum { + /** + * The feature is Enabled. + */ + public static final EnablementStatus ENABLED = fromString("Enabled"); + + /** + * The feature is Disabled. + */ + public static final EnablementStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of EnablementStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EnablementStatus() { + } + + /** + * Creates or finds a EnablementStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding EnablementStatus. + */ + public static EnablementStatus fromString(String name) { + return fromString(name, EnablementStatus.class); + } + + /** + * Gets known EnablementStatus values. + * + * @return known EnablementStatus values. + */ + public static Collection values() { + return values(EnablementStatus.class); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/Operation.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/Operation.java new file mode 100644 index 000000000000..612288e326b9 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/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.playwright.models; + +import com.azure.resourcemanager.playwright.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.playwright.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/OperationDisplay.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/OperationDisplay.java new file mode 100644 index 000000000000..19f476668caf --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/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.playwright.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/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/Operations.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/Operations.java new file mode 100644 index 000000000000..769fe4c59520 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/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.playwright.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/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/Origin.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/Origin.java new file mode 100644 index 000000000000..48cb361d73be --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/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.playwright.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/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/PlaywrightWorkspace.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/PlaywrightWorkspace.java new file mode 100644 index 000000000000..0a490b5d25b9 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/PlaywrightWorkspace.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.playwright.fluent.models.PlaywrightWorkspaceInner; +import java.util.Map; + +/** + * An immutable client-side representation of PlaywrightWorkspace. + */ +public interface PlaywrightWorkspace { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + PlaywrightWorkspaceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.playwright.fluent.models.PlaywrightWorkspaceInner object. + * + * @return the inner object. + */ + PlaywrightWorkspaceInner innerModel(); + + /** + * The entirety of the PlaywrightWorkspace definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The PlaywrightWorkspace definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the PlaywrightWorkspace definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the PlaywrightWorkspace definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the PlaywrightWorkspace definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the PlaywrightWorkspace definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + PlaywrightWorkspace create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PlaywrightWorkspace create(Context context); + } + + /** + * The stage of the PlaywrightWorkspace definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the PlaywrightWorkspace definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(PlaywrightWorkspaceProperties properties); + } + } + + /** + * Begins update for the PlaywrightWorkspace resource. + * + * @return the stage of resource update. + */ + PlaywrightWorkspace.Update update(); + + /** + * The template for PlaywrightWorkspace update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PlaywrightWorkspace apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PlaywrightWorkspace apply(Context context); + } + + /** + * The PlaywrightWorkspace update stages. + */ + interface UpdateStages { + /** + * The stage of the PlaywrightWorkspace update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the PlaywrightWorkspace update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(PlaywrightWorkspaceUpdateProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PlaywrightWorkspace refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PlaywrightWorkspace refresh(Context context); +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/PlaywrightWorkspaceProperties.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/PlaywrightWorkspaceProperties.java new file mode 100644 index 000000000000..f1bc4395d0d2 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/PlaywrightWorkspaceProperties.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Playwright workspace resource properties. + */ +@Fluent +public final class PlaywrightWorkspaceProperties implements JsonSerializable { + /* + * The status of the last resource operation. + */ + private ProvisioningState provisioningState; + + /* + * The workspace data plane URI. + */ + private String dataplaneUri; + + /* + * This property sets the connection region for client workers to cloud-hosted browsers. If enabled, workers connect + * to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the + * Azure region in which the workspace was initially created. + */ + private EnablementStatus regionalAffinity; + + /* + * When enabled, this feature allows the workspace to use local auth (through service access token) for executing + * operations. + */ + private EnablementStatus localAuth; + + /** + * Creates an instance of PlaywrightWorkspaceProperties class. + */ + public PlaywrightWorkspaceProperties() { + } + + /** + * Get the provisioningState property: The status of the last resource operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the dataplaneUri property: The workspace data plane URI. + * + * @return the dataplaneUri value. + */ + public String dataplaneUri() { + return this.dataplaneUri; + } + + /** + * Get the regionalAffinity property: This property sets the connection region for client workers to cloud-hosted + * browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If + * disabled, workers connect to browsers in the Azure region in which the workspace was initially created. + * + * @return the regionalAffinity value. + */ + public EnablementStatus regionalAffinity() { + return this.regionalAffinity; + } + + /** + * Set the regionalAffinity property: This property sets the connection region for client workers to cloud-hosted + * browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If + * disabled, workers connect to browsers in the Azure region in which the workspace was initially created. + * + * @param regionalAffinity the regionalAffinity value to set. + * @return the PlaywrightWorkspaceProperties object itself. + */ + public PlaywrightWorkspaceProperties withRegionalAffinity(EnablementStatus regionalAffinity) { + this.regionalAffinity = regionalAffinity; + return this; + } + + /** + * Get the localAuth property: When enabled, this feature allows the workspace to use local auth (through service + * access token) for executing operations. + * + * @return the localAuth value. + */ + public EnablementStatus localAuth() { + return this.localAuth; + } + + /** + * Set the localAuth property: When enabled, this feature allows the workspace to use local auth (through service + * access token) for executing operations. + * + * @param localAuth the localAuth value to set. + * @return the PlaywrightWorkspaceProperties object itself. + */ + public PlaywrightWorkspaceProperties withLocalAuth(EnablementStatus localAuth) { + this.localAuth = localAuth; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("regionalAffinity", + this.regionalAffinity == null ? null : this.regionalAffinity.toString()); + jsonWriter.writeStringField("localAuth", this.localAuth == null ? null : this.localAuth.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PlaywrightWorkspaceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PlaywrightWorkspaceProperties 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 PlaywrightWorkspaceProperties. + */ + public static PlaywrightWorkspaceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PlaywrightWorkspaceProperties deserializedPlaywrightWorkspaceProperties + = new PlaywrightWorkspaceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedPlaywrightWorkspaceProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("dataplaneUri".equals(fieldName)) { + deserializedPlaywrightWorkspaceProperties.dataplaneUri = reader.getString(); + } else if ("regionalAffinity".equals(fieldName)) { + deserializedPlaywrightWorkspaceProperties.regionalAffinity + = EnablementStatus.fromString(reader.getString()); + } else if ("localAuth".equals(fieldName)) { + deserializedPlaywrightWorkspaceProperties.localAuth + = EnablementStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPlaywrightWorkspaceProperties; + }); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/PlaywrightWorkspaceUpdate.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/PlaywrightWorkspaceUpdate.java new file mode 100644 index 000000000000..1f2520f1cba0 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/PlaywrightWorkspaceUpdate.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The type used for update operations of the PlaywrightWorkspace. + */ +@Fluent +public final class PlaywrightWorkspaceUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * The resource-specific properties for this resource. + */ + private PlaywrightWorkspaceUpdateProperties properties; + + /** + * Creates an instance of PlaywrightWorkspaceUpdate class. + */ + public PlaywrightWorkspaceUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the PlaywrightWorkspaceUpdate object itself. + */ + public PlaywrightWorkspaceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public PlaywrightWorkspaceUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the PlaywrightWorkspaceUpdate object itself. + */ + public PlaywrightWorkspaceUpdate withProperties(PlaywrightWorkspaceUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PlaywrightWorkspaceUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PlaywrightWorkspaceUpdate 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 PlaywrightWorkspaceUpdate. + */ + public static PlaywrightWorkspaceUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PlaywrightWorkspaceUpdate deserializedPlaywrightWorkspaceUpdate = new PlaywrightWorkspaceUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPlaywrightWorkspaceUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedPlaywrightWorkspaceUpdate.properties + = PlaywrightWorkspaceUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPlaywrightWorkspaceUpdate; + }); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/PlaywrightWorkspaceUpdateProperties.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/PlaywrightWorkspaceUpdateProperties.java new file mode 100644 index 000000000000..7b295502268f --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/PlaywrightWorkspaceUpdateProperties.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The updatable properties of the PlaywrightWorkspace. + */ +@Fluent +public final class PlaywrightWorkspaceUpdateProperties + implements JsonSerializable { + /* + * This property sets the connection region for client workers to cloud-hosted browsers. If enabled, workers connect + * to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the + * Azure region in which the workspace was initially created. + */ + private EnablementStatus regionalAffinity; + + /* + * When enabled, this feature allows the workspace to use local auth (through service access token) for executing + * operations. + */ + private EnablementStatus localAuth; + + /** + * Creates an instance of PlaywrightWorkspaceUpdateProperties class. + */ + public PlaywrightWorkspaceUpdateProperties() { + } + + /** + * Get the regionalAffinity property: This property sets the connection region for client workers to cloud-hosted + * browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If + * disabled, workers connect to browsers in the Azure region in which the workspace was initially created. + * + * @return the regionalAffinity value. + */ + public EnablementStatus regionalAffinity() { + return this.regionalAffinity; + } + + /** + * Set the regionalAffinity property: This property sets the connection region for client workers to cloud-hosted + * browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If + * disabled, workers connect to browsers in the Azure region in which the workspace was initially created. + * + * @param regionalAffinity the regionalAffinity value to set. + * @return the PlaywrightWorkspaceUpdateProperties object itself. + */ + public PlaywrightWorkspaceUpdateProperties withRegionalAffinity(EnablementStatus regionalAffinity) { + this.regionalAffinity = regionalAffinity; + return this; + } + + /** + * Get the localAuth property: When enabled, this feature allows the workspace to use local auth (through service + * access token) for executing operations. + * + * @return the localAuth value. + */ + public EnablementStatus localAuth() { + return this.localAuth; + } + + /** + * Set the localAuth property: When enabled, this feature allows the workspace to use local auth (through service + * access token) for executing operations. + * + * @param localAuth the localAuth value to set. + * @return the PlaywrightWorkspaceUpdateProperties object itself. + */ + public PlaywrightWorkspaceUpdateProperties withLocalAuth(EnablementStatus localAuth) { + this.localAuth = localAuth; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("regionalAffinity", + this.regionalAffinity == null ? null : this.regionalAffinity.toString()); + jsonWriter.writeStringField("localAuth", this.localAuth == null ? null : this.localAuth.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PlaywrightWorkspaceUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PlaywrightWorkspaceUpdateProperties 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 PlaywrightWorkspaceUpdateProperties. + */ + public static PlaywrightWorkspaceUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PlaywrightWorkspaceUpdateProperties deserializedPlaywrightWorkspaceUpdateProperties + = new PlaywrightWorkspaceUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("regionalAffinity".equals(fieldName)) { + deserializedPlaywrightWorkspaceUpdateProperties.regionalAffinity + = EnablementStatus.fromString(reader.getString()); + } else if ("localAuth".equals(fieldName)) { + deserializedPlaywrightWorkspaceUpdateProperties.localAuth + = EnablementStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPlaywrightWorkspaceUpdateProperties; + }); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/PlaywrightWorkspaces.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/PlaywrightWorkspaces.java new file mode 100644 index 000000000000..bc513fffec16 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/PlaywrightWorkspaces.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of PlaywrightWorkspaces. + */ +public interface PlaywrightWorkspaces { + /** + * Get a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @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 PlaywrightWorkspace along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String playwrightWorkspaceName, Context context); + + /** + * Get a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @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 PlaywrightWorkspace. + */ + PlaywrightWorkspace getByResourceGroup(String resourceGroupName, String playwrightWorkspaceName); + + /** + * Delete a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String playwrightWorkspaceName); + + /** + * Delete a PlaywrightWorkspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param playwrightWorkspaceName The name of the PlaywrightWorkspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String playwrightWorkspaceName, Context context); + + /** + * List PlaywrightWorkspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List PlaywrightWorkspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List PlaywrightWorkspace resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List PlaywrightWorkspace resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a PlaywrightWorkspace list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Implements global CheckNameAvailability operations. + * + * @param body The CheckAvailability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result along with {@link Response}. + */ + Response checkNameAvailabilityWithResponse(CheckNameAvailabilityRequest body, + Context context); + + /** + * Implements global CheckNameAvailability operations. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result. + */ + CheckNameAvailabilityResponse checkNameAvailability(CheckNameAvailabilityRequest body); + + /** + * Get a PlaywrightWorkspace. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a PlaywrightWorkspace along with {@link Response}. + */ + PlaywrightWorkspace getById(String id); + + /** + * Get a PlaywrightWorkspace. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a PlaywrightWorkspace along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a PlaywrightWorkspace. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a PlaywrightWorkspace. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PlaywrightWorkspace resource. + * + * @param name resource name. + * @return the first stage of the new PlaywrightWorkspace definition. + */ + PlaywrightWorkspace.DefinitionStages.Blank define(String name); +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/ProvisioningState.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/ProvisioningState.java new file mode 100644 index 000000000000..4abf13e40726 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/ProvisioningState.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of the last resource operation. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creation in progress.. + */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** + * Deletion in progress.. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Request accepted for processing.. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/package-info.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/package-info.java new file mode 100644 index 000000000000..77c56f8e9357 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for MicrosoftPlaywrightService. + * Playwright service provides access to Playwright workspace resource and it's operations. + */ +package com.azure.resourcemanager.playwright.models; diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/package-info.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/package-info.java new file mode 100644 index 000000000000..d535adae65f1 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/com/azure/resourcemanager/playwright/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for MicrosoftPlaywrightService. + * Playwright service provides access to Playwright workspace resource and it's operations. + */ +package com.azure.resourcemanager.playwright; diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/java/module-info.java b/sdk/playwright/azure-resourcemanager-playwright/src/main/java/module-info.java new file mode 100644 index 000000000000..edde296da622 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/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.playwright { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.playwright; + exports com.azure.resourcemanager.playwright.fluent; + exports com.azure.resourcemanager.playwright.fluent.models; + exports com.azure.resourcemanager.playwright.models; + + opens com.azure.resourcemanager.playwright.fluent.models to com.azure.core; + opens com.azure.resourcemanager.playwright.models to com.azure.core; + opens com.azure.resourcemanager.playwright.implementation.models to com.azure.core; +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-playwright/proxy-config.json b/sdk/playwright/azure-resourcemanager-playwright/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-playwright/proxy-config.json new file mode 100644 index 000000000000..7701c2ec8ca4 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-playwright/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.playwright.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.playwright.implementation.PlaywrightWorkspacesClientImpl$PlaywrightWorkspacesService"]] \ No newline at end of file diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-playwright/reflect-config.json b/sdk/playwright/azure-resourcemanager-playwright/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-playwright/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-playwright/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/main/resources/azure-resourcemanager-playwright.properties b/sdk/playwright/azure-resourcemanager-playwright/src/main/resources/azure-resourcemanager-playwright.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/main/resources/azure-resourcemanager-playwright.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/samples/java/com/azure/resourcemanager/playwright/generated/OperationsListSamples.java b/sdk/playwright/azure-resourcemanager-playwright/src/samples/java/com/azure/resourcemanager/playwright/generated/OperationsListSamples.java new file mode 100644 index 000000000000..c0a82faddcfb --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/samples/java/com/azure/resourcemanager/playwright/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-07-01-preview/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to MicrosoftPlaywrightServiceManager. + */ + public static void operationsList(com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/samples/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspacesCheckNameAvailabilitySamples.java b/sdk/playwright/azure-resourcemanager-playwright/src/samples/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspacesCheckNameAvailabilitySamples.java new file mode 100644 index 000000000000..ee55299f8863 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/samples/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspacesCheckNameAvailabilitySamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.generated; + +import com.azure.resourcemanager.playwright.models.CheckNameAvailabilityRequest; + +/** + * Samples for PlaywrightWorkspaces CheckNameAvailability. + */ +public final class PlaywrightWorkspacesCheckNameAvailabilitySamples { + /* + * x-ms-original-file: 2025-07-01-preview/PlaywrightWorkspaces_CheckNameAvailability.json + */ + /** + * Sample code: PlaywrightWorkspaces_CheckNameAvailability. + * + * @param manager Entry point to MicrosoftPlaywrightServiceManager. + */ + public static void playwrightWorkspacesCheckNameAvailability( + com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager manager) { + manager.playwrightWorkspaces() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityRequest().withName("dummyName") + .withType("Microsoft.LoadTestService/PlaywrightWorkspaces"), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/CheckNameAvailabilityRequestTests.java b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/CheckNameAvailabilityRequestTests.java new file mode 100644 index 000000000000..a1ea0c3a60ca --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/CheckNameAvailabilityRequestTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwright.models.CheckNameAvailabilityRequest; +import org.junit.jupiter.api.Assertions; + +public final class CheckNameAvailabilityRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CheckNameAvailabilityRequest model + = BinaryData.fromString("{\"name\":\"ftyhxhurokf\",\"type\":\"xolniwpwcukjfk\"}") + .toObject(CheckNameAvailabilityRequest.class); + Assertions.assertEquals("ftyhxhurokf", model.name()); + Assertions.assertEquals("xolniwpwcukjfk", model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CheckNameAvailabilityRequest model + = new CheckNameAvailabilityRequest().withName("ftyhxhurokf").withType("xolniwpwcukjfk"); + model = BinaryData.fromObject(model).toObject(CheckNameAvailabilityRequest.class); + Assertions.assertEquals("ftyhxhurokf", model.name()); + Assertions.assertEquals("xolniwpwcukjfk", model.type()); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/CheckNameAvailabilityResponseInnerTests.java b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/CheckNameAvailabilityResponseInnerTests.java new file mode 100644 index 000000000000..9520c84202e4 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/CheckNameAvailabilityResponseInnerTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwright.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.playwright.models.CheckNameAvailabilityReason; +import org.junit.jupiter.api.Assertions; + +public final class CheckNameAvailabilityResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CheckNameAvailabilityResponseInner model + = BinaryData.fromString("{\"nameAvailable\":false,\"reason\":\"Invalid\",\"message\":\"lryplwckbasyy\"}") + .toObject(CheckNameAvailabilityResponseInner.class); + Assertions.assertFalse(model.nameAvailable()); + Assertions.assertEquals(CheckNameAvailabilityReason.INVALID, model.reason()); + Assertions.assertEquals("lryplwckbasyy", model.message()); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/OperationDisplayTests.java b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..c83cee5438bf --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/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.playwright.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwright.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/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/OperationInnerTests.java b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/OperationInnerTests.java new file mode 100644 index 000000000000..8ab7ac795424 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/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.playwright.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwright.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/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/OperationListResultTests.java b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/OperationListResultTests.java new file mode 100644 index 000000000000..3da82f5c4f46 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/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.playwright.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwright.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/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/OperationsListMockTests.java b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..ec4ff286cd4f --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/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.playwright.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.playwright.MicrosoftPlaywrightServiceManager; +import com.azure.resourcemanager.playwright.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\":\"ddhsgcbacphe\",\"isDataAction\":false,\"display\":{\"provider\":\"nqgoulzndli\",\"resource\":\"yqkgfg\",\"operation\":\"madgakeqsrxyb\",\"description\":\"qedqytbciqfoufl\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MicrosoftPlaywrightServiceManager manager = MicrosoftPlaywrightServiceManager.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/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspaceInnerTests.java b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspaceInnerTests.java new file mode 100644 index 000000000000..fe41a37bedb0 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspaceInnerTests.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.playwright.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwright.fluent.models.PlaywrightWorkspaceInner; +import com.azure.resourcemanager.playwright.models.EnablementStatus; +import com.azure.resourcemanager.playwright.models.PlaywrightWorkspaceProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PlaywrightWorkspaceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PlaywrightWorkspaceInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Canceled\",\"dataplaneUri\":\"pzvgnwzsymglzufc\",\"regionalAffinity\":\"Enabled\",\"localAuth\":\"Enabled\"},\"location\":\"bihanuf\",\"tags\":{\"s\":\"bj\"},\"id\":\"git\",\"name\":\"xqhabi\",\"type\":\"pikxwczbyscnpqxu\"}") + .toObject(PlaywrightWorkspaceInner.class); + Assertions.assertEquals("bihanuf", model.location()); + Assertions.assertEquals("bj", model.tags().get("s")); + Assertions.assertEquals(EnablementStatus.ENABLED, model.properties().regionalAffinity()); + Assertions.assertEquals(EnablementStatus.ENABLED, model.properties().localAuth()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PlaywrightWorkspaceInner model = new PlaywrightWorkspaceInner().withLocation("bihanuf") + .withTags(mapOf("s", "bj")) + .withProperties(new PlaywrightWorkspaceProperties().withRegionalAffinity(EnablementStatus.ENABLED) + .withLocalAuth(EnablementStatus.ENABLED)); + model = BinaryData.fromObject(model).toObject(PlaywrightWorkspaceInner.class); + Assertions.assertEquals("bihanuf", model.location()); + Assertions.assertEquals("bj", model.tags().get("s")); + Assertions.assertEquals(EnablementStatus.ENABLED, model.properties().regionalAffinity()); + Assertions.assertEquals(EnablementStatus.ENABLED, model.properties().localAuth()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspaceListResultTests.java b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspaceListResultTests.java new file mode 100644 index 000000000000..052626dadb05 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspaceListResultTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwright.implementation.models.PlaywrightWorkspaceListResult; +import com.azure.resourcemanager.playwright.models.EnablementStatus; +import org.junit.jupiter.api.Assertions; + +public final class PlaywrightWorkspaceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PlaywrightWorkspaceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Accepted\",\"dataplaneUri\":\"chgejspodm\",\"regionalAffinity\":\"Disabled\",\"localAuth\":\"Enabled\"},\"location\":\"eho\",\"tags\":{\"njaqwixjspro\":\"ahuxinpm\",\"wmfdatscmdvpjhul\":\"vcputegj\"},\"id\":\"uuvmkjozkrwfnd\",\"name\":\"odjpslwejd\",\"type\":\"vwryoqpso\"},{\"properties\":{\"provisioningState\":\"Canceled\",\"dataplaneUri\":\"zakljlahbc\",\"regionalAffinity\":\"Disabled\",\"localAuth\":\"Disabled\"},\"location\":\"dosyg\",\"tags\":{\"vdphlxaolthqtr\":\"aojakhmsbzjhcrz\",\"gvfcj\":\"qjbpfzfsin\",\"xjtfelluwfzit\":\"wzo\",\"qfpjk\":\"np\"},\"id\":\"lxofpdvhpfxxypin\",\"name\":\"nmayhuybb\",\"type\":\"podepoo\"},{\"properties\":{\"provisioningState\":\"Failed\",\"dataplaneUri\":\"amiheognarxz\",\"regionalAffinity\":\"Enabled\",\"localAuth\":\"Enabled\"},\"location\":\"usivye\",\"tags\":{\"un\":\"iqihn\",\"fygxgispemvtzfk\":\"bwjzr\",\"fxqeof\":\"fublj\"},\"id\":\"aeqjhqjbasvms\",\"name\":\"jqul\",\"type\":\"gsntnbybkzgcwr\"},{\"properties\":{\"provisioningState\":\"Failed\",\"dataplaneUri\":\"wrljdouskc\",\"regionalAffinity\":\"Disabled\",\"localAuth\":\"Enabled\"},\"location\":\"cjdkwtnhxbnjbi\",\"tags\":{\"nzl\":\"rglssainqpj\",\"pee\":\"jfm\",\"yqduujit\":\"vmgxsab\",\"rwpdappdsbdkvwrw\":\"jczdzevndh\"},\"id\":\"feusnhut\",\"name\":\"eltmrldhugjzzdat\",\"type\":\"xhocdgeablgphuti\"}],\"nextLink\":\"dvkaozw\"}") + .toObject(PlaywrightWorkspaceListResult.class); + Assertions.assertEquals("eho", model.value().get(0).location()); + Assertions.assertEquals("ahuxinpm", model.value().get(0).tags().get("njaqwixjspro")); + Assertions.assertEquals(EnablementStatus.DISABLED, model.value().get(0).properties().regionalAffinity()); + Assertions.assertEquals(EnablementStatus.ENABLED, model.value().get(0).properties().localAuth()); + Assertions.assertEquals("dvkaozw", model.nextLink()); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspacePropertiesTests.java b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspacePropertiesTests.java new file mode 100644 index 000000000000..7d7bec30c6dd --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspacePropertiesTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwright.models.EnablementStatus; +import com.azure.resourcemanager.playwright.models.PlaywrightWorkspaceProperties; +import org.junit.jupiter.api.Assertions; + +public final class PlaywrightWorkspacePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PlaywrightWorkspaceProperties model = BinaryData.fromString( + "{\"provisioningState\":\"Canceled\",\"dataplaneUri\":\"qniwbybrkxvdumj\",\"regionalAffinity\":\"Disabled\",\"localAuth\":\"Enabled\"}") + .toObject(PlaywrightWorkspaceProperties.class); + Assertions.assertEquals(EnablementStatus.DISABLED, model.regionalAffinity()); + Assertions.assertEquals(EnablementStatus.ENABLED, model.localAuth()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PlaywrightWorkspaceProperties model + = new PlaywrightWorkspaceProperties().withRegionalAffinity(EnablementStatus.DISABLED) + .withLocalAuth(EnablementStatus.ENABLED); + model = BinaryData.fromObject(model).toObject(PlaywrightWorkspaceProperties.class); + Assertions.assertEquals(EnablementStatus.DISABLED, model.regionalAffinity()); + Assertions.assertEquals(EnablementStatus.ENABLED, model.localAuth()); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspaceUpdatePropertiesTests.java b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspaceUpdatePropertiesTests.java new file mode 100644 index 000000000000..8272571deff4 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspaceUpdatePropertiesTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwright.models.EnablementStatus; +import com.azure.resourcemanager.playwright.models.PlaywrightWorkspaceUpdateProperties; +import org.junit.jupiter.api.Assertions; + +public final class PlaywrightWorkspaceUpdatePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PlaywrightWorkspaceUpdateProperties model + = BinaryData.fromString("{\"regionalAffinity\":\"Disabled\",\"localAuth\":\"Disabled\"}") + .toObject(PlaywrightWorkspaceUpdateProperties.class); + Assertions.assertEquals(EnablementStatus.DISABLED, model.regionalAffinity()); + Assertions.assertEquals(EnablementStatus.DISABLED, model.localAuth()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PlaywrightWorkspaceUpdateProperties model + = new PlaywrightWorkspaceUpdateProperties().withRegionalAffinity(EnablementStatus.DISABLED) + .withLocalAuth(EnablementStatus.DISABLED); + model = BinaryData.fromObject(model).toObject(PlaywrightWorkspaceUpdateProperties.class); + Assertions.assertEquals(EnablementStatus.DISABLED, model.regionalAffinity()); + Assertions.assertEquals(EnablementStatus.DISABLED, model.localAuth()); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspaceUpdateTests.java b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspaceUpdateTests.java new file mode 100644 index 000000000000..3cfa6b79bb07 --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspaceUpdateTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.playwright.models.EnablementStatus; +import com.azure.resourcemanager.playwright.models.PlaywrightWorkspaceUpdate; +import com.azure.resourcemanager.playwright.models.PlaywrightWorkspaceUpdateProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PlaywrightWorkspaceUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PlaywrightWorkspaceUpdate model = BinaryData.fromString( + "{\"tags\":{\"gaudcc\":\"k\",\"kryhtnapczwlokj\":\"nhsjcnyej\"},\"properties\":{\"regionalAffinity\":\"Disabled\",\"localAuth\":\"Enabled\"}}") + .toObject(PlaywrightWorkspaceUpdate.class); + Assertions.assertEquals("k", model.tags().get("gaudcc")); + Assertions.assertEquals(EnablementStatus.DISABLED, model.properties().regionalAffinity()); + Assertions.assertEquals(EnablementStatus.ENABLED, model.properties().localAuth()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PlaywrightWorkspaceUpdate model = new PlaywrightWorkspaceUpdate() + .withTags(mapOf("gaudcc", "k", "kryhtnapczwlokj", "nhsjcnyej")) + .withProperties(new PlaywrightWorkspaceUpdateProperties().withRegionalAffinity(EnablementStatus.DISABLED) + .withLocalAuth(EnablementStatus.ENABLED)); + model = BinaryData.fromObject(model).toObject(PlaywrightWorkspaceUpdate.class); + Assertions.assertEquals("k", model.tags().get("gaudcc")); + Assertions.assertEquals(EnablementStatus.DISABLED, model.properties().regionalAffinity()); + Assertions.assertEquals(EnablementStatus.ENABLED, model.properties().localAuth()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspacesCheckNameAvailabilityWithResponseMockTests.java b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspacesCheckNameAvailabilityWithResponseMockTests.java new file mode 100644 index 000000000000..f8bd18bf47eb --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/src/test/java/com/azure/resourcemanager/playwright/generated/PlaywrightWorkspacesCheckNameAvailabilityWithResponseMockTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.playwright.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.playwright.MicrosoftPlaywrightServiceManager; +import com.azure.resourcemanager.playwright.models.CheckNameAvailabilityReason; +import com.azure.resourcemanager.playwright.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.playwright.models.CheckNameAvailabilityResponse; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PlaywrightWorkspacesCheckNameAvailabilityWithResponseMockTests { + @Test + public void testCheckNameAvailabilityWithResponse() throws Exception { + String responseStr = "{\"nameAvailable\":true,\"reason\":\"Invalid\",\"message\":\"pspwgcuertu\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MicrosoftPlaywrightServiceManager manager = MicrosoftPlaywrightServiceManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + CheckNameAvailabilityResponse response = manager.playwrightWorkspaces() + .checkNameAvailabilityWithResponse( + new CheckNameAvailabilityRequest().withName("modmglougpb").withType("tmut"), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertTrue(response.nameAvailable()); + Assertions.assertEquals(CheckNameAvailabilityReason.INVALID, response.reason()); + Assertions.assertEquals("pspwgcuertu", response.message()); + } +} diff --git a/sdk/playwright/azure-resourcemanager-playwright/tsp-location.yaml b/sdk/playwright/azure-resourcemanager-playwright/tsp-location.yaml new file mode 100644 index 000000000000..af70e3b97cae --- /dev/null +++ b/sdk/playwright/azure-resourcemanager-playwright/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/loadtestservice/Playwright.Management +commit: 02d891edd0a78d71fdaa969f028261a831432c54 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/playwright/ci.yml b/sdk/playwright/ci.yml new file mode 100644 index 000000000000..5c0931e2993c --- /dev/null +++ b/sdk/playwright/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/playwright/ci.yml + - sdk/playwright/azure-resourcemanager-playwright/ + exclude: + - sdk/playwright/pom.xml + - sdk/playwright/azure-resourcemanager-playwright/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/playwright/ci.yml + - sdk/playwright/azure-resourcemanager-playwright/ + exclude: + - sdk/playwright/pom.xml + - sdk/playwright/azure-resourcemanager-playwright/pom.xml + +parameters: + - name: release_azureresourcemanagerplaywright + displayName: azure-resourcemanager-playwright + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: playwright + Artifacts: + - name: azure-resourcemanager-playwright + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerplaywright + releaseInBatch: ${{ parameters.release_azureresourcemanagerplaywright }} diff --git a/sdk/playwright/pom.xml b/sdk/playwright/pom.xml new file mode 100644 index 000000000000..87aa59694a82 --- /dev/null +++ b/sdk/playwright/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-playwright-service + pom + 1.0.0 + + + azure-resourcemanager-playwright + +