Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const operations = resourceName.map(name => {
const operation = new DismissRecommendationRequest.DismissRecommendationOperation()
operation.setResourceName(name)
return operation
})
request.setOperationsList(operations)
public async dismissRecommendation(
resourceName: string | string[],
options?: ServiceCreateOptions
): Promise {
const request = new DismissRecommendationRequest()
request.setCustomerId(this.cid)
if (resourceName instanceof Array) {
const operations = resourceName.map(name => {
const operation = new DismissRecommendationRequest.DismissRecommendationOperation()
operation.setResourceName(name)
return operation
})
request.setOperationsList(operations)
} else {
const operation = new DismissRecommendationRequest.DismissRecommendationOperation()
operation.setResourceName(resourceName)
request.setOperationsList([operation])
}
if (options && options.hasOwnProperty('partial_failure')) {
if (!request.setPartialFailure) {
throw new Error(`This method does not support the partial_failure option.`)
}
request.setPartialFailure(options.partial_failure as boolean)
}
const response: DismissRecommendationResponse.AsObject = await this.service.dismissRecommendation(request)
return {
request: request.toObject(),
partial_failure_error: response.partialFailureError,
results: response.resultsList.map(r => r.resourceName),