-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release playwrighttesting microsoft.playwright testing.auth manager 2024 12 01 #31855
base: main
Are you sure you want to change the base?
Changes from 22 commits
a26928d
36c6afd
52a1a37
9cc3283
1db7b13
2cb194c
0bdfe05
c8216f4
6ff1186
13348ff
c3f61c7
b291261
0bb3649
74b8e47
91818d6
528ca41
3f602d2
2cc2e53
c21633b
381b8a0
6f33e52
7ce268b
5d76723
15d8881
96a2f69
c280115
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"title": "AccessTokens_Validate", | ||
"operationId": "AccessTokens_Validate", | ||
"parameters": { | ||
"api-version": "2024-12-01", | ||
"accountId": "sampleAccountId" | ||
}, | ||
"responses": { | ||
"200": {} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"title": "Accounts_GetBrowsers", | ||
"operationId": "Accounts_GetBrowsers", | ||
"parameters": { | ||
"api-version": "2024-12-01", | ||
"accountId": "sampleAccountId", | ||
"os": "linux" | ||
}, | ||
"responses": { | ||
"302": { | ||
"headers": { | ||
"location": "wss://{region}.api.playwright.microsoft.com/redirectURL?api-version=2024-12-01&os=linux" | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,26 +5,31 @@ import "@typespec/http"; | |
import "@typespec/rest"; | ||
import "@typespec/versioning"; | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-autorest"; | ||
|
||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using TypeSpec.Versioning; | ||
using Azure.Core; | ||
using Azure.Core.Traits; | ||
using Autorest; | ||
|
||
@server( | ||
"https://api.playwright-int.io", | ||
"Azure Playwright Service API Endpoint" | ||
"{endpoint}", | ||
"Microsoft Azure Playwright Service API Endpoint", | ||
{ | ||
@doc(""" | ||
Supported Azure Playwright Service API Endpoints (protocol and hostname, for example: | ||
https://{region}.api.playwright.microsoft.com). | ||
""") | ||
endpoint: string, | ||
} | ||
) | ||
@useAuth( | ||
[ | ||
OAuth2Auth<[ | ||
{ | ||
type: OAuth2FlowType.implicit, | ||
authorizationUrl: "https://login.microsoftonline.com/common/oauth2/authorize", | ||
scopes: ["https://preview.playwright-int.io/.default"], | ||
scopes: ["https://playwright.microsoft.com/.default"], | ||
} | ||
]> | ||
] | ||
|
@@ -37,22 +42,22 @@ namespace Microsoft.PlaywrightTesting.AuthManager; | |
|
||
@doc("The PlaywrightTesting Auth Manager service version.") | ||
enum Versions { | ||
@doc("Version 2023-10-01-preview") | ||
@doc("Version 2024-12-01") | ||
@useDependency(Azure.Core.Versions.v1_0_Preview_2) | ||
`2023-10-01-preview`, | ||
`2024-12-01`, | ||
} | ||
|
||
// Models //////////////////// | ||
|
||
@doc("An account is a parent resource for most of the other service resources. It's directly mapped to an ARM resource and helps to create a link between control-plane and data-plane resources.") | ||
@doc("An account is a parent resource for most of the other service resources. It's directly mapped to an Azure resource.") | ||
@resource("accounts") | ||
model Account { | ||
@key("accountId") | ||
@doc("The account id.") | ||
@visibility("read") | ||
id: string; | ||
|
||
@doc("The ARM fully-qualified resource id for the account.") | ||
@doc("The fully-qualified Azure resource id for the account.") | ||
@visibility("read") | ||
resourceId: string; | ||
|
||
|
@@ -64,19 +69,19 @@ model Account { | |
@visibility("read") | ||
state: AccountState; | ||
|
||
@doc("The ARM-based subscription id for the account.") | ||
@doc("The Azure subscription id for the account.") | ||
@visibility("read") | ||
subscriptionId: uuid; | ||
|
||
@doc("The ARM-based subscription state - Registered | Unregistered | Warned | Suspended | Deleted") | ||
@doc("The Azure subscription state - Registered | Unregistered | Warned | Suspended | Deleted") | ||
@visibility("read") | ||
subscriptionState: SubscriptionState; | ||
|
||
@doc("The Azure tenant id of the account.") | ||
@visibility("read") | ||
tenantId: uuid; | ||
|
||
@doc("The account resource ARM location, for eg. eastus, southeastasia.") | ||
@doc("The account resource location in Azure, for eg. eastus, southeastasia.") | ||
@visibility("read") | ||
location: string; | ||
|
||
|
@@ -90,7 +95,11 @@ model Account { | |
|
||
@doc("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.") | ||
@visibility("read") | ||
reporting?: EnablementStatus = EnablementStatus.Disabled; | ||
reporting?: EnablementStatus = EnablementStatus.Enabled; | ||
|
||
@doc("When enabled, this feature allows the workspace to use local auth (through service access token) for executing operations.") | ||
@visibility("read") | ||
localAuth?: EnablementStatus = EnablementStatus.Disabled; | ||
} | ||
|
||
@doc("The account state.") | ||
|
@@ -104,7 +113,7 @@ union AccountState { | |
"Inactive", | ||
} | ||
|
||
@doc("The ARM-based subscription state.") | ||
@doc("The Azure subscription state.") | ||
union SubscriptionState { | ||
string, | ||
|
||
|
@@ -146,26 +155,26 @@ model AccessToken { | |
|
||
@doc("The access-token createdAt utcDateTime.") | ||
@visibility("read") | ||
createdAt?: utcDateTime; | ||
createdAt: utcDateTime; | ||
|
||
@doc("The access-token expiryAt utcDateTime.") | ||
@visibility("read", "create") | ||
expiryAt: utcDateTime; | ||
|
||
@doc("The access-token state - Active | Expired.") | ||
@visibility("read") | ||
state?: AccessTokenState; | ||
state: AccessTokenState; | ||
} | ||
|
||
@doc("The access-token state.") | ||
union AccessTokenState { | ||
string, | ||
|
||
@doc("The access-token is Active.") | ||
"Active", | ||
Active: "Active", | ||
|
||
@doc("The access-token is Expired.") | ||
"Expired", | ||
Expired: "Expired", | ||
} | ||
|
||
@doc("The enablement status of a feature.") | ||
|
@@ -179,6 +188,17 @@ union EnablementStatus { | |
Disabled: "Disabled", | ||
} | ||
|
||
@doc("The os to configure for remote test runs.") | ||
union OS { | ||
string, | ||
|
||
@doc("Linux OS.") | ||
Linux: "linux", | ||
|
||
@doc("Windows OS.") | ||
Windows: "windows", | ||
Comment on lines
+209
to
+213
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a blocker, but we'd expect the casing of enum values be consistent. Here is it lowercase/camelCase e.g. |
||
} | ||
|
||
// Operations //////////////////// | ||
|
||
alias ServiceTraits = NoRepeatableRequests & | ||
|
@@ -189,23 +209,59 @@ alias Operations = Azure.Core.ResourceOperations<ServiceTraits>; | |
|
||
interface AccessTokens { | ||
// AccessToken Operations | ||
// #suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing name" | ||
@doc("Creates an access-token for the account with given access-token id. Authorization required is Bearer JWT Access token provided by EntraID.") | ||
createOrReplace is Operations.ResourceCreateOrReplace<AccessToken>; | ||
|
||
#suppress "@azure-tools/typespec-azure-core/use-standard-names" "Existing name" | ||
@doc("Creates an access-token with given access-token id in guid format.") | ||
createAccessToken is Operations.ResourceCreateOrReplace<AccessToken>; | ||
@doc("Gets an access-token for the account with given access-token id. Authorization required is Bearer JWT Access token provided by EntraID.") | ||
get is Operations.ResourceRead<AccessToken>; | ||
|
||
@doc("Get an access-token for given access-token id in guid format.") | ||
getAccessToken is Operations.ResourceRead<AccessToken>; | ||
@doc("Deletes an access-token for the account with given access-token id. Authorization required is Bearer JWT Access token provided by EntraID.") | ||
delete is Operations.ResourceDelete<AccessToken>; | ||
|
||
@doc("Revoke an access-token with given access-token id in guid format.") | ||
deleteAccessToken is Operations.ResourceDelete<AccessToken>; | ||
@doc("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.") | ||
list is Operations.ResourceList<AccessToken>; | ||
|
||
@doc("List access-tokens for a given accountId.") | ||
listAccessTokens is Operations.ResourceList<AccessToken>; | ||
@doc("Validates access-token provided in authorization header for the given account id. Authorization required is Bearer JWT Access token provided by MPT service.") | ||
@actionSeparator("/") | ||
validate is Operations.ResourceCollectionAction<AccessToken, {}, {}>; | ||
} | ||
|
||
alias GetBrowsersParams = { | ||
@query | ||
@doc("The run id provided by client for corresponding remote test run.") | ||
runId?: string; | ||
|
||
@query | ||
@doc("The os provided by client for remote test runs.") | ||
os?: OS = OS.Linux; | ||
|
||
@path | ||
@doc("The account id.") | ||
accountId: string; | ||
Comment on lines
+248
to
+250
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure how much it effects the Swagger or API. But I'd expect the most important parameter (I assume it be |
||
}; | ||
|
||
alias GetBrowsersResponse = { | ||
@statusCode | ||
_: 302; | ||
|
||
@header | ||
@doc("The redirect target URL to run test on remote browsers.") | ||
location: url; | ||
}; | ||
|
||
interface Accounts { | ||
// Accounts Operations | ||
@doc("Get details of the ARM resource mapped to an account for the given accountId.") | ||
getAccount is Operations.ResourceRead<Account>; | ||
|
||
@doc("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.") | ||
get is Operations.ResourceRead<Account>; | ||
|
||
#suppress "@azure-tools/typespec-azure-core/no-rpc-path-params" "Operations defined using RpcOperation should not have path parameters. Consider using ResourceAction or ResourceCollectionAction instead." | ||
@doc("Gets remote browsers corresponding to given account id and redirects the client for running MPT tests. Authorization required is Bearer JWT Access token provided by EntraID or MPT Service.") | ||
@route("/accounts/{accountId}/browsers") | ||
getBrowsers is RpcOperation< | ||
GetBrowsersParams, | ||
GetBrowsersResponse, | ||
ServiceTraits | ||
>; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
emit: | ||
- "@azure-tools/typespec-autorest" | ||
linter: | ||
extends: | ||
- "@azure-tools/typespec-azure-rulesets/data-plane" | ||
parameters: | ||
"service-dir": | ||
default: "sdk/playwrighttesting" | ||
options: | ||
"@azure-tools/typespec-autorest": | ||
azure-resource-provider-folder: "data-plane" | ||
emitter-output-dir: "{project-root}/.." | ||
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/playwrighttesting.json" | ||
omit-unreachable-types: true | ||
"@azure-tools/typespec-python": | ||
package-dir: "azure-developer-microsoftplaywrighttesting" | ||
package-name: "{package-dir}" | ||
# emitter-output-dir: "{python-sdk-folder}/sdk/{service-directory-name}/{package-name}" | ||
package-mode: azure-dataplane | ||
flavor: azure | ||
"@azure-tools/typespec-ts": | ||
package-dir: "microsoft-playwright-testing-rest" | ||
title: Microsoft Playwright Testing | ||
description: Microsoft Playwright Testing Client | ||
generateMetadata: true | ||
generateTest: false | ||
packageDetails: | ||
name: "@azure-rest/microsoft-playwright-testing" | ||
description: "This package contains Microsoft Playwright Testing client library." | ||
version: 1.0.0 | ||
flavor: azure | ||
"@azure-tools/typespec-csharp": | ||
package-dir: "Azure.Developer.MicrosoftPlaywrightTesting" | ||
clear-output-folder: true | ||
model-namespace: false | ||
namespace: "{package-dir}" | ||
flavor: azure | ||
"@azure-tools/typespec-java": | ||
package-dir: "azure-developer-microsoftplaywrighttesting" | ||
namespace: com.azure.developer.microsoftplaywrighttesting | ||
partial-update: true | ||
generate-tests: false | ||
service-name: Microsoft Playwright Testing | ||
flavor: azure |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why there is a service-side default value (e.g.
EnablementStatus.Disabled
) to this already read-only property?A server-side default value is used when user does not define the property in request (e.g. a PUT), and server choose the value. How does this work together with a property user cannot set?
And since the e.g.
localAuth?
is an optional property, what does it mean, when the response does not containlocalAuth
. Is it "disabled" or "enabled"?