Skip to content

Commit c4120bd

Browse files
authored
azure-arm_attestation (Azure#12437)
1 parent 21969bb commit c4120bd

15 files changed

+2076
-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) 2020 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: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
## Azure AttestationManagementClient SDK for JavaScript
2+
3+
This package contains an isomorphic SDK for AttestationManagementClient.
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-attestation
14+
```
15+
16+
### How to use
17+
18+
#### nodejs - Authentication, client creation and list operations 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+
```typescript
30+
import * as msRest from "@azure/ms-rest-js";
31+
import * as msRestAzure from "@azure/ms-rest-azure-js";
32+
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
33+
import { AttestationManagementClient, AttestationManagementModels, AttestationManagementMappers } from "@azure/arm-attestation";
34+
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
35+
36+
msRestNodeAuth.interactiveLogin().then((creds) => {
37+
const client = new AttestationManagementClient(creds, subscriptionId);
38+
client.operations.list().then((result) => {
39+
console.log("The result is:");
40+
console.log(result);
41+
});
42+
}).catch((err) => {
43+
console.error(err);
44+
});
45+
```
46+
47+
#### browser - Authentication, client creation and list operations as an example written in JavaScript.
48+
49+
##### Install @azure/ms-rest-browserauth
50+
51+
```bash
52+
npm install @azure/ms-rest-browserauth
53+
```
54+
55+
##### Sample code
56+
57+
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
58+
59+
- index.html
60+
```html
61+
<!DOCTYPE html>
62+
<html lang="en">
63+
<head>
64+
<title>@azure/arm-attestation sample</title>
65+
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
66+
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
67+
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
68+
<script src="node_modules/@azure/arm-attestation/dist/arm-attestation.js"></script>
69+
<script type="text/javascript">
70+
const subscriptionId = "<Subscription_Id>";
71+
const authManager = new msAuth.AuthManager({
72+
clientId: "<client id for your Azure AD app>",
73+
tenant: "<optional tenant for your organization>"
74+
});
75+
authManager.finalizeLogin().then((res) => {
76+
if (!res.isLoggedIn) {
77+
// may cause redirects
78+
authManager.login();
79+
}
80+
const client = new Azure.ArmAttestation.AttestationManagementClient(res.creds, subscriptionId);
81+
client.operations.list().then((result) => {
82+
console.log("The result is:");
83+
console.log(result);
84+
}).catch((err) => {
85+
console.log("An error occurred:");
86+
console.error(err);
87+
});
88+
});
89+
</script>
90+
</head>
91+
<body></body>
92+
</html>
93+
```
94+
95+
## Related projects
96+
97+
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
98+
99+
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/attestation/arm-attestation/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-attestation",
3+
"author": "Microsoft Corporation",
4+
"description": "AttestationManagementClient 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-attestation.js",
20+
"module": "./esm/attestationManagementClient.js",
21+
"types": "./esm/attestationManagementClient.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/attestation/arm-attestation",
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-attestation.js.map'\" -o ./dist/arm-attestation.min.js ./dist/arm-attestation.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/attestationManagementClient.js",
10+
external: [
11+
"@azure/ms-rest-js",
12+
"@azure/ms-rest-azure-js"
13+
],
14+
output: {
15+
file: "./dist/arm-attestation.js",
16+
format: "umd",
17+
name: "Azure.ArmAttestation",
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. All rights reserved.
25+
* Licensed under the MIT License. See License.txt in the project root for license information.
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: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for
4+
* license information.
5+
*
6+
* Code generated by Microsoft (R) AutoRest Code Generator.
7+
* Changes may cause incorrect behavior and will be lost if the code is
8+
* regenerated.
9+
*/
10+
11+
import * as msRest from "@azure/ms-rest-js";
12+
import * as Models from "./models";
13+
import * as Mappers from "./models/mappers";
14+
import * as operations from "./operations";
15+
import { AttestationManagementClientContext } from "./attestationManagementClientContext";
16+
17+
18+
class AttestationManagementClient extends AttestationManagementClientContext {
19+
// Operation groups
20+
operations: operations.Operations;
21+
attestationProviders: operations.AttestationProviders;
22+
23+
/**
24+
* Initializes a new instance of the AttestationManagementClient class.
25+
* @param credentials Credentials needed for the client to connect to Azure.
26+
* @param subscriptionId The ID of the target subscription.
27+
* @param [options] The parameter options
28+
*/
29+
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.AttestationManagementClientOptions) {
30+
super(credentials, subscriptionId, options);
31+
this.operations = new operations.Operations(this);
32+
this.attestationProviders = new operations.AttestationProviders(this);
33+
}
34+
}
35+
36+
// Operation Specifications
37+
38+
export {
39+
AttestationManagementClient,
40+
AttestationManagementClientContext,
41+
Models as AttestationManagementModels,
42+
Mappers as AttestationManagementMappers
43+
};
44+
export * from "./operations";
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for
4+
* license information.
5+
*
6+
* Code generated by Microsoft (R) AutoRest Code Generator.
7+
* Changes may cause incorrect behavior and will be lost if the code is
8+
* regenerated.
9+
*/
10+
11+
import * as Models from "./models";
12+
import * as msRest from "@azure/ms-rest-js";
13+
import * as msRestAzure from "@azure/ms-rest-azure-js";
14+
15+
const packageName = "@azure/arm-attestation";
16+
const packageVersion = "1.0.0";
17+
18+
export class AttestationManagementClientContext extends msRestAzure.AzureServiceClient {
19+
credentials: msRest.ServiceClientCredentials;
20+
apiVersion?: string;
21+
subscriptionId: string;
22+
23+
/**
24+
* Initializes a new instance of the AttestationManagementClient class.
25+
* @param credentials Credentials needed for the client to connect to Azure.
26+
* @param subscriptionId The ID of the target subscription.
27+
* @param [options] The parameter options
28+
*/
29+
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.AttestationManagementClientOptions) {
30+
if (credentials == undefined) {
31+
throw new Error('\'credentials\' cannot be null.');
32+
}
33+
if (subscriptionId == undefined) {
34+
throw new Error('\'subscriptionId\' cannot be null.');
35+
}
36+
37+
if (!options) {
38+
options = {};
39+
}
40+
if(!options.userAgent) {
41+
const defaultUserAgent = msRestAzure.getDefaultUserAgentValue();
42+
options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;
43+
}
44+
45+
super(credentials, options);
46+
47+
this.apiVersion = '2020-10-01';
48+
this.acceptLanguage = 'en-US';
49+
this.longRunningOperationRetryTimeout = 30;
50+
this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com";
51+
this.requestContentType = "application/json; charset=utf-8";
52+
this.credentials = credentials;
53+
this.subscriptionId = subscriptionId;
54+
55+
if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) {
56+
this.acceptLanguage = options.acceptLanguage;
57+
}
58+
if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) {
59+
this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout;
60+
}
61+
}
62+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*
5+
* Code generated by Microsoft (R) AutoRest Code Generator.
6+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
*/
8+
9+
export {
10+
AttestationProvider,
11+
AttestationProviderListResult,
12+
AttestationServiceCreationParams,
13+
AttestationServiceCreationSpecificParams,
14+
AttestationServicePatchParams,
15+
AzureEntityResource,
16+
BaseResource,
17+
CloudError,
18+
JSONWebKey,
19+
JSONWebKeySet,
20+
ProxyResource,
21+
Resource,
22+
SystemData,
23+
TrackedResource
24+
} from "../models/mappers";

0 commit comments

Comments
 (0)