UNPKG

@azure/arm-security

Version:
241 lines 10.2 kB
/* * 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 { __awaiter } from "tslib"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { LroEngine } from "@azure/core-lro"; import { LroImpl } from "../lroImpl"; /** Class containing ServerVulnerabilityAssessmentOperations operations. */ export class ServerVulnerabilityAssessmentOperationsImpl { /** * Initialize a new instance of the class ServerVulnerabilityAssessmentOperations class. * @param client Reference to the service client */ constructor(client) { this.client = client; } /** * Gets a list of server vulnerability assessment onboarding statuses on a given resource. * @param resourceGroupName The name of the resource group within the user's subscription. The name is * case insensitive. * @param resourceNamespace The Namespace of the resource. * @param resourceType The type of the resource. * @param resourceName Name of the resource. * @param options The options parameters. */ listByExtendedResource(resourceGroupName, resourceNamespace, resourceType, resourceName, options) { return this.client.sendOperationRequest({ resourceGroupName, resourceNamespace, resourceType, resourceName, options }, listByExtendedResourceOperationSpec); } /** * Gets a server vulnerability assessment onboarding statuses on a given resource. * @param resourceGroupName The name of the resource group within the user's subscription. The name is * case insensitive. * @param resourceNamespace The Namespace of the resource. * @param resourceType The type of the resource. * @param resourceName Name of the resource. * @param options The options parameters. */ get(resourceGroupName, resourceNamespace, resourceType, resourceName, options) { return this.client.sendOperationRequest({ resourceGroupName, resourceNamespace, resourceType, resourceName, options }, getOperationSpec); } /** * Creating a server vulnerability assessment on a resource, which will onboard a resource for having a * vulnerability assessment on it * @param resourceGroupName The name of the resource group within the user's subscription. The name is * case insensitive. * @param resourceNamespace The Namespace of the resource. * @param resourceType The type of the resource. * @param resourceName Name of the resource. * @param options The options parameters. */ createOrUpdate(resourceGroupName, resourceNamespace, resourceType, resourceName, options) { return this.client.sendOperationRequest({ resourceGroupName, resourceNamespace, resourceType, resourceName, options }, createOrUpdateOperationSpec); } /** * Removing server vulnerability assessment from a resource. * @param resourceGroupName The name of the resource group within the user's subscription. The name is * case insensitive. * @param resourceNamespace The Namespace of the resource. * @param resourceType The type of the resource. * @param resourceName Name of the resource. * @param options The options parameters. */ beginDelete(resourceGroupName, resourceNamespace, resourceType, resourceName, options) { return __awaiter(this, void 0, void 0, function* () { const directSendOperation = (args, spec) => __awaiter(this, void 0, void 0, function* () { return this.client.sendOperationRequest(args, spec); }); const sendOperation = (args, spec) => __awaiter(this, void 0, void 0, function* () { var _a; let currentRawResponse = undefined; const providedCallback = (_a = args.options) === null || _a === void 0 ? void 0 : _a.onResponse; const callback = (rawResponse, flatResponse) => { currentRawResponse = rawResponse; providedCallback === null || providedCallback === void 0 ? void 0 : providedCallback(rawResponse, flatResponse); }; const updatedArgs = Object.assign(Object.assign({}, args), { options: Object.assign(Object.assign({}, args.options), { onResponse: callback }) }); const flatResponse = yield directSendOperation(updatedArgs, spec); return { flatResponse, rawResponse: { statusCode: currentRawResponse.status, body: currentRawResponse.parsedBody, headers: currentRawResponse.headers.toJSON() } }; }); const lro = new LroImpl(sendOperation, { resourceGroupName, resourceNamespace, resourceType, resourceName, options }, deleteOperationSpec); const poller = new LroEngine(lro, { resumeFrom: options === null || options === void 0 ? void 0 : options.resumeFrom, intervalInMs: options === null || options === void 0 ? void 0 : options.updateIntervalInMs, lroResourceLocationConfig: "location" }); yield poller.poll(); return poller; }); } /** * Removing server vulnerability assessment from a resource. * @param resourceGroupName The name of the resource group within the user's subscription. The name is * case insensitive. * @param resourceNamespace The Namespace of the resource. * @param resourceType The type of the resource. * @param resourceName Name of the resource. * @param options The options parameters. */ beginDeleteAndWait(resourceGroupName, resourceNamespace, resourceType, resourceName, options) { return __awaiter(this, void 0, void 0, function* () { const poller = yield this.beginDelete(resourceGroupName, resourceNamespace, resourceType, resourceName, options); return poller.pollUntilDone(); }); } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const listByExtendedResourceOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ServerVulnerabilityAssessmentsList }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion9], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceNamespace, Parameters.resourceType, Parameters.resourceName ], headerParameters: [Parameters.accept], serializer }; const getOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ServerVulnerabilityAssessment }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion9], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceNamespace, Parameters.resourceType, Parameters.resourceName, Parameters.serverVulnerabilityAssessment ], headerParameters: [Parameters.accept], serializer }; const createOrUpdateOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}", httpMethod: "PUT", responses: { 202: { bodyMapper: Mappers.ServerVulnerabilityAssessment }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion9], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceNamespace, Parameters.resourceType, Parameters.resourceName, Parameters.serverVulnerabilityAssessment ], headerParameters: [Parameters.accept], serializer }; const deleteOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}", httpMethod: "DELETE", responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion9], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceNamespace, Parameters.resourceType, Parameters.resourceName, Parameters.serverVulnerabilityAssessment ], headerParameters: [Parameters.accept], serializer }; //# sourceMappingURL=serverVulnerabilityAssessmentOperations.js.map