Skip to content

Commit 616b122

Browse files
author
SDKAuto
committed
CodeGen from PR 13540 in Azure/azure-rest-api-specs
Merge 53cabcef924ebaa71dff9c43b3696c2b1ce56668 into e1b647a015a65d9f6b3b4b7ebe04eb7e04469647
1 parent 9e8890a commit 616b122

21 files changed

+5442
-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.

sdk/datadog/arm-datadog/README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
## Azure MicrosoftDatadogClient SDK for JavaScript
2+
3+
This package contains an isomorphic SDK for MicrosoftDatadogClient.
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-datadog
14+
```
15+
16+
### How to use
17+
18+
#### nodejs - client creation and list marketplaceAgreements 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 { MicrosoftDatadogClient } = require("@azure/arm-datadog");
33+
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
34+
35+
msRestNodeAuth.interactiveLogin().then((creds) => {
36+
const client = new MicrosoftDatadogClient(creds, subscriptionId);
37+
client.marketplaceAgreements.list().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 list marketplaceAgreements 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-datadog 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-datadog/dist/arm-datadog.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.ArmDatadog.MicrosoftDatadogClient(res.creds, subscriptionId);
80+
client.marketplaceAgreements.list().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/datadog/arm-datadog/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-datadog",
3+
"author": "Microsoft Corporation",
4+
"description": "MicrosoftDatadogClient 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-datadog.js",
20+
"module": "./esm/microsoftDatadogClient.js",
21+
"types": "./esm/microsoftDatadogClient.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/datadog/arm-datadog",
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-datadog.js.map'\" -o ./dist/arm-datadog.min.js ./dist/arm-datadog.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/microsoftDatadogClient.js",
10+
external: [
11+
"@azure/ms-rest-js",
12+
"@azure/ms-rest-azure-js"
13+
],
14+
output: {
15+
file: "./dist/arm-datadog.js",
16+
format: "umd",
17+
name: "Azure.ArmDatadog",
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;
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation.
3+
* Licensed under the MIT License.
4+
*
5+
* Code generated by Microsoft (R) AutoRest Code Generator.
6+
* Changes may cause incorrect behavior and will be lost if the code is
7+
* regenerated.
8+
*/
9+
10+
import * as msRest from "@azure/ms-rest-js";
11+
import * as Models from "./models";
12+
import * as Mappers from "./models/mappers";
13+
import * as operations from "./operations";
14+
import { MicrosoftDatadogClientContext } from "./microsoftDatadogClientContext";
15+
16+
17+
class MicrosoftDatadogClient extends MicrosoftDatadogClientContext {
18+
// Operation groups
19+
marketplaceAgreements: operations.MarketplaceAgreements;
20+
monitors: operations.Monitors;
21+
operations: operations.Operations;
22+
tagRules: operations.TagRules;
23+
singleSignOnConfigurations: operations.SingleSignOnConfigurations;
24+
25+
/**
26+
* Initializes a new instance of the MicrosoftDatadogClient class.
27+
* @param credentials Credentials needed for the client to connect to Azure.
28+
* @param subscriptionId The ID of the target subscription.
29+
* @param [options] The parameter options
30+
*/
31+
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.MicrosoftDatadogClientOptions) {
32+
super(credentials, subscriptionId, options);
33+
this.marketplaceAgreements = new operations.MarketplaceAgreements(this);
34+
this.monitors = new operations.Monitors(this);
35+
this.operations = new operations.Operations(this);
36+
this.tagRules = new operations.TagRules(this);
37+
this.singleSignOnConfigurations = new operations.SingleSignOnConfigurations(this);
38+
}
39+
}
40+
41+
// Operation Specifications
42+
43+
export {
44+
MicrosoftDatadogClient,
45+
MicrosoftDatadogClientContext,
46+
Models as MicrosoftDatadogModels,
47+
Mappers as MicrosoftDatadogMappers
48+
};
49+
export * from "./operations";
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation.
3+
* Licensed under the MIT License.
4+
*
5+
* Code generated by Microsoft (R) AutoRest Code Generator.
6+
* Changes may cause incorrect behavior and will be lost if the code is
7+
* regenerated.
8+
*/
9+
10+
import * as Models from "./models";
11+
import * as msRest from "@azure/ms-rest-js";
12+
import * as msRestAzure from "@azure/ms-rest-azure-js";
13+
14+
const packageName = "@azure/arm-datadog";
15+
const packageVersion = "1.0.0";
16+
17+
export class MicrosoftDatadogClientContext extends msRestAzure.AzureServiceClient {
18+
credentials: msRest.ServiceClientCredentials;
19+
apiVersion?: string;
20+
subscriptionId: string;
21+
22+
/**
23+
* Initializes a new instance of the MicrosoftDatadogClient class.
24+
* @param credentials Credentials needed for the client to connect to Azure.
25+
* @param subscriptionId The ID of the target subscription.
26+
* @param [options] The parameter options
27+
*/
28+
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.MicrosoftDatadogClientOptions) {
29+
if (credentials == undefined) {
30+
throw new Error('\'credentials\' cannot be null.');
31+
}
32+
if (subscriptionId == undefined) {
33+
throw new Error('\'subscriptionId\' cannot be null.');
34+
}
35+
36+
if (!options) {
37+
options = {};
38+
}
39+
if(!options.userAgent) {
40+
const defaultUserAgent = msRestAzure.getDefaultUserAgentValue();
41+
options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;
42+
}
43+
44+
super(credentials, options);
45+
46+
this.apiVersion = '2021-03-01';
47+
this.acceptLanguage = 'en-US';
48+
this.longRunningOperationRetryTimeout = 30;
49+
this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com";
50+
this.requestContentType = "application/json; charset=utf-8";
51+
this.credentials = credentials;
52+
this.subscriptionId = subscriptionId;
53+
54+
if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) {
55+
this.acceptLanguage = options.acceptLanguage;
56+
}
57+
if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) {
58+
this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout;
59+
}
60+
}
61+
}

0 commit comments

Comments
 (0)