Skip to content

Commit

Permalink
Merge pull request #615 from Azure/daschult/network
Browse files Browse the repository at this point in the history
Regenerate @azure/arm-network, bump version to 0.2.1, add README.md
  • Loading branch information
Dan Schulte authored Nov 30, 2018
2 parents 256a103 + 29979ca commit 60cc241
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 2 deletions.
100 changes: 100 additions & 0 deletions packages/@azure/arm-network/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
## Azure NetworkManagementClient SDK for JavaScript

This package contains an isomorphic SDK for NetworkManagementClient.

### Currently supported environments

- Node.js version 6.x.x or higher
- Browser JavaScript

### How to Install

```bash
npm install @azure/arm-network
```

### How to use

#### nodejs - Authentication, client creation and get applicationGateways as an example written in TypeScript.

##### Install @azure/ms-rest-nodeauth

```bash
npm install @azure/ms-rest-nodeauth
```

##### 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 { NetworkManagementClient, NetworkManagementModels, NetworkManagementMappers } from "@azure/arm-network";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new NetworkManagementClient(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const applicationGatewayName = "testapplicationGatewayName";
client.applicationGateways.get(resourceGroupName, applicationGatewayName).then((result) => {
console.log("The result is:");
console.log(result);
});
}).catch((err) => {
console.error(err);
});
```

#### browser - Authentication, client creation and get applicationGateways as an example written in JavaScript.

##### Install @azure/ms-rest-browserauth

```bash
npm install @azure/ms-rest-browserauth
```

##### 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-network 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/arm-network/dist/arm-network.js"></script>
<script type="text/javascript">
const subscriptionId = "<Subscription_Id>";
const authManager = new msAuth.AuthManager({
clientId: "<client id for your Azure AD app>",
tenant: "<optional tenant for your organization>"
});
authManager.finalizeLogin().then((res) => {
if (!res.isLoggedIn) {
// may cause redirects
authManager.login();
}
const client = new Azure.ArmNetwork.NetworkManagementClient(res.creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const applicationGatewayName = "testapplicationGatewayName";
client.applicationGateways.get(resourceGroupName, applicationGatewayName).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log("An error occurred:");
console.error(err);
});
});
</script>
</head>
<body></body>
</html>
```

## Related projects

- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as msRest from "@azure/ms-rest-js";
import * as msRestAzure from "@azure/ms-rest-azure-js";

const packageName = "@azure/arm-network";
const packageVersion = "0.1.0";
const packageVersion = "0.2.1";

export class NetworkManagementClientContext extends msRestAzure.AzureServiceClient {
credentials: msRest.ServiceClientCredentials;
Expand Down
2 changes: 1 addition & 1 deletion packages/@azure/arm-network/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@azure/arm-network",
"author": "Microsoft Corporation",
"description": "NetworkManagementClient Library with typescript type definitions for node.js and browser.",
"version": "0.2.0",
"version": "0.2.1",
"dependencies": {
"@azure/ms-rest-azure-js": "^1.1.0",
"@azure/ms-rest-js": "^1.1.0",
Expand Down

0 comments on commit 60cc241

Please sign in to comment.