Skip to content

Commit

Permalink
Regenerate arm-consumption
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Schulte committed Oct 15, 2018
1 parent e8e8e3d commit db54a99
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 1,148 deletions.
44 changes: 27 additions & 17 deletions packages/@azure/arm-consumption/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,42 @@ msRestNodeAuth.interactiveLogin().then((creds) => {
```

### browser - Authentication, client creation and list usageDetails as an example written in JavaScript.
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-consumption sample</title>
<script src="node_modules/ms-rest-js/master/msRestBundle.js"></script>
<script src="node_modules/ms-rest-azure-js/master/msRestAzureBundle.js"></script>
<script src="node_modules/@azure/arm-consumption/consumptionManagementClientBundle.js"></script>
<script src="node_modules/ms-rest-js/dist/msRest.browser.js"></script>
<script src="node_modules/ms-rest-azure-js/dist/msRestAzure.js"></script>
<script src="node_modules/ms-rest-browserauth/dist/msAuth.js"></script>
<script src="node_modules/@azure/arm-consumption/dist/arm-consumption.js"></script>
<script>
const subscriptionId = "<Subscription_Id>";
const token = "<access_token>";
const creds = new msRest.TokenCredentials(token);
const client = new ConsumptionManagementClient(creds, undefined, subscriptionId);
const expand = "testexpand";
const filter = "testfilter";
const skiptoken = "testskiptoken";
const top = 1;
const apply = "testapply";
client.usageDetails.list(expand, filter, skiptoken, top, apply).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log('An error ocurred:');
console.error(err);
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.ArmConsumption.ConsumptionManagementClient(res.creds, subscriptionId);
const expand = "testexpand";
const filter = "testfilter";
const skiptoken = "testskiptoken";
const top = 1;
const apply = "testapply";
client.usageDetails.list(expand, filter, skiptoken, top, apply).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log('An error occurred:');
console.error(err);
});
});
</script>
</head>
Expand Down
Loading

0 comments on commit db54a99

Please sign in to comment.