ibmcloud-security-advisor-findings

1.0.0 • Public • Published

IBM Cloud Security Advisor Findings API Node SDK

Findings API is supported in the following regions:

Requirements

Node.js 6.4.0 or later

Installation

For Node.js

To install the SDK:

npm install ibmcloud-security-advisor-findings --save

Install from a tagged release, for example, v1.0.0

npm install ibm-cloud-security/security-advisor-findings-sdk-nodejs#v1.0.0

Getting Started

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

var findings = require('ibmcloud-security-advisor-findings');
var defaultClient = findings.ApiClient.instance;
defaultClient.basePath = "https://us-south.secadvisor.cloud.ibm.com/findings"
let apiInstance = new findings.FindingsNotesApi();
let accountId = "accountId_example";
let authorization = "authorization_example";
let providerId = "providerId_example";
 
apiInstance.listNotes(accountId, authorization, providerId).then((data) => {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}, (error) => {
  console.error(error);
});

To target different regions set the basePath on the client instance accordingly:

  • Dallas - https://us-south.secadvisor.cloud.ibm.com/findings
  • London - https://eu-gb.secadvisor.cloud.ibm.com/findings

Generating Authorization token

Authorization token to be passed as second paramters in all the function calls is obtained by calling IBM Cloud IAM API. It is a bearer token in JWT format. Find a sample here. Read more about the access here

Documentation for API Endpoints

All URIs are relative to:

Class Method HTTP request Description
findings.FindingsGraphApi postGraph POST /v1/{account_id}/graph query findings
findings.FindingsNotesApi createNote POST /v1/{account_id}/providers/{provider_id}/notes Creates a new `Note`.
findings.FindingsNotesApi deleteNote DELETE /v1/{account_id}/providers/{provider_id}/notes/{note_id} Deletes the given `Note` from the system.
findings.FindingsNotesApi getNote GET /v1/{account_id}/providers/{provider_id}/notes/{note_id} Returns the requested `Note`.
findings.FindingsNotesApi getOccurrenceNote GET /v1/{account_id}/providers/{provider_id}/occurrences/{occurrence_id}/note Gets the `Note` attached to the given `Occurrence`.
findings.FindingsNotesApi listNotes GET /v1/{account_id}/providers/{provider_id}/notes Lists all `Notes` for a given provider.
findings.FindingsNotesApi updateNote PUT /v1/{account_id}/providers/{provider_id}/notes/{note_id} Updates an existing `Note`.
findings.FindingsOccurrencesApi createOccurrence POST /v1/{account_id}/providers/{provider_id}/occurrences Creates a new `Occurrence`. Use this method to create `Occurrences` for a resource.
findings.FindingsOccurrencesApi deleteOccurrence DELETE /v1/{account_id}/providers/{provider_id}/occurrences/{occurrence_id} Deletes the given `Occurrence` from the system.
findings.FindingsOccurrencesApi getOccurrence GET /v1/{account_id}/providers/{provider_id}/occurrences/{occurrence_id} Returns the requested `Occurrence`.
findings.FindingsOccurrencesApi listNoteOccurrences GET /v1/{account_id}/providers/{provider_id}/notes/{note_id}/occurrences Lists `Occurrences` referencing the specified `Note`. Use this method to get all occurrences referencing your `Note` across all your customer providers.
findings.FindingsOccurrencesApi listOccurrences GET /v1/{account_id}/providers/{provider_id}/occurrences Lists active `Occurrences` for a given provider matching the filters.
findings.FindingsOccurrencesApi updateOccurrence PUT /v1/{account_id}/providers/{provider_id}/occurrences/{occurrence_id} Updates an existing `Occurrence`.

Documentation for Models

Examples

Try out the examples. Go to Security Advisor dashboard for visualizing it. The examples require you to export the following variables:

export account_id=<your account id>
export authorization=<Bearer <token>>
export region=eu-gb
 
node create_notes.js
node create_occurrences.js

us-south will target the Dallas endpoint. Use eu-gb to target London by exporting region. Default region in the example is us-south Obtain authorization token for filling in the token value. We have used async/await to simplify the examples. Make sure your Node version supports it natively. You can check here

Package Sidebar

Install

npm i ibmcloud-security-advisor-findings

Weekly Downloads

1

Version

1.0.0

License

Apache-2.0

Unpacked Size

512 kB

Total Files

188

Last publish

Collaborators

  • ashishth09