4.1.11 • Published 3 years ago

cg-client v4.1.11

Weekly downloads
5
License
MIT
Repository
-
Last release
3 years ago

cg-client

A JavaScript package for AvePoint Cloud Governance public REST endpoints providing the functionalities of Cloud Governance.

Installation

For Node.js

npm

npm install cg-client --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var CgClient = require('cg-client');

var defaultClient = CgClient.ApiClient.instance;

// You can find the Modern API Endpoint in Cloud Governance admin user guide for your environment.
defaultClient.basePath = "{Cloud_Governance_Modern_API_Endpoint}";

// Configure API key clientSecret: Navigate to AvePoint Cloud Governance Settings > API Authentication Management to Obtain a client secret.
var clientSecret = defaultClient.authentications['clientSecret'];
clientSecret.apiKey = 'eyJ...';

// Configure API key userPrincipalName: The value of the userPrincipalName parameter is the login name of a delegated user that will be used to invoke the AvePoint Cloud Governance API. 
// Make sure the user's account has been added to AvePoint Online Services and has the license for AvePoint Cloud Governance.
// If you calls the Admin api, make sure the user's role is Service Administrator for AvePoint Cloud Governance.
var userPrincipalName = defaultClient.authentications['userPrincipalName'];
userPrincipalName.apiKey = 'someone@example.com';


var api = new CgClient.()
api.().then(function() {
  console.log('API called successfully.');
}, function(error) {
  console.error(error);
});
4.1.10

3 years ago

4.1.11

3 years ago

0.5.5

4 years ago

0.5.4

4 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago