UNPKG

@azure/arm-security

Version:
329 lines 11.9 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 { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; /// <reference lib="esnext.asynciterable" /> /** Class containing AssessmentsMetadata operations. */ export class AssessmentsMetadataImpl { /** * Initialize a new instance of the class AssessmentsMetadata class. * @param client Reference to the service client */ constructor(client) { this.client = client; } /** * Get metadata information on all assessment types * @param options The options parameters. */ list(options) { const iter = this.listPagingAll(options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: () => { return this.listPagingPage(options); } }; } listPagingPage(options) { return __asyncGenerator(this, arguments, function* listPagingPage_1() { let result = yield __await(this._list(options)); yield yield __await(result.value || []); let continuationToken = result.nextLink; while (continuationToken) { result = yield __await(this._listNext(continuationToken, options)); continuationToken = result.nextLink; yield yield __await(result.value || []); } }); } listPagingAll(options) { return __asyncGenerator(this, arguments, function* listPagingAll_1() { var e_1, _a; try { for (var _b = __asyncValues(this.listPagingPage(options)), _c; _c = yield __await(_b.next()), !_c.done;) { const page = _c.value; yield __await(yield* __asyncDelegator(__asyncValues(page))); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b)); } finally { if (e_1) throw e_1.error; } } }); } /** * Get metadata information on all assessment types in a specific subscription * @param options The options parameters. */ listBySubscription(options) { const iter = this.listBySubscriptionPagingAll(options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: () => { return this.listBySubscriptionPagingPage(options); } }; } listBySubscriptionPagingPage(options) { return __asyncGenerator(this, arguments, function* listBySubscriptionPagingPage_1() { let result = yield __await(this._listBySubscription(options)); yield yield __await(result.value || []); let continuationToken = result.nextLink; while (continuationToken) { result = yield __await(this._listBySubscriptionNext(continuationToken, options)); continuationToken = result.nextLink; yield yield __await(result.value || []); } }); } listBySubscriptionPagingAll(options) { return __asyncGenerator(this, arguments, function* listBySubscriptionPagingAll_1() { var e_2, _a; try { for (var _b = __asyncValues(this.listBySubscriptionPagingPage(options)), _c; _c = yield __await(_b.next()), !_c.done;) { const page = _c.value; yield __await(yield* __asyncDelegator(__asyncValues(page))); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b)); } finally { if (e_2) throw e_2.error; } } }); } /** * Get metadata information on all assessment types * @param options The options parameters. */ _list(options) { return this.client.sendOperationRequest({ options }, listOperationSpec); } /** * Get metadata information on an assessment type * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type * @param options The options parameters. */ get(assessmentMetadataName, options) { return this.client.sendOperationRequest({ assessmentMetadataName, options }, getOperationSpec); } /** * Get metadata information on all assessment types in a specific subscription * @param options The options parameters. */ _listBySubscription(options) { return this.client.sendOperationRequest({ options }, listBySubscriptionOperationSpec); } /** * Get metadata information on an assessment type in a specific subscription * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type * @param options The options parameters. */ getInSubscription(assessmentMetadataName, options) { return this.client.sendOperationRequest({ assessmentMetadataName, options }, getInSubscriptionOperationSpec); } /** * Create metadata information on an assessment type in a specific subscription * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type * @param assessmentMetadata AssessmentMetadata object * @param options The options parameters. */ createInSubscription(assessmentMetadataName, assessmentMetadata, options) { return this.client.sendOperationRequest({ assessmentMetadataName, assessmentMetadata, options }, createInSubscriptionOperationSpec); } /** * Delete metadata information on an assessment type in a specific subscription, will cause the * deletion of all the assessments of that type in that subscription * @param assessmentMetadataName The Assessment Key - Unique key for the assessment type * @param options The options parameters. */ deleteInSubscription(assessmentMetadataName, options) { return this.client.sendOperationRequest({ assessmentMetadataName, options }, deleteInSubscriptionOperationSpec); } /** * ListNext * @param nextLink The nextLink from the previous successful call to the List method. * @param options The options parameters. */ _listNext(nextLink, options) { return this.client.sendOperationRequest({ nextLink, options }, listNextOperationSpec); } /** * ListBySubscriptionNext * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. * @param options The options parameters. */ _listBySubscriptionNext(nextLink, options) { return this.client.sendOperationRequest({ nextLink, options }, listBySubscriptionNextOperationSpec); } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const listOperationSpec = { path: "/providers/Microsoft.Security/assessmentMetadata", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.SecurityAssessmentMetadataResponseList }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion10], urlParameters: [Parameters.$host], headerParameters: [Parameters.accept], serializer }; const getOperationSpec = { path: "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.SecurityAssessmentMetadataResponse }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion10], urlParameters: [Parameters.$host, Parameters.assessmentMetadataName], headerParameters: [Parameters.accept], serializer }; const listBySubscriptionOperationSpec = { path: "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.SecurityAssessmentMetadataResponseList }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion10], urlParameters: [Parameters.$host, Parameters.subscriptionId], headerParameters: [Parameters.accept], serializer }; const getInSubscriptionOperationSpec = { path: "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.SecurityAssessmentMetadataResponse }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion10], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.assessmentMetadataName ], headerParameters: [Parameters.accept], serializer }; const createInSubscriptionOperationSpec = { path: "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}", httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.SecurityAssessmentMetadataResponse }, default: { bodyMapper: Mappers.CloudError } }, requestBody: Parameters.assessmentMetadata, queryParameters: [Parameters.apiVersion10], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.assessmentMetadataName ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer }; const deleteInSubscriptionOperationSpec = { path: "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}", httpMethod: "DELETE", responses: { 200: {}, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion10], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.assessmentMetadataName ], headerParameters: [Parameters.accept], serializer }; const listNextOperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.SecurityAssessmentMetadataResponseList }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion10], urlParameters: [Parameters.$host, Parameters.nextLink], headerParameters: [Parameters.accept], serializer }; const listBySubscriptionNextOperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.SecurityAssessmentMetadataResponseList }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion10], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.nextLink ], headerParameters: [Parameters.accept], serializer }; //# sourceMappingURL=assessmentsMetadata.js.map