Skip to content

Commit 7bf9140

Browse files
author
SDKAuto
committed
CodeGen from PR 14250 in Azure/azure-rest-api-specs
Merge 5584769097e739f481a98377ec76f2043aa1aa95 into e401e457b5e95941f241f5c71bc56d42d431a4e0
1 parent bb436f8 commit 7bf9140

35 files changed

+10814
-0
lines changed
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) 2021 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: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
## Azure DataProtectionClient SDK for JavaScript
2+
3+
This package contains an isomorphic SDK for DataProtectionClient.
4+
5+
### Currently supported environments
6+
7+
- Node.js version 6.x.x or higher
8+
- Browser JavaScript
9+
10+
### How to Install
11+
12+
```bash
13+
npm install @azure/arm-dataprotectionplatform
14+
```
15+
16+
### How to use
17+
18+
#### nodejs - client creation and getResourcesInSubscription backupVaults as an example written in TypeScript.
19+
20+
##### Install @azure/ms-rest-nodeauth
21+
22+
- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
23+
```bash
24+
npm install @azure/ms-rest-nodeauth@"^3.0.0"
25+
```
26+
27+
##### Sample code
28+
29+
While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package
30+
```typescript
31+
const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
32+
const { DataProtectionClient } = require("@azure/arm-dataprotectionplatform");
33+
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
34+
35+
msRestNodeAuth.interactiveLogin().then((creds) => {
36+
const client = new DataProtectionClient(creds, subscriptionId);
37+
client.backupVaults.getResourcesInSubscription().then((result) => {
38+
console.log("The result is:");
39+
console.log(result);
40+
});
41+
}).catch((err) => {
42+
console.error(err);
43+
});
44+
```
45+
46+
#### browser - Authentication, client creation and getResourcesInSubscription backupVaults as an example written in JavaScript.
47+
48+
##### Install @azure/ms-rest-browserauth
49+
50+
```bash
51+
npm install @azure/ms-rest-browserauth
52+
```
53+
54+
##### Sample code
55+
56+
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
57+
58+
- index.html
59+
```html
60+
<!DOCTYPE html>
61+
<html lang="en">
62+
<head>
63+
<title>@azure/arm-dataprotectionplatform sample</title>
64+
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
65+
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
66+
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
67+
<script src="node_modules/@azure/arm-dataprotectionplatform/dist/arm-dataprotectionplatform.js"></script>
68+
<script type="text/javascript">
69+
const subscriptionId = "<Subscription_Id>";
70+
const authManager = new msAuth.AuthManager({
71+
clientId: "<client id for your Azure AD app>",
72+
tenant: "<optional tenant for your organization>"
73+
});
74+
authManager.finalizeLogin().then((res) => {
75+
if (!res.isLoggedIn) {
76+
// may cause redirects
77+
authManager.login();
78+
}
79+
const client = new Azure.ArmDataprotectionplatform.DataProtectionClient(res.creds, subscriptionId);
80+
client.backupVaults.getResourcesInSubscription().then((result) => {
81+
console.log("The result is:");
82+
console.log(result);
83+
}).catch((err) => {
84+
console.log("An error occurred:");
85+
console.error(err);
86+
});
87+
});
88+
</script>
89+
</head>
90+
<body></body>
91+
</html>
92+
```
93+
94+
## Related projects
95+
96+
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
97+
98+
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/dataprotectionplatform/arm-dataprotectionplatform/README.png)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"name": "@azure/arm-dataprotectionplatform",
3+
"author": "Microsoft Corporation",
4+
"description": "DataProtectionClient Library with typescript type definitions for node.js and browser.",
5+
"version": "1.0.0",
6+
"dependencies": {
7+
"@azure/ms-rest-azure-js": "^2.0.1",
8+
"@azure/ms-rest-js": "^2.0.4",
9+
"tslib": "^1.10.0"
10+
},
11+
"keywords": [
12+
"node",
13+
"azure",
14+
"typescript",
15+
"browser",
16+
"isomorphic"
17+
],
18+
"license": "MIT",
19+
"main": "./dist/arm-dataprotectionplatform.js",
20+
"module": "./esm/dataProtectionClient.js",
21+
"types": "./esm/dataProtectionClient.d.ts",
22+
"devDependencies": {
23+
"typescript": "^3.5.3",
24+
"rollup": "^1.18.0",
25+
"rollup-plugin-node-resolve": "^5.2.0",
26+
"rollup-plugin-sourcemaps": "^0.4.2",
27+
"uglify-js": "^3.6.0"
28+
},
29+
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/dataprotectionplatform/arm-dataprotectionplatform",
30+
"repository": {
31+
"type": "git",
32+
"url": "https://github.com/Azure/azure-sdk-for-js.git"
33+
},
34+
"bugs": {
35+
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
36+
},
37+
"files": [
38+
"dist/**/*.js",
39+
"dist/**/*.js.map",
40+
"dist/**/*.d.ts",
41+
"dist/**/*.d.ts.map",
42+
"esm/**/*.js",
43+
"esm/**/*.js.map",
44+
"esm/**/*.d.ts",
45+
"esm/**/*.d.ts.map",
46+
"src/**/*.ts",
47+
"README.md",
48+
"rollup.config.js",
49+
"tsconfig.json"
50+
],
51+
"scripts": {
52+
"build": "tsc && rollup -c rollup.config.js && npm run minify",
53+
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-dataprotectionplatform.js.map'\" -o ./dist/arm-dataprotectionplatform.min.js ./dist/arm-dataprotectionplatform.js",
54+
"prepack": "npm install && npm run build"
55+
},
56+
"sideEffects": false,
57+
"autoPublish": true
58+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import rollup from "rollup";
2+
import nodeResolve from "rollup-plugin-node-resolve";
3+
import sourcemaps from "rollup-plugin-sourcemaps";
4+
5+
/**
6+
* @type {rollup.RollupFileOptions}
7+
*/
8+
const config = {
9+
input: "./esm/dataProtectionClient.js",
10+
external: [
11+
"@azure/ms-rest-js",
12+
"@azure/ms-rest-azure-js"
13+
],
14+
output: {
15+
file: "./dist/arm-dataprotectionplatform.js",
16+
format: "umd",
17+
name: "Azure.ArmDataprotectionplatform",
18+
sourcemap: true,
19+
globals: {
20+
"@azure/ms-rest-js": "msRest",
21+
"@azure/ms-rest-azure-js": "msRestAzure"
22+
},
23+
banner: `/*
24+
* Copyright (c) Microsoft Corporation.
25+
* Licensed under the MIT License.
26+
*
27+
* Code generated by Microsoft (R) AutoRest Code Generator.
28+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
29+
*/`
30+
},
31+
plugins: [
32+
nodeResolve({ mainFields: ['module', 'main'] }),
33+
sourcemaps()
34+
]
35+
};
36+
37+
export default config;

0 commit comments

Comments
 (0)