From e847e0e1ae6c80ffc7c21047bd6aa1fa143fdc10 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 7 Feb 2019 07:31:40 +0000 Subject: [PATCH] Generated from ff51908e420ca2089147de8968f60a78e333bf56 Move actions next to alert rules --- .../lib/models/actionsMappers.ts | 19 ++ .../lib/models/alertRulesMappers.ts | 3 + .../arm-securityinsight/lib/models/index.ts | 210 ++++++++++++-- .../arm-securityinsight/lib/models/mappers.ts | 110 +++++-- .../lib/models/parameters.ts | 10 + .../lib/operations/actions.ts | 269 ++++++++++++++++++ .../lib/operations/alertRules.ts | 249 +++++++++++++++- .../lib/operations/index.ts | 1 + .../lib/securityInsights.ts | 2 + 9 files changed, 819 insertions(+), 54 deletions(-) create mode 100644 packages/@azure/arm-securityinsight/lib/models/actionsMappers.ts create mode 100644 packages/@azure/arm-securityinsight/lib/operations/actions.ts diff --git a/packages/@azure/arm-securityinsight/lib/models/actionsMappers.ts b/packages/@azure/arm-securityinsight/lib/models/actionsMappers.ts new file mode 100644 index 000000000000..9f135328ba2f --- /dev/null +++ b/packages/@azure/arm-securityinsight/lib/models/actionsMappers.ts @@ -0,0 +1,19 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export { + discriminators, + ActionsList, + Action, + Resource, + BaseResource, + CloudError +} from "../models/mappers"; + diff --git a/packages/@azure/arm-securityinsight/lib/models/alertRulesMappers.ts b/packages/@azure/arm-securityinsight/lib/models/alertRulesMappers.ts index cf12d0e86ddf..bbadbad7764f 100644 --- a/packages/@azure/arm-securityinsight/lib/models/alertRulesMappers.ts +++ b/packages/@azure/arm-securityinsight/lib/models/alertRulesMappers.ts @@ -13,6 +13,9 @@ export { AlertRulesList, AlertRule, CloudError, + Action, + Resource, + BaseResource, ScheduledAlertRule } from "../models/mappers"; diff --git a/packages/@azure/arm-securityinsight/lib/models/index.ts b/packages/@azure/arm-securityinsight/lib/models/index.ts index 557eb85ef5f0..558aefb6dbce 100644 --- a/packages/@azure/arm-securityinsight/lib/models/index.ts +++ b/packages/@azure/arm-securityinsight/lib/models/index.ts @@ -204,6 +204,58 @@ export interface ScheduledAlertRule { readonly lastModifiedUtc?: string; } +/** + * @interface + * An interface representing Resource. + * An azure resource object + * + * @extends BaseResource + */ +export interface Resource extends BaseResource { + /** + * @member {string} [id] Azure resource Id + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly id?: string; + /** + * @member {string} [type] Azure resource type + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly type?: string; + /** + * @member {string} [name] Azure resource name + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly name?: string; +} + +/** + * @interface + * An interface representing Action. + * Action for alert rule. + * + * @extends Resource + */ +export interface Action extends Resource { + /** + * @member {string} [etag] Etag of the action. + */ + etag?: string; + /** + * @member {string} [triggerUri] The uri for the action to trigger. + */ + triggerUri?: string; + /** + * @member {string} [ruleId] The unique identifier of the rule. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly ruleId?: string; +} + /** * Contains the possible cases for DataConnector. */ @@ -649,34 +701,6 @@ export interface AlertsDataTypeOfDataConnector { alerts?: AlertsDataTypeOfDataConnectorAlerts; } -/** - * @interface - * An interface representing Resource. - * An azure resource object - * - * @extends BaseResource - */ -export interface Resource extends BaseResource { - /** - * @member {string} [id] Azure resource Id - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** - */ - readonly id?: string; - /** - * @member {string} [type] Azure resource type - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** - */ - readonly type?: string; - /** - * @member {string} [name] Azure resource name - * **NOTE: This property will not be serialized. It can only be populated by - * the server.** - */ - readonly name?: string; -} - /** * @interface * An interface representing SecurityInsightsOptions. @@ -720,6 +744,22 @@ export interface AlertRulesList extends Array { readonly nextLink?: string; } +/** + * @interface + * An interface representing the ActionsList. + * List all the actions. + * + * @extends Array + */ +export interface ActionsList extends Array { + /** + * @member {string} [nextLink] URL to fetch the next set of actions. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly nextLink?: string; +} + /** * @interface * An interface representing the DataConnectorList. @@ -872,6 +912,44 @@ export type AlertRulesCreateResponse = AlertRuleUnion & { }; }; +/** + * Contains response data for the getAction operation. + */ +export type AlertRulesGetActionResponse = Action & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: Action; + }; +}; + +/** + * Contains response data for the createAction operation. + */ +export type AlertRulesCreateActionResponse = Action & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: Action; + }; +}; + /** * Contains response data for the listNext operation. */ @@ -891,6 +969,82 @@ export type AlertRulesListNextResponse = AlertRulesList & { }; }; +/** + * Contains response data for the listByAlertRule operation. + */ +export type ActionsListByAlertRuleResponse = ActionsList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ActionsList; + }; +}; + +/** + * Contains response data for the list operation. + */ +export type ActionsListResponse = ActionsList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ActionsList; + }; +}; + +/** + * Contains response data for the listByAlertRuleNext operation. + */ +export type ActionsListByAlertRuleNextResponse = ActionsList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ActionsList; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type ActionsListNextResponse = ActionsList & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: ActionsList; + }; +}; + /** * Contains response data for the list operation. */ diff --git a/packages/@azure/arm-securityinsight/lib/models/mappers.ts b/packages/@azure/arm-securityinsight/lib/models/mappers.ts index 157bb1ac3a08..2cd54dd93d80 100644 --- a/packages/@azure/arm-securityinsight/lib/models/mappers.ts +++ b/packages/@azure/arm-securityinsight/lib/models/mappers.ts @@ -245,6 +245,67 @@ export const ScheduledAlertRule: msRest.CompositeMapper = { } }; +export const Resource: msRest.CompositeMapper = { + serializedName: "Resource", + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + } + } + } +}; + +export const Action: msRest.CompositeMapper = { + serializedName: "Action", + type: { + name: "Composite", + className: "Action", + modelProperties: { + ...Resource.type.modelProperties, + etag: { + serializedName: "etag", + type: { + name: "String" + } + }, + triggerUri: { + serializedName: "properties.triggerUri", + type: { + name: "String" + } + }, + ruleId: { + readOnly: true, + serializedName: "properties.ruleId", + type: { + name: "String" + } + } + } + } +}; + export const DataConnector: msRest.CompositeMapper = { serializedName: "DataConnector", type: { @@ -561,44 +622,43 @@ export const AlertsDataTypeOfDataConnector: msRest.CompositeMapper = { } }; -export const Resource: msRest.CompositeMapper = { - serializedName: "Resource", +export const OperationsList: msRest.CompositeMapper = { + serializedName: "operationsList", type: { name: "Composite", - className: "Resource", + className: "OperationsList", modelProperties: { - id: { - readOnly: true, - serializedName: "id", - type: { - name: "String" - } - }, - type: { - readOnly: true, - serializedName: "type", + nextLink: { + serializedName: "nextLink", type: { name: "String" } }, - name: { - readOnly: true, - serializedName: "name", + value: { + required: true, + serializedName: "", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation" + } + } } } } } }; -export const OperationsList: msRest.CompositeMapper = { - serializedName: "operationsList", +export const AlertRulesList: msRest.CompositeMapper = { + serializedName: "AlertRulesList", type: { name: "Composite", - className: "OperationsList", + className: "AlertRulesList", modelProperties: { nextLink: { + readOnly: true, serializedName: "nextLink", type: { name: "String" @@ -612,7 +672,7 @@ export const OperationsList: msRest.CompositeMapper = { element: { type: { name: "Composite", - className: "Operation" + className: "AlertRule" } } } @@ -621,11 +681,11 @@ export const OperationsList: msRest.CompositeMapper = { } }; -export const AlertRulesList: msRest.CompositeMapper = { - serializedName: "AlertRulesList", +export const ActionsList: msRest.CompositeMapper = { + serializedName: "ActionsList", type: { name: "Composite", - className: "AlertRulesList", + className: "ActionsList", modelProperties: { nextLink: { readOnly: true, @@ -642,7 +702,7 @@ export const AlertRulesList: msRest.CompositeMapper = { element: { type: { name: "Composite", - className: "AlertRule" + className: "Action" } } } diff --git a/packages/@azure/arm-securityinsight/lib/models/parameters.ts b/packages/@azure/arm-securityinsight/lib/models/parameters.ts index 576c4fb77fd4..7c4ae5b23ee1 100644 --- a/packages/@azure/arm-securityinsight/lib/models/parameters.ts +++ b/packages/@azure/arm-securityinsight/lib/models/parameters.ts @@ -20,6 +20,16 @@ export const acceptLanguage: msRest.OperationParameter = { } } }; +export const actionId: msRest.OperationURLParameter = { + parameterPath: "actionId", + mapper: { + required: true, + serializedName: "actionId", + type: { + name: "String" + } + } +}; export const apiVersion: msRest.OperationQueryParameter = { parameterPath: "apiVersion", mapper: { diff --git a/packages/@azure/arm-securityinsight/lib/operations/actions.ts b/packages/@azure/arm-securityinsight/lib/operations/actions.ts new file mode 100644 index 000000000000..c3b4b6e9c3f2 --- /dev/null +++ b/packages/@azure/arm-securityinsight/lib/operations/actions.ts @@ -0,0 +1,269 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/actionsMappers"; +import * as Parameters from "../models/parameters"; +import { SecurityInsightsContext } from "../securityInsightsContext"; + +/** Class representing a Actions. */ +export class Actions { + private readonly client: SecurityInsightsContext; + + /** + * Create a Actions. + * @param {SecurityInsightsContext} client Reference to the service client. + */ + constructor(client: SecurityInsightsContext) { + this.client = client; + } + + /** + * Gets all actions of alert rule. + * @param resourceGroupName The name of the resource group within the user's subscription. The name + * is case insensitive. + * @param operationalInsightsResourceProvider The namespace of workspaces resource provider- + * Microsoft.OperationalInsights. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID + * @param [options] The optional parameters + * @returns Promise + */ + listByAlertRule(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, ruleId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. The name + * is case insensitive. + * @param operationalInsightsResourceProvider The namespace of workspaces resource provider- + * Microsoft.OperationalInsights. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID + * @param callback The callback + */ + listByAlertRule(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, ruleId: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. The name + * is case insensitive. + * @param operationalInsightsResourceProvider The namespace of workspaces resource provider- + * Microsoft.OperationalInsights. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID + * @param options The optional parameters + * @param callback The callback + */ + listByAlertRule(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, ruleId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listByAlertRule(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, ruleId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + operationalInsightsResourceProvider, + workspaceName, + ruleId, + options + }, + listByAlertRuleOperationSpec, + callback) as Promise; + } + + /** + * Gets all actions. + * @param resourceGroupName The name of the resource group within the user's subscription. The name + * is case insensitive. + * @param operationalInsightsResourceProvider The namespace of workspaces resource provider- + * Microsoft.OperationalInsights. + * @param workspaceName The name of the workspace. + * @param [options] The optional parameters + * @returns Promise + */ + list(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. The name + * is case insensitive. + * @param operationalInsightsResourceProvider The namespace of workspaces resource provider- + * Microsoft.OperationalInsights. + * @param workspaceName The name of the workspace. + * @param callback The callback + */ + list(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. The name + * is case insensitive. + * @param operationalInsightsResourceProvider The namespace of workspaces resource provider- + * Microsoft.OperationalInsights. + * @param workspaceName The name of the workspace. + * @param options The optional parameters + * @param callback The callback + */ + list(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + list(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + operationalInsightsResourceProvider, + workspaceName, + options + }, + listOperationSpec, + callback) as Promise; + } + + /** + * Gets all actions of alert rule. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listByAlertRuleNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listByAlertRuleNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listByAlertRuleNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listByAlertRuleNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listByAlertRuleNextOperationSpec, + callback) as Promise; + } + + /** + * Gets all actions. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns Promise + */ + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + listNextOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listByAlertRuleOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.operationalInsightsResourceProvider, + Parameters.workspaceName, + Parameters.ruleId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ActionsList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/actions", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.operationalInsightsResourceProvider, + Parameters.workspaceName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ActionsList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listByAlertRuleNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ActionsList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const listNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ActionsList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/packages/@azure/arm-securityinsight/lib/operations/alertRules.ts b/packages/@azure/arm-securityinsight/lib/operations/alertRules.ts index 199fcd44abb4..bc13bfdf8d02 100644 --- a/packages/@azure/arm-securityinsight/lib/operations/alertRules.ts +++ b/packages/@azure/arm-securityinsight/lib/operations/alertRules.ts @@ -69,7 +69,7 @@ export class AlertRules { } /** - * Gets a alert rule. + * Gets the alert rule. * @param resourceGroupName The name of the resource group within the user's subscription. The name * is case insensitive. * @param operationalInsightsResourceProvider The namespace of workspaces resource provider- @@ -210,6 +210,160 @@ export class AlertRules { callback); } + /** + * Gets the action of alert rule. + * @param resourceGroupName The name of the resource group within the user's subscription. The name + * is case insensitive. + * @param operationalInsightsResourceProvider The namespace of workspaces resource provider- + * Microsoft.OperationalInsights. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID + * @param actionId Action ID + * @param [options] The optional parameters + * @returns Promise + */ + getAction(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, ruleId: string, actionId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. The name + * is case insensitive. + * @param operationalInsightsResourceProvider The namespace of workspaces resource provider- + * Microsoft.OperationalInsights. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID + * @param actionId Action ID + * @param callback The callback + */ + getAction(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, ruleId: string, actionId: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. The name + * is case insensitive. + * @param operationalInsightsResourceProvider The namespace of workspaces resource provider- + * Microsoft.OperationalInsights. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID + * @param actionId Action ID + * @param options The optional parameters + * @param callback The callback + */ + getAction(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, ruleId: string, actionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getAction(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, ruleId: string, actionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + operationalInsightsResourceProvider, + workspaceName, + ruleId, + actionId, + options + }, + getActionOperationSpec, + callback) as Promise; + } + + /** + * Creates or updates the action of alert rule. + * @param resourceGroupName The name of the resource group within the user's subscription. The name + * is case insensitive. + * @param operationalInsightsResourceProvider The namespace of workspaces resource provider- + * Microsoft.OperationalInsights. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID + * @param actionId Action ID + * @param action The action + * @param [options] The optional parameters + * @returns Promise + */ + createAction(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, ruleId: string, actionId: string, action: Models.Action, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. The name + * is case insensitive. + * @param operationalInsightsResourceProvider The namespace of workspaces resource provider- + * Microsoft.OperationalInsights. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID + * @param actionId Action ID + * @param action The action + * @param callback The callback + */ + createAction(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, ruleId: string, actionId: string, action: Models.Action, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. The name + * is case insensitive. + * @param operationalInsightsResourceProvider The namespace of workspaces resource provider- + * Microsoft.OperationalInsights. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID + * @param actionId Action ID + * @param action The action + * @param options The optional parameters + * @param callback The callback + */ + createAction(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, ruleId: string, actionId: string, action: Models.Action, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + createAction(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, ruleId: string, actionId: string, action: Models.Action, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + operationalInsightsResourceProvider, + workspaceName, + ruleId, + actionId, + action, + options + }, + createActionOperationSpec, + callback) as Promise; + } + + /** + * Delete the action of alert rule. + * @param resourceGroupName The name of the resource group within the user's subscription. The name + * is case insensitive. + * @param operationalInsightsResourceProvider The namespace of workspaces resource provider- + * Microsoft.OperationalInsights. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID + * @param actionId Action ID + * @param [options] The optional parameters + * @returns Promise + */ + deleteAction(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, ruleId: string, actionId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. The name + * is case insensitive. + * @param operationalInsightsResourceProvider The namespace of workspaces resource provider- + * Microsoft.OperationalInsights. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID + * @param actionId Action ID + * @param callback The callback + */ + deleteAction(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, ruleId: string, actionId: string, callback: msRest.ServiceCallback): void; + /** + * @param resourceGroupName The name of the resource group within the user's subscription. The name + * is case insensitive. + * @param operationalInsightsResourceProvider The namespace of workspaces resource provider- + * Microsoft.OperationalInsights. + * @param workspaceName The name of the workspace. + * @param ruleId Alert rule ID + * @param actionId Action ID + * @param options The optional parameters + * @param callback The callback + */ + deleteAction(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, ruleId: string, actionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteAction(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, ruleId: string, actionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + operationalInsightsResourceProvider, + workspaceName, + ruleId, + actionId, + options + }, + deleteActionOperationSpec, + callback); + } + /** * Gets all alert rules. * @param nextPageLink The NextLink from the previous successful call to List operation. @@ -357,6 +511,99 @@ const deleteMethodOperationSpec: msRest.OperationSpec = { serializer }; +const getActionOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.operationalInsightsResourceProvider, + Parameters.workspaceName, + Parameters.ruleId, + Parameters.actionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.Action + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const createActionOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.operationalInsightsResourceProvider, + Parameters.workspaceName, + Parameters.ruleId, + Parameters.actionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "action", + mapper: { + ...Mappers.Action, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.Action + }, + 201: { + bodyMapper: Mappers.Action + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const deleteActionOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.operationalInsightsResourceProvider, + Parameters.workspaceName, + Parameters.ruleId, + Parameters.actionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + const listNextOperationSpec: msRest.OperationSpec = { httpMethod: "GET", baseUrl: "https://management.azure.com", diff --git a/packages/@azure/arm-securityinsight/lib/operations/index.ts b/packages/@azure/arm-securityinsight/lib/operations/index.ts index 383a177cd354..f5e2debaaf45 100644 --- a/packages/@azure/arm-securityinsight/lib/operations/index.ts +++ b/packages/@azure/arm-securityinsight/lib/operations/index.ts @@ -10,4 +10,5 @@ export * from "./operations"; export * from "./alertRules"; +export * from "./actions"; export * from "./dataConnectors"; diff --git a/packages/@azure/arm-securityinsight/lib/securityInsights.ts b/packages/@azure/arm-securityinsight/lib/securityInsights.ts index a4256a265cfa..bb8deaf999b4 100644 --- a/packages/@azure/arm-securityinsight/lib/securityInsights.ts +++ b/packages/@azure/arm-securityinsight/lib/securityInsights.ts @@ -19,6 +19,7 @@ class SecurityInsights extends SecurityInsightsContext { // Operation groups operations: operations.Operations; alertRules: operations.AlertRules; + actions: operations.Actions; dataConnectors: operations.DataConnectors; /** @@ -31,6 +32,7 @@ class SecurityInsights extends SecurityInsightsContext { super(credentials, subscriptionId, options); this.operations = new operations.Operations(this); this.alertRules = new operations.AlertRules(this); + this.actions = new operations.Actions(this); this.dataConnectors = new operations.DataConnectors(this); } }