diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index f6584e917f14c..8d3a088295df2 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -265,6 +265,7 @@ com.azure.spring:spring-cloud-azure-stream-binder-servicebus-core;5.19.0;5.20.0- com.azure.spring:spring-cloud-azure-stream-binder-servicebus;5.19.0;5.20.0-beta.1 com.azure.spring:spring-cloud-azure-testcontainers;5.19.0;5.20.0-beta.1 com.azure:azure-spring-data-cosmos;5.19.0;5.20.0-beta.1 +com.azure:azure-developer-microsoftplaywrighttesting;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager;2.45.0;2.46.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-appplatform;2.45.0;2.46.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-appservice;2.45.0;2.46.0-beta.1 diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/CHANGELOG.md b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/CHANGELOG.md new file mode 100644 index 0000000000000..657529309a100 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/CHANGELOG.md @@ -0,0 +1,16 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +- Azure Microsoft Playwright Testing client library for Java. This package contains Microsoft Azure Microsoft Playwright Testing client library. + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes +### Features Added + +- Initial release for the azure-developer-microsoftplaywrighttesting Java SDK. diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/README.md b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/README.md new file mode 100644 index 0000000000000..c71308c1282f2 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/README.md @@ -0,0 +1,80 @@ +# Azure Microsoft Playwright Testing client library for Java + +Azure Microsoft Playwright Testing client library for Java. + +This package contains Microsoft Azure Microsoft Playwright Testing client library. + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] +- [Product documentation][product_documentation] + +## 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:azure-developer-microsoftplaywrighttesting;current}) +```xml + + com.azure + azure-developer-microsoftplaywrighttesting + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Authentication + +[Azure Identity][azure_identity] package provides the default implementation for authenticating the client. + +## Key concepts + +## Examples + +```java com.azure.developer.microsoftplaywrighttesting.readme +``` + +### Service API versions + +The client library targets the latest service API version by default. +The service client builder accepts an optional service API version parameter to specify which API version to communicate. + +#### Select a service API version + +You have the flexibility to explicitly select a supported service API version when initializing a service client via the service client builder. +This ensures that the client can communicate with services using the specified API version. + +When selecting an API version, it is important to verify that there are no breaking changes compared to the latest API version. +If there are significant differences, API calls may fail due to incompatibility. + +Always ensure that the chosen API version is fully supported and operational for your specific use case and that it aligns with the service's versioning policy. + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[product_documentation]: https://azure.microsoft.com/services/ +[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 + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fplaywrighttesting%2Fazure-developer-microsoftplaywrighttesting%2FREADME.png) diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/assets.json b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/assets.json new file mode 100644 index 0000000000000..024c149542a2a --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/assets.json @@ -0,0 +1 @@ +{"AssetsRepo":"Azure/azure-sdk-assets","AssetsRepoPrefixPath":"java","TagPrefix":"java/playwrighttesting/azure-developer-microsoftplaywrighttesting","Tag":""} \ No newline at end of file diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/pom.xml b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/pom.xml new file mode 100644 index 0000000000000..aca926e4dc2c8 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/pom.xml @@ -0,0 +1,72 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure + azure-developer-microsoftplaywrighttesting + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Microsoft Playwright Testing + This package contains Microsoft Azure Microsoft Playwright Testing client library. + 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 + false + + + + com.azure + azure-core + 1.54.1 + + + com.azure + azure-core-http-netty + 1.15.7 + + + com.azure + azure-core-test + 1.27.0-beta.4 + test + + + com.azure + azure-identity + 1.14.2 + test + + + diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/AccessTokensAsyncClient.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/AccessTokensAsyncClient.java new file mode 100644 index 0000000000000..67827337faa11 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/AccessTokensAsyncClient.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.microsoftplaywrighttesting; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.developer.microsoftplaywrighttesting.implementation.AccessTokensImpl; +import com.azure.developer.microsoftplaywrighttesting.models.AccessToken; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous AuthManagerClient type. + */ +@ServiceClient(builder = AuthManagerClientBuilder.class, isAsync = true) +public final class AccessTokensAsyncClient { + @Generated + private final AccessTokensImpl serviceClient; + + /** + * Initializes an instance of AccessTokensAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + AccessTokensAsyncClient(AccessTokensImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Creates an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return model of an access-token linked to an account along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrReplaceWithResponse(String accountId, String accessTokenId, + BinaryData resource, RequestOptions requestOptions) { + return this.serviceClient.createOrReplaceWithResponseAsync(accountId, accessTokenId, resource, requestOptions); + } + + /** + * Gets an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an access-token for the account with given access-token id along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(String accountId, String accessTokenId, + RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(accountId, accessTokenId, requestOptions); + } + + /** + * Deletes an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponse(String accountId, String accessTokenId, + RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponseAsync(accountId, accessTokenId, requestOptions); + } + + /** + * Lists access-tokens for the given account id. It can use OData query params like $select, $filter, $orderby, $top + * and $skip. The default page size is 10. Use nextLink in response to fetch more objects in the list. Authorization + * required is Bearer JWT Access token provided by EntraID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of AccessToken items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(String accountId, RequestOptions requestOptions) { + return this.serviceClient.listAsync(accountId, requestOptions); + } + + /** + * Creates an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model of an access-token linked to an account on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrReplace(String accountId, String accessTokenId, AccessToken resource) { + // Generated convenience method for createOrReplaceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createOrReplaceWithResponse(accountId, accessTokenId, BinaryData.fromObject(resource), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AccessToken.class)); + } + + /** + * Gets an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an access-token for the account with given access-token id on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get(String accountId, String accessTokenId) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(accountId, accessTokenId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AccessToken.class)); + } + + /** + * Deletes an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @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. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono delete(String accountId, String accessTokenId) { + // Generated convenience method for deleteWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteWithResponse(accountId, accessTokenId, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Lists access-tokens for the given account id. It can use OData query params like $select, $filter, $orderby, $top + * and $skip. The default page size is 10. Use nextLink in response to fetch more objects in the list. Authorization + * required is Bearer JWT Access token provided by EntraID. + * + * @param accountId The account id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of AccessToken items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(String accountId) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = list(accountId, requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(AccessToken.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/AccessTokensClient.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/AccessTokensClient.java new file mode 100644 index 0000000000000..d02711867a7e9 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/AccessTokensClient.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.developer.microsoftplaywrighttesting; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.developer.microsoftplaywrighttesting.implementation.AccessTokensImpl; +import com.azure.developer.microsoftplaywrighttesting.models.AccessToken; + +/** + * Initializes a new instance of the synchronous AuthManagerClient type. + */ +@ServiceClient(builder = AuthManagerClientBuilder.class) +public final class AccessTokensClient { + @Generated + private final AccessTokensImpl serviceClient; + + /** + * Initializes an instance of AccessTokensClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + AccessTokensClient(AccessTokensImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Creates an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return model of an access-token linked to an account along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrReplaceWithResponse(String accountId, String accessTokenId, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.createOrReplaceWithResponse(accountId, accessTokenId, resource, requestOptions); + } + + /** + * Gets an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an access-token for the account with given access-token id along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String accountId, String accessTokenId, RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(accountId, accessTokenId, requestOptions); + } + + /** + * Deletes an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String accountId, String accessTokenId, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponse(accountId, accessTokenId, requestOptions); + } + + /** + * Lists access-tokens for the given account id. It can use OData query params like $select, $filter, $orderby, $top + * and $skip. The default page size is 10. Use nextLink in response to fetch more objects in the list. Authorization + * required is Bearer JWT Access token provided by EntraID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of AccessToken items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String accountId, RequestOptions requestOptions) { + return this.serviceClient.list(accountId, requestOptions); + } + + /** + * Creates an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return model of an access-token linked to an account. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AccessToken createOrReplace(String accountId, String accessTokenId, AccessToken resource) { + // Generated convenience method for createOrReplaceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createOrReplaceWithResponse(accountId, accessTokenId, BinaryData.fromObject(resource), requestOptions) + .getValue() + .toObject(AccessToken.class); + } + + /** + * Gets an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an access-token for the account with given access-token id. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AccessToken get(String accountId, String accessTokenId) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(accountId, accessTokenId, requestOptions).getValue().toObject(AccessToken.class); + } + + /** + * Deletes an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String accountId, String accessTokenId) { + // Generated convenience method for deleteWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteWithResponse(accountId, accessTokenId, requestOptions).getValue(); + } + + /** + * Lists access-tokens for the given account id. It can use OData query params like $select, $filter, $orderby, $top + * and $skip. The default page size is 10. Use nextLink in response to fetch more objects in the list. Authorization + * required is Bearer JWT Access token provided by EntraID. + * + * @param accountId The account id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of AccessToken items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String accountId) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.list(accountId, requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(AccessToken.class)); + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/AccountsAsyncClient.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/AccountsAsyncClient.java new file mode 100644 index 0000000000000..588aad527947f --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/AccountsAsyncClient.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.microsoftplaywrighttesting; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.developer.microsoftplaywrighttesting.implementation.AccountsImpl; +import com.azure.developer.microsoftplaywrighttesting.models.Account; +import com.azure.developer.microsoftplaywrighttesting.models.OS; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous AuthManagerClient type. + */ +@ServiceClient(builder = AuthManagerClientBuilder.class, isAsync = true) +public final class AccountsAsyncClient { + @Generated + private final AccountsImpl serviceClient; + + /** + * Initializes an instance of AccountsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + AccountsAsyncClient(AccountsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get details of the Azure resource mapped to an account for the given account id. Authorization required is Bearer + * JWT Access token provided by EntraID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     resourceId: String (Required)
+     *     name: String (Required)
+     *     state: String(Active/Inactive) (Required)
+     *     subscriptionId: String (Required)
+     *     subscriptionState: String(Registered/Warned/Suspended/Deleted/Unregistered) (Required)
+     *     tenantId: String (Required)
+     *     location: String (Required)
+     *     regionalAffinity: String(Enabled/Disabled) (Optional)
+     *     scalableExecution: String(Enabled/Disabled) (Optional)
+     *     reporting: String(Enabled/Disabled) (Optional)
+     *     localAuth: String(Enabled/Disabled) (Optional)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details of the Azure resource mapped to an account for the given account id along with {@link Response} + * on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(String accountId, RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(accountId, requestOptions); + } + + /** + * Gets remote browsers corresponding to given account id and redirects the client for running Playwright tests. + * Authorization required is Bearer JWT Access token provided by EntraID or Microsoft Playwright Testing Service. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
runIdStringNoThe run id provided by client for corresponding remote test + * run.
osStringNoThe os provided by client for remote test runs. Allowed values: + * "linux", "windows".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param accountId The account id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return remote browsers corresponding to given account id and redirects the client for running Playwright tests + * along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getBrowsersWithResponse(String accountId, RequestOptions requestOptions) { + return this.serviceClient.getBrowsersWithResponseAsync(accountId, requestOptions); + } + + /** + * Get details of the Azure resource mapped to an account for the given account id. Authorization required is Bearer + * JWT Access token provided by EntraID. + * + * @param accountId The account id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of the Azure resource mapped to an account for the given account id on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get(String accountId) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(accountId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Account.class)); + } + + /** + * Gets remote browsers corresponding to given account id and redirects the client for running Playwright tests. + * Authorization required is Bearer JWT Access token provided by EntraID or Microsoft Playwright Testing Service. + * + * @param accountId The account id. + * @param runId The run id provided by client for corresponding remote test run. + * @param os The os provided by client for remote test runs. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return remote browsers corresponding to given account id and redirects the client for running Playwright tests + * on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getBrowsers(String accountId, String runId, OS os) { + // Generated convenience method for getBrowsersWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (runId != null) { + requestOptions.addQueryParam("runId", runId, false); + } + if (os != null) { + requestOptions.addQueryParam("os", os.toString(), false); + } + return getBrowsersWithResponse(accountId, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Gets remote browsers corresponding to given account id and redirects the client for running Playwright tests. + * Authorization required is Bearer JWT Access token provided by EntraID or Microsoft Playwright Testing Service. + * + * @param accountId The account id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return remote browsers corresponding to given account id and redirects the client for running Playwright tests + * on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getBrowsers(String accountId) { + // Generated convenience method for getBrowsersWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getBrowsersWithResponse(accountId, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/AccountsClient.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/AccountsClient.java new file mode 100644 index 0000000000000..a82672d84d67c --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/AccountsClient.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.microsoftplaywrighttesting; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.developer.microsoftplaywrighttesting.implementation.AccountsImpl; +import com.azure.developer.microsoftplaywrighttesting.models.Account; +import com.azure.developer.microsoftplaywrighttesting.models.OS; + +/** + * Initializes a new instance of the synchronous AuthManagerClient type. + */ +@ServiceClient(builder = AuthManagerClientBuilder.class) +public final class AccountsClient { + @Generated + private final AccountsImpl serviceClient; + + /** + * Initializes an instance of AccountsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + AccountsClient(AccountsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get details of the Azure resource mapped to an account for the given account id. Authorization required is Bearer + * JWT Access token provided by EntraID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     resourceId: String (Required)
+     *     name: String (Required)
+     *     state: String(Active/Inactive) (Required)
+     *     subscriptionId: String (Required)
+     *     subscriptionState: String(Registered/Warned/Suspended/Deleted/Unregistered) (Required)
+     *     tenantId: String (Required)
+     *     location: String (Required)
+     *     regionalAffinity: String(Enabled/Disabled) (Optional)
+     *     scalableExecution: String(Enabled/Disabled) (Optional)
+     *     reporting: String(Enabled/Disabled) (Optional)
+     *     localAuth: String(Enabled/Disabled) (Optional)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details of the Azure resource mapped to an account for the given account id along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String accountId, RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(accountId, requestOptions); + } + + /** + * Gets remote browsers corresponding to given account id and redirects the client for running Playwright tests. + * Authorization required is Bearer JWT Access token provided by EntraID or Microsoft Playwright Testing Service. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
runIdStringNoThe run id provided by client for corresponding remote test + * run.
osStringNoThe os provided by client for remote test runs. Allowed values: + * "linux", "windows".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param accountId The account id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return remote browsers corresponding to given account id and redirects the client for running Playwright tests + * along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getBrowsersWithResponse(String accountId, RequestOptions requestOptions) { + return this.serviceClient.getBrowsersWithResponse(accountId, requestOptions); + } + + /** + * Get details of the Azure resource mapped to an account for the given account id. Authorization required is Bearer + * JWT Access token provided by EntraID. + * + * @param accountId The account id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of the Azure resource mapped to an account for the given account id. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Account get(String accountId) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(accountId, requestOptions).getValue().toObject(Account.class); + } + + /** + * Gets remote browsers corresponding to given account id and redirects the client for running Playwright tests. + * Authorization required is Bearer JWT Access token provided by EntraID or Microsoft Playwright Testing Service. + * + * @param accountId The account id. + * @param runId The run id provided by client for corresponding remote test run. + * @param os The os provided by client for remote test runs. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void getBrowsers(String accountId, String runId, OS os) { + // Generated convenience method for getBrowsersWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (runId != null) { + requestOptions.addQueryParam("runId", runId, false); + } + if (os != null) { + requestOptions.addQueryParam("os", os.toString(), false); + } + getBrowsersWithResponse(accountId, requestOptions).getValue(); + } + + /** + * Gets remote browsers corresponding to given account id and redirects the client for running Playwright tests. + * Authorization required is Bearer JWT Access token provided by EntraID or Microsoft Playwright Testing Service. + * + * @param accountId The account id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void getBrowsers(String accountId) { + // Generated convenience method for getBrowsersWithResponse + RequestOptions requestOptions = new RequestOptions(); + getBrowsersWithResponse(accountId, requestOptions).getValue(); + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/AuthManagerClientBuilder.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/AuthManagerClientBuilder.java new file mode 100644 index 0000000000000..dcc218a4d15d6 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/AuthManagerClientBuilder.java @@ -0,0 +1,359 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.microsoftplaywrighttesting; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.client.traits.TokenCredentialTrait; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +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.AddHeadersPolicy; +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.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.developer.microsoftplaywrighttesting.implementation.AuthManagerClientImpl; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the AuthManagerClient type. + */ +@ServiceClientBuilder( + serviceClients = { + AccessTokensClient.class, + AccountsClient.class, + AccessTokensAsyncClient.class, + AccountsAsyncClient.class }) +public final class AuthManagerClientBuilder + implements HttpTrait, ConfigurationTrait, + TokenCredentialTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final String[] DEFAULT_SCOPES = new String[] { "https://playwright.microsoft.com/.default" }; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-developer-microsoftplaywrighttesting.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the AuthManagerClientBuilder. + */ + @Generated + public AuthManagerClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AuthManagerClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AuthManagerClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AuthManagerClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AuthManagerClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AuthManagerClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AuthManagerClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AuthManagerClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The TokenCredential used for authentication. + */ + @Generated + private TokenCredential tokenCredential; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AuthManagerClientBuilder credential(TokenCredential tokenCredential) { + this.tokenCredential = tokenCredential; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AuthManagerClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private MicrosoftPlaywrightTestingServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the AuthManagerClientBuilder. + */ + @Generated + public AuthManagerClientBuilder serviceVersion(MicrosoftPlaywrightTestingServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the AuthManagerClientBuilder. + */ + @Generated + public AuthManagerClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of AuthManagerClientImpl with the provided parameters. + * + * @return an instance of AuthManagerClientImpl. + */ + @Generated + private AuthManagerClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + MicrosoftPlaywrightTestingServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : MicrosoftPlaywrightTestingServiceVersion.getLatest(); + AuthManagerClientImpl client = new AuthManagerClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + if (tokenCredential != null) { + policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of AccessTokensAsyncClient class. + * + * @return an instance of AccessTokensAsyncClient. + */ + @Generated + public AccessTokensAsyncClient buildAccessTokensAsyncClient() { + return new AccessTokensAsyncClient(buildInnerClient().getAccessTokens()); + } + + /** + * Builds an instance of AccountsAsyncClient class. + * + * @return an instance of AccountsAsyncClient. + */ + @Generated + public AccountsAsyncClient buildAccountsAsyncClient() { + return new AccountsAsyncClient(buildInnerClient().getAccounts()); + } + + /** + * Builds an instance of AccessTokensClient class. + * + * @return an instance of AccessTokensClient. + */ + @Generated + public AccessTokensClient buildAccessTokensClient() { + return new AccessTokensClient(buildInnerClient().getAccessTokens()); + } + + /** + * Builds an instance of AccountsClient class. + * + * @return an instance of AccountsClient. + */ + @Generated + public AccountsClient buildAccountsClient() { + return new AccountsClient(buildInnerClient().getAccounts()); + } + + private static final ClientLogger LOGGER = new ClientLogger(AuthManagerClientBuilder.class); +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/MicrosoftPlaywrightTestingServiceVersion.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/MicrosoftPlaywrightTestingServiceVersion.java new file mode 100644 index 0000000000000..8fd3400e3f1bb --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/MicrosoftPlaywrightTestingServiceVersion.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.developer.microsoftplaywrighttesting; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of Microsoft Playwright TestingClient. + */ +public enum MicrosoftPlaywrightTestingServiceVersion implements ServiceVersion { + /** + * Enum value 2024-12-01. + */ + V2024_12_01("2024-12-01"); + + private final String version; + + MicrosoftPlaywrightTestingServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link MicrosoftPlaywrightTestingServiceVersion}. + */ + public static MicrosoftPlaywrightTestingServiceVersion getLatest() { + return V2024_12_01; + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/implementation/AccessTokensImpl.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/implementation/AccessTokensImpl.java new file mode 100644 index 0000000000000..fc579b3e3dd05 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/implementation/AccessTokensImpl.java @@ -0,0 +1,641 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.microsoftplaywrighttesting.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.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +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.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.developer.microsoftplaywrighttesting.MicrosoftPlaywrightTestingServiceVersion; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in AccessTokens. + */ +public final class AccessTokensImpl { + /** + * The proxy service used to perform REST calls. + */ + private final AccessTokensService service; + + /** + * The service client containing this operation class. + */ + private final AuthManagerClientImpl client; + + /** + * Initializes an instance of AccessTokensImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AccessTokensImpl(AuthManagerClientImpl client) { + this.service + = RestProxy.create(AccessTokensService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public MicrosoftPlaywrightTestingServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for AuthManagerClientAccessTokens to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AuthManagerClientAcc") + public interface AccessTokensService { + @Put("/accounts/{accountId}/access-tokens/{accessTokenId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createOrReplace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("accountId") String accountId, + @PathParam("accessTokenId") String accessTokenId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData resource, + RequestOptions requestOptions, Context context); + + @Put("/accounts/{accountId}/access-tokens/{accessTokenId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createOrReplaceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("accountId") String accountId, + @PathParam("accessTokenId") String accessTokenId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData resource, + RequestOptions requestOptions, Context context); + + @Get("/accounts/{accountId}/access-tokens/{accessTokenId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("accountId") String accountId, + @PathParam("accessTokenId") String accessTokenId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/accounts/{accountId}/access-tokens/{accessTokenId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("accountId") String accountId, + @PathParam("accessTokenId") String accessTokenId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Delete("/accounts/{accountId}/access-tokens/{accessTokenId}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("accountId") String accountId, + @PathParam("accessTokenId") String accessTokenId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Delete("/accounts/{accountId}/access-tokens/{accessTokenId}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("accountId") String accountId, @PathParam("accessTokenId") String accessTokenId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/accounts/{accountId}/access-tokens") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("accountId") String accountId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/accounts/{accountId}/access-tokens") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("accountId") String accountId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * Creates an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return model of an access-token linked to an account along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrReplaceWithResponseAsync(String accountId, String accessTokenId, + BinaryData resource, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.createOrReplace(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + accountId, accessTokenId, contentType, accept, resource, requestOptions, context)); + } + + /** + * Creates an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return model of an access-token linked to an account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrReplaceWithResponse(String accountId, String accessTokenId, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrReplaceSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + accountId, accessTokenId, contentType, accept, resource, requestOptions, Context.NONE); + } + + /** + * Gets an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an access-token for the account with given access-token id along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String accountId, String accessTokenId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accountId, accessTokenId, accept, requestOptions, context)); + } + + /** + * Gets an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an access-token for the account with given access-token id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String accountId, String accessTokenId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), accountId, + accessTokenId, accept, requestOptions, Context.NONE); + } + + /** + * Deletes an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync(String accountId, String accessTokenId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accountId, accessTokenId, accept, requestOptions, context)); + } + + /** + * Deletes an access-token for the account with given access-token id. Authorization required is Bearer JWT Access + * token provided by EntraID. + * + * @param accountId The account id. + * @param accessTokenId The access-token id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String accountId, String accessTokenId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), accountId, + accessTokenId, accept, requestOptions, Context.NONE); + } + + /** + * Lists access-tokens for the given account id. It can use OData query params like $select, $filter, $orderby, $top + * and $skip. The default page size is 10. Use nextLink in response to fetch more objects in the list. Authorization + * required is Bearer JWT Access token provided by EntraID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of AccessToken items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String accountId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accountId, accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Lists access-tokens for the given account id. It can use OData query params like $select, $filter, $orderby, $top + * and $skip. The default page size is 10. Use nextLink in response to fetch more objects in the list. Authorization + * required is Bearer JWT Access token provided by EntraID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of AccessToken items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(String accountId, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listSinglePageAsync(accountId, requestOptions), + nextLink -> listNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * Lists access-tokens for the given account id. It can use OData query params like $select, $filter, $orderby, $top + * and $skip. The default page size is 10. Use nextLink in response to fetch more objects in the list. Authorization + * required is Bearer JWT Access token provided by EntraID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of AccessToken items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String accountId, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accountId, accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Lists access-tokens for the given account id. It can use OData query params like $select, $filter, $orderby, $top + * and $skip. The default page size is 10. Use nextLink in response to fetch more objects in the list. Authorization + * required is Bearer JWT Access token provided by EntraID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of AccessToken items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String accountId, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listSinglePage(accountId, requestOptions), + nextLink -> listNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of AccessToken items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     jwtToken: String (Optional)
+     *     createdAt: OffsetDateTime (Required)
+     *     expiryAt: OffsetDateTime (Required)
+     *     state: String(Active/Expired) (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of AccessToken items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/implementation/AccountsImpl.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/implementation/AccountsImpl.java new file mode 100644 index 0000000000000..20a22d6fcdd14 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/implementation/AccountsImpl.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.microsoftplaywrighttesting.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +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.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.developer.microsoftplaywrighttesting.MicrosoftPlaywrightTestingServiceVersion; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Accounts. + */ +public final class AccountsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final AccountsService service; + + /** + * The service client containing this operation class. + */ + private final AuthManagerClientImpl client; + + /** + * Initializes an instance of AccountsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AccountsImpl(AuthManagerClientImpl client) { + this.service = RestProxy.create(AccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public MicrosoftPlaywrightTestingServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for AuthManagerClientAccounts to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AuthManagerClientAcc") + public interface AccountsService { + @Get("/accounts/{accountId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("accountId") String accountId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/accounts/{accountId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("accountId") String accountId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/accounts/{accountId}/browsers") + @ExpectedResponses({ 302 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getBrowsers(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("accountId") String accountId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/accounts/{accountId}/browsers") + @ExpectedResponses({ 302 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getBrowsersSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("accountId") String accountId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * Get details of the Azure resource mapped to an account for the given account id. Authorization required is Bearer + * JWT Access token provided by EntraID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     resourceId: String (Required)
+     *     name: String (Required)
+     *     state: String(Active/Inactive) (Required)
+     *     subscriptionId: String (Required)
+     *     subscriptionState: String(Registered/Warned/Suspended/Deleted/Unregistered) (Required)
+     *     tenantId: String (Required)
+     *     location: String (Required)
+     *     regionalAffinity: String(Enabled/Disabled) (Optional)
+     *     scalableExecution: String(Enabled/Disabled) (Optional)
+     *     reporting: String(Enabled/Disabled) (Optional)
+     *     localAuth: String(Enabled/Disabled) (Optional)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details of the Azure resource mapped to an account for the given account id along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String accountId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accountId, accept, requestOptions, context)); + } + + /** + * Get details of the Azure resource mapped to an account for the given account id. Authorization required is Bearer + * JWT Access token provided by EntraID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     resourceId: String (Required)
+     *     name: String (Required)
+     *     state: String(Active/Inactive) (Required)
+     *     subscriptionId: String (Required)
+     *     subscriptionState: String(Registered/Warned/Suspended/Deleted/Unregistered) (Required)
+     *     tenantId: String (Required)
+     *     location: String (Required)
+     *     regionalAffinity: String(Enabled/Disabled) (Optional)
+     *     scalableExecution: String(Enabled/Disabled) (Optional)
+     *     reporting: String(Enabled/Disabled) (Optional)
+     *     localAuth: String(Enabled/Disabled) (Optional)
+     * }
+     * }
+     * 
+ * + * @param accountId The account id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details of the Azure resource mapped to an account for the given account id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String accountId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), accountId, + accept, requestOptions, Context.NONE); + } + + /** + * Gets remote browsers corresponding to given account id and redirects the client for running Playwright tests. + * Authorization required is Bearer JWT Access token provided by EntraID or Microsoft Playwright Testing Service. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
runIdStringNoThe run id provided by client for corresponding remote test + * run.
osStringNoThe os provided by client for remote test runs. Allowed values: + * "linux", "windows".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param accountId The account id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return remote browsers corresponding to given account id and redirects the client for running Playwright tests + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getBrowsersWithResponseAsync(String accountId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getBrowsers(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accountId, accept, requestOptions, context)); + } + + /** + * Gets remote browsers corresponding to given account id and redirects the client for running Playwright tests. + * Authorization required is Bearer JWT Access token provided by EntraID or Microsoft Playwright Testing Service. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
runIdStringNoThe run id provided by client for corresponding remote test + * run.
osStringNoThe os provided by client for remote test runs. Allowed values: + * "linux", "windows".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param accountId The account id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return remote browsers corresponding to given account id and redirects the client for running Playwright tests + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getBrowsersWithResponse(String accountId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getBrowsersSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + accountId, accept, requestOptions, Context.NONE); + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/implementation/AuthManagerClientImpl.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/implementation/AuthManagerClientImpl.java new file mode 100644 index 0000000000000..0d5fa83e2a840 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/implementation/AuthManagerClientImpl.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.microsoftplaywrighttesting.implementation; + +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.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.developer.microsoftplaywrighttesting.MicrosoftPlaywrightTestingServiceVersion; + +/** + * Initializes a new instance of the AuthManagerClient type. + */ +public final class AuthManagerClientImpl { + /** + * Supported Azure Playwright Service API Endpoints (protocol and hostname, for example: + * https://{region}.api.playwright.microsoft.com). + */ + private final String endpoint; + + /** + * Gets Supported Azure Playwright Service API Endpoints (protocol and hostname, for example: + * https://{region}.api.playwright.microsoft.com). + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final MicrosoftPlaywrightTestingServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public MicrosoftPlaywrightTestingServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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. + */ + public SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The AccessTokensImpl object to access its operations. + */ + private final AccessTokensImpl accessTokens; + + /** + * Gets the AccessTokensImpl object to access its operations. + * + * @return the AccessTokensImpl object. + */ + public AccessTokensImpl getAccessTokens() { + return this.accessTokens; + } + + /** + * The AccountsImpl object to access its operations. + */ + private final AccountsImpl accounts; + + /** + * Gets the AccountsImpl object to access its operations. + * + * @return the AccountsImpl object. + */ + public AccountsImpl getAccounts() { + return this.accounts; + } + + /** + * Initializes an instance of AuthManagerClient client. + * + * @param endpoint Supported Azure Playwright Service API Endpoints (protocol and hostname, for example: + * https://{region}.api.playwright.microsoft.com). + * @param serviceVersion Service version. + */ + public AuthManagerClientImpl(String endpoint, MicrosoftPlaywrightTestingServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of AuthManagerClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Supported Azure Playwright Service API Endpoints (protocol and hostname, for example: + * https://{region}.api.playwright.microsoft.com). + * @param serviceVersion Service version. + */ + public AuthManagerClientImpl(HttpPipeline httpPipeline, String endpoint, + MicrosoftPlaywrightTestingServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of AuthManagerClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Supported Azure Playwright Service API Endpoints (protocol and hostname, for example: + * https://{region}.api.playwright.microsoft.com). + * @param serviceVersion Service version. + */ + public AuthManagerClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + MicrosoftPlaywrightTestingServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.accessTokens = new AccessTokensImpl(this); + this.accounts = new AccountsImpl(this); + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/implementation/package-info.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/implementation/package-info.java new file mode 100644 index 0000000000000..186efd05e4f04 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for MicrosoftPlaywrightTesting. + * + */ +package com.azure.developer.microsoftplaywrighttesting.implementation; diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/AccessToken.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/AccessToken.java new file mode 100644 index 0000000000000..c55995afbb87a --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/AccessToken.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.microsoftplaywrighttesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +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.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Model of an access-token linked to an account. + */ +@Immutable +public final class AccessToken implements JsonSerializable { + /* + * The access-token id. + */ + @Generated + private String id; + + /* + * The access-token name. + */ + @Generated + private final String name; + + /* + * The access-token value in JWT format. + */ + @Generated + private String jwtToken; + + /* + * The access-token createdAt utcDateTime. + */ + @Generated + private OffsetDateTime createdAt; + + /* + * The access-token expiryAt utcDateTime. + */ + @Generated + private final OffsetDateTime expiryAt; + + /* + * The access-token state - Active | Expired. + */ + @Generated + private AccessTokenState state; + + /** + * Creates an instance of AccessToken class. + * + * @param name the name value to set. + * @param expiryAt the expiryAt value to set. + */ + @Generated + public AccessToken(String name, OffsetDateTime expiryAt) { + this.name = name; + this.expiryAt = expiryAt; + } + + /** + * Get the id property: The access-token id. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The access-token name. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the jwtToken property: The access-token value in JWT format. + * + * @return the jwtToken value. + */ + @Generated + public String getJwtToken() { + return this.jwtToken; + } + + /** + * Get the createdAt property: The access-token createdAt utcDateTime. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Get the expiryAt property: The access-token expiryAt utcDateTime. + * + * @return the expiryAt value. + */ + @Generated + public OffsetDateTime getExpiryAt() { + return this.expiryAt; + } + + /** + * Get the state property: The access-token state - Active | Expired. + * + * @return the state value. + */ + @Generated + public AccessTokenState getState() { + return this.state; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("expiryAt", + this.expiryAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expiryAt)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AccessToken from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AccessToken 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 AccessToken. + */ + @Generated + public static AccessToken fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + OffsetDateTime createdAt = null; + OffsetDateTime expiryAt = null; + AccessTokenState state = null; + String jwtToken = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("createdAt".equals(fieldName)) { + createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("expiryAt".equals(fieldName)) { + expiryAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("state".equals(fieldName)) { + state = AccessTokenState.fromString(reader.getString()); + } else if ("jwtToken".equals(fieldName)) { + jwtToken = reader.getString(); + } else { + reader.skipChildren(); + } + } + AccessToken deserializedAccessToken = new AccessToken(name, expiryAt); + deserializedAccessToken.id = id; + deserializedAccessToken.createdAt = createdAt; + deserializedAccessToken.state = state; + deserializedAccessToken.jwtToken = jwtToken; + + return deserializedAccessToken; + }); + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/AccessTokenState.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/AccessTokenState.java new file mode 100644 index 0000000000000..c64788d1d23ca --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/AccessTokenState.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.developer.microsoftplaywrighttesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The access-token state. + */ +public final class AccessTokenState extends ExpandableStringEnum { + /** + * The access-token is Active. + */ + @Generated + public static final AccessTokenState ACTIVE = fromString("Active"); + + /** + * The access-token is Expired. + */ + @Generated + public static final AccessTokenState EXPIRED = fromString("Expired"); + + /** + * Creates a new instance of AccessTokenState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public AccessTokenState() { + } + + /** + * Creates or finds a AccessTokenState from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccessTokenState. + */ + @Generated + public static AccessTokenState fromString(String name) { + return fromString(name, AccessTokenState.class); + } + + /** + * Gets known AccessTokenState values. + * + * @return known AccessTokenState values. + */ + @Generated + public static Collection values() { + return values(AccessTokenState.class); + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/Account.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/Account.java new file mode 100644 index 0000000000000..597ec6929644d --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/Account.java @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.microsoftplaywrighttesting.models; + +import com.azure.core.annotation.Generated; +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; + +/** + * An account is a parent resource for most of the other service resources. It's directly mapped to an Azure resource. + */ +@Immutable +public final class Account implements JsonSerializable { + /* + * The account id. + */ + @Generated + private String id; + + /* + * The fully-qualified Azure resource id for the account. + */ + @Generated + private String resourceId; + + /* + * The account name. + */ + @Generated + private String name; + + /* + * The state of account - Active | Inactive + */ + @Generated + private AccountState state; + + /* + * The Azure subscription id for the account. + */ + @Generated + private String subscriptionId; + + /* + * The Azure subscription state - Registered | Unregistered | Warned | Suspended | Deleted + */ + @Generated + private SubscriptionState subscriptionState; + + /* + * The Azure tenant id of the account. + */ + @Generated + private String tenantId; + + /* + * The account resource location in Azure, for eg. eastus, southeastasia. + */ + @Generated + private String location; + + /* + * This property sets the connection region for Playwright 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. + */ + @Generated + private EnablementStatus regionalAffinity; + + /* + * When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of + * parallel workers for a test run, significantly minimizing test completion durations. + */ + @Generated + private EnablementStatus scalableExecution; + + /* + * When enabled, this feature allows the workspace to upload and display test results, including artifacts like + * traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. + */ + @Generated + private EnablementStatus reporting; + + /* + * When enabled, this feature allows the workspace to use local auth (through service access token) for executing + * operations. + */ + @Generated + private EnablementStatus localAuth; + + /** + * Creates an instance of Account class. + */ + @Generated + private Account() { + } + + /** + * Get the id property: The account id. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the resourceId property: The fully-qualified Azure resource id for the account. + * + * @return the resourceId value. + */ + @Generated + public String getResourceId() { + return this.resourceId; + } + + /** + * Get the name property: The account name. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the state property: The state of account - Active | Inactive. + * + * @return the state value. + */ + @Generated + public AccountState getState() { + return this.state; + } + + /** + * Get the subscriptionId property: The Azure subscription id for the account. + * + * @return the subscriptionId value. + */ + @Generated + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * Get the subscriptionState property: The Azure subscription state - Registered | Unregistered | Warned | Suspended + * | Deleted. + * + * @return the subscriptionState value. + */ + @Generated + public SubscriptionState getSubscriptionState() { + return this.subscriptionState; + } + + /** + * Get the tenantId property: The Azure tenant id of the account. + * + * @return the tenantId value. + */ + @Generated + public String getTenantId() { + return this.tenantId; + } + + /** + * Get the location property: The account resource location in Azure, for eg. eastus, southeastasia. + * + * @return the location value. + */ + @Generated + public String getLocation() { + return this.location; + } + + /** + * Get the regionalAffinity property: This property sets the connection region for Playwright 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. + */ + @Generated + public EnablementStatus getRegionalAffinity() { + return this.regionalAffinity; + } + + /** + * Get the scalableExecution property: When enabled, Playwright client workers can connect to cloud-hosted browsers. + * This can increase the number of parallel workers for a test run, significantly minimizing test completion + * durations. + * + * @return the scalableExecution value. + */ + @Generated + public EnablementStatus getScalableExecution() { + return this.scalableExecution; + } + + /** + * Get the reporting property: When enabled, this feature allows the workspace to upload and display test results, + * including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient + * troubleshooting. + * + * @return the reporting value. + */ + @Generated + public EnablementStatus getReporting() { + return this.reporting; + } + + /** + * 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. + */ + @Generated + public EnablementStatus getLocalAuth() { + return this.localAuth; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Account from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Account 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 Account. + */ + @Generated + public static Account fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Account deserializedAccount = new Account(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAccount.id = reader.getString(); + } else if ("resourceId".equals(fieldName)) { + deserializedAccount.resourceId = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAccount.name = reader.getString(); + } else if ("state".equals(fieldName)) { + deserializedAccount.state = AccountState.fromString(reader.getString()); + } else if ("subscriptionId".equals(fieldName)) { + deserializedAccount.subscriptionId = reader.getString(); + } else if ("subscriptionState".equals(fieldName)) { + deserializedAccount.subscriptionState = SubscriptionState.fromString(reader.getString()); + } else if ("tenantId".equals(fieldName)) { + deserializedAccount.tenantId = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedAccount.location = reader.getString(); + } else if ("regionalAffinity".equals(fieldName)) { + deserializedAccount.regionalAffinity = EnablementStatus.fromString(reader.getString()); + } else if ("scalableExecution".equals(fieldName)) { + deserializedAccount.scalableExecution = EnablementStatus.fromString(reader.getString()); + } else if ("reporting".equals(fieldName)) { + deserializedAccount.reporting = EnablementStatus.fromString(reader.getString()); + } else if ("localAuth".equals(fieldName)) { + deserializedAccount.localAuth = EnablementStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAccount; + }); + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/AccountState.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/AccountState.java new file mode 100644 index 0000000000000..eeaf5112bdc58 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/AccountState.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.developer.microsoftplaywrighttesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The account state. + */ +public final class AccountState extends ExpandableStringEnum { + /** + * The account is Active. + */ + @Generated + public static final AccountState ACTIVE = fromString("Active"); + + /** + * The account is Inactive. + */ + @Generated + public static final AccountState INACTIVE = fromString("Inactive"); + + /** + * Creates a new instance of AccountState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public AccountState() { + } + + /** + * Creates or finds a AccountState from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccountState. + */ + @Generated + public static AccountState fromString(String name) { + return fromString(name, AccountState.class); + } + + /** + * Gets known AccountState values. + * + * @return known AccountState values. + */ + @Generated + public static Collection values() { + return values(AccountState.class); + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/EnablementStatus.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/EnablementStatus.java new file mode 100644 index 0000000000000..605383aa07c95 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/EnablementStatus.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.developer.microsoftplaywrighttesting.models; + +import com.azure.core.annotation.Generated; +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. + */ + @Generated + public static final EnablementStatus ENABLED = fromString("Enabled"); + + /** + * The feature is Disabled. + */ + @Generated + public static final EnablementStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of EnablementStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public EnablementStatus() { + } + + /** + * Creates or finds a EnablementStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding EnablementStatus. + */ + @Generated + public static EnablementStatus fromString(String name) { + return fromString(name, EnablementStatus.class); + } + + /** + * Gets known EnablementStatus values. + * + * @return known EnablementStatus values. + */ + @Generated + public static Collection values() { + return values(EnablementStatus.class); + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/OS.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/OS.java new file mode 100644 index 0000000000000..5c3c39984d6f1 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/OS.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.developer.microsoftplaywrighttesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The os to configure for remote test runs. + */ +public final class OS extends ExpandableStringEnum { + /** + * Linux OS. + */ + @Generated + public static final OS LINUX = fromString("linux"); + + /** + * Windows OS. + */ + @Generated + public static final OS WINDOWS = fromString("windows"); + + /** + * Creates a new instance of OS value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public OS() { + } + + /** + * Creates or finds a OS from its string representation. + * + * @param name a name to look for. + * @return the corresponding OS. + */ + @Generated + public static OS fromString(String name) { + return fromString(name, OS.class); + } + + /** + * Gets known OS values. + * + * @return known OS values. + */ + @Generated + public static Collection values() { + return values(OS.class); + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/SubscriptionState.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/SubscriptionState.java new file mode 100644 index 0000000000000..43c05708cdd50 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/SubscriptionState.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.microsoftplaywrighttesting.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The Azure subscription state. + */ +public final class SubscriptionState extends ExpandableStringEnum { + /** + * The subscription state is Registered. + */ + @Generated + public static final SubscriptionState REGISTERED = fromString("Registered"); + + /** + * The subscription state is Warned. + */ + @Generated + public static final SubscriptionState WARNED = fromString("Warned"); + + /** + * The subscription state is Suspended. + */ + @Generated + public static final SubscriptionState SUSPENDED = fromString("Suspended"); + + /** + * The subscription state is Deleted. + */ + @Generated + public static final SubscriptionState DELETED = fromString("Deleted"); + + /** + * The subscription state is Unregistered. + */ + @Generated + public static final SubscriptionState UNREGISTERED = fromString("Unregistered"); + + /** + * Creates a new instance of SubscriptionState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public SubscriptionState() { + } + + /** + * Creates or finds a SubscriptionState from its string representation. + * + * @param name a name to look for. + * @return the corresponding SubscriptionState. + */ + @Generated + public static SubscriptionState fromString(String name) { + return fromString(name, SubscriptionState.class); + } + + /** + * Gets known SubscriptionState values. + * + * @return known SubscriptionState values. + */ + @Generated + public static Collection values() { + return values(SubscriptionState.class); + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/package-info.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/package-info.java new file mode 100644 index 0000000000000..a3c2c1c0bfab1 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for MicrosoftPlaywrightTesting. + * + */ +package com.azure.developer.microsoftplaywrighttesting.models; diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/package-info.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/package-info.java new file mode 100644 index 0000000000000..4dcfac4532f3f --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/com/azure/developer/microsoftplaywrighttesting/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for MicrosoftPlaywrightTesting. + * + */ +package com.azure.developer.microsoftplaywrighttesting; diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/module-info.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/module-info.java new file mode 100644 index 0000000000000..c6228c90ca074 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/java/module-info.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.developer.microsoftplaywrighttesting { + requires transitive com.azure.core; + + exports com.azure.developer.microsoftplaywrighttesting; + exports com.azure.developer.microsoftplaywrighttesting.models; + + opens com.azure.developer.microsoftplaywrighttesting.models to com.azure.core; +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/resources/META-INF/azure-developer-microsoftplaywrighttesting_apiview_properties.json b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/resources/META-INF/azure-developer-microsoftplaywrighttesting_apiview_properties.json new file mode 100644 index 0000000000000..be52095a75e89 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/resources/META-INF/azure-developer-microsoftplaywrighttesting_apiview_properties.json @@ -0,0 +1,39 @@ +{ + "flavor": "azure", + "CrossLanguageDefinitionId": { + "com.azure.developer.microsoftplaywrighttesting.AccessTokensAsyncClient": "null", + "com.azure.developer.microsoftplaywrighttesting.AccessTokensAsyncClient.createOrReplace": "Microsoft.PlaywrightTesting.AuthManager.AccessTokens.createOrReplace", + "com.azure.developer.microsoftplaywrighttesting.AccessTokensAsyncClient.createOrReplaceWithResponse": "Microsoft.PlaywrightTesting.AuthManager.AccessTokens.createOrReplace", + "com.azure.developer.microsoftplaywrighttesting.AccessTokensAsyncClient.delete": "Microsoft.PlaywrightTesting.AuthManager.AccessTokens.delete", + "com.azure.developer.microsoftplaywrighttesting.AccessTokensAsyncClient.deleteWithResponse": "Microsoft.PlaywrightTesting.AuthManager.AccessTokens.delete", + "com.azure.developer.microsoftplaywrighttesting.AccessTokensAsyncClient.get": "Microsoft.PlaywrightTesting.AuthManager.AccessTokens.get", + "com.azure.developer.microsoftplaywrighttesting.AccessTokensAsyncClient.getWithResponse": "Microsoft.PlaywrightTesting.AuthManager.AccessTokens.get", + "com.azure.developer.microsoftplaywrighttesting.AccessTokensAsyncClient.list": "Microsoft.PlaywrightTesting.AuthManager.AccessTokens.list", + "com.azure.developer.microsoftplaywrighttesting.AccessTokensClient": "null", + "com.azure.developer.microsoftplaywrighttesting.AccessTokensClient.createOrReplace": "Microsoft.PlaywrightTesting.AuthManager.AccessTokens.createOrReplace", + "com.azure.developer.microsoftplaywrighttesting.AccessTokensClient.createOrReplaceWithResponse": "Microsoft.PlaywrightTesting.AuthManager.AccessTokens.createOrReplace", + "com.azure.developer.microsoftplaywrighttesting.AccessTokensClient.delete": "Microsoft.PlaywrightTesting.AuthManager.AccessTokens.delete", + "com.azure.developer.microsoftplaywrighttesting.AccessTokensClient.deleteWithResponse": "Microsoft.PlaywrightTesting.AuthManager.AccessTokens.delete", + "com.azure.developer.microsoftplaywrighttesting.AccessTokensClient.get": "Microsoft.PlaywrightTesting.AuthManager.AccessTokens.get", + "com.azure.developer.microsoftplaywrighttesting.AccessTokensClient.getWithResponse": "Microsoft.PlaywrightTesting.AuthManager.AccessTokens.get", + "com.azure.developer.microsoftplaywrighttesting.AccessTokensClient.list": "Microsoft.PlaywrightTesting.AuthManager.AccessTokens.list", + "com.azure.developer.microsoftplaywrighttesting.AccountsAsyncClient": "null", + "com.azure.developer.microsoftplaywrighttesting.AccountsAsyncClient.get": "Microsoft.PlaywrightTesting.AuthManager.Accounts.get", + "com.azure.developer.microsoftplaywrighttesting.AccountsAsyncClient.getBrowsers": "Microsoft.PlaywrightTesting.AuthManager.Accounts.getBrowsers", + "com.azure.developer.microsoftplaywrighttesting.AccountsAsyncClient.getBrowsersWithResponse": "Microsoft.PlaywrightTesting.AuthManager.Accounts.getBrowsers", + "com.azure.developer.microsoftplaywrighttesting.AccountsAsyncClient.getWithResponse": "Microsoft.PlaywrightTesting.AuthManager.Accounts.get", + "com.azure.developer.microsoftplaywrighttesting.AccountsClient": "null", + "com.azure.developer.microsoftplaywrighttesting.AccountsClient.get": "Microsoft.PlaywrightTesting.AuthManager.Accounts.get", + "com.azure.developer.microsoftplaywrighttesting.AccountsClient.getBrowsers": "Microsoft.PlaywrightTesting.AuthManager.Accounts.getBrowsers", + "com.azure.developer.microsoftplaywrighttesting.AccountsClient.getBrowsersWithResponse": "Microsoft.PlaywrightTesting.AuthManager.Accounts.getBrowsers", + "com.azure.developer.microsoftplaywrighttesting.AccountsClient.getWithResponse": "Microsoft.PlaywrightTesting.AuthManager.Accounts.get", + "com.azure.developer.microsoftplaywrighttesting.AuthManagerClientBuilder": "Microsoft.PlaywrightTesting.AuthManager", + "com.azure.developer.microsoftplaywrighttesting.models.AccessToken": "Microsoft.PlaywrightTesting.AuthManager.AccessToken", + "com.azure.developer.microsoftplaywrighttesting.models.AccessTokenState": "Microsoft.PlaywrightTesting.AuthManager.AccessTokenState", + "com.azure.developer.microsoftplaywrighttesting.models.Account": "Microsoft.PlaywrightTesting.AuthManager.Account", + "com.azure.developer.microsoftplaywrighttesting.models.AccountState": "Microsoft.PlaywrightTesting.AuthManager.AccountState", + "com.azure.developer.microsoftplaywrighttesting.models.EnablementStatus": "Microsoft.PlaywrightTesting.AuthManager.EnablementStatus", + "com.azure.developer.microsoftplaywrighttesting.models.OS": "Microsoft.PlaywrightTesting.AuthManager.OS", + "com.azure.developer.microsoftplaywrighttesting.models.SubscriptionState": "Microsoft.PlaywrightTesting.AuthManager.SubscriptionState" + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/resources/azure-developer-microsoftplaywrighttesting.properties b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/resources/azure-developer-microsoftplaywrighttesting.properties new file mode 100644 index 0000000000000..ca812989b4f27 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/main/resources/azure-developer-microsoftplaywrighttesting.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/ReadmeSamples.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/ReadmeSamples.java new file mode 100644 index 0000000000000..51f54f5d9bba1 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/ReadmeSamples.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.microsoftplaywrighttesting; + +public final class ReadmeSamples { + public void readmeSamples() { + // BEGIN: com.azure.developer.microsoftplaywrighttesting.readme + // END: com.azure.developer.microsoftplaywrighttesting.readme + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccessTokensCreateOrReplace.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccessTokensCreateOrReplace.java new file mode 100644 index 0000000000000..c1b904ab8c4d3 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccessTokensCreateOrReplace.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.microsoftplaywrighttesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.microsoftplaywrighttesting.AccessTokensClient; +import com.azure.developer.microsoftplaywrighttesting.AuthManagerClientBuilder; +import com.azure.developer.microsoftplaywrighttesting.models.AccessToken; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.time.OffsetDateTime; + +public class AccessTokensCreateOrReplace { + public static void main(String[] args) { + AccessTokensClient accessTokensClient + = new AuthManagerClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildAccessTokensClient(); + // BEGIN:com.azure.developer.microsoftplaywrighttesting.generated.accesstokenscreateorreplace.accesstokenscreateorreplace + AccessToken response = accessTokensClient.createOrReplace( + "sampleAccountId_00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000", + new AccessToken("sampleAccessToken", OffsetDateTime.parse("2022-09-28T12:32:33Z"))); + // END:com.azure.developer.microsoftplaywrighttesting.generated.accesstokenscreateorreplace.accesstokenscreateorreplace + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccessTokensDelete.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccessTokensDelete.java new file mode 100644 index 0000000000000..d7eca85ab05d8 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccessTokensDelete.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.microsoftplaywrighttesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.microsoftplaywrighttesting.AccessTokensClient; +import com.azure.developer.microsoftplaywrighttesting.AuthManagerClientBuilder; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class AccessTokensDelete { + public static void main(String[] args) { + AccessTokensClient accessTokensClient + = new AuthManagerClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildAccessTokensClient(); + // BEGIN:com.azure.developer.microsoftplaywrighttesting.generated.accesstokensdelete.accesstokensdelete + accessTokensClient.delete("sampleAccountId_00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000000"); + // END:com.azure.developer.microsoftplaywrighttesting.generated.accesstokensdelete.accesstokensdelete + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccessTokensGet.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccessTokensGet.java new file mode 100644 index 0000000000000..2377469840c89 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccessTokensGet.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.developer.microsoftplaywrighttesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.microsoftplaywrighttesting.AccessTokensClient; +import com.azure.developer.microsoftplaywrighttesting.AuthManagerClientBuilder; +import com.azure.developer.microsoftplaywrighttesting.models.AccessToken; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class AccessTokensGet { + public static void main(String[] args) { + AccessTokensClient accessTokensClient + = new AuthManagerClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildAccessTokensClient(); + // BEGIN:com.azure.developer.microsoftplaywrighttesting.generated.accesstokensget.accesstokensget + AccessToken response = accessTokensClient.get("sampleAccountId_00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000000"); + // END:com.azure.developer.microsoftplaywrighttesting.generated.accesstokensget.accesstokensget + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccessTokensList.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccessTokensList.java new file mode 100644 index 0000000000000..6c2f28bc311fb --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccessTokensList.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.microsoftplaywrighttesting.generated; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Configuration; +import com.azure.developer.microsoftplaywrighttesting.AccessTokensClient; +import com.azure.developer.microsoftplaywrighttesting.AuthManagerClientBuilder; +import com.azure.developer.microsoftplaywrighttesting.models.AccessToken; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class AccessTokensList { + public static void main(String[] args) { + AccessTokensClient accessTokensClient + = new AuthManagerClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildAccessTokensClient(); + // BEGIN:com.azure.developer.microsoftplaywrighttesting.generated.accesstokenslist.accesstokenslist + PagedIterable response + = accessTokensClient.list("sampleAccountId_00000000-0000-0000-0000-000000000000"); + // END:com.azure.developer.microsoftplaywrighttesting.generated.accesstokenslist.accesstokenslist + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccountsGet.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccountsGet.java new file mode 100644 index 0000000000000..c1962cf6c731e --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccountsGet.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.microsoftplaywrighttesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.microsoftplaywrighttesting.AccountsClient; +import com.azure.developer.microsoftplaywrighttesting.AuthManagerClientBuilder; +import com.azure.developer.microsoftplaywrighttesting.models.Account; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class AccountsGet { + public static void main(String[] args) { + AccountsClient accountsClient + = new AuthManagerClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildAccountsClient(); + // BEGIN:com.azure.developer.microsoftplaywrighttesting.generated.accountsget.accountsget + Account response = accountsClient.get("sampleAccountId_00000000-0000-0000-0000-000000000000"); + // END:com.azure.developer.microsoftplaywrighttesting.generated.accountsget.accountsget + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccountsGetBrowsers.java b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccountsGetBrowsers.java new file mode 100644 index 0000000000000..2dbf219687606 --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/src/samples/java/com/azure/developer/microsoftplaywrighttesting/generated/AccountsGetBrowsers.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.developer.microsoftplaywrighttesting.generated; + +import com.azure.core.util.Configuration; +import com.azure.developer.microsoftplaywrighttesting.AccountsClient; +import com.azure.developer.microsoftplaywrighttesting.AuthManagerClientBuilder; +import com.azure.developer.microsoftplaywrighttesting.models.OS; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class AccountsGetBrowsers { + public static void main(String[] args) { + AccountsClient accountsClient + = new AuthManagerClientBuilder().credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildAccountsClient(); + // BEGIN:com.azure.developer.microsoftplaywrighttesting.generated.accountsgetbrowsers.accountsgetbrowsers + accountsClient.getBrowsers("sampleAccountId_00000000-0000-0000-0000-000000000000", null, OS.LINUX); + // END:com.azure.developer.microsoftplaywrighttesting.generated.accountsgetbrowsers.accountsgetbrowsers + } +} diff --git a/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/tsp-location.yaml b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/tsp-location.yaml new file mode 100644 index 0000000000000..14a138697dbab --- /dev/null +++ b/sdk/playwrighttesting/azure-developer-microsoftplaywrighttesting/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/playwrighttesting/PlaywrightTesting.AuthManager +commit: 9686d49b64cd32f4120d426b0e45f25e24843a20 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/playwrighttesting/ci.yml b/sdk/playwrighttesting/ci.yml index 6d5b7f6ce934a..af7d11f98f3c0 100644 --- a/sdk/playwrighttesting/ci.yml +++ b/sdk/playwrighttesting/ci.yml @@ -34,6 +34,10 @@ parameters: displayName: azure-resourcemanager-playwrighttesting type: boolean default: false + - name: release_azuredevelopermicrosoftplaywrighttesting + displayName: azure-developer-microsoftplaywrighttesting + type: boolean + default: true extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -44,3 +48,7 @@ extends: groupId: com.azure.resourcemanager safeName: azureresourcemanagerplaywrighttesting releaseInBatch: ${{ parameters.release_azureresourcemanagerplaywrighttesting }} + - name: azure-developer-microsoftplaywrighttesting + groupId: com.azure + safeName: azuredevelopermicrosoftplaywrighttesting + releaseInBatch: ${{ parameters.release_azuredevelopermicrosoftplaywrighttesting }} diff --git a/sdk/playwrighttesting/pom.xml b/sdk/playwrighttesting/pom.xml index 9279109bf1d84..009b72c2b30d1 100644 --- a/sdk/playwrighttesting/pom.xml +++ b/sdk/playwrighttesting/pom.xml @@ -10,6 +10,7 @@ 1.0.0 + azure-developer-microsoftplaywrighttesting azure-resourcemanager-playwrighttesting