arm-support-identity-ten (#15942)
This commit is contained in:
Родитель
bb9896d200
Коммит
d76e6f68ad
|
@ -1,89 +1,100 @@
|
|||
## Azure DataBoxEdgeManagementClient SDK for JavaScript
|
||||
|
||||
This package contains an isomorphic SDK for DataBoxEdgeManagementClient.
|
||||
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for DataBoxEdgeManagementClient.
|
||||
|
||||
### Currently supported environments
|
||||
|
||||
- Node.js version 6.x.x or higher
|
||||
- Browser JavaScript
|
||||
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
|
||||
- Latest versions of Safari, Chrome, Edge, and Firefox.
|
||||
|
||||
### How to Install
|
||||
### Prerequisites
|
||||
|
||||
You must have an [Azure subscription](https://azure.microsoft.com/free/).
|
||||
|
||||
### How to install
|
||||
|
||||
To use this SDK in your project, you will need to install two packages.
|
||||
- `@azure/arm-edgegateway` that contains the client.
|
||||
- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
|
||||
|
||||
Install both packages using the below command:
|
||||
```bash
|
||||
npm install @azure/arm-edgegateway
|
||||
npm install --save @azure/arm-edgegateway @azure/identity
|
||||
```
|
||||
|
||||
> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
|
||||
If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
|
||||
|
||||
### How to use
|
||||
|
||||
#### nodejs - Authentication, client creation and list operations as an example written in TypeScript.
|
||||
- If you are writing a client side browser application,
|
||||
- Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
|
||||
- Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
|
||||
- If you are writing a server side application,
|
||||
- [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
|
||||
- Complete the set up steps required by the credential if any.
|
||||
- Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
|
||||
|
||||
##### Install @azure/ms-rest-nodeauth
|
||||
In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
|
||||
Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
|
||||
|
||||
```bash
|
||||
npm install @azure/ms-rest-nodeauth
|
||||
```
|
||||
#### nodejs - Authentication, client creation, and list operations as an example written in JavaScript.
|
||||
|
||||
##### Sample code
|
||||
|
||||
```typescript
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import * as msRestAzure from "@azure/ms-rest-azure-js";
|
||||
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
|
||||
import { DataBoxEdgeManagementClient, DataBoxEdgeManagementModels, DataBoxEdgeManagementMappers } from "@azure/arm-edgegateway";
|
||||
```javascript
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
const { DataBoxEdgeManagementClient } = require("@azure/arm-edgegateway");
|
||||
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
|
||||
|
||||
msRestNodeAuth.interactiveLogin().then((creds) => {
|
||||
const client = new DataBoxEdgeManagementClient(creds, subscriptionId);
|
||||
client.operations.list().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
});
|
||||
// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
|
||||
// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
|
||||
const creds = new DefaultAzureCredential();
|
||||
const client = new DataBoxEdgeManagementClient(creds, subscriptionId);
|
||||
|
||||
client.operations.list().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
```
|
||||
|
||||
#### browser - Authentication, client creation and list operations as an example written in JavaScript.
|
||||
#### browser - Authentication, client creation, and list operations as an example written in JavaScript.
|
||||
|
||||
##### Install @azure/ms-rest-browserauth
|
||||
|
||||
```bash
|
||||
npm install @azure/ms-rest-browserauth
|
||||
```
|
||||
In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
|
||||
- See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
|
||||
- Note down the client Id from the previous step and use it in the browser sample below.
|
||||
|
||||
##### Sample code
|
||||
|
||||
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
|
||||
|
||||
- index.html
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>@azure/arm-edgegateway sample</title>
|
||||
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
|
||||
<script src="node_modules/@azure/identity/dist/index.js"></script>
|
||||
<script src="node_modules/@azure/arm-edgegateway/dist/arm-edgegateway.js"></script>
|
||||
<script type="text/javascript">
|
||||
const subscriptionId = "<Subscription_Id>";
|
||||
const authManager = new msAuth.AuthManager({
|
||||
// Create credentials using the `@azure/identity` package.
|
||||
// Please note that you can also use credentials from the `@azure/ms-rest-browserauth` package instead.
|
||||
const credential = new InteractiveBrowserCredential(
|
||||
{
|
||||
clientId: "<client id for your Azure AD app>",
|
||||
tenant: "<optional tenant for your organization>"
|
||||
tenantId: "<optional tenant for your organization>"
|
||||
});
|
||||
authManager.finalizeLogin().then((res) => {
|
||||
if (!res.isLoggedIn) {
|
||||
// may cause redirects
|
||||
authManager.login();
|
||||
}
|
||||
const client = new Azure.ArmEdgegateway.DataBoxEdgeManagementClient(res.creds, subscriptionId);
|
||||
client.operations.list().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
const client = new Azure.ArmEdgegateway.DataBoxEdgeManagementClient(creds, subscriptionId);
|
||||
client.operations.list().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
@ -95,4 +106,4 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
|
|||
|
||||
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
|
||||
|
||||
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fedgegateway%2Farm-edgegateway%2FREADME.png)
|
||||
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/edgegateway/arm-edgegateway/README.png)
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
"name": "@azure/arm-edgegateway",
|
||||
"author": "Microsoft Corporation",
|
||||
"description": "DataBoxEdgeManagementClient Library with typescript type definitions for node.js and browser.",
|
||||
"version": "2.0.1",
|
||||
"version": "2.1.0",
|
||||
"dependencies": {
|
||||
"@azure/ms-rest-azure-js": "^2.0.0",
|
||||
"@azure/ms-rest-js": "^2.0.3",
|
||||
"@azure/ms-rest-azure-js": "^2.1.0",
|
||||
"@azure/ms-rest-js": "^2.2.0",
|
||||
"@azure/core-auth": "^1.1.4",
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"keywords": [
|
||||
|
@ -20,7 +21,7 @@
|
|||
"module": "./esm/dataBoxEdgeManagementClient.js",
|
||||
"types": "./esm/dataBoxEdgeManagementClient.d.ts",
|
||||
"devDependencies": {
|
||||
"typescript": "^3.1.1",
|
||||
"typescript": "^3.6.0",
|
||||
"rollup": "^0.66.2",
|
||||
"rollup-plugin-node-resolve": "^3.4.0",
|
||||
"rollup-plugin-sourcemaps": "^0.4.2",
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
import * as Models from "./models";
|
||||
import * as Mappers from "./models/mappers";
|
||||
import * as operations from "./operations";
|
||||
|
@ -32,11 +33,16 @@ class DataBoxEdgeManagementClient extends DataBoxEdgeManagementClientContext {
|
|||
|
||||
/**
|
||||
* Initializes a new instance of the DataBoxEdgeManagementClient class.
|
||||
* @param credentials Credentials needed for the client to connect to Azure.
|
||||
* @param credentials Credentials needed for the client to connect to Azure. Credentials
|
||||
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
|
||||
* more information about these credentials, see
|
||||
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
|
||||
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
|
||||
* @azure/ms-rest-browserauth are also supported.
|
||||
* @param subscriptionId The subscription ID.
|
||||
* @param [options] The parameter options
|
||||
*/
|
||||
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.DataBoxEdgeManagementClientOptions) {
|
||||
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.DataBoxEdgeManagementClientOptions) {
|
||||
super(credentials, subscriptionId, options);
|
||||
this.operations = new operations.Operations(this);
|
||||
this.devices = new operations.Devices(this);
|
||||
|
|
|
@ -10,23 +10,29 @@
|
|||
|
||||
import * as Models from "./models";
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
import * as msRestAzure from "@azure/ms-rest-azure-js";
|
||||
|
||||
const packageName = "@azure/arm-edgegateway";
|
||||
const packageVersion = "2.0.1";
|
||||
const packageVersion = "2.1.0";
|
||||
|
||||
export class DataBoxEdgeManagementClientContext extends msRestAzure.AzureServiceClient {
|
||||
credentials: msRest.ServiceClientCredentials;
|
||||
credentials: msRest.ServiceClientCredentials | TokenCredential;
|
||||
apiVersion?: string;
|
||||
subscriptionId: string;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the DataBoxEdgeManagementClient class.
|
||||
* @param credentials Credentials needed for the client to connect to Azure.
|
||||
* @param credentials Credentials needed for the client to connect to Azure. Credentials
|
||||
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
|
||||
* more information about these credentials, see
|
||||
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
|
||||
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
|
||||
* @azure/ms-rest-browserauth are also supported.
|
||||
* @param subscriptionId The subscription ID.
|
||||
* @param [options] The parameter options
|
||||
*/
|
||||
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.DataBoxEdgeManagementClientOptions) {
|
||||
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.DataBoxEdgeManagementClientOptions) {
|
||||
if (credentials == undefined) {
|
||||
throw new Error('\'credentials\' cannot be null.');
|
||||
}
|
||||
|
|
|
@ -1,90 +1,100 @@
|
|||
## Azure EventHubManagementClient SDK for JavaScript
|
||||
|
||||
This package contains an isomorphic SDK for EventHubManagementClient.
|
||||
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for EventHubManagementClient.
|
||||
|
||||
### Currently supported environments
|
||||
|
||||
- Node.js version 6.x.x or higher
|
||||
- Browser JavaScript
|
||||
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
|
||||
- Latest versions of Safari, Chrome, Edge, and Firefox.
|
||||
|
||||
### How to Install
|
||||
### Prerequisites
|
||||
|
||||
You must have an [Azure subscription](https://azure.microsoft.com/free/).
|
||||
|
||||
### How to install
|
||||
|
||||
To use this SDK in your project, you will need to install two packages.
|
||||
- `@azure/arm-eventhub-profile-2020-09-01-hybrid` that contains the client.
|
||||
- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
|
||||
|
||||
Install both packages using the below command:
|
||||
```bash
|
||||
npm install @azure/arm-eventhub-profile-2020-09-01-hybrid
|
||||
npm install --save @azure/arm-eventhub-profile-2020-09-01-hybrid @azure/identity
|
||||
```
|
||||
|
||||
> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
|
||||
If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
|
||||
|
||||
### How to use
|
||||
|
||||
#### nodejs - Authentication, client creation and listAvailableClusterRegion clusters as an example written in TypeScript.
|
||||
- If you are writing a client side browser application,
|
||||
- Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
|
||||
- Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
|
||||
- If you are writing a server side application,
|
||||
- [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
|
||||
- Complete the set up steps required by the credential if any.
|
||||
- Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
|
||||
|
||||
##### Install @azure/ms-rest-nodeauth
|
||||
In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
|
||||
Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
|
||||
|
||||
- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
|
||||
```bash
|
||||
npm install @azure/ms-rest-nodeauth@"^3.0.0"
|
||||
```
|
||||
#### nodejs - Authentication, client creation, and listAvailableClusterRegion clusters as an example written in JavaScript.
|
||||
|
||||
##### Sample code
|
||||
|
||||
```typescript
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import * as msRestAzure from "@azure/ms-rest-azure-js";
|
||||
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
|
||||
import { EventHubManagementClient, EventHubManagementModels, EventHubManagementMappers } from "@azure/arm-eventhub-profile-2020-09-01-hybrid";
|
||||
```javascript
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
const { EventHubManagementClient } = require("@azure/arm-eventhub-profile-2020-09-01-hybrid");
|
||||
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
|
||||
|
||||
msRestNodeAuth.interactiveLogin().then((creds) => {
|
||||
const client = new EventHubManagementClient(creds, subscriptionId);
|
||||
client.clusters.listAvailableClusterRegion().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
});
|
||||
// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
|
||||
// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
|
||||
const creds = new DefaultAzureCredential();
|
||||
const client = new EventHubManagementClient(creds, subscriptionId);
|
||||
|
||||
client.clusters.listAvailableClusterRegion().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
```
|
||||
|
||||
#### browser - Authentication, client creation and listAvailableClusterRegion clusters as an example written in JavaScript.
|
||||
#### browser - Authentication, client creation, and listAvailableClusterRegion clusters as an example written in JavaScript.
|
||||
|
||||
##### Install @azure/ms-rest-browserauth
|
||||
|
||||
```bash
|
||||
npm install @azure/ms-rest-browserauth
|
||||
```
|
||||
In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
|
||||
- See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
|
||||
- Note down the client Id from the previous step and use it in the browser sample below.
|
||||
|
||||
##### Sample code
|
||||
|
||||
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
|
||||
|
||||
- index.html
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>@azure/arm-eventhub-profile-2020-09-01-hybrid sample</title>
|
||||
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
|
||||
<script src="node_modules/@azure/identity/dist/index.js"></script>
|
||||
<script src="node_modules/@azure/arm-eventhub-profile-2020-09-01-hybrid/dist/arm-eventhub-profile-2020-09-01-hybrid.js"></script>
|
||||
<script type="text/javascript">
|
||||
const subscriptionId = "<Subscription_Id>";
|
||||
const authManager = new msAuth.AuthManager({
|
||||
// Create credentials using the `@azure/identity` package.
|
||||
// Please note that you can also use credentials from the `@azure/ms-rest-browserauth` package instead.
|
||||
const credential = new InteractiveBrowserCredential(
|
||||
{
|
||||
clientId: "<client id for your Azure AD app>",
|
||||
tenant: "<optional tenant for your organization>"
|
||||
tenantId: "<optional tenant for your organization>"
|
||||
});
|
||||
authManager.finalizeLogin().then((res) => {
|
||||
if (!res.isLoggedIn) {
|
||||
// may cause redirects
|
||||
authManager.login();
|
||||
}
|
||||
const client = new Azure.ArmEventhubProfile20200901Hybrid.EventHubManagementClient(res.creds, subscriptionId);
|
||||
client.clusters.listAvailableClusterRegion().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
const client = new Azure.ArmEventhubProfile20200901Hybrid.EventHubManagementClient(creds, subscriptionId);
|
||||
client.clusters.listAvailableClusterRegion().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
"name": "@azure/arm-eventhub-profile-2020-09-01-hybrid",
|
||||
"author": "Microsoft Corporation",
|
||||
"description": "EventHubManagementClient Library with typescript type definitions for node.js and browser.",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"dependencies": {
|
||||
"@azure/ms-rest-azure-js": "^2.0.1",
|
||||
"@azure/ms-rest-js": "^2.0.4",
|
||||
"@azure/ms-rest-azure-js": "^2.1.0",
|
||||
"@azure/ms-rest-js": "^2.2.0",
|
||||
"@azure/core-auth": "^1.1.4",
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"keywords": [
|
||||
|
@ -20,7 +21,7 @@
|
|||
"module": "./esm/eventHubManagementClient.js",
|
||||
"types": "./esm/eventHubManagementClient.d.ts",
|
||||
"devDependencies": {
|
||||
"typescript": "^3.5.3",
|
||||
"typescript": "^3.6.0",
|
||||
"rollup": "^1.18.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"rollup-plugin-sourcemaps": "^0.4.2",
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
import * as Models from "./models";
|
||||
import * as Mappers from "./models/mappers";
|
||||
import * as operations from "./operations";
|
||||
|
@ -29,12 +30,17 @@ class EventHubManagementClient extends EventHubManagementClientContext {
|
|||
|
||||
/**
|
||||
* Initializes a new instance of the EventHubManagementClient class.
|
||||
* @param credentials Credentials needed for the client to connect to Azure.
|
||||
* @param credentials Credentials needed for the client to connect to Azure. Credentials
|
||||
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
|
||||
* more information about these credentials, see
|
||||
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
|
||||
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
|
||||
* @azure/ms-rest-browserauth are also supported.
|
||||
* @param subscriptionId Subscription credentials that uniquely identify a Microsoft Azure
|
||||
* subscription. The subscription ID forms part of the URI for every service call.
|
||||
* @param [options] The parameter options
|
||||
*/
|
||||
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.EventHubManagementClientOptions) {
|
||||
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.EventHubManagementClientOptions) {
|
||||
super(credentials, subscriptionId, options);
|
||||
this.clusters = new operations.Clusters(this);
|
||||
this.namespaces = new operations.Namespaces(this);
|
||||
|
|
|
@ -10,23 +10,29 @@
|
|||
|
||||
import * as Models from "./models";
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
import * as msRestAzure from "@azure/ms-rest-azure-js";
|
||||
|
||||
const packageName = "@azure/arm-eventhub-profile-2020-09-01-hybrid";
|
||||
const packageVersion = "1.0.0";
|
||||
const packageVersion = "1.1.0";
|
||||
|
||||
export class EventHubManagementClientContext extends msRestAzure.AzureServiceClient {
|
||||
credentials: msRest.ServiceClientCredentials;
|
||||
credentials: msRest.ServiceClientCredentials | TokenCredential;
|
||||
subscriptionId: string;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the EventHubManagementClient class.
|
||||
* @param credentials Credentials needed for the client to connect to Azure.
|
||||
* @param credentials Credentials needed for the client to connect to Azure. Credentials
|
||||
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
|
||||
* more information about these credentials, see
|
||||
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
|
||||
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
|
||||
* @azure/ms-rest-browserauth are also supported.
|
||||
* @param subscriptionId Subscription credentials that uniquely identify a Microsoft Azure
|
||||
* subscription. The subscription ID forms part of the URI for every service call.
|
||||
* @param [options] The parameter options
|
||||
*/
|
||||
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.EventHubManagementClientOptions) {
|
||||
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.EventHubManagementClientOptions) {
|
||||
if (credentials == undefined) {
|
||||
throw new Error('\'credentials\' cannot be null.');
|
||||
}
|
||||
|
|
|
@ -1,89 +1,100 @@
|
|||
## Azure FeatureClient SDK for JavaScript
|
||||
|
||||
This package contains an isomorphic SDK for FeatureClient.
|
||||
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for FeatureClient.
|
||||
|
||||
### Currently supported environments
|
||||
|
||||
- Node.js version 6.x.x or higher
|
||||
- Browser JavaScript
|
||||
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
|
||||
- Latest versions of Safari, Chrome, Edge, and Firefox.
|
||||
|
||||
### How to Install
|
||||
### Prerequisites
|
||||
|
||||
You must have an [Azure subscription](https://azure.microsoft.com/free/).
|
||||
|
||||
### How to install
|
||||
|
||||
To use this SDK in your project, you will need to install two packages.
|
||||
- `@azure/arm-features` that contains the client.
|
||||
- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
|
||||
|
||||
Install both packages using the below command:
|
||||
```bash
|
||||
npm install @azure/arm-features
|
||||
npm install --save @azure/arm-features @azure/identity
|
||||
```
|
||||
|
||||
> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
|
||||
If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
|
||||
|
||||
### How to use
|
||||
|
||||
#### nodejs - Authentication, client creation and listOperations as an example written in TypeScript.
|
||||
- If you are writing a client side browser application,
|
||||
- Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
|
||||
- Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
|
||||
- If you are writing a server side application,
|
||||
- [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
|
||||
- Complete the set up steps required by the credential if any.
|
||||
- Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
|
||||
|
||||
##### Install @azure/ms-rest-nodeauth
|
||||
In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
|
||||
Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
|
||||
|
||||
```bash
|
||||
npm install @azure/ms-rest-nodeauth
|
||||
```
|
||||
#### nodejs - Authentication, client creation, and listOperations as an example written in JavaScript.
|
||||
|
||||
##### Sample code
|
||||
|
||||
```typescript
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import * as msRestAzure from "@azure/ms-rest-azure-js";
|
||||
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
|
||||
import { FeatureClient, FeatureModels, FeatureMappers } from "@azure/arm-features";
|
||||
```javascript
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
const { FeatureClient } = require("@azure/arm-features");
|
||||
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
|
||||
|
||||
msRestNodeAuth.interactiveLogin().then((creds) => {
|
||||
const client = new FeatureClient(creds, subscriptionId);
|
||||
client.listOperations().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
});
|
||||
// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
|
||||
// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
|
||||
const creds = new DefaultAzureCredential();
|
||||
const client = new FeatureClient(creds, subscriptionId);
|
||||
|
||||
client.listOperations().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
```
|
||||
|
||||
#### browser - Authentication, client creation and listOperations as an example written in JavaScript.
|
||||
#### browser - Authentication, client creation, and listOperations as an example written in JavaScript.
|
||||
|
||||
##### Install @azure/ms-rest-browserauth
|
||||
|
||||
```bash
|
||||
npm install @azure/ms-rest-browserauth
|
||||
```
|
||||
In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
|
||||
- See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
|
||||
- Note down the client Id from the previous step and use it in the browser sample below.
|
||||
|
||||
##### Sample code
|
||||
|
||||
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
|
||||
|
||||
- index.html
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>@azure/arm-features sample</title>
|
||||
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
|
||||
<script src="node_modules/@azure/identity/dist/index.js"></script>
|
||||
<script src="node_modules/@azure/arm-features/dist/arm-features.js"></script>
|
||||
<script type="text/javascript">
|
||||
const subscriptionId = "<Subscription_Id>";
|
||||
const authManager = new msAuth.AuthManager({
|
||||
// Create credentials using the `@azure/identity` package.
|
||||
// Please note that you can also use credentials from the `@azure/ms-rest-browserauth` package instead.
|
||||
const credential = new InteractiveBrowserCredential(
|
||||
{
|
||||
clientId: "<client id for your Azure AD app>",
|
||||
tenant: "<optional tenant for your organization>"
|
||||
tenantId: "<optional tenant for your organization>"
|
||||
});
|
||||
authManager.finalizeLogin().then((res) => {
|
||||
if (!res.isLoggedIn) {
|
||||
// may cause redirects
|
||||
authManager.login();
|
||||
}
|
||||
const client = new Azure.ArmFeatures.FeatureClient(res.creds, subscriptionId);
|
||||
client.listOperations().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
const client = new Azure.ArmFeatures.FeatureClient(creds, subscriptionId);
|
||||
client.listOperations().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
@ -95,4 +106,4 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
|
|||
|
||||
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
|
||||
|
||||
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Ffeatures%2Farm-features%2FREADME.png)
|
||||
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/features/arm-features/README.png)
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
"name": "@azure/arm-features",
|
||||
"author": "Microsoft Corporation",
|
||||
"description": "FeatureClient Library with typescript type definitions for node.js and browser.",
|
||||
"version": "1.0.3",
|
||||
"version": "1.1.0",
|
||||
"dependencies": {
|
||||
"@azure/ms-rest-azure-js": "^1.3.2",
|
||||
"@azure/ms-rest-js": "^1.8.1",
|
||||
"@azure/ms-rest-azure-js": "^1.4.0",
|
||||
"@azure/ms-rest-js": "^1.11.0",
|
||||
"@azure/core-auth": "^1.1.4",
|
||||
"tslib": "^1.9.3"
|
||||
},
|
||||
"keywords": [
|
||||
|
@ -20,7 +21,7 @@
|
|||
"module": "./esm/featureClient.js",
|
||||
"types": "./esm/featureClient.d.ts",
|
||||
"devDependencies": {
|
||||
"typescript": "^3.1.1",
|
||||
"typescript": "^3.6.0",
|
||||
"rollup": "^0.66.2",
|
||||
"rollup-plugin-node-resolve": "^3.4.0",
|
||||
"rollup-plugin-sourcemaps": "^0.4.2",
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
import * as Models from "./models";
|
||||
import * as Mappers from "./models/mappers";
|
||||
import * as Parameters from "./models/parameters";
|
||||
|
@ -22,11 +23,16 @@ class FeatureClient extends FeatureClientContext {
|
|||
|
||||
/**
|
||||
* Initializes a new instance of the FeatureClient class.
|
||||
* @param credentials Credentials needed for the client to connect to Azure.
|
||||
* @param credentials Credentials needed for the client to connect to Azure. Credentials
|
||||
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
|
||||
* more information about these credentials, see
|
||||
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
|
||||
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
|
||||
* @azure/ms-rest-browserauth are also supported.
|
||||
* @param subscriptionId The ID of the target subscription.
|
||||
* @param [options] The parameter options
|
||||
*/
|
||||
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.FeatureClientOptions) {
|
||||
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.FeatureClientOptions) {
|
||||
super(credentials, subscriptionId, options);
|
||||
this.features = new operations.Features(this);
|
||||
}
|
||||
|
|
|
@ -10,23 +10,29 @@
|
|||
|
||||
import * as Models from "./models";
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
import * as msRestAzure from "@azure/ms-rest-azure-js";
|
||||
|
||||
const packageName = "@azure/arm-features";
|
||||
const packageVersion = "1.0.3";
|
||||
const packageVersion = "1.1.0";
|
||||
|
||||
export class FeatureClientContext extends msRestAzure.AzureServiceClient {
|
||||
credentials: msRest.ServiceClientCredentials;
|
||||
credentials: msRest.ServiceClientCredentials | TokenCredential;
|
||||
subscriptionId: string;
|
||||
apiVersion?: string;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the FeatureClient class.
|
||||
* @param credentials Credentials needed for the client to connect to Azure.
|
||||
* @param credentials Credentials needed for the client to connect to Azure. Credentials
|
||||
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
|
||||
* more information about these credentials, see
|
||||
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
|
||||
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
|
||||
* @azure/ms-rest-browserauth are also supported.
|
||||
* @param subscriptionId The ID of the target subscription.
|
||||
* @param [options] The parameter options
|
||||
*/
|
||||
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.FeatureClientOptions) {
|
||||
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.FeatureClientOptions) {
|
||||
if (credentials == undefined) {
|
||||
throw new Error('\'credentials\' cannot be null.');
|
||||
}
|
||||
|
|
|
@ -1,90 +1,100 @@
|
|||
## Azure FrontDoorManagementClient SDK for JavaScript
|
||||
|
||||
This package contains an isomorphic SDK for FrontDoorManagementClient.
|
||||
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for FrontDoorManagementClient.
|
||||
|
||||
### Currently supported environments
|
||||
|
||||
- Node.js version 6.x.x or higher
|
||||
- Browser JavaScript
|
||||
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
|
||||
- Latest versions of Safari, Chrome, Edge, and Firefox.
|
||||
|
||||
### How to Install
|
||||
### Prerequisites
|
||||
|
||||
You must have an [Azure subscription](https://azure.microsoft.com/free/).
|
||||
|
||||
### How to install
|
||||
|
||||
To use this SDK in your project, you will need to install two packages.
|
||||
- `@azure/arm-frontdoor` that contains the client.
|
||||
- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
|
||||
|
||||
Install both packages using the below command:
|
||||
```bash
|
||||
npm install @azure/arm-frontdoor
|
||||
npm install --save @azure/arm-frontdoor @azure/identity
|
||||
```
|
||||
|
||||
> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
|
||||
If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
|
||||
|
||||
### How to use
|
||||
|
||||
#### nodejs - Authentication, client creation and list networkExperimentProfiles as an example written in TypeScript.
|
||||
- If you are writing a client side browser application,
|
||||
- Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
|
||||
- Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
|
||||
- If you are writing a server side application,
|
||||
- [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
|
||||
- Complete the set up steps required by the credential if any.
|
||||
- Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
|
||||
|
||||
##### Install @azure/ms-rest-nodeauth
|
||||
In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
|
||||
Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
|
||||
|
||||
- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
|
||||
```bash
|
||||
npm install @azure/ms-rest-nodeauth@"^3.0.0"
|
||||
```
|
||||
#### nodejs - Authentication, client creation, and list networkExperimentProfiles as an example written in JavaScript.
|
||||
|
||||
##### Sample code
|
||||
|
||||
```typescript
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import * as msRestAzure from "@azure/ms-rest-azure-js";
|
||||
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
|
||||
import { FrontDoorManagementClient, FrontDoorManagementModels, FrontDoorManagementMappers } from "@azure/arm-frontdoor";
|
||||
```javascript
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
const { FrontDoorManagementClient } = require("@azure/arm-frontdoor");
|
||||
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
|
||||
|
||||
msRestNodeAuth.interactiveLogin().then((creds) => {
|
||||
const client = new FrontDoorManagementClient(creds, subscriptionId);
|
||||
client.networkExperimentProfiles.list().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
});
|
||||
// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
|
||||
// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
|
||||
const creds = new DefaultAzureCredential();
|
||||
const client = new FrontDoorManagementClient(creds, subscriptionId);
|
||||
|
||||
client.networkExperimentProfiles.list().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
```
|
||||
|
||||
#### browser - Authentication, client creation and list networkExperimentProfiles as an example written in JavaScript.
|
||||
#### browser - Authentication, client creation, and list networkExperimentProfiles as an example written in JavaScript.
|
||||
|
||||
##### Install @azure/ms-rest-browserauth
|
||||
|
||||
```bash
|
||||
npm install @azure/ms-rest-browserauth
|
||||
```
|
||||
In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
|
||||
- See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
|
||||
- Note down the client Id from the previous step and use it in the browser sample below.
|
||||
|
||||
##### Sample code
|
||||
|
||||
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
|
||||
|
||||
- index.html
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>@azure/arm-frontdoor sample</title>
|
||||
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
|
||||
<script src="node_modules/@azure/identity/dist/index.js"></script>
|
||||
<script src="node_modules/@azure/arm-frontdoor/dist/arm-frontdoor.js"></script>
|
||||
<script type="text/javascript">
|
||||
const subscriptionId = "<Subscription_Id>";
|
||||
const authManager = new msAuth.AuthManager({
|
||||
// Create credentials using the `@azure/identity` package.
|
||||
// Please note that you can also use credentials from the `@azure/ms-rest-browserauth` package instead.
|
||||
const credential = new InteractiveBrowserCredential(
|
||||
{
|
||||
clientId: "<client id for your Azure AD app>",
|
||||
tenant: "<optional tenant for your organization>"
|
||||
tenantId: "<optional tenant for your organization>"
|
||||
});
|
||||
authManager.finalizeLogin().then((res) => {
|
||||
if (!res.isLoggedIn) {
|
||||
// may cause redirects
|
||||
authManager.login();
|
||||
}
|
||||
const client = new Azure.ArmFrontdoor.FrontDoorManagementClient(res.creds, subscriptionId);
|
||||
client.networkExperimentProfiles.list().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
const client = new Azure.ArmFrontdoor.FrontDoorManagementClient(creds, subscriptionId);
|
||||
client.networkExperimentProfiles.list().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
"name": "@azure/arm-frontdoor",
|
||||
"author": "Microsoft Corporation",
|
||||
"description": "FrontDoorManagementClient Library with typescript type definitions for node.js and browser.",
|
||||
"version": "4.0.0",
|
||||
"version": "4.1.0",
|
||||
"dependencies": {
|
||||
"@azure/ms-rest-azure-js": "^2.0.1",
|
||||
"@azure/ms-rest-js": "^2.0.4",
|
||||
"@azure/ms-rest-azure-js": "^2.1.0",
|
||||
"@azure/ms-rest-js": "^2.2.0",
|
||||
"@azure/core-auth": "^1.1.4",
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"keywords": [
|
||||
|
@ -20,7 +21,7 @@
|
|||
"module": "./esm/frontDoorManagementClient.js",
|
||||
"types": "./esm/frontDoorManagementClient.d.ts",
|
||||
"devDependencies": {
|
||||
"typescript": "^3.5.3",
|
||||
"typescript": "^3.6.0",
|
||||
"rollup": "^1.18.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"rollup-plugin-sourcemaps": "^0.4.2",
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
import * as Models from "./models";
|
||||
import * as Mappers from "./models/mappers";
|
||||
import * as Parameters from "./models/parameters";
|
||||
|
@ -31,12 +32,17 @@ class FrontDoorManagementClient extends FrontDoorManagementClientContext {
|
|||
|
||||
/**
|
||||
* Initializes a new instance of the FrontDoorManagementClient class.
|
||||
* @param credentials Credentials needed for the client to connect to Azure.
|
||||
* @param credentials Credentials needed for the client to connect to Azure. Credentials
|
||||
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
|
||||
* more information about these credentials, see
|
||||
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
|
||||
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
|
||||
* @azure/ms-rest-browserauth are also supported.
|
||||
* @param subscriptionId The subscription credentials which uniquely identify the Microsoft Azure
|
||||
* subscription. The subscription ID forms part of the URI for every service call.
|
||||
* @param [options] The parameter options
|
||||
*/
|
||||
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.FrontDoorManagementClientOptions) {
|
||||
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.FrontDoorManagementClientOptions) {
|
||||
super(credentials, subscriptionId, options);
|
||||
this.networkExperimentProfiles = new operations.NetworkExperimentProfiles(this);
|
||||
this.preconfiguredEndpoints = new operations.PreconfiguredEndpoints(this);
|
||||
|
|
|
@ -10,23 +10,29 @@
|
|||
|
||||
import * as Models from "./models";
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
import * as msRestAzure from "@azure/ms-rest-azure-js";
|
||||
|
||||
const packageName = "@azure/arm-frontdoor";
|
||||
const packageVersion = "4.0.0";
|
||||
const packageVersion = "4.1.0";
|
||||
|
||||
export class FrontDoorManagementClientContext extends msRestAzure.AzureServiceClient {
|
||||
credentials: msRest.ServiceClientCredentials;
|
||||
credentials: msRest.ServiceClientCredentials | TokenCredential;
|
||||
subscriptionId: string;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the FrontDoorManagementClient class.
|
||||
* @param credentials Credentials needed for the client to connect to Azure.
|
||||
* @param credentials Credentials needed for the client to connect to Azure. Credentials
|
||||
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
|
||||
* more information about these credentials, see
|
||||
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
|
||||
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
|
||||
* @azure/ms-rest-browserauth are also supported.
|
||||
* @param subscriptionId The subscription credentials which uniquely identify the Microsoft Azure
|
||||
* subscription. The subscription ID forms part of the URI for every service call.
|
||||
* @param [options] The parameter options
|
||||
*/
|
||||
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.FrontDoorManagementClientOptions) {
|
||||
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.FrontDoorManagementClientOptions) {
|
||||
if (credentials == undefined) {
|
||||
throw new Error('\'credentials\' cannot be null.');
|
||||
}
|
||||
|
|
|
@ -1,90 +1,100 @@
|
|||
## Azure HanaManagementClient SDK for JavaScript
|
||||
|
||||
This package contains an isomorphic SDK for HanaManagementClient.
|
||||
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for HanaManagementClient.
|
||||
|
||||
### Currently supported environments
|
||||
|
||||
- Node.js version 6.x.x or higher
|
||||
- Browser JavaScript
|
||||
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
|
||||
- Latest versions of Safari, Chrome, Edge, and Firefox.
|
||||
|
||||
### How to Install
|
||||
### Prerequisites
|
||||
|
||||
You must have an [Azure subscription](https://azure.microsoft.com/free/).
|
||||
|
||||
### How to install
|
||||
|
||||
To use this SDK in your project, you will need to install two packages.
|
||||
- `@azure/arm-hanaonazure` that contains the client.
|
||||
- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
|
||||
|
||||
Install both packages using the below command:
|
||||
```bash
|
||||
npm install @azure/arm-hanaonazure
|
||||
npm install --save @azure/arm-hanaonazure @azure/identity
|
||||
```
|
||||
|
||||
> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
|
||||
If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
|
||||
|
||||
### How to use
|
||||
|
||||
#### nodejs - Authentication, client creation and list operations as an example written in TypeScript.
|
||||
- If you are writing a client side browser application,
|
||||
- Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
|
||||
- Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
|
||||
- If you are writing a server side application,
|
||||
- [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
|
||||
- Complete the set up steps required by the credential if any.
|
||||
- Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
|
||||
|
||||
##### Install @azure/ms-rest-nodeauth
|
||||
In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
|
||||
Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
|
||||
|
||||
- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
|
||||
```bash
|
||||
npm install @azure/ms-rest-nodeauth@"^3.0.0"
|
||||
```
|
||||
#### nodejs - Authentication, client creation, and list operations as an example written in JavaScript.
|
||||
|
||||
##### Sample code
|
||||
|
||||
```typescript
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import * as msRestAzure from "@azure/ms-rest-azure-js";
|
||||
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
|
||||
import { HanaManagementClient, HanaManagementModels, HanaManagementMappers } from "@azure/arm-hanaonazure";
|
||||
```javascript
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
const { HanaManagementClient } = require("@azure/arm-hanaonazure");
|
||||
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
|
||||
|
||||
msRestNodeAuth.interactiveLogin().then((creds) => {
|
||||
const client = new HanaManagementClient(creds, subscriptionId);
|
||||
client.operations.list().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
});
|
||||
// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
|
||||
// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
|
||||
const creds = new DefaultAzureCredential();
|
||||
const client = new HanaManagementClient(creds, subscriptionId);
|
||||
|
||||
client.operations.list().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
```
|
||||
|
||||
#### browser - Authentication, client creation and list operations as an example written in JavaScript.
|
||||
#### browser - Authentication, client creation, and list operations as an example written in JavaScript.
|
||||
|
||||
##### Install @azure/ms-rest-browserauth
|
||||
|
||||
```bash
|
||||
npm install @azure/ms-rest-browserauth
|
||||
```
|
||||
In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
|
||||
- See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
|
||||
- Note down the client Id from the previous step and use it in the browser sample below.
|
||||
|
||||
##### Sample code
|
||||
|
||||
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
|
||||
|
||||
- index.html
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>@azure/arm-hanaonazure sample</title>
|
||||
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
|
||||
<script src="node_modules/@azure/identity/dist/index.js"></script>
|
||||
<script src="node_modules/@azure/arm-hanaonazure/dist/arm-hanaonazure.js"></script>
|
||||
<script type="text/javascript">
|
||||
const subscriptionId = "<Subscription_Id>";
|
||||
const authManager = new msAuth.AuthManager({
|
||||
// Create credentials using the `@azure/identity` package.
|
||||
// Please note that you can also use credentials from the `@azure/ms-rest-browserauth` package instead.
|
||||
const credential = new InteractiveBrowserCredential(
|
||||
{
|
||||
clientId: "<client id for your Azure AD app>",
|
||||
tenant: "<optional tenant for your organization>"
|
||||
tenantId: "<optional tenant for your organization>"
|
||||
});
|
||||
authManager.finalizeLogin().then((res) => {
|
||||
if (!res.isLoggedIn) {
|
||||
// may cause redirects
|
||||
authManager.login();
|
||||
}
|
||||
const client = new Azure.ArmHanaonazure.HanaManagementClient(res.creds, subscriptionId);
|
||||
client.operations.list().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
const client = new Azure.ArmHanaonazure.HanaManagementClient(creds, subscriptionId);
|
||||
client.operations.list().then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
"name": "@azure/arm-hanaonazure",
|
||||
"author": "Microsoft Corporation",
|
||||
"description": "HanaManagementClient Library with typescript type definitions for node.js and browser.",
|
||||
"version": "3.0.0",
|
||||
"version": "3.1.0",
|
||||
"dependencies": {
|
||||
"@azure/ms-rest-azure-js": "^2.0.1",
|
||||
"@azure/ms-rest-js": "^2.0.4",
|
||||
"@azure/ms-rest-azure-js": "^2.1.0",
|
||||
"@azure/ms-rest-js": "^2.2.0",
|
||||
"@azure/core-auth": "^1.1.4",
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"keywords": [
|
||||
|
@ -20,7 +21,7 @@
|
|||
"module": "./esm/hanaManagementClient.js",
|
||||
"types": "./esm/hanaManagementClient.d.ts",
|
||||
"devDependencies": {
|
||||
"typescript": "^3.5.3",
|
||||
"typescript": "^3.6.0",
|
||||
"rollup": "^1.18.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"rollup-plugin-sourcemaps": "^0.4.2",
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
import * as Models from "./models";
|
||||
import * as Mappers from "./models/mappers";
|
||||
import * as operations from "./operations";
|
||||
|
@ -23,12 +24,17 @@ class HanaManagementClient extends HanaManagementClientContext {
|
|||
|
||||
/**
|
||||
* Initializes a new instance of the HanaManagementClient class.
|
||||
* @param credentials Credentials needed for the client to connect to Azure.
|
||||
* @param credentials Credentials needed for the client to connect to Azure. Credentials
|
||||
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
|
||||
* more information about these credentials, see
|
||||
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
|
||||
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
|
||||
* @azure/ms-rest-browserauth are also supported.
|
||||
* @param subscriptionId Subscription ID which uniquely identify Microsoft Azure subscription. The
|
||||
* subscription ID forms part of the URI for every service call.
|
||||
* @param [options] The parameter options
|
||||
*/
|
||||
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.HanaManagementClientOptions) {
|
||||
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.HanaManagementClientOptions) {
|
||||
super(credentials, subscriptionId, options);
|
||||
this.operations = new operations.Operations(this);
|
||||
this.hanaInstances = new operations.HanaInstances(this);
|
||||
|
|
|
@ -10,24 +10,30 @@
|
|||
|
||||
import * as Models from "./models";
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
import * as msRestAzure from "@azure/ms-rest-azure-js";
|
||||
|
||||
const packageName = "@azure/arm-hanaonazure";
|
||||
const packageVersion = "3.0.0";
|
||||
const packageVersion = "3.1.0";
|
||||
|
||||
export class HanaManagementClientContext extends msRestAzure.AzureServiceClient {
|
||||
credentials: msRest.ServiceClientCredentials;
|
||||
credentials: msRest.ServiceClientCredentials | TokenCredential;
|
||||
subscriptionId: string;
|
||||
apiVersion?: string;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the HanaManagementClient class.
|
||||
* @param credentials Credentials needed for the client to connect to Azure.
|
||||
* @param credentials Credentials needed for the client to connect to Azure. Credentials
|
||||
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
|
||||
* more information about these credentials, see
|
||||
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
|
||||
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
|
||||
* @azure/ms-rest-browserauth are also supported.
|
||||
* @param subscriptionId Subscription ID which uniquely identify Microsoft Azure subscription. The
|
||||
* subscription ID forms part of the URI for every service call.
|
||||
* @param [options] The parameter options
|
||||
*/
|
||||
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.HanaManagementClientOptions) {
|
||||
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.HanaManagementClientOptions) {
|
||||
if (credentials == undefined) {
|
||||
throw new Error('\'credentials\' cannot be null.');
|
||||
}
|
||||
|
|
|
@ -1,93 +1,103 @@
|
|||
## Azure HealthbotClient SDK for JavaScript
|
||||
|
||||
This package contains an isomorphic SDK for HealthbotClient.
|
||||
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for HealthbotClient.
|
||||
|
||||
### Currently supported environments
|
||||
|
||||
- Node.js version 6.x.x or higher
|
||||
- Browser JavaScript
|
||||
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
|
||||
- Latest versions of Safari, Chrome, Edge, and Firefox.
|
||||
|
||||
### How to Install
|
||||
### Prerequisites
|
||||
|
||||
You must have an [Azure subscription](https://azure.microsoft.com/free/).
|
||||
|
||||
### How to install
|
||||
|
||||
To use this SDK in your project, you will need to install two packages.
|
||||
- `@azure/arm-healthbot` that contains the client.
|
||||
- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
|
||||
|
||||
Install both packages using the below command:
|
||||
```bash
|
||||
npm install @azure/arm-healthbot
|
||||
npm install --save @azure/arm-healthbot @azure/identity
|
||||
```
|
||||
|
||||
> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
|
||||
If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
|
||||
|
||||
### How to use
|
||||
|
||||
#### nodejs - client creation and get bots as an example written in TypeScript.
|
||||
- If you are writing a client side browser application,
|
||||
- Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
|
||||
- Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
|
||||
- If you are writing a server side application,
|
||||
- [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
|
||||
- Complete the set up steps required by the credential if any.
|
||||
- Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
|
||||
|
||||
##### Install @azure/ms-rest-nodeauth
|
||||
In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
|
||||
Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
|
||||
|
||||
- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
|
||||
```bash
|
||||
npm install @azure/ms-rest-nodeauth@"^3.0.0"
|
||||
```
|
||||
#### nodejs - Authentication, client creation, and get bots as an example written in JavaScript.
|
||||
|
||||
##### Sample code
|
||||
|
||||
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
|
||||
```typescript
|
||||
const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
|
||||
```javascript
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
const { HealthbotClient } = require("@azure/arm-healthbot");
|
||||
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
|
||||
|
||||
msRestNodeAuth.interactiveLogin().then((creds) => {
|
||||
const client = new HealthbotClient(creds, subscriptionId);
|
||||
const resourceGroupName = "testresourceGroupName";
|
||||
const botName = "testbotName";
|
||||
client.bots.get(resourceGroupName, botName).then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
});
|
||||
// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
|
||||
// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
|
||||
const creds = new DefaultAzureCredential();
|
||||
const client = new HealthbotClient(creds, subscriptionId);
|
||||
const resourceGroupName = "testresourceGroupName";
|
||||
const botName = "testbotName";
|
||||
client.bots.get(resourceGroupName, botName).then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
```
|
||||
|
||||
#### browser - Authentication, client creation and get bots as an example written in JavaScript.
|
||||
#### browser - Authentication, client creation, and get bots as an example written in JavaScript.
|
||||
|
||||
##### Install @azure/ms-rest-browserauth
|
||||
|
||||
```bash
|
||||
npm install @azure/ms-rest-browserauth
|
||||
```
|
||||
In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
|
||||
- See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
|
||||
- Note down the client Id from the previous step and use it in the browser sample below.
|
||||
|
||||
##### Sample code
|
||||
|
||||
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
|
||||
|
||||
- index.html
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>@azure/arm-healthbot sample</title>
|
||||
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
|
||||
<script src="node_modules/@azure/identity/dist/index.js"></script>
|
||||
<script src="node_modules/@azure/arm-healthbot/dist/arm-healthbot.js"></script>
|
||||
<script type="text/javascript">
|
||||
const subscriptionId = "<Subscription_Id>";
|
||||
const authManager = new msAuth.AuthManager({
|
||||
// Create credentials using the `@azure/identity` package.
|
||||
// Please note that you can also use credentials from the `@azure/ms-rest-browserauth` package instead.
|
||||
const credential = new InteractiveBrowserCredential(
|
||||
{
|
||||
clientId: "<client id for your Azure AD app>",
|
||||
tenant: "<optional tenant for your organization>"
|
||||
tenantId: "<optional tenant for your organization>"
|
||||
});
|
||||
authManager.finalizeLogin().then((res) => {
|
||||
if (!res.isLoggedIn) {
|
||||
// may cause redirects
|
||||
authManager.login();
|
||||
}
|
||||
const client = new Azure.ArmHealthbot.HealthbotClient(res.creds, subscriptionId);
|
||||
const resourceGroupName = "testresourceGroupName";
|
||||
const botName = "testbotName";
|
||||
client.bots.get(resourceGroupName, botName).then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
const client = new Azure.ArmHealthbot.HealthbotClient(creds, subscriptionId);
|
||||
const resourceGroupName = "testresourceGroupName";
|
||||
const botName = "testbotName";
|
||||
client.bots.get(resourceGroupName, botName).then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
"name": "@azure/arm-healthbot",
|
||||
"author": "Microsoft Corporation",
|
||||
"description": "HealthbotClient Library with typescript type definitions for node.js and browser.",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"dependencies": {
|
||||
"@azure/ms-rest-azure-js": "^2.0.1",
|
||||
"@azure/ms-rest-js": "^2.0.4",
|
||||
"@azure/ms-rest-azure-js": "^2.1.0",
|
||||
"@azure/ms-rest-js": "^2.2.0",
|
||||
"@azure/core-auth": "^1.1.4",
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"keywords": [
|
||||
|
@ -20,7 +21,7 @@
|
|||
"module": "./esm/healthbotClient.js",
|
||||
"types": "./esm/healthbotClient.d.ts",
|
||||
"devDependencies": {
|
||||
"typescript": "^3.5.3",
|
||||
"typescript": "^3.6.0",
|
||||
"rollup": "^1.18.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"rollup-plugin-sourcemaps": "^0.4.2",
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
import * as Models from "./models";
|
||||
import * as Mappers from "./models/mappers";
|
||||
import * as operations from "./operations";
|
||||
|
@ -21,11 +22,16 @@ class HealthbotClient extends HealthbotClientContext {
|
|||
|
||||
/**
|
||||
* Initializes a new instance of the HealthbotClient class.
|
||||
* @param credentials Credentials needed for the client to connect to Azure.
|
||||
* @param credentials Credentials needed for the client to connect to Azure. Credentials
|
||||
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
|
||||
* more information about these credentials, see
|
||||
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
|
||||
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
|
||||
* @azure/ms-rest-browserauth are also supported.
|
||||
* @param subscriptionId Azure Subscription ID.
|
||||
* @param [options] The parameter options
|
||||
*/
|
||||
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.HealthbotClientOptions) {
|
||||
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.HealthbotClientOptions) {
|
||||
super(credentials, subscriptionId, options);
|
||||
this.bots = new operations.Bots(this);
|
||||
this.operations = new operations.Operations(this);
|
||||
|
|
|
@ -9,23 +9,29 @@
|
|||
|
||||
import * as Models from "./models";
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
import * as msRestAzure from "@azure/ms-rest-azure-js";
|
||||
|
||||
const packageName = "@azure/arm-healthbot";
|
||||
const packageVersion = "1.0.0";
|
||||
const packageVersion = "1.1.0";
|
||||
|
||||
export class HealthbotClientContext extends msRestAzure.AzureServiceClient {
|
||||
credentials: msRest.ServiceClientCredentials;
|
||||
credentials: msRest.ServiceClientCredentials | TokenCredential;
|
||||
subscriptionId: string;
|
||||
apiVersion?: string;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the HealthbotClient class.
|
||||
* @param credentials Credentials needed for the client to connect to Azure.
|
||||
* @param credentials Credentials needed for the client to connect to Azure. Credentials
|
||||
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
|
||||
* more information about these credentials, see
|
||||
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
|
||||
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
|
||||
* @azure/ms-rest-browserauth are also supported.
|
||||
* @param subscriptionId Azure Subscription ID.
|
||||
* @param [options] The parameter options
|
||||
*/
|
||||
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.HealthbotClientOptions) {
|
||||
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.HealthbotClientOptions) {
|
||||
if (credentials == undefined) {
|
||||
throw new Error('\'credentials\' cannot be null.');
|
||||
}
|
||||
|
|
|
@ -1,94 +1,103 @@
|
|||
## Azure HealthcareApisManagementClient SDK for JavaScript
|
||||
|
||||
This package contains an isomorphic SDK for HealthcareApisManagementClient.
|
||||
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for HealthcareApisManagementClient.
|
||||
|
||||
### Currently supported environments
|
||||
|
||||
- Node.js version 6.x.x or higher
|
||||
- Browser JavaScript
|
||||
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
|
||||
- Latest versions of Safari, Chrome, Edge, and Firefox.
|
||||
|
||||
### How to Install
|
||||
### Prerequisites
|
||||
|
||||
You must have an [Azure subscription](https://azure.microsoft.com/free/).
|
||||
|
||||
### How to install
|
||||
|
||||
To use this SDK in your project, you will need to install two packages.
|
||||
- `@azure/arm-healthcareapis` that contains the client.
|
||||
- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
|
||||
|
||||
Install both packages using the below command:
|
||||
```bash
|
||||
npm install @azure/arm-healthcareapis
|
||||
npm install --save @azure/arm-healthcareapis @azure/identity
|
||||
```
|
||||
|
||||
> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
|
||||
If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
|
||||
|
||||
### How to use
|
||||
|
||||
#### nodejs - Authentication, client creation and get services as an example written in TypeScript.
|
||||
- If you are writing a client side browser application,
|
||||
- Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
|
||||
- Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
|
||||
- If you are writing a server side application,
|
||||
- [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
|
||||
- Complete the set up steps required by the credential if any.
|
||||
- Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
|
||||
|
||||
##### Install @azure/ms-rest-nodeauth
|
||||
In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
|
||||
Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
|
||||
|
||||
- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
|
||||
```bash
|
||||
npm install @azure/ms-rest-nodeauth@"^3.0.0"
|
||||
```
|
||||
#### nodejs - Authentication, client creation, and get services as an example written in JavaScript.
|
||||
|
||||
##### Sample code
|
||||
|
||||
```typescript
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import * as msRestAzure from "@azure/ms-rest-azure-js";
|
||||
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
|
||||
import { HealthcareApisManagementClient, HealthcareApisManagementModels, HealthcareApisManagementMappers } from "@azure/arm-healthcareapis";
|
||||
```javascript
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
const { HealthcareApisManagementClient } = require("@azure/arm-healthcareapis");
|
||||
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
|
||||
|
||||
msRestNodeAuth.interactiveLogin().then((creds) => {
|
||||
const client = new HealthcareApisManagementClient(creds, subscriptionId);
|
||||
const resourceGroupName = "testresourceGroupName";
|
||||
const resourceName = "testresourceName";
|
||||
client.services.get(resourceGroupName, resourceName).then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
});
|
||||
// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
|
||||
// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
|
||||
const creds = new DefaultAzureCredential();
|
||||
const client = new HealthcareApisManagementClient(creds, subscriptionId);
|
||||
const resourceGroupName = "testresourceGroupName";
|
||||
const resourceName = "testresourceName";
|
||||
client.services.get(resourceGroupName, resourceName).then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
```
|
||||
|
||||
#### browser - Authentication, client creation and get services as an example written in JavaScript.
|
||||
#### browser - Authentication, client creation, and get services as an example written in JavaScript.
|
||||
|
||||
##### Install @azure/ms-rest-browserauth
|
||||
|
||||
```bash
|
||||
npm install @azure/ms-rest-browserauth
|
||||
```
|
||||
In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
|
||||
- See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
|
||||
- Note down the client Id from the previous step and use it in the browser sample below.
|
||||
|
||||
##### Sample code
|
||||
|
||||
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
|
||||
|
||||
- index.html
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>@azure/arm-healthcareapis sample</title>
|
||||
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
|
||||
<script src="node_modules/@azure/identity/dist/index.js"></script>
|
||||
<script src="node_modules/@azure/arm-healthcareapis/dist/arm-healthcareapis.js"></script>
|
||||
<script type="text/javascript">
|
||||
const subscriptionId = "<Subscription_Id>";
|
||||
const authManager = new msAuth.AuthManager({
|
||||
// Create credentials using the `@azure/identity` package.
|
||||
// Please note that you can also use credentials from the `@azure/ms-rest-browserauth` package instead.
|
||||
const credential = new InteractiveBrowserCredential(
|
||||
{
|
||||
clientId: "<client id for your Azure AD app>",
|
||||
tenant: "<optional tenant for your organization>"
|
||||
tenantId: "<optional tenant for your organization>"
|
||||
});
|
||||
authManager.finalizeLogin().then((res) => {
|
||||
if (!res.isLoggedIn) {
|
||||
// may cause redirects
|
||||
authManager.login();
|
||||
}
|
||||
const client = new Azure.ArmHealthcareapis.HealthcareApisManagementClient(res.creds, subscriptionId);
|
||||
const resourceGroupName = "testresourceGroupName";
|
||||
const resourceName = "testresourceName";
|
||||
client.services.get(resourceGroupName, resourceName).then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
const client = new Azure.ArmHealthcareapis.HealthcareApisManagementClient(creds, subscriptionId);
|
||||
const resourceGroupName = "testresourceGroupName";
|
||||
const resourceName = "testresourceName";
|
||||
client.services.get(resourceGroupName, resourceName).then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
"name": "@azure/arm-healthcareapis",
|
||||
"author": "Microsoft Corporation",
|
||||
"description": "HealthcareApisManagementClient Library with typescript type definitions for node.js and browser.",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"dependencies": {
|
||||
"@azure/ms-rest-azure-js": "^2.0.1",
|
||||
"@azure/ms-rest-js": "^2.0.4",
|
||||
"@azure/ms-rest-azure-js": "^2.1.0",
|
||||
"@azure/ms-rest-js": "^2.2.0",
|
||||
"@azure/core-auth": "^1.1.4",
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"keywords": [
|
||||
|
@ -20,7 +21,7 @@
|
|||
"module": "./esm/healthcareApisManagementClient.js",
|
||||
"types": "./esm/healthcareApisManagementClient.d.ts",
|
||||
"devDependencies": {
|
||||
"typescript": "^3.5.3",
|
||||
"typescript": "^3.6.0",
|
||||
"rollup": "^1.18.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"rollup-plugin-sourcemaps": "^0.4.2",
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
import * as Models from "./models";
|
||||
import * as Mappers from "./models/mappers";
|
||||
import * as operations from "./operations";
|
||||
|
@ -25,11 +26,16 @@ class HealthcareApisManagementClient extends HealthcareApisManagementClientConte
|
|||
|
||||
/**
|
||||
* Initializes a new instance of the HealthcareApisManagementClient class.
|
||||
* @param credentials Credentials needed for the client to connect to Azure.
|
||||
* @param credentials Credentials needed for the client to connect to Azure. Credentials
|
||||
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
|
||||
* more information about these credentials, see
|
||||
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
|
||||
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
|
||||
* @azure/ms-rest-browserauth are also supported.
|
||||
* @param subscriptionId The subscription identifier.
|
||||
* @param [options] The parameter options
|
||||
*/
|
||||
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.HealthcareApisManagementClientOptions) {
|
||||
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.HealthcareApisManagementClientOptions) {
|
||||
super(credentials, subscriptionId, options);
|
||||
this.services = new operations.Services(this);
|
||||
this.operations = new operations.Operations(this);
|
||||
|
|
|
@ -10,23 +10,29 @@
|
|||
|
||||
import * as Models from "./models";
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
import * as msRestAzure from "@azure/ms-rest-azure-js";
|
||||
|
||||
const packageName = "@azure/arm-healthcareapis";
|
||||
const packageVersion = "1.0.0";
|
||||
const packageVersion = "1.1.0";
|
||||
|
||||
export class HealthcareApisManagementClientContext extends msRestAzure.AzureServiceClient {
|
||||
credentials: msRest.ServiceClientCredentials;
|
||||
credentials: msRest.ServiceClientCredentials | TokenCredential;
|
||||
subscriptionId: string;
|
||||
apiVersion?: string;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the HealthcareApisManagementClient class.
|
||||
* @param credentials Credentials needed for the client to connect to Azure.
|
||||
* @param credentials Credentials needed for the client to connect to Azure. Credentials
|
||||
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
|
||||
* more information about these credentials, see
|
||||
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
|
||||
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
|
||||
* @azure/ms-rest-browserauth are also supported.
|
||||
* @param subscriptionId The subscription identifier.
|
||||
* @param [options] The parameter options
|
||||
*/
|
||||
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.HealthcareApisManagementClientOptions) {
|
||||
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.HealthcareApisManagementClientOptions) {
|
||||
if (credentials == undefined) {
|
||||
throw new Error('\'credentials\' cannot be null.');
|
||||
}
|
||||
|
|
|
@ -1,96 +1,105 @@
|
|||
## Azure HybridComputeManagementClient SDK for JavaScript
|
||||
|
||||
This package contains an isomorphic SDK for HybridComputeManagementClient.
|
||||
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for HybridComputeManagementClient.
|
||||
|
||||
### Currently supported environments
|
||||
|
||||
- Node.js version 6.x.x or higher
|
||||
- Browser JavaScript
|
||||
- [LTS versions of Node.js](https://nodejs.org/about/releases/)
|
||||
- Latest versions of Safari, Chrome, Edge, and Firefox.
|
||||
|
||||
### How to Install
|
||||
### Prerequisites
|
||||
|
||||
You must have an [Azure subscription](https://azure.microsoft.com/free/).
|
||||
|
||||
### How to install
|
||||
|
||||
To use this SDK in your project, you will need to install two packages.
|
||||
- `@azure/arm-hybridcompute` that contains the client.
|
||||
- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory.
|
||||
|
||||
Install both packages using the below command:
|
||||
```bash
|
||||
npm install @azure/arm-hybridcompute
|
||||
npm install --save @azure/arm-hybridcompute @azure/identity
|
||||
```
|
||||
|
||||
> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
|
||||
If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.
|
||||
|
||||
### How to use
|
||||
|
||||
#### nodejs - Authentication, client creation and get machines as an example written in TypeScript.
|
||||
- If you are writing a client side browser application,
|
||||
- Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions.
|
||||
- Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below.
|
||||
- If you are writing a server side application,
|
||||
- [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples)
|
||||
- Complete the set up steps required by the credential if any.
|
||||
- Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below.
|
||||
|
||||
##### Install @azure/ms-rest-nodeauth
|
||||
In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
|
||||
Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.
|
||||
|
||||
- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
|
||||
```bash
|
||||
npm install @azure/ms-rest-nodeauth@"^3.0.0"
|
||||
```
|
||||
#### nodejs - Authentication, client creation, and get machines as an example written in JavaScript.
|
||||
|
||||
##### Sample code
|
||||
|
||||
```typescript
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import * as msRestAzure from "@azure/ms-rest-azure-js";
|
||||
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
|
||||
import { HybridComputeManagementClient, HybridComputeManagementModels, HybridComputeManagementMappers } from "@azure/arm-hybridcompute";
|
||||
```javascript
|
||||
const { DefaultAzureCredential } = require("@azure/identity");
|
||||
const { HybridComputeManagementClient } = require("@azure/arm-hybridcompute");
|
||||
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
|
||||
|
||||
msRestNodeAuth.interactiveLogin().then((creds) => {
|
||||
const client = new HybridComputeManagementClient(creds, subscriptionId);
|
||||
const resourceGroupName = "testresourceGroupName";
|
||||
const name = "testname";
|
||||
const expand = "instanceView";
|
||||
client.machines.get(resourceGroupName, name, expand).then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
});
|
||||
// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples
|
||||
// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
|
||||
const creds = new DefaultAzureCredential();
|
||||
const client = new HybridComputeManagementClient(creds, subscriptionId);
|
||||
const resourceGroupName = "testresourceGroupName";
|
||||
const name = "testname";
|
||||
const expand = "instanceView";
|
||||
client.machines.get(resourceGroupName, name, expand).then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
```
|
||||
|
||||
#### browser - Authentication, client creation and get machines as an example written in JavaScript.
|
||||
#### browser - Authentication, client creation, and get machines as an example written in JavaScript.
|
||||
|
||||
##### Install @azure/ms-rest-browserauth
|
||||
|
||||
```bash
|
||||
npm install @azure/ms-rest-browserauth
|
||||
```
|
||||
In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser.
|
||||
- See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser.
|
||||
- Note down the client Id from the previous step and use it in the browser sample below.
|
||||
|
||||
##### Sample code
|
||||
|
||||
See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.
|
||||
|
||||
- index.html
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>@azure/arm-hybridcompute sample</title>
|
||||
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
|
||||
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
|
||||
<script src="node_modules/@azure/identity/dist/index.js"></script>
|
||||
<script src="node_modules/@azure/arm-hybridcompute/dist/arm-hybridcompute.js"></script>
|
||||
<script type="text/javascript">
|
||||
const subscriptionId = "<Subscription_Id>";
|
||||
const authManager = new msAuth.AuthManager({
|
||||
// Create credentials using the `@azure/identity` package.
|
||||
// Please note that you can also use credentials from the `@azure/ms-rest-browserauth` package instead.
|
||||
const credential = new InteractiveBrowserCredential(
|
||||
{
|
||||
clientId: "<client id for your Azure AD app>",
|
||||
tenant: "<optional tenant for your organization>"
|
||||
tenantId: "<optional tenant for your organization>"
|
||||
});
|
||||
authManager.finalizeLogin().then((res) => {
|
||||
if (!res.isLoggedIn) {
|
||||
// may cause redirects
|
||||
authManager.login();
|
||||
}
|
||||
const client = new Azure.ArmHybridcompute.HybridComputeManagementClient(res.creds, subscriptionId);
|
||||
const resourceGroupName = "testresourceGroupName";
|
||||
const name = "testname";
|
||||
const expand = "instanceView";
|
||||
client.machines.get(resourceGroupName, name, expand).then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
const client = new Azure.ArmHybridcompute.HybridComputeManagementClient(creds, subscriptionId);
|
||||
const resourceGroupName = "testresourceGroupName";
|
||||
const name = "testname";
|
||||
const expand = "instanceView";
|
||||
client.machines.get(resourceGroupName, name, expand).then((result) => {
|
||||
console.log("The result is:");
|
||||
console.log(result);
|
||||
}).catch((err) => {
|
||||
console.log("An error occurred:");
|
||||
console.error(err);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
"name": "@azure/arm-hybridcompute",
|
||||
"author": "Microsoft Corporation",
|
||||
"description": "HybridComputeManagementClient Library with typescript type definitions for node.js and browser.",
|
||||
"version": "2.0.0",
|
||||
"version": "2.1.0",
|
||||
"dependencies": {
|
||||
"@azure/ms-rest-azure-js": "^2.0.1",
|
||||
"@azure/ms-rest-js": "^2.0.4",
|
||||
"@azure/ms-rest-azure-js": "^2.1.0",
|
||||
"@azure/ms-rest-js": "^2.2.0",
|
||||
"@azure/core-auth": "^1.1.4",
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"keywords": [
|
||||
|
@ -20,7 +21,7 @@
|
|||
"module": "./esm/hybridComputeManagementClient.js",
|
||||
"types": "./esm/hybridComputeManagementClient.d.ts",
|
||||
"devDependencies": {
|
||||
"typescript": "^3.5.3",
|
||||
"typescript": "^3.6.0",
|
||||
"rollup": "^1.18.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"rollup-plugin-sourcemaps": "^0.4.2",
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
import * as Models from "./models";
|
||||
import * as Mappers from "./models/mappers";
|
||||
import * as operations from "./operations";
|
||||
|
@ -23,12 +24,17 @@ class HybridComputeManagementClient extends HybridComputeManagementClientContext
|
|||
|
||||
/**
|
||||
* Initializes a new instance of the HybridComputeManagementClient class.
|
||||
* @param credentials Credentials needed for the client to connect to Azure.
|
||||
* @param credentials Credentials needed for the client to connect to Azure. Credentials
|
||||
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
|
||||
* more information about these credentials, see
|
||||
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
|
||||
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
|
||||
* @azure/ms-rest-browserauth are also supported.
|
||||
* @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure
|
||||
* subscription. The subscription ID forms part of the URI for every service call.
|
||||
* @param [options] The parameter options
|
||||
*/
|
||||
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.HybridComputeManagementClientOptions) {
|
||||
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.HybridComputeManagementClientOptions) {
|
||||
super(credentials, subscriptionId, options);
|
||||
this.machines = new operations.Machines(this);
|
||||
this.machineExtensions = new operations.MachineExtensions(this);
|
||||
|
|
|
@ -10,24 +10,30 @@
|
|||
|
||||
import * as Models from "./models";
|
||||
import * as msRest from "@azure/ms-rest-js";
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
import * as msRestAzure from "@azure/ms-rest-azure-js";
|
||||
|
||||
const packageName = "@azure/arm-hybridcompute";
|
||||
const packageVersion = "2.0.0";
|
||||
const packageVersion = "2.1.0";
|
||||
|
||||
export class HybridComputeManagementClientContext extends msRestAzure.AzureServiceClient {
|
||||
credentials: msRest.ServiceClientCredentials;
|
||||
credentials: msRest.ServiceClientCredentials | TokenCredential;
|
||||
subscriptionId: string;
|
||||
apiVersion?: string;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the HybridComputeManagementClient class.
|
||||
* @param credentials Credentials needed for the client to connect to Azure.
|
||||
* @param credentials Credentials needed for the client to connect to Azure. Credentials
|
||||
* implementing the TokenCredential interface from the @azure/identity package are recommended. For
|
||||
* more information about these credentials, see
|
||||
* {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
|
||||
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
|
||||
* @azure/ms-rest-browserauth are also supported.
|
||||
* @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure
|
||||
* subscription. The subscription ID forms part of the URI for every service call.
|
||||
* @param [options] The parameter options
|
||||
*/
|
||||
constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.HybridComputeManagementClientOptions) {
|
||||
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.HybridComputeManagementClientOptions) {
|
||||
if (credentials == undefined) {
|
||||
throw new Error('\'credentials\' cannot be null.');
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче