Skip to content

Commit

Permalink
Rectified a typo (#31855)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjmadhu authored Jan 7, 2025
1 parent 49456eb commit 74157f1
Show file tree
Hide file tree
Showing 20 changed files with 1,243 additions and 81 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"title": "AccessTokens_CreateAccessToken",
"operationId": "AccessTokens_CreateAccessToken",
"title": "AccessTokens_CreateOrReplace",
"operationId": "AccessTokens_CreateOrReplace",
"parameters": {
"api-version": "2023-10-01-preview",
"accountId": "sampleAccountId",
"api-version": "2024-12-01",
"accountId": "sampleAccountId_00000000-0000-0000-0000-000000000000",
"accessTokenId": "00000000-0000-0000-0000-000000000000",
"resource": {
"id": "00000000-0000-0000-0000-000000000000",
Expand Down
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_00000000-0000-0000-0000-000000000000",
"accessTokenId": "00000000-0000-0000-0000-000000000000"
},
"responses": {
"204": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"title": "AccessTokens_GetAccessToken",
"operationId": "AccessTokens_GetAccessToken",
"title": "AccessTokens_Get",
"operationId": "AccessTokens_Get",
"parameters": {
"api-version": "2023-10-01-preview",
"accountId": "sampleAccountId",
"api-version": "2024-12-01",
"accountId": "sampleAccountId_00000000-0000-0000-0000-000000000000",
"accessTokenId": "00000000-0000-0000-0000-000000000000"
},
"responses": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"title": "AccessTokens_ListAccessTokens",
"operationId": "AccessTokens_ListAccessTokens",
"title": "AccessTokens_List",
"operationId": "AccessTokens_List",
"parameters": {
"api-version": "2023-10-01-preview",
"accountId": "sampleAccountId"
"api-version": "2024-12-01",
"accountId": "sampleAccountId_00000000-0000-0000-0000-000000000000"
},
"responses": {
"200": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"title": "Accounts_GetAccount",
"operationId": "Accounts_GetAccount",
"title": "Accounts_Get",
"operationId": "Accounts_Get",
"parameters": {
"api-version": "2023-10-01-preview",
"accountId": "sampleAccountId"
"api-version": "2024-12-01",
"accountId": "sampleAccountId_00000000-0000-0000-0000-000000000000"
},
"responses": {
"200": {
"body": {
"id": "sampleAccountId",
"id": "sampleAccountId_00000000-0000-0000-0000-000000000000",
"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.AzurePlaywrightService/accounts/myPlaywrightAccount",
"name": "myPlaywrightAccount",
"state": "Active",
Expand All @@ -18,7 +18,8 @@
"location": "westus",
"regionalAffinity": "Enabled",
"scalableExecution": "Enabled",
"reporting": "Disabled"
"reporting": "Disabled",
"localAuth": "Enabled"
}
}
}
Expand Down
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_00000000-0000-0000-0000-000000000000",
"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 @@ -5,26 +5,41 @@ 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,
description: "We can use OAuth2 Implicit flow to get the auth token for calling the APIs.",
authorizationUrl: "https://login.microsoftonline.com/common/oauth2/authorize",
scopes: ["https://preview.playwright-int.io/.default"],
scopes: ["https://playwright.microsoft.com/.default"],
}
]>,
OAuth2Auth<[
{
type: OAuth2FlowType.authorizationCode,
description: "We can use OAuth2 Authorization Code flow to get the auth token for calling the APIs.",
authorizationUrl: "https://login.microsoftonline.com/common/oauth2/authorize",
tokenUrl: "https://login.microsoftonline.com/common/v2.0/oauth2/token",
scopes: ["https://playwright.microsoft.com/.default"],
}
]>
]
Expand All @@ -37,22 +52,24 @@ 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.")
@maxLength(64)
@pattern("[A-Za-z0-9]+(_[A-Za-z0-9]+)*(-[A-Za-z0-9]+)+")
@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 +81,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 +107,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.")
Expand All @@ -104,7 +125,7 @@ union AccountState {
"Inactive",
}

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

Expand All @@ -130,6 +151,8 @@ union SubscriptionState {
model AccessToken {
@key("accessTokenId")
@doc("The access-token id.")
@maxLength(64)
@pattern("[A-Za-z0-9]+(-[A-Za-z0-9]+)+")
@visibility("read")
id: uuid;

Expand All @@ -146,26 +169,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 +202,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",
}

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

alias ServiceTraits = NoRepeatableRequests &
Expand All @@ -189,23 +223,54 @@ alias Operations = Azure.Core.ResourceOperations<ServiceTraits>;

interface AccessTokens {
// AccessToken Operations
@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("List access-tokens for a given accountId.")
listAccessTokens is Operations.ResourceList<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>;
}

alias GetBrowsersParams = {
@path
@doc("The account id.")
accountId: string;

@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;
};

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 Playwright tests. Authorization required is Bearer JWT Access token provided by EntraID or Microsoft Playwright Testing 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
Loading

0 comments on commit 74157f1

Please sign in to comment.