Skip to content
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

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a26928d
Copy files from preview/2023-10-01-preview
mjmadhu Dec 12, 2024
36c6afd
Update version to stable/2024-12-01
mjmadhu Dec 12, 2024
52a1a37
Added tag for 2024-12-01 in readme file
mjmadhu Dec 12, 2024
9cc3283
Added stable api-version for data-plane auth manager apis
mjmadhu Dec 12, 2024
1db7b13
Rectified a typo
mjmadhu Dec 12, 2024
2cb194c
Typespec Validation error resolved
mjmadhu Dec 12, 2024
0bdfe05
Typespec Validation error resolved
mjmadhu Dec 12, 2024
c8216f4
TSP Validation fix trial
mjmadhu Dec 12, 2024
6ff1186
TSP Validation fix trial
mjmadhu Dec 12, 2024
13348ff
Removed redundant imports
mjmadhu Dec 13, 2024
c3f61c7
Fixed readme errors
mjmadhu Dec 13, 2024
b291261
Merge branch 'main' into dev-playwrighttesting-Microsoft.PlaywrightTe…
mjmadhu Dec 15, 2024
0bb3649
Merge branch 'main' into dev-playwrighttesting-Microsoft.PlaywrightTe…
mjmadhu Dec 17, 2024
74b8e47
Added trailing newline char in tspconfig.yaml
mjmadhu Dec 17, 2024
91818d6
Typespec validation errors fix
mjmadhu Dec 17, 2024
528ca41
Committing changes by npx tsv
mjmadhu Dec 17, 2024
3f602d2
Update formatting
mjmadhu Dec 17, 2024
2cc2e53
Merge branch 'main' into dev-playwrighttesting-Microsoft.PlaywrightTe…
mjmadhu Dec 17, 2024
c21633b
Added suppression and bit more documentation in comments
mjmadhu Dec 17, 2024
381b8a0
Merge branch 'main' into dev-playwrighttesting-Microsoft.PlaywrightTe…
mjmadhu Dec 18, 2024
6f33e52
Merge branch 'main' into dev-playwrighttesting-Microsoft.PlaywrightTe…
mjmadhu Dec 18, 2024
7ce268b
Suppression improvement
mjmadhu Dec 18, 2024
5d76723
Merge branch 'main' into dev-playwrighttesting-Microsoft.PlaywrightTe…
mjmadhu Dec 19, 2024
15d8881
Removed validate access token api as suggested in review feedback
mjmadhu Dec 19, 2024
96a2f69
Added suppressions for swagger lintdiff issues
mjmadhu Dec 19, 2024
c280115
Added suppressions for swagger lintdiff issues
mjmadhu Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"title": "AccessTokens_Create",
"operationId": "AccessTokens_Create",
"parameters": {
"api-version": "2024-12-01",
"accountId": "sampleAccountId",
"accessTokenId": "00000000-0000-0000-0000-000000000000",
"resource": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "sampleAccessToken",
"expiryAt": "2022-09-28T12:32:33Z"
}
},
"responses": {
"200": {
"body": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "sampleAccessToken",
"jwtToken": "sampleJwtToken",
"createdAt": "2021-09-28T12:32:33Z",
"expiryAt": "2022-09-28T12:32:33Z",
"state": "Active"
}
},
"201": {
"body": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "sampleAccessToken",
"jwtToken": "sampleJwtToken",
"createdAt": "2021-09-28T12:32:33Z",
"expiryAt": "2022-09-28T12:32:33Z",
"state": "Active"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"title": "AccessTokens_Delete",
"operationId": "AccessTokens_Delete",
"parameters": {
"api-version": "2024-12-01",
"accountId": "sampleAccountId",
"accessTokenId": "00000000-0000-0000-0000-000000000000"
},
"responses": {
"204": {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"title": "AccessTokens_Get",
"operationId": "AccessTokens_Get",
"parameters": {
"api-version": "2024-12-01",
"accountId": "sampleAccountId",
"accessTokenId": "00000000-0000-0000-0000-000000000000"
},
"responses": {
"200": {
"body": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "sampleAccessToken",
"jwtToken": "sampleJwtToken",
"createdAt": "2021-09-28T12:32:33Z",
"expiryAt": "2022-09-28T12:32:33Z",
"state": "Active"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"title": "AccessTokens_List",
"operationId": "AccessTokens_List",
"parameters": {
"api-version": "2024-12-01",
"accountId": "sampleAccountId"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "00000000-0000-0000-0000-000000000000",
"name": "sampleAccessToken",
"jwtToken": "sampleJwtToken",
"createdAt": "2021-09-28T12:32:33Z",
"expiryAt": "2022-09-28T12:32:33Z",
"state": "Active"
}
],
"nextLink": null
}
}
}
}
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,26 @@
{
"title": "Accounts_Get",
"operationId": "Accounts_Get",
"parameters": {
"api-version": "2024-12-01",
"accountId": "sampleAccountId"
},
"responses": {
"200": {
"body": {
"id": "sampleAccountId",
"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.AzurePlaywrightService/accounts/myPlaywrightAccount",
"name": "myPlaywrightAccount",
"state": "Active",
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"subscriptionState": "Registered",
"tenantId": "00000000-0000-0000-0000-000000000000",
"location": "westus",
"regionalAffinity": "Enabled",
"scalableExecution": "Enabled",
"reporting": "Disabled",
"localAuth": "Enabled"
}
}
}
}
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
Expand Up @@ -15,16 +15,23 @@ 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"],
}
]>
]
Expand All @@ -37,22 +44,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;

Expand All @@ -64,19 +71,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;

Expand All @@ -90,7 +97,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;
Comment on lines 108 to +114
Copy link
Member

@weidongxu-microsoft weidongxu-microsoft Dec 23, 2024

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 contain localAuth. Is it "disabled" or "enabled"?

}

@doc("The account state.")
Expand All @@ -104,7 +115,7 @@ union AccountState {
"Inactive",
}

@doc("The ARM-based subscription state.")
@doc("The Azure subscription state.")
union SubscriptionState {
string,

Expand Down Expand Up @@ -146,26 +157,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.")
Expand All @@ -179,6 +190,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
Copy link
Member

@weidongxu-microsoft weidongxu-microsoft Dec 23, 2024

Choose a reason for hiding this comment

The 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. linux, and the enum value above is PascalCase e.g. Active. Any reason for this inconsistency?

}

// Operations ////////////////////

alias ServiceTraits = NoRepeatableRequests &
Expand All @@ -189,23 +211,66 @@ 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.")
@example("./AccessTokens_Create.json", "AccessTokens_Create")
create 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.")
@example("./AccessTokens_Get.json", "AccessTokens_Get")
get 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.")
@example("./AccessTokens_Delete.json", "AccessTokens_Delete")
delete is Operations.ResourceDelete<AccessToken>;

@doc("Lists access-tokens for the given account id. Authorization required is Bearer JWT Access token provided by EntraID.")
@example("./AccessTokens_List.json", "AccessTokens_List")
list 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.")
@example("./AccessTokens_Validate.json", "AccessTokens_Validate")
@actionSeparator("/")
validate is Operations.ResourceCollectionAction<AccessToken, {}, {}>;
}

alias GetBrowsersParams = {
@query
@doc("The run id provided by client for corresponding remote test run.")
runId?: string;

#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>;
@query
@doc("The os provided by client for remote test runs.")
os?: OS = OS.Linux;

@doc("Get an access-token for given access-token id in guid format.")
getAccessToken is Operations.ResourceRead<AccessToken>;
@path
@doc("The account id.")
accountId: string;
Comment on lines +248 to +250

Choose a reason for hiding this comment

The 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 accountId) at the top.

};

@doc("Revoke an access-token with given access-token id in guid format.")
deleteAccessToken is Operations.ResourceDelete<AccessToken>;
alias GetBrowsersResponse = {
@statusCode
_: 302;

@doc("List access-tokens for a given accountId.")
listAccessTokens is Operations.ResourceList<AccessToken>;
}
@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 accountId. Authorization required is Bearer JWT Access token provided by EntraID.")
@example("./Accounts_Get.json", "Accounts_Get")
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 accountId and redirects the client for running MPT tests. Authorization required is Bearer JWT Access token provided by EntraID or MPT Service.")
@example("./Accounts_GetBrowsers.json", "Accounts_GetBrowsers")
@route("/accounts/{accountId}/browsers")
getBrowsers is RpcOperation<
GetBrowsersParams,
GetBrowsersResponse,
ServiceTraits
>;
}
Loading
Loading