Skip to content

Commit 75e74aa

Browse files
author
SDKAuto
committed
CodeGen from PR 3624 in openapi-env-test/azure-rest-api-specs
Merge 9fd5aa6e45d1a47bc6a6e7fd9b04fc0551279933 into 8f88980809993b20c39f68b744345d2de504b863
1 parent df2b629 commit 75e74aa

23 files changed

+1537
-23
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 350 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rush.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* This is the main configuration file for Rush.
33
* For full documentation, please see https://rushjs.io
4-
*/ {
4+
*/{
55
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json",
66
/**
77
* (Required) This specifies the version of the Rush engine to be used in this repo.
@@ -1928,6 +1928,11 @@
19281928
"packageName": "@azure/arm-billingbenefits",
19291929
"projectFolder": "sdk/billingbenefits/arm-billingbenefits",
19301930
"versionPolicyName": "management"
1931+
},
1932+
{
1933+
"packageName": "@azure-rest/contosowidgetmanager-rest",
1934+
"projectFolder": "sdk/contosowidgetmanager/contosowidgetmanager-rest",
1935+
"versionPolicyName": "client"
19311936
}
19321937
]
1933-
}
1938+
}

sdk/contosowidgetmanager/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
2+
3+
trigger:
4+
branches:
5+
include:
6+
- main
7+
- feature/*
8+
- release/*
9+
- hotfix/*
10+
exclude:
11+
- feature/v4
12+
paths:
13+
include:
14+
- sdk/contosowidgetmanager/
15+
pr:
16+
branches:
17+
include:
18+
- main
19+
- feature/*
20+
- release/*
21+
- hotfix/*
22+
exclude:
23+
- feature/v4
24+
paths:
25+
include:
26+
- sdk/contosowidgetmanager/
27+
extends:
28+
template: /eng/pipelines/templates/stages/archetype-sdk-client.yml
29+
parameters:
30+
ServiceDirectory: contosowidgetmanager
31+
Artifacts:
32+
- name: azure-rest-contosowidgetmanager-rest
33+
safeName: azurerestcontosowidgetmanagerrest
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"plugins": ["@azure/azure-sdk"],
3+
"extends": ["plugin:@azure/azure-sdk/azure-sdk-base"],
4+
"rules": {
5+
"@azure/azure-sdk/ts-modules-only-named": "warn",
6+
"@azure/azure-sdk/ts-apiextractor-json-types": "warn",
7+
"@azure/azure-sdk/ts-package-json-types": "warn",
8+
"@azure/azure-sdk/ts-package-json-engine-is-present": "warn",
9+
"tsdoc/syntax": "warn"
10+
}
11+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Azure ContosoWidgetManager REST client library for JavaScript
2+
3+
Contoso WidgetManager Service
4+
5+
**Please rely heavily on our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library**
6+
7+
Key links:
8+
9+
- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/contosowidgetmanager/contosowidgetmanager-rest)
10+
- [Package (NPM)](https://www.npmjs.com/package/@azure-rest/contosowidgetmanager-rest)
11+
- [API reference documentation](https://docs.microsoft.com/javascript/api/@azure-rest/contosowidgetmanager-rest?view=azure-node-preview)
12+
- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/contosowidgetmanager/contosowidgetmanager-rest/samples)
13+
14+
## Getting started
15+
16+
### Currently supported environments
17+
18+
- LTS versions of Node.js
19+
20+
### Prerequisites
21+
22+
- You must have an [Azure subscription](https://azure.microsoft.com/free/) to use this package.
23+
24+
### Install the `@azure-rest/contosowidgetmanager-rest` package
25+
26+
Install the Azure ContosoWidgetManager REST client REST client library for JavaScript with `npm`:
27+
28+
```bash
29+
npm install @azure-rest/contosowidgetmanager-rest
30+
```
31+
32+
### Create and authenticate a `ContosoWidgetManagerClient`
33+
34+
To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token),
35+
provide an instance of the desired credential type obtained from the
36+
[@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library.
37+
38+
To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity)
39+
40+
After setup, you can choose which type of [credential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) from `@azure/identity` to use.
41+
As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential)
42+
can be used to authenticate the client.
43+
44+
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
45+
AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
46+
47+
## Troubleshooting
48+
49+
### Logging
50+
51+
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
52+
53+
```javascript
54+
const { setLogLevel } = require("@azure/logger");
55+
56+
setLogLevel("info");
57+
```
58+
59+
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
"mainEntryPointFilePath": "./types/src/index.d.ts",
4+
"docModel": {
5+
"enabled": true
6+
},
7+
"apiReport": {
8+
"enabled": true,
9+
"reportFolder": "./review"
10+
},
11+
"dtsRollup": {
12+
"enabled": true,
13+
"untrimmedFilePath": "",
14+
"publicTrimmedFilePath": "./types/contosowidgetmanager-rest.d.ts"
15+
},
16+
"messages": {
17+
"tsdocMessageReporting": {
18+
"default": {
19+
"logLevel": "none"
20+
}
21+
},
22+
"extractorMessageReporting": {
23+
"ae-missing-release-tag": {
24+
"logLevel": "none"
25+
},
26+
"ae-unresolved-link": {
27+
"logLevel": "none"
28+
}
29+
}
30+
}
31+
}
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT license.
3+
4+
// https://github.com/karma-runner/karma-chrome-launcher
5+
process.env.CHROME_BIN = require("puppeteer").executablePath();
6+
require("dotenv").config();
7+
const { relativeRecordingsPath } = require("@azure-tools/test-recorder");
8+
process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath();
9+
10+
module.exports = function (config) {
11+
config.set({
12+
// base path that will be used to resolve all patterns (eg. files, exclude)
13+
basePath: "./",
14+
15+
// frameworks to use
16+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
17+
frameworks: ["source-map-support", "mocha"],
18+
19+
plugins: [
20+
"karma-mocha",
21+
"karma-mocha-reporter",
22+
"karma-chrome-launcher",
23+
"karma-edge-launcher",
24+
"karma-firefox-launcher",
25+
"karma-ie-launcher",
26+
"karma-env-preprocessor",
27+
"karma-coverage",
28+
"karma-sourcemap-loader",
29+
"karma-junit-reporter",
30+
"karma-source-map-support",
31+
],
32+
33+
// list of files / patterns to load in the browser
34+
files: [
35+
"dist-test/index.browser.js",
36+
{
37+
pattern: "dist-test/index.browser.js.map",
38+
type: "html",
39+
included: false,
40+
served: true,
41+
},
42+
],
43+
44+
// list of files / patterns to exclude
45+
exclude: [],
46+
47+
// preprocess matching files before serving them to the browser
48+
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
49+
preprocessors: {
50+
"**/*.js": ["sourcemap", "env"],
51+
// IMPORTANT: COMMENT following line if you want to debug in your browsers!!
52+
// Preprocess source file to calculate code coverage, however this will make source file unreadable
53+
// "dist-test/index.js": ["coverage"]
54+
},
55+
56+
envPreprocessor: [
57+
"TEST_MODE",
58+
"ENDPOINT",
59+
"AZURE_CLIENT_SECRET",
60+
"AZURE_CLIENT_ID",
61+
"AZURE_TENANT_ID",
62+
"SUBSCRIPTION_ID",
63+
"RECORDINGS_RELATIVE_PATH",
64+
],
65+
66+
// test results reporter to use
67+
// possible values: 'dots', 'progress'
68+
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
69+
reporters: ["mocha", "coverage", "junit"],
70+
71+
coverageReporter: {
72+
// specify a common output directory
73+
dir: "coverage-browser/",
74+
reporters: [
75+
{ type: "json", subdir: ".", file: "coverage.json" },
76+
{ type: "lcovonly", subdir: ".", file: "lcov.info" },
77+
{ type: "html", subdir: "html" },
78+
{ type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" },
79+
],
80+
},
81+
82+
junitReporter: {
83+
outputDir: "", // results will be saved as $outputDir/$browserName.xml
84+
outputFile: "test-results.browser.xml", // if included, results will be saved as $outputDir/$browserName/$outputFile
85+
suite: "", // suite will become the package name attribute in xml testsuite element
86+
useBrowserName: false, // add browser name to report and classes names
87+
nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
88+
classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
89+
properties: {}, // key value pair of properties to add to the <properties> section of the report
90+
},
91+
92+
// web server port
93+
port: 9876,
94+
95+
// enable / disable colors in the output (reporters and logs)
96+
colors: true,
97+
98+
// level of logging
99+
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
100+
logLevel: config.LOG_INFO,
101+
102+
// enable / disable watching file and executing tests whenever any file changes
103+
autoWatch: false,
104+
105+
// --no-sandbox allows our tests to run in Linux without having to change the system.
106+
// --disable-web-security allows us to authenticate from the browser without having to write tests using interactive auth, which would be far more complex.
107+
browsers: ["ChromeHeadlessNoSandbox"],
108+
customLaunchers: {
109+
ChromeHeadlessNoSandbox: {
110+
base: "ChromeHeadless",
111+
flags: ["--no-sandbox", "--disable-web-security"],
112+
},
113+
},
114+
115+
// Continuous Integration mode
116+
// if true, Karma captures browsers, runs the tests and exits
117+
singleRun: false,
118+
119+
// Concurrency level
120+
// how many browser should be started simultaneous
121+
concurrency: 1,
122+
123+
browserNoActivityTimeout: 60000000,
124+
browserDisconnectTimeout: 10000,
125+
browserDisconnectTolerance: 3,
126+
127+
client: {
128+
mocha: {
129+
// change Karma's debug.html to the mocha web reporter
130+
reporter: "html",
131+
timeout: "600000",
132+
},
133+
},
134+
});
135+
};

0 commit comments

Comments
 (0)