Class: Perspective

cox-chapi.Perspective

new Perspective(api_keyopt)

Parameters:
Name Type Attributes Description
api_key string <optional>
Source:

Methods

add_to_group(pers, accts, group_name, cb)

adds an account to a group in a perspective
Parameters:
Name Type Description
pers object | string an object representing the perspective, or the perspective's id
accts mixed the account to add to a group, the account's id, or an array of a mixture of those
group_name string the name of the group to add an account to
cb objectCallback called with the updated perspective
Source:

create(perspective, cb)

Creates an perspective from the json object
Parameters:
Name Type Description
perspective object an object specifying fields for the new perspective
cb objectCallback called with the new perspective
Source:

destroy(flagsopt, id, cb)

Deletes the perspective with the specified id
Parameters:
Name Type Attributes Description
flags object <optional>
leave null/undefined if not specifying options
Properties
Name Type Attributes Description
force boolean <optional>
if true, delete regardless of dependencies
hard_delete boolean <optional>
if true, skips archiving the perspective before deletion
id number the id of the perspective
cb stringCallback called with a success message
Source:

get(flagsopt, id, cb)

gets a JSON object containing data for a perspective
Parameters:
Name Type Attributes Description
flags object <optional>
an optional flags object
Properties
Name Type Attributes Description
cache boolean <optional>
if true, this method will re-use a stored list of perspectives from the last time the --cache flag wasn't used when looking up ids from names
id number the id of the perspective
cb objectCallback called with an object representing the perspective
Source:

list(flagsopt, cb)

gets a JSON object containing all the perspectives
Parameters:
Name Type Attributes Description
flags object <optional>
an optional flags object
Properties
Name Type Attributes Description
cache boolean <optional>
if true, this method will re-use a stored list of perspectives from the last time the --cache flag wasn't used
cb objectCallback called with an object with an array of perspective names/ids
Source:

list_groups(pers, cb)

gets an array of groups for a perspective
Parameters:
Name Type Description
pers object | string an object representing a perspective, or the perspective's id
cb arrayCallback an array of groups for the perspective
Source:

set_api_key(api_key)

sets the api key to use when making calls to CloudHealth's API
Parameters:
Name Type Description
api_key string
Source:

update(perspective, cb)

Updates fields for the perspective with the specified id to match the given object
Parameters:
Name Type Description
perspective object an object holding new data to update the perspective with
Properties
Name Type Description
id number the id of the perspective
cb objectCallback called with the updated perspective
Source: