Skip to content

Commit bf1aed7

Browse files
Updates after npx ci
1 parent c625faf commit bf1aed7

File tree

18 files changed

+7984
-0
lines changed

18 files changed

+7984
-0
lines changed

npx

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Azure MicrosoftAzureFleet client library for JavaScript
2+
3+
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure MicrosoftAzureFleet client.
4+
5+
6+
7+
[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/computefleet/arm-computefleet) |
8+
[Package (NPM)](https://www.npmjs.com/package/@azure/arm-computefleet) |
9+
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-computefleet?view=azure-node-preview) |
10+
[Samples](https://github.com/Azure-Samples/azure-samples-js-management)
11+
12+
## Getting started
13+
14+
### Currently supported environments
15+
16+
- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
17+
- Latest versions of Safari, Chrome, Edge and Firefox.
18+
19+
See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
20+
21+
### Prerequisites
22+
23+
- An [Azure subscription][azure_sub].
24+
25+
### Install the `@azure/arm-computefleet` package
26+
27+
Install the Azure MicrosoftAzureFleet client library for JavaScript with `npm`:
28+
29+
```bash
30+
npm install @azure/arm-computefleet
31+
```
32+
33+
### Create and authenticate a `MicrosoftAzureFleet`
34+
35+
To create a client object to access the Azure MicrosoftAzureFleet API, you will need the `endpoint` of your Azure MicrosoftAzureFleet resource and a `credential`. The Azure MicrosoftAzureFleet client can use Azure Active Directory credentials to authenticate.
36+
You can find the endpoint for your Azure MicrosoftAzureFleet resource in the [Azure Portal][azure_portal].
37+
38+
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).
39+
40+
To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package:
41+
42+
```bash
43+
npm install @azure/identity
44+
```
45+
46+
You will also need to **register a new AAD application and grant access to Azure MicrosoftAzureFleet** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions).
47+
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`.
48+
49+
For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal).
50+
51+
```javascript
52+
const { MicrosoftAzureFleet } = require("@azure/arm-computefleet");
53+
const { DefaultAzureCredential } = require("@azure/identity");
54+
// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details.
55+
56+
const subscriptionId = "00000000-0000-0000-0000-000000000000";
57+
const client = new MicrosoftAzureFleet(new DefaultAzureCredential(), subscriptionId);
58+
59+
// For client-side applications running in the browser, use this code instead:
60+
// const credential = new InteractiveBrowserCredential({
61+
// tenantId: "<YOUR_TENANT_ID>",
62+
// clientId: "<YOUR_CLIENT_ID>"
63+
// });
64+
// const client = new MicrosoftAzureFleet(credential, subscriptionId);
65+
```
66+
67+
68+
### JavaScript Bundle
69+
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).
70+
71+
## Key concepts
72+
73+
### MicrosoftAzureFleet
74+
75+
`MicrosoftAzureFleet` is the primary interface for developers using the Azure MicrosoftAzureFleet client library. Explore the methods on this client object to understand the different features of the Azure MicrosoftAzureFleet service that you can access.
76+
77+
## Troubleshooting
78+
79+
### Logging
80+
81+
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`:
82+
83+
```javascript
84+
const { setLogLevel } = require("@azure/logger");
85+
setLogLevel("info");
86+
```
87+
88+
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).
89+
90+
## Next steps
91+
92+
Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library.
93+
94+
## Contributing
95+
96+
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.
97+
98+
## Related projects
99+
100+
- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
101+
102+
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fcomputefleet%2Farm-computefleet%2FREADME.png)
103+
104+
[azure_cli]: https://docs.microsoft.com/cli/azure
105+
[azure_sub]: https://azure.microsoft.com/free/
106+
[azure_sub]: https://azure.microsoft.com/free/
107+
[azure_portal]: https://portal.azure.com
108+
[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity
109+
[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential
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": "./types/arm-computefleet.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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"name": "@azure/arm-computefleet",
3+
"sdk-type": "mgmt",
4+
"author": "Microsoft Corporation",
5+
"description": "A generated SDK for MicrosoftAzureFleet.",
6+
"version": "1.0.0-beta.1",
7+
"engines": { "node": ">=18.0.0" },
8+
"dependencies": {
9+
"@azure/core-lro": "^2.5.4",
10+
"@azure/abort-controller": "^2.1.2",
11+
"@azure/core-paging": "^1.2.0",
12+
"@azure/core-client": "^1.7.0",
13+
"@azure/core-auth": "^1.6.0",
14+
"@azure/core-rest-pipeline": "^1.14.0",
15+
"tslib": "^2.2.0"
16+
},
17+
"keywords": ["node", "azure", "typescript", "browser", "isomorphic"],
18+
"license": "MIT",
19+
"main": "./dist/index.js",
20+
"module": "./dist-esm/index.js",
21+
"types": "./types/arm-computefleet.d.ts",
22+
"devDependencies": {
23+
"@microsoft/api-extractor": "^7.31.1",
24+
"mkdirp": "^3.0.1",
25+
"typescript": "~5.5.3",
26+
"uglify-js": "^3.4.9",
27+
"rimraf": "^5.0.0",
28+
"dotenv": "^16.0.0",
29+
"@azure/dev-tool": "^1.0.0"
30+
},
31+
"repository": {
32+
"type": "git",
33+
"url": "https://github.com/Azure/azure-sdk-for-js.git"
34+
},
35+
"bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" },
36+
"files": [
37+
"dist/**/*.js",
38+
"dist/**/*.js.map",
39+
"dist/**/*.d.ts",
40+
"dist/**/*.d.ts.map",
41+
"dist-esm/**/*.js",
42+
"dist-esm/**/*.js.map",
43+
"dist-esm/**/*.d.ts",
44+
"dist-esm/**/*.d.ts.map",
45+
"src/**/*.ts",
46+
"README.md",
47+
"LICENSE",
48+
"tsconfig.json",
49+
"review/*",
50+
"CHANGELOG.md",
51+
"types/*"
52+
],
53+
"scripts": {
54+
"build": "npm run clean && tsc && dev-tool run bundle && npm run minify && mkdirp ./review && npm run extract-api",
55+
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js",
56+
"prepack": "npm run build",
57+
"pack": "npm pack 2>&1",
58+
"extract-api": "dev-tool run extract-api",
59+
"lint": "echo skipped",
60+
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
61+
"build:node": "echo skipped",
62+
"build:browser": "echo skipped",
63+
"build:test": "echo skipped",
64+
"build:samples": "echo skipped.",
65+
"check-format": "echo skipped",
66+
"execute:samples": "echo skipped",
67+
"format": "echo skipped",
68+
"test": "echo skipped",
69+
"test:node": "echo skipped",
70+
"test:browser": "echo skipped",
71+
"unit-test": "echo skipped",
72+
"unit-test:node": "echo skipped",
73+
"unit-test:browser": "echo skipped",
74+
"integration-test": "echo skipped",
75+
"integration-test:node": "echo skipped",
76+
"integration-test:browser": "echo skipped"
77+
},
78+
"sideEffects": false,
79+
"//metadata": {
80+
"constantPaths": [
81+
{ "path": "src/microsoftAzureFleet.ts", "prefix": "packageDetails" }
82+
]
83+
},
84+
"autoPublish": true,
85+
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/computefleet/arm-computefleet"
86+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference lib="esnext.asynciterable" />
2+
export { getContinuationToken } from "./pagingHelper";
3+
export * from "./models";
4+
export { MicrosoftAzureFleet } from "./microsoftAzureFleet";
5+
export * from "./operationsInterfaces";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
import { AbortSignalLike } from "@azure/abort-controller";
5+
import { LongRunningOperation, LroResponse } from "@azure/core-lro";
6+
7+
export function createLroSpec<T>(inputs: {
8+
sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>;
9+
args: Record<string, unknown>;
10+
spec: {
11+
readonly requestBody?: unknown;
12+
readonly path?: string;
13+
readonly httpMethod: string;
14+
} & Record<string, any>;
15+
}): LongRunningOperation<T> {
16+
const { args, spec, sendOperationFn } = inputs;
17+
return {
18+
requestMethod: spec.httpMethod,
19+
requestPath: spec.path!,
20+
sendInitialRequest: () => sendOperationFn(args, spec),
21+
sendPollRequest: (
22+
path: string,
23+
options?: { abortSignal?: AbortSignalLike },
24+
) => {
25+
const { requestBody, ...restSpec } = spec;
26+
return sendOperationFn(args, {
27+
...restSpec,
28+
httpMethod: "GET",
29+
path,
30+
abortSignal: options?.abortSignal,
31+
});
32+
},
33+
};
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
import * as coreClient from "@azure/core-client";
2+
import * as coreRestPipeline from "@azure/core-rest-pipeline";
3+
import {
4+
PipelineRequest,
5+
PipelineResponse,
6+
SendRequest,
7+
} from "@azure/core-rest-pipeline";
8+
import * as coreAuth from "@azure/core-auth";
9+
import { OperationsImpl, FleetsImpl } from "./operations";
10+
import { Operations, Fleets } from "./operationsInterfaces";
11+
import { MicrosoftAzureFleetOptionalParams } from "./models";
12+
13+
export class MicrosoftAzureFleet extends coreClient.ServiceClient {
14+
$host: string;
15+
apiVersion: string;
16+
subscriptionId: string;
17+
18+
/**
19+
* Initializes a new instance of the MicrosoftAzureFleet class.
20+
* @param credentials Subscription credentials which uniquely identify client subscription.
21+
* @param subscriptionId The ID of the target subscription. The value must be an UUID.
22+
* @param options The parameter options
23+
*/
24+
constructor(
25+
credentials: coreAuth.TokenCredential,
26+
subscriptionId: string,
27+
options?: MicrosoftAzureFleetOptionalParams,
28+
) {
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+
// Initializing default values for options
37+
if (!options) {
38+
options = {};
39+
}
40+
const defaults: MicrosoftAzureFleetOptionalParams = {
41+
requestContentType: "application/json; charset=utf-8",
42+
credential: credentials,
43+
};
44+
45+
const packageDetails = `azsdk-js-arm-computefleet/1.0.0-beta.1`;
46+
const userAgentPrefix =
47+
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
48+
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
49+
: `${packageDetails}`;
50+
51+
const optionsWithDefaults = {
52+
...defaults,
53+
...options,
54+
userAgentOptions: {
55+
userAgentPrefix,
56+
},
57+
endpoint:
58+
options.endpoint ?? options.baseUri ?? "https://management.azure.com",
59+
};
60+
super(optionsWithDefaults);
61+
62+
let bearerTokenAuthenticationPolicyFound: boolean = false;
63+
if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
64+
const pipelinePolicies: coreRestPipeline.PipelinePolicy[] =
65+
options.pipeline.getOrderedPolicies();
66+
bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
67+
(pipelinePolicy) =>
68+
pipelinePolicy.name ===
69+
coreRestPipeline.bearerTokenAuthenticationPolicyName,
70+
);
71+
}
72+
if (
73+
!options ||
74+
!options.pipeline ||
75+
options.pipeline.getOrderedPolicies().length == 0 ||
76+
!bearerTokenAuthenticationPolicyFound
77+
) {
78+
this.pipeline.removePolicy({
79+
name: coreRestPipeline.bearerTokenAuthenticationPolicyName,
80+
});
81+
this.pipeline.addPolicy(
82+
coreRestPipeline.bearerTokenAuthenticationPolicy({
83+
credential: credentials,
84+
scopes:
85+
optionsWithDefaults.credentialScopes ??
86+
`${optionsWithDefaults.endpoint}/.default`,
87+
challengeCallbacks: {
88+
authorizeRequestOnChallenge:
89+
coreClient.authorizeRequestOnClaimChallenge,
90+
},
91+
}),
92+
);
93+
}
94+
// Parameter assignments
95+
this.subscriptionId = subscriptionId;
96+
97+
// Assigning values to Constant parameters
98+
this.$host = options.$host || "https://management.azure.com";
99+
this.apiVersion = options.apiVersion || "2024-11-01";
100+
this.operations = new OperationsImpl(this);
101+
this.fleets = new FleetsImpl(this);
102+
this.addCustomApiVersionPolicy(options.apiVersion);
103+
}
104+
105+
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
106+
private addCustomApiVersionPolicy(apiVersion?: string) {
107+
if (!apiVersion) {
108+
return;
109+
}
110+
const apiVersionPolicy = {
111+
name: "CustomApiVersionPolicy",
112+
async sendRequest(
113+
request: PipelineRequest,
114+
next: SendRequest,
115+
): Promise<PipelineResponse> {
116+
const param = request.url.split("?");
117+
if (param.length > 1) {
118+
const newParams = param[1].split("&").map((item) => {
119+
if (item.indexOf("api-version") > -1) {
120+
return "api-version=" + apiVersion;
121+
} else {
122+
return item;
123+
}
124+
});
125+
request.url = param[0] + "?" + newParams.join("&");
126+
}
127+
return next(request);
128+
},
129+
};
130+
this.pipeline.addPolicy(apiVersionPolicy);
131+
}
132+
133+
operations: Operations;
134+
fleets: Fleets;
135+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy