Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

azure-arm-resource

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

azure-arm-resource - npm Package Compare versions

Comparing version 0.10.7 to 1.0.0-preview

lib/authorization/authorizationClient.d.ts

88

lib/resource.js

@@ -16,85 +16,9 @@ //

//
'use strict';
var exports = module.exports;
exports.AuthorizationClient = require('./authorization/authorizationClient');
exports.FeatureClient = require('./feature/featureClient');
exports.SubscriptionClient = require('./subscription/subscriptionClient');
exports.ResourceManagementClient = require('./resource/resourceManagementClient');
var ResourceManagementClient = require('./resourceManagementClient');
exports.ResourceManagementClient = ResourceManagementClient;
/**
* Creates a new {@link ResourceManagementClient} object.
*
* @param {string} [credentials.subscriptionId] The subscription identifier.
* @param {string} [credentials.token] The access token.
* @param {string} [baseUri] The base uri.
* @return {ResourceManagementClient} A new ResourceManagementClient object.
*/
exports.createResourceManagementClient = function (credentials, baseUri) {
return new exports.ResourceManagementClient.ResourceManagementClient(credentials, baseUri);
};
var ResourceSubscriptionClient = require('./subscriptionClient');
exports.ResourceSubscriptionClient = ResourceSubscriptionClient;
/**
* Creates a new {@link ResourceSubscriptionClient} object.
*
* @param {string} [credentials.token] The access token.
* @param {string} [baseUri] The base uri.
* @return {ResourceSubscriptionClient} A new ResourceSubscriptionClient object.
*/
exports.createResourceSubscriptionClient = function (credentials, baseUri) {
return new exports.ResourceSubscriptionClient.SubscriptionClient(credentials, baseUri);
};
var ResourceFeatureClient = require('./featureClient');
exports.ResourceFeatureClient = ResourceFeatureClient;
/**
* Creates a new {@link ResourceFeatureClient} object.
*
* @param {string} [credentials.token] The access token.
* @param {string} [baseUri] The base uri.
* @return {ResourceFeatureClient} A new ResourceFeatureClient object.
*/
exports.createResourceFeatureClient = function (credentials, baseUri) {
return new exports.ResourceFeatureClient.FeatureClient(credentials, baseUri);
};
function getProviderName(resourceType) {
var firstIndex = resourceType.indexOf('/');
var providerName;
if (firstIndex !== -1){
providerName = resourceType.substr(0, firstIndex);
}
return providerName;
}
function getResourceTypeName(resourceType) {
var lastIndex = resourceType.lastIndexOf('/');
var resourceTypeName;
if (lastIndex !== -1){
resourceTypeName = resourceType.substr(lastIndex+1);
}
return resourceTypeName;
}
/**
* Creates a new Resource Identity object.
*
* @param {string} name The resource name
* @param {string} resourceType The resource type.
* @param {string} apiVersion The api version.
* @param {string} [parent] The parent resource.
* @return {object} The resource identity.
*/
exports.createResourceIdentity = function (name, resourceType, apiVersion, parent) {
var identity = {
resourceName: name,
resourceProviderNamespace: getProviderName(resourceType),
resourceProviderApiVersion: apiVersion,
resourceType: getResourceTypeName(resourceType),
parentResourcePath: !!parent ? parent : ''
};
return identity;
};
exports = module.exports;

@@ -5,11 +5,7 @@ {

"contributors": [
"Block, Glenn <gblock@microsoft.com>",
"Cowlishaw, Mark <markcowl@microsoft.com>",
"Dejardin, Louis <loudej@microsoft.com>",
"Georgiev, Yavor <yavorg@microsoft.com>",
"Janczuk, Tomasz <tjanczuk@microsoft.com>",
"Rodrigues, Andre <andrerod@microsoft.com>",
"Tavares, Chris <ctavares@microsoft.com>"
"Wang, Yugang <yugangw@microsoft.com>",
"Zavery, Amar <amzavery@microsoft.com>",
"Srinivasan, Vivek <visriniv@microsoft.com>"
],
"version": "0.10.7",
"version": "1.0.0-preview",
"description": "Microsoft Azure Resource Management Client Library for node",

@@ -26,3 +22,3 @@ "tags": [

"engines": {
"node": ">= 0.6.15"
"node": ">= 0.10.0"
},

@@ -36,4 +32,4 @@ "licenses": [

"dependencies": {
"azure-common": "^0.9.13",
"underscore": "1.4.x"
"ms-rest": "^1.8.0",
"ms-rest-azure": "^1.8.0"
},

@@ -40,0 +36,0 @@ "homepage": "http://github.com/Azure/azure-sdk-for-node",

# Microsoft Azure SDK for Node.js - Resource Management
This project provides a Node.js package that makes it easy to manage Azure resources. Right now it supports:
- **Node.js version: 0.6.15 or higher**
- **API version: 2013-08-01**
- **Node.js version: 0.10.0 or higher**
- **API version: 2015-11-01**

@@ -21,3 +21,9 @@ ## Features

- TODO: Describe tokens
```javascript
var msrestAzure = require('ms-rest-azure');
//user authentication
var credentials = new msRestAzure.UserTokenCredentials('your-client-id', 'your-domain', 'your-username', 'your-password', 'your-redirect-uri');
//service principal authentication
var credentials = new msRestAzure.ApplicationTokenCredentials('your-client-id', 'your-domain', 'your-secret');
```

@@ -27,14 +33,123 @@ ### Create the ResourceManagementClient

```javascript
var fs = require("fs"),
common = require("azure-common"),
resourceManagement = require("azure-arm-resource");
var resourceManagement = require("azure-arm-resource");
var client = new resourceManagement.ResourceManagementClient(credentials, 'your-subscription-id');
```
var resourceManagementClient = resourceManagement.createResourceManagementClient(new common.TokenCloudCredentials({
subscriptionId: "<your subscription id>",
token: "<your token here>"
}));
## Creating a Resource Group
```javascript
var util = require('util');
var groupParameters = {
location: 'West US',
tags: {
tag1: 'val1',
tag2: 'val2'
}
};
var groupName = 'testGroup1';
client.resourceGroups.createOrUpdate(groupName, groupParameters, function (err, result, request, response) {
if (err) {
console.log(err);
/*err has reference to the actual request and response, so you can see what was sent and received on the wire.
The structure of err looks like this:
err: {
code: 'Error Code',
message: 'Error Message',
body: 'The response body if any',
request: reference to a stripped version of http request
response: reference to a stripped version of the response
}
*/
} else {
console.log('result is: ' + util.inspect(result, {depth: null}));
}
});
```
## Create a Generic Resource in a Resource Group
```javascript
var groupName = 'testGroup1';
var resourceName = 'autorestsite102';
var params = { 'location': 'West US', 'properties' : { 'SiteMode': 'Limited', 'ComputeMode': 'Shared' }, 'Name': resourceName };
var resourceType = 'sites';
var parentResourcePath = '';
var resourceProviderNamespace = 'Microsoft.Web';
var apiVersion = '2014-04-01';
client.resources.createOrUpdate(groupName, resourceProviderNamespace, parentResourcePath,
resourceType, resourceName , apiVersion, params, function (err, result, request, response) {
if (err) {
console.log(err);
} else {
console.log(result);
}
});
```
## Get a Generic Resource in a Resource Group
```javascript
var groupName = 'testGroup1';
var resourceName = 'autorestsite102';
var resourceType = 'sites';
var parentResourcePath = '';
var resourceProviderNamespace = 'Microsoft.Web';
var apiVersion = '2014-04-01';
client.resources.get(groupName, resourceProviderNamespace, parentResourcePath,
resourceType, resourceName, apiVersion, function (err, result, request, response) {
if (err) {
console.log(err);
} else {
console.log(result);
}
});
```
## Listing all resources in your subscription
```javascript
client.resources.list(function (err, result, request, response) {
if (err) {
console.log(err);
} else {
console.log(result);
}
});
```
## Deleting a Generic Resource in a Resource Group
```javascript
var groupName = 'testGroup1';
var resourceName = 'autorestsite102';
var resourceType = 'sites';
var parentResourcePath = '';
var resourceProviderNamespace = 'Microsoft.Web';
var apiVersion = '2014-04-01';
client.resources.deleteMethod(groupName, resourceProviderNamespace, parentResourcePath,
resourceType, resourceName, apiVersion, function (err, result, request, response) {
if (err) {
console.log(err);
} else {
console.log(result);
}
});
```
## Deleting the Resource Group
```javascript
var groupName = 'testGroup1';
client.resourceGroups.deleteMethod(groupName, function (err, result, request, response) {
if (err) {
console.log(err);
} else {
console.log(result);
}
});
```
Please take a look at the tests over [here](https://github.com/Azure/azure-sdk-for-node/tree/autorest/test/services/resourceManagement) for more examples.
## Related projects
- [Microsoft Azure SDK for Node.js - All-up](https://github.com/WindowsAzure/azure-sdk-for-node)
- [Microsoft Azure SDK for Node.js - All-up](https://github.com/Azure/azure-sdk-for-node)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc