@azure/arm-security
Version:
A generated SDK for SecurityCenter.
107 lines (100 loc) • 3.39 kB
text/typescript
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import { SqlVulnerabilityAssessmentScans } from "../operationsInterfaces";
import * as coreClient from "@azure/core-client";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { SecurityCenter } from "../securityCenter";
import {
SqlVulnerabilityAssessmentScansGetOptionalParams,
SqlVulnerabilityAssessmentScansGetResponse,
SqlVulnerabilityAssessmentScansListOptionalParams,
SqlVulnerabilityAssessmentScansListResponse
} from "../models";
/** Class containing SqlVulnerabilityAssessmentScans operations. */
export class SqlVulnerabilityAssessmentScansImpl
implements SqlVulnerabilityAssessmentScans {
private readonly client: SecurityCenter;
/**
* Initialize a new instance of the class SqlVulnerabilityAssessmentScans class.
* @param client Reference to the service client
*/
constructor(client: SecurityCenter) {
this.client = client;
}
/**
* Gets the scan details of a single scan record.
* @param scanId The scan Id. Type 'latest' to get the scan record for the latest scan.
* @param workspaceId The workspace Id.
* @param resourceId The identifier of the resource.
* @param options The options parameters.
*/
get(
scanId: string,
workspaceId: string,
resourceId: string,
options?: SqlVulnerabilityAssessmentScansGetOptionalParams
): Promise<SqlVulnerabilityAssessmentScansGetResponse> {
return this.client.sendOperationRequest(
{ scanId, workspaceId, resourceId, options },
getOperationSpec
);
}
/**
* Gets a list of scan records.
* @param workspaceId The workspace Id.
* @param resourceId The identifier of the resource.
* @param options The options parameters.
*/
list(
workspaceId: string,
resourceId: string,
options?: SqlVulnerabilityAssessmentScansListOptionalParams
): Promise<SqlVulnerabilityAssessmentScansListResponse> {
return this.client.sendOperationRequest(
{ workspaceId, resourceId, options },
listOperationSpec
);
}
}
// Operation Specifications
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
const getOperationSpec: coreClient.OperationSpec = {
path:
"/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.Scan
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.workspaceId, Parameters.apiVersion12],
urlParameters: [Parameters.$host, Parameters.resourceId, Parameters.scanId],
headerParameters: [Parameters.accept],
serializer
};
const listOperationSpec: coreClient.OperationSpec = {
path:
"/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans",
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.Scans
},
default: {
bodyMapper: Mappers.CloudError
}
},
queryParameters: [Parameters.workspaceId, Parameters.apiVersion12],
urlParameters: [Parameters.$host, Parameters.resourceId],
headerParameters: [Parameters.accept],
serializer
};