UNPKG

@azure/arm-security

Version:
372 lines 14.4 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 IotSecuritySolution operations. */ export class IotSecuritySolutionImpl { /** * Initialize a new instance of the class IotSecuritySolution class. * @param client Reference to the service client */ constructor(client) { this.client = client; } /** * Use this method to get the list of IoT Security solutions by 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_1, _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_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; } } }); } /** * Use this method to get the list IoT Security solutions organized by resource group. * @param resourceGroupName The name of the resource group within the user's subscription. The name is * case insensitive. * @param options The options parameters. */ listByResourceGroup(resourceGroupName, options) { const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); return { next() { return iter.next(); }, [Symbol.asyncIterator]() { return this; }, byPage: () => { return this.listByResourceGroupPagingPage(resourceGroupName, options); } }; } listByResourceGroupPagingPage(resourceGroupName, options) { return __asyncGenerator(this, arguments, function* listByResourceGroupPagingPage_1() { let result = yield __await(this._listByResourceGroup(resourceGroupName, options)); yield yield __await(result.value || []); let continuationToken = result.nextLink; while (continuationToken) { result = yield __await(this._listByResourceGroupNext(resourceGroupName, continuationToken, options)); continuationToken = result.nextLink; yield yield __await(result.value || []); } }); } listByResourceGroupPagingAll(resourceGroupName, options) { return __asyncGenerator(this, arguments, function* listByResourceGroupPagingAll_1() { var e_2, _a; try { for (var _b = __asyncValues(this.listByResourceGroupPagingPage(resourceGroupName, 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; } } }); } /** * Use this method to get the list of IoT Security solutions by subscription. * @param options The options parameters. */ _listBySubscription(options) { return this.client.sendOperationRequest({ options }, listBySubscriptionOperationSpec); } /** * Use this method to get the list IoT Security solutions organized by resource group. * @param resourceGroupName The name of the resource group within the user's subscription. The name is * case insensitive. * @param options The options parameters. */ _listByResourceGroup(resourceGroupName, options) { return this.client.sendOperationRequest({ resourceGroupName, options }, listByResourceGroupOperationSpec); } /** * User this method to get details of a specific IoT Security solution based on solution name * @param resourceGroupName The name of the resource group within the user's subscription. The name is * case insensitive. * @param solutionName The name of the IoT Security solution. * @param options The options parameters. */ get(resourceGroupName, solutionName, options) { return this.client.sendOperationRequest({ resourceGroupName, solutionName, options }, getOperationSpec); } /** * Use this method to create or update yours IoT Security solution * @param resourceGroupName The name of the resource group within the user's subscription. The name is * case insensitive. * @param solutionName The name of the IoT Security solution. * @param iotSecuritySolutionData The security solution data * @param options The options parameters. */ createOrUpdate(resourceGroupName, solutionName, iotSecuritySolutionData, options) { return this.client.sendOperationRequest({ resourceGroupName, solutionName, iotSecuritySolutionData, options }, createOrUpdateOperationSpec); } /** * Use this method to update existing IoT Security solution tags or user defined resources. To update * other fields use the CreateOrUpdate method. * @param resourceGroupName The name of the resource group within the user's subscription. The name is * case insensitive. * @param solutionName The name of the IoT Security solution. * @param updateIotSecuritySolutionData The security solution data * @param options The options parameters. */ update(resourceGroupName, solutionName, updateIotSecuritySolutionData, options) { return this.client.sendOperationRequest({ resourceGroupName, solutionName, updateIotSecuritySolutionData, options }, updateOperationSpec); } /** * Use this method to delete yours IoT Security solution * @param resourceGroupName The name of the resource group within the user's subscription. The name is * case insensitive. * @param solutionName The name of the IoT Security solution. * @param options The options parameters. */ delete(resourceGroupName, solutionName, options) { return this.client.sendOperationRequest({ resourceGroupName, solutionName, options }, deleteOperationSpec); } /** * 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); } /** * ListByResourceGroupNext * @param resourceGroupName The name of the resource group within the user's subscription. The name is * case insensitive. * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. * @param options The options parameters. */ _listByResourceGroupNext(resourceGroupName, nextLink, options) { return this.client.sendOperationRequest({ resourceGroupName, nextLink, options }, listByResourceGroupNextOperationSpec); } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const listBySubscriptionOperationSpec = { path: "/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.IoTSecuritySolutionsList }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion5, Parameters.filter], urlParameters: [Parameters.$host, Parameters.subscriptionId], headerParameters: [Parameters.accept], serializer }; const listByResourceGroupOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.IoTSecuritySolutionsList }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion5, Parameters.filter], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName ], headerParameters: [Parameters.accept], serializer }; const getOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.IoTSecuritySolutionModel }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion5], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.solutionName ], headerParameters: [Parameters.accept], serializer }; const createOrUpdateOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}", httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.IoTSecuritySolutionModel }, 201: { bodyMapper: Mappers.IoTSecuritySolutionModel }, default: { bodyMapper: Mappers.CloudError } }, requestBody: Parameters.iotSecuritySolutionData, queryParameters: [Parameters.apiVersion5], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.solutionName ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer }; const updateOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}", httpMethod: "PATCH", responses: { 200: { bodyMapper: Mappers.IoTSecuritySolutionModel }, default: { bodyMapper: Mappers.CloudError } }, requestBody: Parameters.updateIotSecuritySolutionData, queryParameters: [Parameters.apiVersion5], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.solutionName ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", serializer }; const deleteOperationSpec = { path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}", httpMethod: "DELETE", responses: { 200: {}, 204: {}, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion5], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.solutionName ], headerParameters: [Parameters.accept], serializer }; const listBySubscriptionNextOperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.IoTSecuritySolutionsList }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion5, Parameters.filter], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.nextLink ], headerParameters: [Parameters.accept], serializer }; const listByResourceGroupNextOperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.IoTSecuritySolutionsList }, default: { bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion5, Parameters.filter], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.nextLink ], headerParameters: [Parameters.accept], serializer }; //# sourceMappingURL=iotSecuritySolution.js.map