From 76a5df4b738f73b4d16edf3574de9830ede7a25c Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 5 Feb 2019 12:42:24 -0800 Subject: [PATCH] [AutoPR securityinsights/resource-manager] Adding data connectors APIs (#1055) * Generated from 1a6ebaa4e0f6627020df1cb8706b481ba4aef7c6 Try to fix some checks issues * Generated from 852097272ac674f1b2931aa299767468407eed51 Try to fix issues once again * Generated from c69c6aa9b511b58e14d2711c23c607476f4da35b Fixing typos --- .../lib/models/dataConnectorsMappers.ts | 31 + .../arm-securityinsight/lib/models/index.ts | 554 ++++++++++++++++++ .../arm-securityinsight/lib/models/mappers.ts | 355 ++++++++++- .../lib/models/parameters.ts | 10 + .../lib/operations/dataConnectors.ts | 379 ++++++++++++ .../lib/operations/index.ts | 1 + .../lib/securityInsights.ts | 2 + 7 files changed, 1331 insertions(+), 1 deletion(-) create mode 100644 packages/@azure/arm-securityinsight/lib/models/dataConnectorsMappers.ts create mode 100644 packages/@azure/arm-securityinsight/lib/operations/dataConnectors.ts diff --git a/packages/@azure/arm-securityinsight/lib/models/dataConnectorsMappers.ts b/packages/@azure/arm-securityinsight/lib/models/dataConnectorsMappers.ts new file mode 100644 index 000000000000..df446e3c4a09 --- /dev/null +++ b/packages/@azure/arm-securityinsight/lib/models/dataConnectorsMappers.ts @@ -0,0 +1,31 @@ +/* + * 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, + DataConnectorList, + DataConnector, + CloudError, + OfficeDataConnector, + OfficeDataConnectorDataTypes, + OfficeDataConnectorDataTypesSharePoint, + DataConnectorDataTypeCommon, + OfficeDataConnectorDataTypesExchange, + TIDataConnectorDataTypesIndicators, + TIDataConnector, + TIDataConnectorDataTypes, + AlertsDataTypeOfDataConnectorAlerts, + DataConnectorWithAlerts, + AlertsDataTypeOfDataConnector, + AADDataConnector, + ASCDataConnector, + MCASDataConnector +} from "../models/mappers"; + diff --git a/packages/@azure/arm-securityinsight/lib/models/index.ts b/packages/@azure/arm-securityinsight/lib/models/index.ts index 6fedc3d030e8..557eb85ef5f0 100644 --- a/packages/@azure/arm-securityinsight/lib/models/index.ts +++ b/packages/@azure/arm-securityinsight/lib/models/index.ts @@ -204,6 +204,451 @@ export interface ScheduledAlertRule { readonly lastModifiedUtc?: string; } +/** + * Contains the possible cases for DataConnector. + */ +export type DataConnectorUnion = DataConnector | OfficeDataConnector | TIDataConnector | DataConnectorWithAlertsUnion; + +/** + * @interface + * An interface representing DataConnector. + * Data connector. + * + */ +export interface DataConnector { + /** + * @member {string} kind Polymorphic Discriminator + */ + kind: "DataConnector"; + /** + * @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; + /** + * @member {string} [etag] Etag of the data connector. + */ + etag?: string; +} + +/** + * @interface + * An interface representing DataConnectorKind1. + * Describes an Azure resource with kind. + * + */ +export interface DataConnectorKind1 { + /** + * @member {DataConnectorKind} [kind] The kind of the data connector. + * Possible values include: 'AzureActiveDirectory', 'AzureSecurityCenter', + * 'MicrosoftCloudAppSecurity', 'ThreatIntelligence', 'Office365' + */ + kind?: DataConnectorKind; +} + +/** + * @interface + * An interface representing DataConnectorContextId. + * Describes an Azure resource with kind. + * + */ +export interface DataConnectorContextId { + /** + * @member {string} [contextId] The context id of the origin data source + * (Like tenantID, SubscriptionID etc.). + */ + contextId?: string; +} + +/** + * @interface + * An interface representing DataConnectorDataTypeCommon. + * Common field for data type in data connectors. + * + */ +export interface DataConnectorDataTypeCommon { + /** + * @member {DataTypeState} [state] Describe whether this data type connection + * is enabled or not. Possible values include: 'Enabled', 'Disabled' + */ + state?: DataTypeState; +} + +/** + * @interface + * An interface representing OfficeDataConnectorDataTypesSharePoint. + * SharePoint data type connection. + * + * @extends DataConnectorDataTypeCommon + */ +export interface OfficeDataConnectorDataTypesSharePoint extends DataConnectorDataTypeCommon { +} + +/** + * @interface + * An interface representing OfficeDataConnectorDataTypesExchange. + * Exchange data type connection. + * + * @extends DataConnectorDataTypeCommon + */ +export interface OfficeDataConnectorDataTypesExchange extends DataConnectorDataTypeCommon { +} + +/** + * @interface + * An interface representing OfficeDataConnectorDataTypes. + * The available data types for office data connector. + * + */ +export interface OfficeDataConnectorDataTypes { + /** + * @member {OfficeDataConnectorDataTypesSharePoint} [sharePoint] SharePoint + * data type connection. + */ + sharePoint?: OfficeDataConnectorDataTypesSharePoint; + /** + * @member {OfficeDataConnectorDataTypesExchange} [exchange] Exchange data + * type connection. + */ + exchange?: OfficeDataConnectorDataTypesExchange; +} + +/** + * @interface + * An interface representing OfficeDataConnector. + * Represents office data connector. + * + */ +export interface OfficeDataConnector { + /** + * @member {string} kind Polymorphic Discriminator + */ + kind: "Office365"; + /** + * @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; + /** + * @member {string} [etag] Etag of the data connector. + */ + etag?: string; + /** + * @member {string} [contextId] The context id of the origin data source + * (Like tenantID, SubscriptionID etc.). + */ + contextId?: string; + /** + * @member {OfficeDataConnectorDataTypes} [dataTypes] The available data + * types for the connector. + */ + dataTypes?: OfficeDataConnectorDataTypes; +} + +/** + * @interface + * An interface representing TIDataConnectorDataTypesIndicators. + * Data type for indicators connection. + * + * @extends DataConnectorDataTypeCommon + */ +export interface TIDataConnectorDataTypesIndicators extends DataConnectorDataTypeCommon { +} + +/** + * @interface + * An interface representing TIDataConnectorDataTypes. + * The available data types for TI data connector. + * + */ +export interface TIDataConnectorDataTypes { + /** + * @member {TIDataConnectorDataTypesIndicators} [indicators] Data type for + * indicators connection. + */ + indicators?: TIDataConnectorDataTypesIndicators; +} + +/** + * @interface + * An interface representing TIDataConnector. + * Represents threat intelligence data connector. + * + */ +export interface TIDataConnector { + /** + * @member {string} kind Polymorphic Discriminator + */ + kind: "ThreatIntelligence"; + /** + * @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; + /** + * @member {string} [etag] Etag of the data connector. + */ + etag?: string; + /** + * @member {string} [contextId] The context id of the origin data source + * (Like tenantID, SubscriptionID etc.). + */ + contextId?: string; + /** + * @member {TIDataConnectorDataTypes} [dataTypes] The available data types + * for the connector. + */ + dataTypes?: TIDataConnectorDataTypes; +} + +/** + * Contains the possible cases for DataConnectorWithAlerts. + */ +export type DataConnectorWithAlertsUnion = DataConnectorWithAlerts | AADDataConnector | ASCDataConnector | MCASDataConnector; + +/** + * @interface + * An interface representing DataConnectorWithAlerts. + * Data connector with alerts data type. + * + */ +export interface DataConnectorWithAlerts { + /** + * @member {string} kind Polymorphic Discriminator + */ + kind: "DataConnectorWithAlerts"; + /** + * @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; + /** + * @member {string} [etag] Etag of the data connector. + */ + etag?: string; + /** + * @member {string} [contextId] The context id of the origin data source + * (Like tenantID, SubscriptionID etc.). + */ + contextId?: string; + /** + * @member {AlertsDataTypeOfDataConnector} [dataTypes] The available data + * types for the connector. + */ + dataTypes?: AlertsDataTypeOfDataConnector; +} + +/** + * @interface + * An interface representing AADDataConnector. + * Represents AAD (Azure Active Directory) data connector. + * + */ +export interface AADDataConnector { + /** + * @member {string} kind Polymorphic Discriminator + */ + kind: "AzureActiveDirectory"; + /** + * @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; + /** + * @member {string} [etag] Etag of the data connector. + */ + etag?: string; + /** + * @member {string} [contextId] The context id of the origin data source + * (Like tenantID, SubscriptionID etc.). + */ + contextId?: string; + /** + * @member {AlertsDataTypeOfDataConnector} [dataTypes] The available data + * types for the connector. + */ + dataTypes?: AlertsDataTypeOfDataConnector; +} + +/** + * @interface + * An interface representing ASCDataConnector. + * Represents ASC (Azure Security Center) data connector. + * + */ +export interface ASCDataConnector { + /** + * @member {string} kind Polymorphic Discriminator + */ + kind: "AzureSecurityCenter"; + /** + * @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; + /** + * @member {string} [etag] Etag of the data connector. + */ + etag?: string; + /** + * @member {string} [contextId] The context id of the origin data source + * (Like tenantID, SubscriptionID etc.). + */ + contextId?: string; + /** + * @member {AlertsDataTypeOfDataConnector} [dataTypes] The available data + * types for the connector. + */ + dataTypes?: AlertsDataTypeOfDataConnector; +} + +/** + * @interface + * An interface representing MCASDataConnector. + * Represents MCAS (Microsoft Cloud App Security) data connector. + * + */ +export interface MCASDataConnector { + /** + * @member {string} kind Polymorphic Discriminator + */ + kind: "MicrosoftCloudAppSecurity"; + /** + * @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; + /** + * @member {string} [etag] Etag of the data connector. + */ + etag?: string; + /** + * @member {string} [contextId] The context id of the origin data source + * (Like tenantID, SubscriptionID etc.). + */ + contextId?: string; + /** + * @member {AlertsDataTypeOfDataConnector} [dataTypes] The available data + * types for the connector. + */ + dataTypes?: AlertsDataTypeOfDataConnector; +} + +/** + * @interface + * An interface representing AlertsDataTypeOfDataConnectorAlerts. + * Alerts data type connection. + * + * @extends DataConnectorDataTypeCommon + */ +export interface AlertsDataTypeOfDataConnectorAlerts extends DataConnectorDataTypeCommon { +} + +/** + * @interface + * An interface representing AlertsDataTypeOfDataConnector. + * Alerts data type for data connectors. + * + */ +export interface AlertsDataTypeOfDataConnector { + /** + * @member {AlertsDataTypeOfDataConnectorAlerts} [alerts] Alerts data type + * connection. + */ + alerts?: AlertsDataTypeOfDataConnectorAlerts; +} + /** * @interface * An interface representing Resource. @@ -275,6 +720,22 @@ export interface AlertRulesList extends Array { readonly nextLink?: string; } +/** + * @interface + * An interface representing the DataConnectorList. + * List all the data connectors. + * + * @extends Array + */ +export interface DataConnectorList extends Array { + /** + * @member {string} [nextLink] URL to fetch the next set of data connectors. + * **NOTE: This property will not be serialized. It can only be populated by + * the server.** + */ + readonly nextLink?: string; +} + /** * Defines values for AlertRuleKind. * Possible values include: 'Scheduled' @@ -299,6 +760,23 @@ export type Severity = 'Low' | 'Medium' | 'High' | 'Informational'; */ export type TriggerOperator = 'GreaterThan' | 'LessThan' | 'Equal' | 'NotEqual'; +/** + * Defines values for DataConnectorKind. + * Possible values include: 'AzureActiveDirectory', 'AzureSecurityCenter', + * 'MicrosoftCloudAppSecurity', 'ThreatIntelligence', 'Office365' + * @readonly + * @enum {string} + */ +export type DataConnectorKind = 'AzureActiveDirectory' | 'AzureSecurityCenter' | 'MicrosoftCloudAppSecurity' | 'ThreatIntelligence' | 'Office365'; + +/** + * Defines values for DataTypeState. + * Possible values include: 'Enabled', 'Disabled' + * @readonly + * @enum {string} + */ +export type DataTypeState = 'Enabled' | 'Disabled'; + /** * Contains response data for the list operation. */ @@ -412,3 +890,79 @@ export type AlertRulesListNextResponse = AlertRulesList & { parsedBody: AlertRulesList; }; }; + +/** + * Contains response data for the list operation. + */ +export type DataConnectorsListResponse = DataConnectorList & { + /** + * 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: DataConnectorList; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type DataConnectorsGetResponse = DataConnectorUnion & { + /** + * 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: DataConnectorUnion; + }; +}; + +/** + * Contains response data for the create operation. + */ +export type DataConnectorsCreateResponse = DataConnectorUnion & { + /** + * 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: DataConnectorUnion; + }; +}; + +/** + * Contains response data for the listNext operation. + */ +export type DataConnectorsListNextResponse = DataConnectorList & { + /** + * 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: DataConnectorList; + }; +}; diff --git a/packages/@azure/arm-securityinsight/lib/models/mappers.ts b/packages/@azure/arm-securityinsight/lib/models/mappers.ts index dcc97c81e513..157bb1ac3a08 100644 --- a/packages/@azure/arm-securityinsight/lib/models/mappers.ts +++ b/packages/@azure/arm-securityinsight/lib/models/mappers.ts @@ -245,6 +245,322 @@ export const ScheduledAlertRule: msRest.CompositeMapper = { } }; +export const DataConnector: msRest.CompositeMapper = { + serializedName: "DataConnector", + type: { + name: "Composite", + polymorphicDiscriminator: { + serializedName: "kind", + clientName: "kind" + }, + uberParent: "DataConnector", + className: "DataConnector", + 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" + } + }, + etag: { + serializedName: "etag", + type: { + name: "String" + } + }, + kind: { + required: true, + serializedName: "kind", + type: { + name: "String" + } + } + } + } +}; + +export const DataConnectorKind1: msRest.CompositeMapper = { + serializedName: "DataConnectorKind", + type: { + name: "Composite", + className: "DataConnectorKind1", + modelProperties: { + kind: { + serializedName: "kind", + type: { + name: "String" + } + } + } + } +}; + +export const DataConnectorContextId: msRest.CompositeMapper = { + serializedName: "DataConnectorContextId", + type: { + name: "Composite", + className: "DataConnectorContextId", + modelProperties: { + contextId: { + serializedName: "contextId", + type: { + name: "String" + } + } + } + } +}; + +export const DataConnectorDataTypeCommon: msRest.CompositeMapper = { + serializedName: "DataConnectorDataTypeCommon", + type: { + name: "Composite", + className: "DataConnectorDataTypeCommon", + modelProperties: { + state: { + serializedName: "state", + type: { + name: "String" + } + } + } + } +}; + +export const OfficeDataConnectorDataTypesSharePoint: msRest.CompositeMapper = { + serializedName: "OfficeDataConnectorDataTypes_sharePoint", + type: { + name: "Composite", + className: "OfficeDataConnectorDataTypesSharePoint", + modelProperties: { + ...DataConnectorDataTypeCommon.type.modelProperties + } + } +}; + +export const OfficeDataConnectorDataTypesExchange: msRest.CompositeMapper = { + serializedName: "OfficeDataConnectorDataTypes_exchange", + type: { + name: "Composite", + className: "OfficeDataConnectorDataTypesExchange", + modelProperties: { + ...DataConnectorDataTypeCommon.type.modelProperties + } + } +}; + +export const OfficeDataConnectorDataTypes: msRest.CompositeMapper = { + serializedName: "OfficeDataConnectorDataTypes", + type: { + name: "Composite", + className: "OfficeDataConnectorDataTypes", + modelProperties: { + sharePoint: { + serializedName: "sharePoint", + type: { + name: "Composite", + className: "OfficeDataConnectorDataTypesSharePoint" + } + }, + exchange: { + serializedName: "exchange", + type: { + name: "Composite", + className: "OfficeDataConnectorDataTypesExchange" + } + } + } + } +}; + +export const OfficeDataConnector: msRest.CompositeMapper = { + serializedName: "Office365", + type: { + name: "Composite", + polymorphicDiscriminator: DataConnector.type.polymorphicDiscriminator, + uberParent: "DataConnector", + className: "OfficeDataConnector", + modelProperties: { + ...DataConnector.type.modelProperties, + contextId: { + serializedName: "properties.contextId", + type: { + name: "String" + } + }, + dataTypes: { + serializedName: "properties.dataTypes", + type: { + name: "Composite", + className: "OfficeDataConnectorDataTypes" + } + } + } + } +}; + +export const TIDataConnectorDataTypesIndicators: msRest.CompositeMapper = { + serializedName: "TIDataConnectorDataTypes_indicators", + type: { + name: "Composite", + className: "TIDataConnectorDataTypesIndicators", + modelProperties: { + ...DataConnectorDataTypeCommon.type.modelProperties + } + } +}; + +export const TIDataConnectorDataTypes: msRest.CompositeMapper = { + serializedName: "TIDataConnectorDataTypes", + type: { + name: "Composite", + className: "TIDataConnectorDataTypes", + modelProperties: { + indicators: { + serializedName: "indicators", + type: { + name: "Composite", + className: "TIDataConnectorDataTypesIndicators" + } + } + } + } +}; + +export const TIDataConnector: msRest.CompositeMapper = { + serializedName: "ThreatIntelligence", + type: { + name: "Composite", + polymorphicDiscriminator: DataConnector.type.polymorphicDiscriminator, + uberParent: "DataConnector", + className: "TIDataConnector", + modelProperties: { + ...DataConnector.type.modelProperties, + contextId: { + serializedName: "properties.contextId", + type: { + name: "String" + } + }, + dataTypes: { + serializedName: "properties.dataTypes", + type: { + name: "Composite", + className: "TIDataConnectorDataTypes" + } + } + } + } +}; + +export const DataConnectorWithAlerts: msRest.CompositeMapper = { + serializedName: "DataConnectorWithAlerts", + type: { + name: "Composite", + polymorphicDiscriminator: DataConnector.type.polymorphicDiscriminator, + uberParent: "DataConnector", + className: "DataConnectorWithAlerts", + modelProperties: { + ...DataConnector.type.modelProperties, + contextId: { + serializedName: "properties.contextId", + type: { + name: "String" + } + }, + dataTypes: { + serializedName: "properties.dataTypes", + type: { + name: "Composite", + className: "AlertsDataTypeOfDataConnector" + } + } + } + } +}; + +export const AADDataConnector: msRest.CompositeMapper = { + serializedName: "AzureActiveDirectory", + type: { + name: "Composite", + polymorphicDiscriminator: DataConnector.type.polymorphicDiscriminator, + uberParent: "DataConnector", + className: "AADDataConnector", + modelProperties: { + ...DataConnectorWithAlerts.type.modelProperties + } + } +}; + +export const ASCDataConnector: msRest.CompositeMapper = { + serializedName: "AzureSecurityCenter", + type: { + name: "Composite", + polymorphicDiscriminator: DataConnector.type.polymorphicDiscriminator, + uberParent: "DataConnector", + className: "ASCDataConnector", + modelProperties: { + ...DataConnectorWithAlerts.type.modelProperties + } + } +}; + +export const MCASDataConnector: msRest.CompositeMapper = { + serializedName: "MicrosoftCloudAppSecurity", + type: { + name: "Composite", + polymorphicDiscriminator: DataConnector.type.polymorphicDiscriminator, + uberParent: "DataConnector", + className: "MCASDataConnector", + modelProperties: { + ...DataConnectorWithAlerts.type.modelProperties + } + } +}; + +export const AlertsDataTypeOfDataConnectorAlerts: msRest.CompositeMapper = { + serializedName: "AlertsDataTypeOfDataConnector_alerts", + type: { + name: "Composite", + className: "AlertsDataTypeOfDataConnectorAlerts", + modelProperties: { + ...DataConnectorDataTypeCommon.type.modelProperties + } + } +}; + +export const AlertsDataTypeOfDataConnector: msRest.CompositeMapper = { + serializedName: "AlertsDataTypeOfDataConnector", + type: { + name: "Composite", + className: "AlertsDataTypeOfDataConnector", + modelProperties: { + alerts: { + serializedName: "alerts", + type: { + name: "Composite", + className: "AlertsDataTypeOfDataConnectorAlerts" + } + } + } + } +}; + export const Resource: msRest.CompositeMapper = { serializedName: "Resource", type: { @@ -335,7 +651,44 @@ export const AlertRulesList: msRest.CompositeMapper = { } }; +export const DataConnectorList: msRest.CompositeMapper = { + serializedName: "DataConnectorList", + type: { + name: "Composite", + className: "DataConnectorList", + modelProperties: { + nextLink: { + readOnly: true, + serializedName: "nextLink", + type: { + name: "String" + } + }, + value: { + required: true, + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DataConnector" + } + } + } + } + } + } +}; + export const discriminators = { 'AlertRule' : AlertRule, - 'AlertRule.Scheduled' : ScheduledAlertRule + 'AlertRule.Scheduled' : ScheduledAlertRule, + 'DataConnector' : DataConnector, + 'DataConnector.Office365' : OfficeDataConnector, + 'DataConnector.ThreatIntelligence' : TIDataConnector, + 'DataConnector.AzureActiveDirectory' : AADDataConnector, + 'DataConnector.AzureSecurityCenter' : ASCDataConnector, + 'DataConnector.MicrosoftCloudAppSecurity' : MCASDataConnector, + 'DataConnector.DataConnectorWithAlerts' : DataConnectorWithAlerts }; diff --git a/packages/@azure/arm-securityinsight/lib/models/parameters.ts b/packages/@azure/arm-securityinsight/lib/models/parameters.ts index 88a1383064f4..576c4fb77fd4 100644 --- a/packages/@azure/arm-securityinsight/lib/models/parameters.ts +++ b/packages/@azure/arm-securityinsight/lib/models/parameters.ts @@ -32,6 +32,16 @@ export const apiVersion: msRest.OperationQueryParameter = { } } }; +export const dataConnectorId: msRest.OperationURLParameter = { + parameterPath: "dataConnectorId", + mapper: { + required: true, + serializedName: "dataConnectorId", + type: { + name: "String" + } + } +}; export const nextPageLink: msRest.OperationURLParameter = { parameterPath: "nextPageLink", mapper: { diff --git a/packages/@azure/arm-securityinsight/lib/operations/dataConnectors.ts b/packages/@azure/arm-securityinsight/lib/operations/dataConnectors.ts new file mode 100644 index 000000000000..46220a8be023 --- /dev/null +++ b/packages/@azure/arm-securityinsight/lib/operations/dataConnectors.ts @@ -0,0 +1,379 @@ +/* + * 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/dataConnectorsMappers"; +import * as Parameters from "../models/parameters"; +import { SecurityInsightsContext } from "../securityInsightsContext"; + +/** Class representing a DataConnectors. */ +export class DataConnectors { + private readonly client: SecurityInsightsContext; + + /** + * Create a DataConnectors. + * @param {SecurityInsightsContext} client Reference to the service client. + */ + constructor(client: SecurityInsightsContext) { + this.client = client; + } + + /** + * Gets all data connectors. + * @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 a data connector. + * @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 dataConnectorId Connector ID + * @param [options] The optional parameters + * @returns Promise + */ + get(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, dataConnectorId: 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 dataConnectorId Connector ID + * @param callback The callback + */ + get(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, dataConnectorId: 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 dataConnectorId Connector ID + * @param options The optional parameters + * @param callback The callback + */ + get(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, dataConnectorId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, dataConnectorId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + operationalInsightsResourceProvider, + workspaceName, + dataConnectorId, + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * Creates or updates the data connector. + * @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 dataConnectorId Connector ID + * @param dataConnector The data connector + * @param [options] The optional parameters + * @returns Promise + */ + create(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, dataConnectorId: string, dataConnector: Models.DataConnectorUnion, 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 dataConnectorId Connector ID + * @param dataConnector The data connector + * @param callback The callback + */ + create(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, dataConnectorId: string, dataConnector: Models.DataConnectorUnion, 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 dataConnectorId Connector ID + * @param dataConnector The data connector + * @param options The optional parameters + * @param callback The callback + */ + create(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, dataConnectorId: string, dataConnector: Models.DataConnectorUnion, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + create(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, dataConnectorId: string, dataConnector: Models.DataConnectorUnion, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + operationalInsightsResourceProvider, + workspaceName, + dataConnectorId, + dataConnector, + options + }, + createOperationSpec, + callback) as Promise; + } + + /** + * Delete the data connector. + * @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 dataConnectorId Connector ID + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, dataConnectorId: 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 dataConnectorId Connector ID + * @param callback The callback + */ + deleteMethod(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, dataConnectorId: 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 dataConnectorId Connector ID + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, dataConnectorId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(resourceGroupName: string, operationalInsightsResourceProvider: string, workspaceName: string, dataConnectorId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + operationalInsightsResourceProvider, + workspaceName, + dataConnectorId, + options + }, + deleteMethodOperationSpec, + callback); + } + + /** + * Gets all data connectors. + * @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 listOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.operationalInsightsResourceProvider, + Parameters.workspaceName + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.DataConnectorList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.operationalInsightsResourceProvider, + Parameters.workspaceName, + Parameters.dataConnectorId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.DataConnector + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const createOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.operationalInsightsResourceProvider, + Parameters.workspaceName, + Parameters.dataConnectorId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.acceptLanguage + ], + requestBody: { + parameterPath: "dataConnector", + mapper: { + ...Mappers.DataConnector, + required: true + } + }, + responses: { + 200: { + bodyMapper: Mappers.DataConnector + }, + 201: { + bodyMapper: Mappers.DataConnector + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; + +const deleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}", + urlParameters: [ + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.operationalInsightsResourceProvider, + Parameters.workspaceName, + Parameters.dataConnectorId + ], + 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", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.DataConnectorList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + serializer +}; diff --git a/packages/@azure/arm-securityinsight/lib/operations/index.ts b/packages/@azure/arm-securityinsight/lib/operations/index.ts index 2adf6543bbdd..383a177cd354 100644 --- a/packages/@azure/arm-securityinsight/lib/operations/index.ts +++ b/packages/@azure/arm-securityinsight/lib/operations/index.ts @@ -10,3 +10,4 @@ export * from "./operations"; export * from "./alertRules"; +export * from "./dataConnectors"; diff --git a/packages/@azure/arm-securityinsight/lib/securityInsights.ts b/packages/@azure/arm-securityinsight/lib/securityInsights.ts index e7e4ea06bd1e..a4256a265cfa 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; + dataConnectors: operations.DataConnectors; /** * Initializes a new instance of the SecurityInsights class. @@ -30,6 +31,7 @@ class SecurityInsights extends SecurityInsightsContext { super(credentials, subscriptionId, options); this.operations = new operations.Operations(this); this.alertRules = new operations.AlertRules(this); + this.dataConnectors = new operations.DataConnectors(this); } }