1.0.0 • Published 5 years ago

ibmcloud-security-advisor-findings v1.0.0

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
5 years ago

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:

ClassMethodHTTP requestDescription
findings.FindingsGraphApipostGraphPOST /v1/{account_id}/graphquery findings
findings.FindingsNotesApicreateNotePOST /v1/{account_id}/providers/{provider_id}/notesCreates a new `Note`.
findings.FindingsNotesApideleteNoteDELETE /v1/{account_id}/providers/{provider_id}/notes/{note_id}Deletes the given `Note` from the system.
findings.FindingsNotesApigetNoteGET /v1/{account_id}/providers/{provider_id}/notes/{note_id}Returns the requested `Note`.
findings.FindingsNotesApigetOccurrenceNoteGET /v1/{account_id}/providers/{provider_id}/occurrences/{occurrence_id}/noteGets the `Note` attached to the given `Occurrence`.
findings.FindingsNotesApilistNotesGET /v1/{account_id}/providers/{provider_id}/notesLists all `Notes` for a given provider.
findings.FindingsNotesApiupdateNotePUT /v1/{account_id}/providers/{provider_id}/notes/{note_id}Updates an existing `Note`.
findings.FindingsOccurrencesApicreateOccurrencePOST /v1/{account_id}/providers/{provider_id}/occurrencesCreates a new `Occurrence`. Use this method to create `Occurrences` for a resource.
findings.FindingsOccurrencesApideleteOccurrenceDELETE /v1/{account_id}/providers/{provider_id}/occurrences/{occurrence_id}Deletes the given `Occurrence` from the system.
findings.FindingsOccurrencesApigetOccurrenceGET /v1/{account_id}/providers/{provider_id}/occurrences/{occurrence_id}Returns the requested `Occurrence`.
findings.FindingsOccurrencesApilistNoteOccurrencesGET /v1/{account_id}/providers/{provider_id}/notes/{note_id}/occurrencesLists `Occurrences` referencing the specified `Note`. Use this method to get all occurrences referencing your `Note` across all your customer providers.
findings.FindingsOccurrencesApilistOccurrencesGET /v1/{account_id}/providers/{provider_id}/occurrencesLists active `Occurrences` for a given provider matching the filters.
findings.FindingsOccurrencesApiupdateOccurrencePUT /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