Skip to content

Commit b001252

Browse files
author
SDKAuto
committed
CodeGen from PR 34078 in Azure/azure-rest-api-specs
Merge e143e2f9dab0445acbca423b5eb2e7ac6a6b67d9 into 37a849b656ecfb33424822b9f245aebff2ae994f
1 parent f25f63d commit b001252

File tree

88 files changed

+8525
-0
lines changed

Some content is hidden

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

88 files changed

+8525
-0
lines changed

sdk/elasticsan/arm-elasticsan/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (c) Microsoft Corporation.
2+
3+
MIT License
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: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Azure ElasticSan client library for JavaScript
2+
3+
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure ElasticSan client.
4+
5+
(missing-service-description) Add service description
6+
7+
Key links:
8+
9+
- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/elasticsan/arm-elasticsan)
10+
- [Package (NPM)](https://www.npmjs.com/package/@azure/arm-elasticsan)
11+
- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-elasticsan?view=azure-node-preview)
12+
- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/elasticsan/arm-elasticsan/samples)
13+
14+
## Getting started
15+
16+
### Currently supported environments
17+
18+
- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
19+
- Latest versions of Safari, Chrome, Edge and Firefox.
20+
21+
See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
22+
23+
### Prerequisites
24+
25+
- An [Azure subscription][azure_sub].
26+
27+
### Install the `@azure/arm-elasticsan` package
28+
29+
Install the Azure ElasticSan client library for JavaScript with `npm`:
30+
31+
```bash
32+
npm install @azure/arm-elasticsan
33+
```
34+
35+
### Create and authenticate a `ElasticSanClient`
36+
37+
To create a client object to access the Azure ElasticSan API, you will need the `endpoint` of your Azure ElasticSan resource and a `credential`. The Azure ElasticSan client can use Azure Active Directory credentials to authenticate.
38+
You can find the endpoint for your Azure ElasticSan resource in the [Azure Portal][azure_portal].
39+
40+
You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token).
41+
42+
To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package:
43+
44+
```bash
45+
npm install @azure/identity
46+
```
47+
48+
You will also need to **register a new AAD application and grant access to Azure ElasticSan** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions).
49+
50+
For more information about how to create an Azure AD Application check out [this guide](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal).
51+
52+
Using Node.js and Node-like environments, you can use the `DefaultAzureCredential` class to authenticate the client.
53+
54+
```ts snippet:ReadmeSampleCreateClient_Node
55+
import { ElasticSanClient } from "@azure/arm-elasticsan";
56+
import { DefaultAzureCredential } from "@azure/identity";
57+
58+
const subscriptionId = "00000000-0000-0000-0000-000000000000";
59+
const client = new ElasticSanClient(new DefaultAzureCredential(), subscriptionId);
60+
```
61+
62+
For browser environments, use the `InteractiveBrowserCredential` from the `@azure/identity` package to authenticate.
63+
64+
```ts snippet:ReadmeSampleCreateClient_Browser
65+
import { InteractiveBrowserCredential } from "@azure/identity";
66+
import { ElasticSanClient } from "@azure/arm-elasticsan";
67+
68+
const credential = new InteractiveBrowserCredential({
69+
tenantId: "<YOUR_TENANT_ID>",
70+
clientId: "<YOUR_CLIENT_ID>"
71+
});
72+
const client = new ElasticSanClient(credential, subscriptionId);
73+
```
74+
75+
76+
### JavaScript Bundle
77+
To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling).
78+
79+
## Key concepts
80+
81+
### ElasticSanClient
82+
83+
`ElasticSanClient` is the primary interface for developers using the Azure ElasticSan client library. Explore the methods on this client object to understand the different features of the Azure ElasticSan service that you can access.
84+
85+
## Troubleshooting
86+
87+
### Logging
88+
89+
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`:
90+
91+
```ts snippet:SetLogLevel
92+
import { setLogLevel } from "@azure/logger";
93+
94+
setLogLevel("info");
95+
```
96+
97+
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).
98+
99+
## Next steps
100+
101+
Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/elasticsan/arm-elasticsan/samples) directory for detailed examples on how to use this library.
102+
103+
## Contributing
104+
105+
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
106+
107+
## Related projects
108+
109+
- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
110+
111+
[azure_sub]: https://azure.microsoft.com/free/
112+
[azure_portal]: https://portal.azure.com
113+
[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity
114+
[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential
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": "dist/esm/index.d.ts",
4+
"docModel": { "enabled": true },
5+
"apiReport": { "enabled": true, "reportFolder": "./review" },
6+
"dtsRollup": {
7+
"enabled": true,
8+
"untrimmedFilePath": "",
9+
"publicTrimmedFilePath": "dist/arm-elasticsan.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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import azsdkEslint from "@azure/eslint-plugin-azure-sdk";
2+
3+
export default azsdkEslint.config([
4+
{
5+
rules: {
6+
"@azure/azure-sdk/ts-modules-only-named": "warn",
7+
"@azure/azure-sdk/ts-package-json-types": "warn",
8+
"@azure/azure-sdk/ts-package-json-engine-is-present": "warn",
9+
"@azure/azure-sdk/ts-package-json-files-required": "off",
10+
"@azure/azure-sdk/ts-package-json-main-is-cjs": "off",
11+
"tsdoc/syntax": "warn"
12+
}
13+
}
14+
]);
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
{
2+
"name": "@azure/arm-elasticsan",
3+
"version": "1.0.0-beta.1",
4+
"description": "A generated SDK for ElasticSanClient.",
5+
"engines": {
6+
"node": ">=18.0.0"
7+
},
8+
"sideEffects": false,
9+
"autoPublish": false,
10+
"tshy": {
11+
"exports": {
12+
"./package.json": "./package.json",
13+
".": "./src/index.ts",
14+
"./api": "./src/api/index.ts",
15+
"./api/skusOperationGroup": "src/api/skusOperationGroup/index.ts",
16+
"./api/snapshots": "src/api/snapshots/index.ts",
17+
"./api/volumes": "src/api/volumes/index.ts",
18+
"./api/volumeGroups": "src/api/volumeGroups/index.ts",
19+
"./api/privateEndpointConnections": "src/api/privateEndpointConnections/index.ts",
20+
"./api/elasticSans": "src/api/elasticSans/index.ts",
21+
"./api/operations": "src/api/operations/index.ts",
22+
"./models": "./src/models/index.ts"
23+
},
24+
"dialects": ["esm", "commonjs"],
25+
"esmDialects": ["browser", "react-native"],
26+
"selfLink": false,
27+
"project": "./tsconfig.src.json"
28+
},
29+
"type": "module",
30+
"keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"],
31+
"author": "Microsoft Corporation",
32+
"license": "MIT",
33+
"files": [
34+
"dist/",
35+
"!dist/**/*.d.*ts.map",
36+
"README.md",
37+
"LICENSE",
38+
"review/*",
39+
"CHANGELOG.md"
40+
],
41+
"sdk-type": "mgmt",
42+
"repository": "github:Azure/azure-sdk-for-js",
43+
"bugs": {
44+
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
45+
},
46+
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/elasticsan/arm-elasticsan/README.md",
47+
"prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
48+
"//metadata": {
49+
"constantPaths": [
50+
{
51+
"path": "src/api/elasticSanContext.ts",
52+
"prefix": "userAgentInfo"
53+
}
54+
]
55+
},
56+
"dependencies": {
57+
"@azure/core-util": "^1.9.2",
58+
"@azure-rest/core-client": "^2.3.1",
59+
"@azure/core-auth": "^1.6.0",
60+
"@azure/core-rest-pipeline": "^1.5.0",
61+
"@azure/logger": "^1.0.0",
62+
"tslib": "^2.6.2",
63+
"@azure/core-lro": "^3.1.0",
64+
"@azure/abort-controller": "^2.1.2"
65+
},
66+
"devDependencies": {
67+
"dotenv": "^16.0.0",
68+
"@types/node": "^18.0.0",
69+
"eslint": "^9.9.0",
70+
"typescript": "~5.8.2",
71+
"@azure/identity": "^4.2.1",
72+
"@vitest/browser": "^3.0.3",
73+
"@vitest/coverage-istanbul": "^3.0.3",
74+
"playwright": "^1.41.2",
75+
"vitest": "^3.0.3",
76+
"@azure-tools/test-credential": "^2.0.0",
77+
"@azure-tools/test-recorder": "^4.0.0",
78+
"@azure/dev-tool": "^1.0.0",
79+
"@azure/eslint-plugin-azure-sdk": "^3.0.0"
80+
},
81+
"scripts": {
82+
"clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
83+
"extract-api": "dev-tool run vendored rimraf review && dev-tool run extract-api",
84+
"pack": "npm pack 2>&1",
85+
"lint": "eslint package.json api-extractor.json src test",
86+
"lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]",
87+
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
88+
"unit-test:browser": "npm run build:test && dev-tool run test:vitest --browser",
89+
"unit-test:node": "dev-tool run test:vitest",
90+
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
91+
"integration-test:browser": "echo skipped",
92+
"integration-test:node": "echo skipped",
93+
"build:samples": "tsc -p tsconfig.samples.json && dev-tool samples publish -f",
94+
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"",
95+
"execute:samples": "dev-tool samples run samples-dev",
96+
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"",
97+
"generate:client": "echo skipped",
98+
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser",
99+
"minify": "dev-tool run vendored uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js",
100+
"build:test": "npm run clean && dev-tool run build-package && dev-tool run build-test",
101+
"build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
102+
"test:node": "npm run clean && dev-tool run build-package && npm run unit-test:node && npm run integration-test:node",
103+
"test": "npm run clean && dev-tool run build-package && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test",
104+
"update-snippets": "dev-tool run update-snippets"
105+
},
106+
"//sampleConfiguration": {
107+
"productName": "@azure/arm-elasticsan",
108+
"productSlugs": ["azure"],
109+
"disableDocsMs": true,
110+
"apiRefLink": "https://learn.microsoft.com/javascript/api/@azure/arm-elasticsan?view=azure-node-preview"
111+
}
112+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Feel free to add your own environment variables.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
import { ElasticSanClient } from "@azure/arm-elasticsan";
5+
import { DefaultAzureCredential } from "@azure/identity";
6+
7+
/**
8+
* This sample demonstrates how to create ElasticSan.
9+
*
10+
* @summary create ElasticSan.
11+
* x-ms-original-file: 2024-07-01-preview/ElasticSans_Create_MaximumSet_Gen.json
12+
*/
13+
async function elasticSansCreateMaximumSetGen(): Promise<void> {
14+
const credential = new DefaultAzureCredential();
15+
const subscriptionId = "subscriptionid";
16+
const client = new ElasticSanClient(credential, subscriptionId);
17+
await client.elasticSans.create("resourcegroupname", "elasticsanname");
18+
}
19+
20+
/**
21+
* This sample demonstrates how to create ElasticSan.
22+
*
23+
* @summary create ElasticSan.
24+
* x-ms-original-file: 2024-07-01-preview/ElasticSans_Create_MinimumSet_Gen.json
25+
*/
26+
async function elasticSansCreateMinimumSetGen(): Promise<void> {
27+
const credential = new DefaultAzureCredential();
28+
const subscriptionId = "subscriptionid";
29+
const client = new ElasticSanClient(credential, subscriptionId);
30+
await client.elasticSans.create("resourcegroupname", "elasticsanname");
31+
}
32+
33+
async function main(): Promise<void> {
34+
await elasticSansCreateMaximumSetGen();
35+
await elasticSansCreateMinimumSetGen();
36+
}
37+
38+
main().catch(console.error);
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
import { ElasticSanClient } from "@azure/arm-elasticsan";
5+
import { DefaultAzureCredential } from "@azure/identity";
6+
7+
/**
8+
* This sample demonstrates how to delete a Elastic San.
9+
*
10+
* @summary delete a Elastic San.
11+
* x-ms-original-file: 2024-07-01-preview/ElasticSans_Delete_MaximumSet_Gen.json
12+
*/
13+
async function elasticSansDeleteMaximumSetGen(): Promise<void> {
14+
const credential = new DefaultAzureCredential();
15+
const subscriptionId = "subscriptionid";
16+
const client = new ElasticSanClient(credential, subscriptionId);
17+
await client.elasticSans.delete("resourcegroupname", "elasticsanname");
18+
}
19+
20+
/**
21+
* This sample demonstrates how to delete a Elastic San.
22+
*
23+
* @summary delete a Elastic San.
24+
* x-ms-original-file: 2024-07-01-preview/ElasticSans_Delete_MinimumSet_Gen.json
25+
*/
26+
async function elasticSansDeleteMinimumSetGen(): Promise<void> {
27+
const credential = new DefaultAzureCredential();
28+
const subscriptionId = "subscriptionid";
29+
const client = new ElasticSanClient(credential, subscriptionId);
30+
await client.elasticSans.delete("resourcegroupname", "elasticsanname");
31+
}
32+
33+
async function main(): Promise<void> {
34+
await elasticSansDeleteMaximumSetGen();
35+
await elasticSansDeleteMinimumSetGen();
36+
}
37+
38+
main().catch(console.error);

0 commit comments

Comments
 (0)