Skip to content

Commit bffedf4

Browse files
qiaozhakazrael2119MaryGao
authored
Release rlc for arm compute (Azure#23292)
* release-rlc-for-arm-compute * add samples generated from swagger * add test for azure-rest-arm-compute * refresh with latest stable version * update test * fix test * update tests * work around ci failure * work around ci failure * Update sdk/compute/arm-compute-rest/package.json Co-authored-by: Mary Gao <yanmeigao1210@gmail.com> * Update ignore-links.txt * Update test customized test policy * update changes * fix ci failure * Update customizedTestPolicy.ts * Update README.md Co-authored-by: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Co-authored-by: Mary Gao <yanmeigao1210@gmail.com>
1 parent 9566fa6 commit bffedf4

File tree

896 files changed

+129200
-97
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

896 files changed

+129200
-97
lines changed

common/config/rush/pnpm-lock.yaml

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

eng/ignore-links.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ https://docs.microsoft.com/javascript/api/@azure/arm-nginx?view=azure-node-previ
2424
https://docs.microsoft.com/javascript/api/@azure/arm-agrifood?view=azure-node-preview
2525
https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/personalizer/ai-personalizer-rest/samples
2626
https://docs.microsoft.com/javascript/api/@azure/arm-chaos?view=azure-node-preview
27+
https://docs.microsoft.com/javascript/api/@azure-rest/arm-compute?view=azure-node-preview

rush.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,11 @@
906906
"projectFolder": "sdk/compute/arm-compute",
907907
"versionPolicyName": "management"
908908
},
909+
{
910+
"packageName": "@azure-rest/arm-compute",
911+
"projectFolder": "sdk/compute/arm-compute-rest",
912+
"versionPolicyName": "client"
913+
},
909914
{
910915
"packageName": "@azure/arm-storage",
911916
"projectFolder": "sdk/storage/arm-storage",
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 1.0.0-beta.1 (2021-09-22)
2+
3+
- First release of package, see README.md for details.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2022 Microsoft
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Azure ComputeManagement REST client library for JavaScript
2+
3+
Compute Management Rest Client
4+
5+
**If you are not familiar with our REST client, please spend 5 minutes to take a look at our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library, the REST client provides a light-weighted & developer friendly way to call azure rest api**
6+
7+
Key links:
8+
9+
- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/compute/arm-compute-rest)
10+
- [Package (NPM)](https://www.npmjs.com/package/@azure-rest/arm-compute)
11+
- [API reference documentation](https://docs.microsoft.com/javascript/api/@azure-rest/arm-compute?view=azure-node-preview)
12+
- [Samples](https://github.com/Azure-Samples/azure-samples-js-management)
13+
14+
## Getting started
15+
16+
### Currently supported environments
17+
18+
- Node.js version 14.x.x or higher
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/arm-compute` package
25+
26+
Install the Azure ComputeManagement client REST client library for JavaScript with `npm`:
27+
28+
```bash
29+
npm install @azure-rest/arm-compute
30+
```
31+
32+
### Create and authenticate a `ComputeManagementClient`
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+
Use the returned token credential to authenticate the client:
48+
49+
```typescript
50+
import ComputeManagementClient from "@azure-rest/arm-compute";
51+
import { DefaultAzureCredential } from "@azure/identity";
52+
const credential = new DefaultAzureCredential();
53+
const client = ComputeManagementClient(credential);
54+
```
55+
56+
## Examples
57+
58+
The following section shows you how to initialize and authenticate your client, then list all of your Virtual Machines within a resource group.
59+
### List all virtual machines within a resource group
60+
61+
```typescript
62+
import createComputeManagementClient, {
63+
VirtualMachinesListParameters,
64+
paginate,
65+
} from "@azure-rest/arm-compute";
66+
import { DefaultAzureCredential } from "@azure/identity";
67+
async function virtualMachinesListMaximumSetGen() {
68+
const credential = new DefaultAzureCredential();
69+
const client = createComputeManagementClient(credential);
70+
const subscriptionId = "";
71+
const resourceGroupName = "rgcompute";
72+
const options: VirtualMachinesListParameters = {
73+
queryParameters: {
74+
$filter: "aaaaaaaaaaaaaaaaaaaaaaa",
75+
"api-version": "2022-08-01",
76+
},
77+
};
78+
const initialResponse = await client
79+
.path(
80+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines",
81+
subscriptionId,
82+
resourceGroupName
83+
)
84+
.get(options);
85+
const pageData = paginate(client, initialResponse);
86+
const result = [];
87+
for await (const item of pageData) {
88+
result.push(item);
89+
}
90+
console.log(result);
91+
}
92+
93+
virtualMachinesListMaximumSetGen().catch(console.error);
94+
```
95+
96+
## Troubleshooting
97+
98+
### Logging
99+
100+
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`:
101+
102+
```javascript
103+
import { setLogLevel } from "@azure/logger";
104+
105+
setLogLevel("info");
106+
```
107+
108+
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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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": { "enabled": true },
5+
"apiReport": { "enabled": true, "reportFolder": "./review" },
6+
"dtsRollup": {
7+
"enabled": true,
8+
"untrimmedFilePath": "",
9+
"publicTrimmedFilePath": "./types/arm-compute.d.ts"
10+
},
11+
"messages": {
12+
"tsdocMessageReporting": { "default": { "logLevel": "none" } },
13+
"extractorMessageReporting": {
14+
"ae-missing-release-tag": { "logLevel": "none" },
15+
"ae-unresolved-link": { "logLevel": "none" }
16+
}
17+
}
18+
}
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+
"RECORDINGS_RELATIVE_PATH",
58+
"TEST_MODE",
59+
"ENDPOINT",
60+
"AZURE_CLIENT_SECRET",
61+
"AZURE_CLIENT_ID",
62+
"AZURE_TENANT_ID",
63+
"SUBSCRIPTION_ID",
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)