UNPKG

ibmcloud-security-advisor-findings

Version:

JavaScript client library for the IBM Cloud Security Advisor Findings API

489 lines (412 loc) 19.5 kB
/** * Findings API * The Findings API * * OpenAPI spec version: 1.0.0 * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * * Swagger Codegen version: 2.4.7 * * Do not edit the class manually. * */ var ApiClient = require('../ApiClient'); var Body = require('../model/Body'); var Body1 = require('../model/Body1'); var InlineResponse200 = require('../model/InlineResponse200'); var InlineResponse200Notes = require('../model/InlineResponse200Notes'); /** * FindingsNotes service. * @module api/FindingsNotesApi */ /** * Constructs a new FindingsNotesApi. * @alias module:api/FindingsNotesApi * @class * @param {module:ApiClient} apiClient Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ module.exports = function(apiClient) { this.apiClient = apiClient || ApiClient.instance; /** * Creates a new `Note`. * @param {String} accountId Account ID * @param {String} authorization The Identity & Access Management (IAM) Bearer token. * @param {String} providerId Part of `parent`. This field contains the provider_id for example: providers/{provider_id} * @param {module:model/Body} body Body for Note creation * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse200Notes} and HTTP response */ this.createNoteWithHttpInfo = function(accountId, authorization, providerId, body) { var postBody = body; // verify the required parameter 'accountId' is set if (accountId === undefined || accountId === null) { throw new Error("Missing the required parameter 'accountId' when calling createNote"); } // verify the required parameter 'authorization' is set if (authorization === undefined || authorization === null) { throw new Error("Missing the required parameter 'authorization' when calling createNote"); } // verify the required parameter 'providerId' is set if (providerId === undefined || providerId === null) { throw new Error("Missing the required parameter 'providerId' when calling createNote"); } // verify the required parameter 'body' is set if (body === undefined || body === null) { throw new Error("Missing the required parameter 'body' when calling createNote"); } var pathParams = { 'account_id': accountId, 'provider_id': providerId }; var queryParams = { }; var headerParams = { 'Authorization': authorization }; var formParams = { }; var authNames = ['UserMin']; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = InlineResponse200Notes; return this.apiClient.callApi( '/v1/{account_id}/providers/{provider_id}/notes', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Creates a new `Note`. * @param {String} accountId Account ID * @param {String} authorization The Identity & Access Management (IAM) Bearer token. * @param {String} providerId Part of `parent`. This field contains the provider_id for example: providers/{provider_id} * @param {module:model/Body} body Body for Note creation * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse200Notes} */ this.createNote = function(accountId, authorization, providerId, body) { return this.createNoteWithHttpInfo(accountId, authorization, providerId, body) .then(function(response_and_data) { return response_and_data.data; }); } /** * Deletes the given `Note` from the system. * @param {String} accountId Account ID * @param {String} authorization The Identity & Access Management (IAM) Bearer token. * @param {String} providerId First part of note `name`: providers/{provider_id}/notes/{note_id} * @param {String} noteId Second part of note `name`: providers/{provider_id}/notes/{note_id} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Object} and HTTP response */ this.deleteNoteWithHttpInfo = function(accountId, authorization, providerId, noteId) { var postBody = null; // verify the required parameter 'accountId' is set if (accountId === undefined || accountId === null) { throw new Error("Missing the required parameter 'accountId' when calling deleteNote"); } // verify the required parameter 'authorization' is set if (authorization === undefined || authorization === null) { throw new Error("Missing the required parameter 'authorization' when calling deleteNote"); } // verify the required parameter 'providerId' is set if (providerId === undefined || providerId === null) { throw new Error("Missing the required parameter 'providerId' when calling deleteNote"); } // verify the required parameter 'noteId' is set if (noteId === undefined || noteId === null) { throw new Error("Missing the required parameter 'noteId' when calling deleteNote"); } var pathParams = { 'account_id': accountId, 'provider_id': providerId, 'note_id': noteId }; var queryParams = { }; var headerParams = { 'Authorization': authorization }; var formParams = { }; var authNames = ['UserMin']; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = Object; return this.apiClient.callApi( '/v1/{account_id}/providers/{provider_id}/notes/{note_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Deletes the given `Note` from the system. * @param {String} accountId Account ID * @param {String} authorization The Identity & Access Management (IAM) Bearer token. * @param {String} providerId First part of note `name`: providers/{provider_id}/notes/{note_id} * @param {String} noteId Second part of note `name`: providers/{provider_id}/notes/{note_id} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Object} */ this.deleteNote = function(accountId, authorization, providerId, noteId) { return this.deleteNoteWithHttpInfo(accountId, authorization, providerId, noteId) .then(function(response_and_data) { return response_and_data.data; }); } /** * Returns the requested `Note`. * @param {String} accountId Account ID * @param {String} authorization The Identity & Access Management (IAM) Bearer token. * @param {String} providerId First part of note `name`: providers/{provider_id}/notes/{note_id} * @param {String} noteId Second part of note `name`: providers/{provider_id}/notes/{note_id} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse200Notes} and HTTP response */ this.getNoteWithHttpInfo = function(accountId, authorization, providerId, noteId) { var postBody = null; // verify the required parameter 'accountId' is set if (accountId === undefined || accountId === null) { throw new Error("Missing the required parameter 'accountId' when calling getNote"); } // verify the required parameter 'authorization' is set if (authorization === undefined || authorization === null) { throw new Error("Missing the required parameter 'authorization' when calling getNote"); } // verify the required parameter 'providerId' is set if (providerId === undefined || providerId === null) { throw new Error("Missing the required parameter 'providerId' when calling getNote"); } // verify the required parameter 'noteId' is set if (noteId === undefined || noteId === null) { throw new Error("Missing the required parameter 'noteId' when calling getNote"); } var pathParams = { 'account_id': accountId, 'provider_id': providerId, 'note_id': noteId }; var queryParams = { }; var headerParams = { 'Authorization': authorization }; var formParams = { }; var authNames = ['UserMin']; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = InlineResponse200Notes; return this.apiClient.callApi( '/v1/{account_id}/providers/{provider_id}/notes/{note_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Returns the requested `Note`. * @param {String} accountId Account ID * @param {String} authorization The Identity & Access Management (IAM) Bearer token. * @param {String} providerId First part of note `name`: providers/{provider_id}/notes/{note_id} * @param {String} noteId Second part of note `name`: providers/{provider_id}/notes/{note_id} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse200Notes} */ this.getNote = function(accountId, authorization, providerId, noteId) { return this.getNoteWithHttpInfo(accountId, authorization, providerId, noteId) .then(function(response_and_data) { return response_and_data.data; }); } /** * Gets the `Note` attached to the given `Occurrence`. * @param {String} accountId Account ID * @param {String} authorization The Identity & Access Management (IAM) Bearer token. * @param {String} providerId First part of occurrence `name`: providers/{provider_id}/occurrences/{occurrence_id} * @param {String} occurrenceId Second part of occurrence `name`: providers/{provider_id}/occurrences/{occurrence_id} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse200Notes} and HTTP response */ this.getOccurrenceNoteWithHttpInfo = function(accountId, authorization, providerId, occurrenceId) { var postBody = null; // verify the required parameter 'accountId' is set if (accountId === undefined || accountId === null) { throw new Error("Missing the required parameter 'accountId' when calling getOccurrenceNote"); } // verify the required parameter 'authorization' is set if (authorization === undefined || authorization === null) { throw new Error("Missing the required parameter 'authorization' when calling getOccurrenceNote"); } // verify the required parameter 'providerId' is set if (providerId === undefined || providerId === null) { throw new Error("Missing the required parameter 'providerId' when calling getOccurrenceNote"); } // verify the required parameter 'occurrenceId' is set if (occurrenceId === undefined || occurrenceId === null) { throw new Error("Missing the required parameter 'occurrenceId' when calling getOccurrenceNote"); } var pathParams = { 'account_id': accountId, 'provider_id': providerId, 'occurrence_id': occurrenceId }; var queryParams = { }; var headerParams = { 'Authorization': authorization }; var formParams = { }; var authNames = ['UserMin']; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = InlineResponse200Notes; return this.apiClient.callApi( '/v1/{account_id}/providers/{provider_id}/occurrences/{occurrence_id}/note', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Gets the `Note` attached to the given `Occurrence`. * @param {String} accountId Account ID * @param {String} authorization The Identity & Access Management (IAM) Bearer token. * @param {String} providerId First part of occurrence `name`: providers/{provider_id}/occurrences/{occurrence_id} * @param {String} occurrenceId Second part of occurrence `name`: providers/{provider_id}/occurrences/{occurrence_id} * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse200Notes} */ this.getOccurrenceNote = function(accountId, authorization, providerId, occurrenceId) { return this.getOccurrenceNoteWithHttpInfo(accountId, authorization, providerId, occurrenceId) .then(function(response_and_data) { return response_and_data.data; }); } /** * Lists all `Notes` for a given provider. * @param {String} accountId Account ID * @param {String} authorization The Identity & Access Management (IAM) Bearer token. * @param {String} providerId Part of `parent`. This field contains the provider_id for example: providers/{provider_id} * @param {Object} opts Optional parameters * @param {Number} opts.pageSize Number of notes to return in the list. * @param {String} opts.pageToken Token to provide to skip to a particular spot in the list. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse200} and HTTP response */ this.listNotesWithHttpInfo = function(accountId, authorization, providerId, opts) { opts = opts || {}; var postBody = null; // verify the required parameter 'accountId' is set if (accountId === undefined || accountId === null) { throw new Error("Missing the required parameter 'accountId' when calling listNotes"); } // verify the required parameter 'authorization' is set if (authorization === undefined || authorization === null) { throw new Error("Missing the required parameter 'authorization' when calling listNotes"); } // verify the required parameter 'providerId' is set if (providerId === undefined || providerId === null) { throw new Error("Missing the required parameter 'providerId' when calling listNotes"); } var pathParams = { 'account_id': accountId, 'provider_id': providerId }; var queryParams = { 'page_size': opts['pageSize'], 'page_token': opts['pageToken'] }; var headerParams = { 'Authorization': authorization }; var formParams = { }; var authNames = ['UserMin']; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = InlineResponse200; return this.apiClient.callApi( '/v1/{account_id}/providers/{provider_id}/notes', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Lists all `Notes` for a given provider. * @param {String} accountId Account ID * @param {String} authorization The Identity & Access Management (IAM) Bearer token. * @param {String} providerId Part of `parent`. This field contains the provider_id for example: providers/{provider_id} * @param {Object} opts Optional parameters * @param {Number} opts.pageSize Number of notes to return in the list. * @param {String} opts.pageToken Token to provide to skip to a particular spot in the list. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse200} */ this.listNotes = function(accountId, authorization, providerId, opts) { return this.listNotesWithHttpInfo(accountId, authorization, providerId, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Updates an existing `Note`. * @param {String} accountId Account ID * @param {String} authorization The Identity & Access Management (IAM) Bearer token. * @param {String} providerId First part of note `name`: providers/{provider_id}/notes/{note_id} * @param {String} noteId Second part of note `name`: providers/{provider_id}/notes/{note_id} * @param {module:model/Body1} body Body for Note updation * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse200Notes} and HTTP response */ this.updateNoteWithHttpInfo = function(accountId, authorization, providerId, noteId, body) { var postBody = body; // verify the required parameter 'accountId' is set if (accountId === undefined || accountId === null) { throw new Error("Missing the required parameter 'accountId' when calling updateNote"); } // verify the required parameter 'authorization' is set if (authorization === undefined || authorization === null) { throw new Error("Missing the required parameter 'authorization' when calling updateNote"); } // verify the required parameter 'providerId' is set if (providerId === undefined || providerId === null) { throw new Error("Missing the required parameter 'providerId' when calling updateNote"); } // verify the required parameter 'noteId' is set if (noteId === undefined || noteId === null) { throw new Error("Missing the required parameter 'noteId' when calling updateNote"); } // verify the required parameter 'body' is set if (body === undefined || body === null) { throw new Error("Missing the required parameter 'body' when calling updateNote"); } var pathParams = { 'account_id': accountId, 'provider_id': providerId, 'note_id': noteId }; var queryParams = { }; var headerParams = { 'Authorization': authorization }; var formParams = { }; var authNames = ['UserMin']; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = InlineResponse200Notes; return this.apiClient.callApi( '/v1/{account_id}/providers/{provider_id}/notes/{note_id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Updates an existing `Note`. * @param {String} accountId Account ID * @param {String} authorization The Identity & Access Management (IAM) Bearer token. * @param {String} providerId First part of note `name`: providers/{provider_id}/notes/{note_id} * @param {String} noteId Second part of note `name`: providers/{provider_id}/notes/{note_id} * @param {module:model/Body1} body Body for Note updation * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse200Notes} */ this.updateNote = function(accountId, authorization, providerId, noteId, body) { return this.updateNoteWithHttpInfo(accountId, authorization, providerId, noteId, body) .then(function(response_and_data) { return response_and_data.data; }); } };