From 457203b10f99ccc212e0a46d2079ac1aab3d6cea Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 23 Jan 2020 12:53:15 +0000 Subject: [PATCH] Generated from 803a75e791105219d7a6d01451d983692c9cc6bd fixed enum --- .../src/Generated/ActionsOperations.cs | 472 ++++ .../Generated/ActionsOperationsExtensions.cs | 115 + .../Generated/AlertRuleTemplatesOperations.cs | 708 ++++++ .../AlertRuleTemplatesOperationsExtensions.cs | 165 ++ .../src/Generated/AlertRulesOperations.cs | 1987 +++++++++++++++++ .../AlertRulesOperationsExtensions.cs | 475 ++++ .../Generated/BookmarkRelationsOperations.cs | 1269 +++++++++++ .../BookmarkRelationsOperationsExtensions.cs | 323 +++ .../src/Generated/BookmarksOperations.cs | 1213 ++++++++++ .../BookmarksOperationsExtensions.cs | 280 +++ .../src/Generated/CaseCommentsOperations.cs | 328 +++ .../CaseCommentsOperationsExtensions.cs | 95 + .../src/Generated/CaseRelationsOperations.cs | 1274 +++++++++++ .../CaseRelationsOperationsExtensions.cs | 333 +++ .../Generated/CasesAggregationsOperations.cs | 299 +++ .../CasesAggregationsOperationsExtensions.cs | 81 + .../src/Generated/CasesOperations.cs | 1508 +++++++++++++ .../Generated/CasesOperationsExtensions.cs | 384 ++++ .../src/Generated/CommentsOperations.cs | 498 +++++ .../Generated/CommentsOperationsExtensions.cs | 138 ++ .../src/Generated/DataConnectorsOperations.cs | 1209 ++++++++++ .../DataConnectorsOperationsExtensions.cs | 280 +++ .../src/Generated/EntitiesOperations.cs | 967 ++++++++ .../Generated/EntitiesOperationsExtensions.cs | 227 ++ .../src/Generated/EntityQueriesOperations.cs | 708 ++++++ .../EntityQueriesOperationsExtensions.cs | 165 ++ .../src/Generated/IActionsOperations.cs | 82 + .../IAlertRuleTemplatesOperations.cs | 112 + .../src/Generated/IAlertRulesOperations.cs | 289 +++ .../Generated/IBookmarkRelationsOperations.cs | 201 ++ .../src/Generated/IBookmarksOperations.cs | 178 ++ .../src/Generated/ICaseCommentsOperations.cs | 67 + .../src/Generated/ICaseRelationsOperations.cs | 206 ++ .../Generated/ICasesAggregationsOperations.cs | 61 + .../src/Generated/ICasesOperations.cs | 236 ++ .../src/Generated/ICommentsOperations.cs | 95 + .../Generated/IDataConnectorsOperations.cs | 178 ++ .../src/Generated/IEntitiesOperations.cs | 149 ++ .../src/Generated/IEntityQueriesOperations.cs | 112 + .../Generated/IOfficeConsentsOperations.cs | 142 ++ .../src/Generated/IOperations.cs | 70 + .../Generated/IProductSettingsOperations.cs | 96 + .../src/Generated/ISecurityInsightsClient.cs | 187 ++ .../Generated/Models/AADCheckRequirements.cs | 52 + .../src/Generated/Models/AADDataConnector.cs | 70 + .../Generated/Models/AATPCheckRequirements.cs | 52 + .../src/Generated/Models/AATPDataConnector.cs | 70 + .../Generated/Models/ASCCheckRequirements.cs | 69 + .../src/Generated/Models/ASCDataConnector.cs | 71 + .../src/Generated/Models/AccountEntity.cs | 180 ++ .../src/Generated/Models/ActionRequest.cs | 60 + .../src/Generated/Models/ActionResponse.cs | 67 + .../src/Generated/Models/Aggregations.cs | 67 + .../src/Generated/Models/AggregationsKind.cs | 49 + .../src/Generated/Models/AlertRule.cs | 75 + .../src/Generated/Models/AlertRuleKind.cs | 23 + .../src/Generated/Models/AlertRuleKind1.cs | 68 + .../src/Generated/Models/AlertRuleTemplate.cs | 67 + .../Models/AlertRuleTemplatePropertiesBase.cs | 112 + .../src/Generated/Models/AlertSeverity.cs | 36 + .../src/Generated/Models/AlertStatus.cs | 40 + .../Models/AlertsDataTypeOfDataConnector.cs | 53 + .../AlertsDataTypeOfDataConnectorAlerts.cs | 48 + .../src/Generated/Models/AttackTactic.cs | 32 + .../Models/AwsCloudTrailCheckRequirements.cs | 60 + .../Models/AwsCloudTrailDataConnector.cs | 71 + .../AwsCloudTrailDataConnectorDataTypes.cs | 54 + ...AwsCloudTrailDataConnectorDataTypesLogs.cs | 48 + .../Generated/Models/AzureResourceEntity.cs | 84 + .../src/Generated/Models/Bookmark.cs | 159 ++ .../src/Generated/Models/BookmarkRelation.cs | 114 + .../src/Generated/Models/CaseComment.cs | 89 + .../src/Generated/Models/CaseModel.cs | 216 ++ .../src/Generated/Models/CaseRelation.cs | 106 + .../src/Generated/Models/CaseSeverity.cs | 40 + .../src/Generated/Models/CaseStatus.cs | 36 + .../src/Generated/Models/CasesAggregation.cs | 68 + .../CasesAggregationBySeverityProperties.cs | 90 + .../CasesAggregationByStatusProperties.cs | 81 + .../src/Generated/Models/CloseReason.cs | 40 + .../Models/CloudApplicationEntity.cs | 105 + .../src/Generated/Models/ConfidenceLevel.cs | 33 + .../Generated/Models/ConfidenceScoreStatus.cs | 39 + .../src/Generated/Models/DataConnector.cs | 75 + .../Models/DataConnectorAuthorizationState.cs | 22 + .../Models/DataConnectorDataTypeCommon.cs | 56 + .../src/Generated/Models/DataConnectorKind.cs | 28 + .../Generated/Models/DataConnectorKind1.cs | 73 + .../Models/DataConnectorLicenseState.cs | 23 + .../Models/DataConnectorRequirementsState.cs | 65 + .../Generated/Models/DataConnectorStatus.cs | 61 + .../Generated/Models/DataConnectorTenantId.cs | 52 + .../DataConnectorWithAlertsProperties.cs | 54 + .../Models/DataConnectorsCheckRequirements.cs | 60 + .../src/Generated/Models/DataTypeState.cs | 22 + .../src/Generated/Models/DataTypeStatus.cs | 22 + .../src/Generated/Models/DnsEntity.cs | 111 + .../src/Generated/Models/ElevationToken.cs | 75 + .../src/Generated/Models/Entity.cs | 67 + .../Models/EntityCommonProperties.cs | 67 + .../Models/EntityExpandParameters.cs | 73 + .../Generated/Models/EntityExpandResponse.cs | 60 + .../Models/EntityExpandResponseValue.cs | 54 + .../src/Generated/Models/EntityKind.cs | 88 + .../src/Generated/Models/EntityKind1.cs | 73 + .../src/Generated/Models/EntityQuery.cs | 116 + .../src/Generated/Models/EntityType.cs | 88 + .../Models/ExpansionResultAggregation.cs | 103 + .../Models/ExpansionResultsMetadata.cs | 55 + .../src/Generated/Models/FileEntity.cs | 111 + .../src/Generated/Models/FileHashAlgorithm.cs | 40 + .../src/Generated/Models/FileHashEntity.cs | 93 + .../src/Generated/Models/FusionAlertRule.cs | 133 ++ .../Models/FusionAlertRuleTemplate.cs | 142 ++ .../src/Generated/Models/GeoLocation.cs | 116 + .../src/Generated/Models/HostEntity.cs | 160 ++ .../src/Generated/Models/IncidentInfo.cs | 104 + .../src/Generated/Models/IncidentSeverity.cs | 40 + .../src/Generated/Models/IoTDeviceEntity.cs | 144 ++ .../src/Generated/Models/IpEntity.cs | 103 + .../src/Generated/Models/KillChainIntent.cs | 136 ++ .../src/Generated/Models/LicenseStatus.cs | 22 + .../Generated/Models/MCASCheckRequirements.cs | 52 + .../src/Generated/Models/MCASDataConnector.cs | 70 + .../Models/MCASDataConnectorDataTypes.cs | 55 + ...MCASDataConnectorDataTypesDiscoveryLogs.cs | 48 + .../Models/MDATPCheckRequirements.cs | 53 + .../Generated/Models/MDATPDataConnector.cs | 71 + .../src/Generated/Models/MalwareEntity.cs | 113 + ...rosoftSecurityIncidentCreationAlertRule.cs | 165 ++ ...cidentCreationAlertRuleCommonProperties.cs | 97 + ...curityIncidentCreationAlertRuleTemplate.cs | 181 ++ .../Models/MicrosoftSecurityProductName.cs | 25 + .../src/Generated/Models/OSFamily.cs | 84 + .../src/Generated/Models/OfficeConsent.cs | 68 + .../Generated/Models/OfficeDataConnector.cs | 70 + .../Models/OfficeDataConnectorDataTypes.cs | 61 + .../OfficeDataConnectorDataTypesExchange.cs | 48 + .../OfficeDataConnectorDataTypesSharePoint.cs | 48 + .../src/Generated/Models/Operation.cs | 59 + .../src/Generated/Models/OperationDisplay.cs | 75 + .../src/Generated/Models/Page.cs | 53 + .../src/Generated/Models/ProcessEntity.cs | 156 ++ .../src/Generated/Models/RegistryHive.cs | 60 + .../src/Generated/Models/RegistryKeyEntity.cs | 100 + .../Generated/Models/RegistryValueEntity.cs | 115 + .../src/Generated/Models/RegistryValueKind.cs | 52 + .../src/Generated/Models/RelationBase.cs | 65 + .../src/Generated/Models/RelationNode.cs | 80 + .../src/Generated/Models/RelationNodeKind.cs | 28 + .../src/Generated/Models/RelationTypes.cs | 24 + .../Generated/Models/RelationsModelInput.cs | 77 + .../src/Generated/Models/Resource.cs | 69 + .../src/Generated/Models/ResourceWithEtag.cs | 77 + .../Generated/Models/ScheduledAlertRule.cs | 205 ++ .../ScheduledAlertRuleCommonProperties.cs | 106 + .../Models/ScheduledAlertRuleTemplate.cs | 208 ++ .../src/Generated/Models/SecurityAlert.cs | 280 +++ ...ityAlertPropertiesConfidenceReasonsItem.cs | 61 + .../Generated/Models/SecurityGroupEntity.cs | 105 + .../src/Generated/Models/SettingKind.cs | 22 + .../src/Generated/Models/Settings.cs | 75 + .../src/Generated/Models/SettingsKind.cs | 67 + .../src/Generated/Models/StatusInMcas.cs | 22 + .../Generated/Models/TICheckRequirements.cs | 52 + .../src/Generated/Models/TIDataConnector.cs | 70 + .../Models/TIDataConnectorDataTypes.cs | 52 + .../TIDataConnectorDataTypesIndicators.cs | 48 + .../src/Generated/Models/TemplateStatus.cs | 32 + .../Generated/Models/ThreatIntelligence.cs | 96 + .../src/Generated/Models/ToggleSettings.cs | 60 + .../src/Generated/Models/TriggerOperator.cs | 72 + .../src/Generated/Models/UebaSettings.cs | 84 + .../src/Generated/Models/UrlEntity.cs | 83 + .../src/Generated/Models/UserInfo.cs | 67 + .../src/Generated/OfficeConsentsOperations.cs | 932 ++++++++ .../OfficeConsentsOperationsExtensions.cs | 218 ++ .../src/Generated/Operations.cs | 390 ++++ .../src/Generated/OperationsExtensions.cs | 87 + .../Generated/ProductSettingsOperations.cs | 558 +++++ .../ProductSettingsOperationsExtensions.cs | 143 ++ .../src/Generated/SdkInfo_SecurityInsights.cs | 43 + .../src/Generated/SecurityInsightsClient.cs | 724 ++++++ .../SecurityInsightsClientExtensions.cs | 89 + 184 files changed, 31293 insertions(+) create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperationsExtensions.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperationsExtensions.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperationsExtensions.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkRelationsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkRelationsOperationsExtensions.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperationsExtensions.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CaseCommentsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CaseCommentsOperationsExtensions.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CaseRelationsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CaseRelationsOperationsExtensions.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CasesAggregationsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CasesAggregationsOperationsExtensions.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CasesOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CasesOperationsExtensions.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CommentsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CommentsOperationsExtensions.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperationsExtensions.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesOperationsExtensions.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityQueriesOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityQueriesOperationsExtensions.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IActionsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRuleTemplatesOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRulesOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarkRelationsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarksOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICaseCommentsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICaseRelationsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICasesAggregationsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICasesOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICommentsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IDataConnectorsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntitiesOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntityQueriesOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IOfficeConsentsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IProductSettingsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ISecurityInsightsClient.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AADCheckRequirements.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AADDataConnector.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AATPCheckRequirements.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AATPDataConnector.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ASCCheckRequirements.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ASCDataConnector.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AccountEntity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActionRequest.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActionResponse.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Aggregations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AggregationsKind.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRule.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleKind.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleKind1.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleTemplate.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleTemplatePropertiesBase.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertSeverity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertStatus.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertsDataTypeOfDataConnector.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertsDataTypeOfDataConnectorAlerts.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AttackTactic.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailCheckRequirements.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnector.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypes.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypesLogs.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AzureResourceEntity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Bookmark.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/BookmarkRelation.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseComment.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseModel.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseRelation.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseSeverity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseStatus.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CasesAggregation.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CasesAggregationBySeverityProperties.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CasesAggregationByStatusProperties.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CloseReason.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CloudApplicationEntity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConfidenceLevel.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConfidenceScoreStatus.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnector.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorAuthorizationState.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorDataTypeCommon.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorKind.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorKind1.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorLicenseState.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorRequirementsState.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorStatus.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorTenantId.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorWithAlertsProperties.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorsCheckRequirements.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataTypeState.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataTypeStatus.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DnsEntity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ElevationToken.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Entity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityCommonProperties.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandParameters.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandResponse.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandResponseValue.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityKind.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityKind1.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQuery.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityType.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ExpansionResultAggregation.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ExpansionResultsMetadata.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileEntity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileHashAlgorithm.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileHashEntity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FusionAlertRule.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FusionAlertRuleTemplate.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GeoLocation.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/HostEntity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentInfo.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentSeverity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IoTDeviceEntity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IpEntity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/KillChainIntent.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/LicenseStatus.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASCheckRequirements.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnector.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnectorDataTypes.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnectorDataTypesDiscoveryLogs.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MDATPCheckRequirements.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MDATPDataConnector.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MalwareEntity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRule.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRuleCommonProperties.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRuleTemplate.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityProductName.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OSFamily.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeConsent.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnector.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypes.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesExchange.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesSharePoint.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Operation.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OperationDisplay.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Page.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ProcessEntity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryHive.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryKeyEntity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryValueEntity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryValueKind.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationBase.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationNode.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationNodeKind.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationTypes.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationsModelInput.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Resource.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ResourceWithEtag.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRule.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRuleCommonProperties.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRuleTemplate.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityAlert.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityAlertPropertiesConfidenceReasonsItem.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityGroupEntity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingKind.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Settings.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingsKind.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/StatusInMcas.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TICheckRequirements.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnector.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypes.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypesIndicators.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TemplateStatus.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligence.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ToggleSettings.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TriggerOperator.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UebaSettings.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UrlEntity.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UserInfo.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/OfficeConsentsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/OfficeConsentsOperationsExtensions.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Operations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/OperationsExtensions.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ProductSettingsOperations.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ProductSettingsOperationsExtensions.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SdkInfo_SecurityInsights.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SecurityInsightsClient.cs create mode 100644 sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SecurityInsightsClientExtensions.cs diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperations.cs new file mode 100644 index 000000000000..74687ac5165b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperations.cs @@ -0,0 +1,472 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ActionsOperations operations. + /// + internal partial class ActionsOperations : IServiceOperations, IActionsOperations + { + /// + /// Initializes a new instance of the ActionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ActionsOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// Gets all actions of alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByAlertRuleWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (ruleId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("ruleId", ruleId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByAlertRule", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all actions of alert rule. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByAlertRuleNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByAlertRuleNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperationsExtensions.cs new file mode 100644 index 000000000000..ef936bde0f47 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperationsExtensions.cs @@ -0,0 +1,115 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ActionsOperations. + /// + public static partial class ActionsOperationsExtensions + { + /// + /// Gets all actions of alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + public static IPage ListByAlertRule(this IActionsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId) + { + return operations.ListByAlertRuleAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId).GetAwaiter().GetResult(); + } + + /// + /// Gets all actions of alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// The cancellation token. + /// + public static async Task> ListByAlertRuleAsync(this IActionsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByAlertRuleWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all actions of alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByAlertRuleNext(this IActionsOperations operations, string nextPageLink) + { + return operations.ListByAlertRuleNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all actions of alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByAlertRuleNextAsync(this IActionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByAlertRuleNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperations.cs new file mode 100644 index 000000000000..7c718eaee850 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperations.cs @@ -0,0 +1,708 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AlertRuleTemplatesOperations operations. + /// + internal partial class AlertRuleTemplatesOperations : IServiceOperations, IAlertRuleTemplatesOperations + { + /// + /// Initializes a new instance of the AlertRuleTemplatesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AlertRuleTemplatesOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// Gets all alert rule templates. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the alert rule template. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule template ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string alertRuleTemplateId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (alertRuleTemplateId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "alertRuleTemplateId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("alertRuleTemplateId", alertRuleTemplateId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{alertRuleTemplateId}", System.Uri.EscapeDataString(alertRuleTemplateId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all alert rule templates. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperationsExtensions.cs new file mode 100644 index 000000000000..ddb4e4cc76a7 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperationsExtensions.cs @@ -0,0 +1,165 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AlertRuleTemplatesOperations. + /// + public static partial class AlertRuleTemplatesOperationsExtensions + { + /// + /// Gets all alert rule templates. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + public static IPage List(this IAlertRuleTemplatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets all alert rule templates. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAlertRuleTemplatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the alert rule template. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule template ID + /// + public static AlertRuleTemplate Get(this IAlertRuleTemplatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string alertRuleTemplateId) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, alertRuleTemplateId).GetAwaiter().GetResult(); + } + + /// + /// Gets the alert rule template. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule template ID + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAlertRuleTemplatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string alertRuleTemplateId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, alertRuleTemplateId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all alert rule templates. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IAlertRuleTemplatesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all alert rule templates. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IAlertRuleTemplatesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperations.cs new file mode 100644 index 000000000000..2f5e30f9d63d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperations.cs @@ -0,0 +1,1987 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AlertRulesOperations operations. + /// + internal partial class AlertRulesOperations : IServiceOperations, IAlertRulesOperations + { + /// + /// Initializes a new instance of the AlertRulesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AlertRulesOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// Gets all alert rules. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (ruleId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("ruleId", ruleId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// The alert rule + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, AlertRule alertRule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (ruleId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); + } + if (alertRule == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "alertRule"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("ruleId", ruleId); + tracingParameters.Add("alertRule", alertRule); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(alertRule != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(alertRule, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete the alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (ruleId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("ruleId", ruleId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the action of alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetActionWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (ruleId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); + } + if (actionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "actionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("ruleId", ruleId); + tracingParameters.Add("actionId", actionId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetAction", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId)); + _url = _url.Replace("{actionId}", System.Uri.EscapeDataString(actionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the action of alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// Etag of the azure resource + /// + /// + /// Logic App Callback URL for this specific workflow. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateActionWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, string etag = default(string), string triggerUri = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (ruleId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); + } + if (actionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "actionId"); + } + ActionRequest action = new ActionRequest(); + if (etag != null || triggerUri != null) + { + action.Etag = etag; + action.TriggerUri = triggerUri; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("ruleId", ruleId); + tracingParameters.Add("actionId", actionId); + tracingParameters.Add("action", action); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateAction", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId)); + _url = _url.Replace("{actionId}", System.Uri.EscapeDataString(actionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(action != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(action, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete the action of alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteActionWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (ruleId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); + } + if (actionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "actionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("ruleId", ruleId); + tracingParameters.Add("actionId", actionId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteAction", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId)); + _url = _url.Replace("{actionId}", System.Uri.EscapeDataString(actionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all alert rules. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperationsExtensions.cs new file mode 100644 index 000000000000..8c13238adfac --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperationsExtensions.cs @@ -0,0 +1,475 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AlertRulesOperations. + /// + public static partial class AlertRulesOperationsExtensions + { + /// + /// Gets all alert rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + public static IPage List(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets all alert rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + public static AlertRule Get(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId).GetAwaiter().GetResult(); + } + + /// + /// Gets the alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// The alert rule + /// + public static AlertRule CreateOrUpdate(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, AlertRule alertRule) + { + return operations.CreateOrUpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, alertRule).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// The alert rule + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, AlertRule alertRule, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, alertRule, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + public static void Delete(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId) + { + operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId).GetAwaiter().GetResult(); + } + + /// + /// Delete the alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the action of alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + public static ActionResponse GetAction(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId) + { + return operations.GetActionAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, actionId).GetAwaiter().GetResult(); + } + + /// + /// Gets the action of alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// The cancellation token. + /// + public static async Task GetActionAsync(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetActionWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, actionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the action of alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// Etag of the azure resource + /// + /// + /// Logic App Callback URL for this specific workflow. + /// + public static ActionResponse CreateOrUpdateAction(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, string etag = default(string), string triggerUri = default(string)) + { + return operations.CreateOrUpdateActionAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, actionId, etag, triggerUri).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the action of alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// Etag of the azure resource + /// + /// + /// Logic App Callback URL for this specific workflow. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateActionAsync(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, string etag = default(string), string triggerUri = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateActionWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, actionId, etag, triggerUri, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the action of alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + public static void DeleteAction(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId) + { + operations.DeleteActionAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, actionId).GetAwaiter().GetResult(); + } + + /// + /// Delete the action of alert rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// The cancellation token. + /// + public static async Task DeleteActionAsync(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteActionWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, actionId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all alert rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IAlertRulesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all alert rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IAlertRulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkRelationsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkRelationsOperations.cs new file mode 100644 index 000000000000..eb15bd946f2c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkRelationsOperations.cs @@ -0,0 +1,1269 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BookmarkRelationsOperations operations. + /// + internal partial class BookmarkRelationsOperations : IServiceOperations, IBookmarkRelationsOperations + { + /// + /// Initializes a new instance of the BookmarkRelationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BookmarkRelationsOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// Gets all bookmark relations. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. Optional. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (bookmarkId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bookmarkId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("bookmarkId", bookmarkId); + tracingParameters.Add("skipToken", skipToken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (skipToken != null) + { + _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a bookmark relation. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// Relation Name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetRelationWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (bookmarkId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bookmarkId"); + } + if (relationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "relationName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("bookmarkId", bookmarkId); + tracingParameters.Add("relationName", relationName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetRelation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId)); + _url = _url.Replace("{relationName}", System.Uri.EscapeDataString(relationName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates the bookmark relation. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// Relation Name + /// + /// + /// The relation input model + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateRelationWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, RelationsModelInput relationInputModel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (bookmarkId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bookmarkId"); + } + if (relationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "relationName"); + } + if (relationInputModel == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "relationInputModel"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("bookmarkId", bookmarkId); + tracingParameters.Add("relationName", relationName); + tracingParameters.Add("relationInputModel", relationInputModel); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateRelation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId)); + _url = _url.Replace("{relationName}", System.Uri.EscapeDataString(relationName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(relationInputModel != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(relationInputModel, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete the bookmark relation. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// Relation Name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteRelationWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (bookmarkId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bookmarkId"); + } + if (relationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "relationName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("bookmarkId", bookmarkId); + tracingParameters.Add("relationName", relationName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteRelation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId)); + _url = _url.Replace("{relationName}", System.Uri.EscapeDataString(relationName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all bookmark relations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkRelationsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkRelationsOperationsExtensions.cs new file mode 100644 index 000000000000..8e8c330f950d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkRelationsOperationsExtensions.cs @@ -0,0 +1,323 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BookmarkRelationsOperations. + /// + public static partial class BookmarkRelationsOperationsExtensions + { + /// + /// Gets all bookmark relations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. Optional. + /// + public static IPage List(this IBookmarkRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string)) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, odataQuery, skipToken).GetAwaiter().GetResult(); + } + + /// + /// Gets all bookmark relations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. Optional. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IBookmarkRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, odataQuery, skipToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a bookmark relation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// Relation Name + /// + public static BookmarkRelation GetRelation(this IBookmarkRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName) + { + return operations.GetRelationAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, relationName).GetAwaiter().GetResult(); + } + + /// + /// Gets a bookmark relation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// Relation Name + /// + /// + /// The cancellation token. + /// + public static async Task GetRelationAsync(this IBookmarkRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetRelationWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, relationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates the bookmark relation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// Relation Name + /// + /// + /// The relation input model + /// + public static BookmarkRelation CreateOrUpdateRelation(this IBookmarkRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, RelationsModelInput relationInputModel) + { + return operations.CreateOrUpdateRelationAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, relationName, relationInputModel).GetAwaiter().GetResult(); + } + + /// + /// Creates the bookmark relation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// Relation Name + /// + /// + /// The relation input model + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateRelationAsync(this IBookmarkRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, RelationsModelInput relationInputModel, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateRelationWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, relationName, relationInputModel, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the bookmark relation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// Relation Name + /// + public static void DeleteRelation(this IBookmarkRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName) + { + operations.DeleteRelationAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, relationName).GetAwaiter().GetResult(); + } + + /// + /// Delete the bookmark relation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// Relation Name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteRelationAsync(this IBookmarkRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteRelationWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, relationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all bookmark relations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IBookmarkRelationsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all bookmark relations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IBookmarkRelationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperations.cs new file mode 100644 index 000000000000..c85cccb0aa94 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperations.cs @@ -0,0 +1,1213 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BookmarksOperations operations. + /// + internal partial class BookmarksOperations : IServiceOperations, IBookmarksOperations + { + /// + /// Initializes a new instance of the BookmarksOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BookmarksOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// Gets all bookmarks. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a bookmark. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (bookmarkId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bookmarkId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("bookmarkId", bookmarkId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the bookmark. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// The bookmark + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, Bookmark bookmark, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (bookmarkId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bookmarkId"); + } + if (bookmark == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bookmark"); + } + if (bookmark != null) + { + bookmark.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("bookmarkId", bookmarkId); + tracingParameters.Add("bookmark", bookmark); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(bookmark != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(bookmark, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete the bookmark. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (bookmarkId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bookmarkId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("bookmarkId", bookmarkId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all bookmarks. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperationsExtensions.cs new file mode 100644 index 000000000000..844fdd9d6875 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperationsExtensions.cs @@ -0,0 +1,280 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BookmarksOperations. + /// + public static partial class BookmarksOperationsExtensions + { + /// + /// Gets all bookmarks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + public static IPage List(this IBookmarksOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets all bookmarks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IBookmarksOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a bookmark. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + public static Bookmark Get(this IBookmarksOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId).GetAwaiter().GetResult(); + } + + /// + /// Gets a bookmark. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBookmarksOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the bookmark. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// The bookmark + /// + public static Bookmark CreateOrUpdate(this IBookmarksOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, Bookmark bookmark) + { + return operations.CreateOrUpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, bookmark).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the bookmark. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// The bookmark + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IBookmarksOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, Bookmark bookmark, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, bookmark, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the bookmark. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + public static void Delete(this IBookmarksOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId) + { + operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId).GetAwaiter().GetResult(); + } + + /// + /// Delete the bookmark. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IBookmarksOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all bookmarks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IBookmarksOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all bookmarks. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IBookmarksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CaseCommentsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CaseCommentsOperations.cs new file mode 100644 index 000000000000..fd7790bbb6d1 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CaseCommentsOperations.cs @@ -0,0 +1,328 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CaseCommentsOperations operations. + /// + internal partial class CaseCommentsOperations : IServiceOperations, ICaseCommentsOperations + { + /// + /// Initializes a new instance of the CaseCommentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CaseCommentsOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// Creates the case comment. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Case comment ID + /// + /// + /// The comment message + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public async Task> CreateCommentWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string caseCommentId, string message, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (caseId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "caseId"); + } + if (caseCommentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "caseCommentId"); + } + if (message == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "message"); + } + CaseComment caseComment = new CaseComment(); + if (message != null) + { + caseComment.Message = message; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("caseId", caseId); + tracingParameters.Add("caseCommentId", caseCommentId); + tracingParameters.Add("caseComment", caseComment); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateComment", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/cases/{caseId}/comments/{caseCommentId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{caseId}", System.Uri.EscapeDataString(caseId)); + _url = _url.Replace("{caseCommentId}", System.Uri.EscapeDataString(caseCommentId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(caseComment != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(caseComment, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CaseCommentsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CaseCommentsOperationsExtensions.cs new file mode 100644 index 000000000000..81e49212189b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CaseCommentsOperationsExtensions.cs @@ -0,0 +1,95 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CaseCommentsOperations. + /// + public static partial class CaseCommentsOperationsExtensions + { + /// + /// Creates the case comment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Case comment ID + /// + /// + /// The comment message + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static CaseComment CreateComment(this ICaseCommentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string caseCommentId, string message) + { + return operations.CreateCommentAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, caseCommentId, message).GetAwaiter().GetResult(); + } + + /// + /// Creates the case comment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Case comment ID + /// + /// + /// The comment message + /// + /// + /// The cancellation token. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static async Task CreateCommentAsync(this ICaseCommentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string caseCommentId, string message, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateCommentWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, caseCommentId, message, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CaseRelationsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CaseRelationsOperations.cs new file mode 100644 index 000000000000..1372f56ce89f --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CaseRelationsOperations.cs @@ -0,0 +1,1274 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CaseRelationsOperations operations. + /// + internal partial class CaseRelationsOperations : IServiceOperations, ICaseRelationsOperations + { + /// + /// Initializes a new instance of the CaseRelationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CaseRelationsOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// Gets all case relations. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. Optional. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (caseId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "caseId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("caseId", caseId); + tracingParameters.Add("skipToken", skipToken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/cases/{caseId}/relations").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{caseId}", System.Uri.EscapeDataString(caseId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (skipToken != null) + { + _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a case relation. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Relation Name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public async Task> GetRelationWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string relationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (caseId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "caseId"); + } + if (relationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "relationName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("caseId", caseId); + tracingParameters.Add("relationName", relationName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetRelation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/cases/{caseId}/relations/{relationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{caseId}", System.Uri.EscapeDataString(caseId)); + _url = _url.Replace("{relationName}", System.Uri.EscapeDataString(relationName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the case relation. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Relation Name + /// + /// + /// The relation input model + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public async Task> CreateOrUpdateRelationWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string relationName, RelationsModelInput relationInputModel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (caseId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "caseId"); + } + if (relationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "relationName"); + } + if (relationInputModel == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "relationInputModel"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("caseId", caseId); + tracingParameters.Add("relationName", relationName); + tracingParameters.Add("relationInputModel", relationInputModel); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateRelation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/cases/{caseId}/relations/{relationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{caseId}", System.Uri.EscapeDataString(caseId)); + _url = _url.Replace("{relationName}", System.Uri.EscapeDataString(relationName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(relationInputModel != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(relationInputModel, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete the case relation. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Relation Name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public async Task DeleteRelationWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string relationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (caseId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "caseId"); + } + if (relationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "relationName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("caseId", caseId); + tracingParameters.Add("relationName", relationName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteRelation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/cases/{caseId}/relations/{relationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{caseId}", System.Uri.EscapeDataString(caseId)); + _url = _url.Replace("{relationName}", System.Uri.EscapeDataString(relationName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all case relations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CaseRelationsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CaseRelationsOperationsExtensions.cs new file mode 100644 index 000000000000..845514ad132d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CaseRelationsOperationsExtensions.cs @@ -0,0 +1,333 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CaseRelationsOperations. + /// + public static partial class CaseRelationsOperationsExtensions + { + /// + /// Gets all case relations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. Optional. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static IPage List(this ICaseRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string)) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, odataQuery, skipToken).GetAwaiter().GetResult(); + } + + /// + /// Gets all case relations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. Optional. + /// + /// + /// The cancellation token. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static async Task> ListAsync(this ICaseRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, odataQuery, skipToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a case relation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Relation Name + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static CaseRelation GetRelation(this ICaseRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string relationName) + { + return operations.GetRelationAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, relationName).GetAwaiter().GetResult(); + } + + /// + /// Gets a case relation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Relation Name + /// + /// + /// The cancellation token. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static async Task GetRelationAsync(this ICaseRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string relationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetRelationWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, relationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the case relation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Relation Name + /// + /// + /// The relation input model + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static CaseRelation CreateOrUpdateRelation(this ICaseRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string relationName, RelationsModelInput relationInputModel) + { + return operations.CreateOrUpdateRelationAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, relationName, relationInputModel).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the case relation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Relation Name + /// + /// + /// The relation input model + /// + /// + /// The cancellation token. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static async Task CreateOrUpdateRelationAsync(this ICaseRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string relationName, RelationsModelInput relationInputModel, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateRelationWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, relationName, relationInputModel, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the case relation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Relation Name + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static void DeleteRelation(this ICaseRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string relationName) + { + operations.DeleteRelationAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, relationName).GetAwaiter().GetResult(); + } + + /// + /// Delete the case relation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Relation Name + /// + /// + /// The cancellation token. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static async Task DeleteRelationAsync(this ICaseRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string relationName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteRelationWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, relationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all case relations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static IPage ListNext(this ICaseRelationsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all case relations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static async Task> ListNextAsync(this ICaseRelationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CasesAggregationsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CasesAggregationsOperations.cs new file mode 100644 index 000000000000..9a2690e0bb22 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CasesAggregationsOperations.cs @@ -0,0 +1,299 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CasesAggregationsOperations operations. + /// + internal partial class CasesAggregationsOperations : IServiceOperations, ICasesAggregationsOperations + { + /// + /// Initializes a new instance of the CasesAggregationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CasesAggregationsOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// Get aggregative result for the given resources under the defined workspace + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The aggregation name. Supports - Cases + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string aggregationsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (aggregationsName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "aggregationsName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("aggregationsName", aggregationsName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/aggregations/{aggregationsName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{aggregationsName}", System.Uri.EscapeDataString(aggregationsName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CasesAggregationsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CasesAggregationsOperationsExtensions.cs new file mode 100644 index 000000000000..5b3dc62d6566 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CasesAggregationsOperationsExtensions.cs @@ -0,0 +1,81 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CasesAggregationsOperations. + /// + public static partial class CasesAggregationsOperationsExtensions + { + /// + /// Get aggregative result for the given resources under the defined workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The aggregation name. Supports - Cases + /// + public static Aggregations Get(this ICasesAggregationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string aggregationsName) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, aggregationsName).GetAwaiter().GetResult(); + } + + /// + /// Get aggregative result for the given resources under the defined workspace + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The aggregation name. Supports - Cases + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ICasesAggregationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string aggregationsName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, aggregationsName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CasesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CasesOperations.cs new file mode 100644 index 000000000000..84cc03b2ffb2 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CasesOperations.cs @@ -0,0 +1,1508 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CasesOperations operations. + /// + internal partial class CasesOperations : IServiceOperations, ICasesOperations + { + /// + /// Initializes a new instance of the CasesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CasesOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// Gets all cases. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Filters the results, based on a Boolean condition. Optional. + /// + /// + /// Sorts the results. Optional. + /// + /// + /// Returns only the first n results. Optional. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. Optional. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("filter", filter); + tracingParameters.Add("orderby", orderby); + tracingParameters.Add("top", top); + tracingParameters.Add("skipToken", skipToken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/cases").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (orderby != null) + { + _queryParameters.Add(string.Format("$orderby={0}", System.Uri.EscapeDataString(orderby))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (skipToken != null) + { + _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a case. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (caseId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "caseId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("caseId", caseId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/cases/{caseId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{caseId}", System.Uri.EscapeDataString(caseId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the case. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// The case + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, CaseModel caseParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (caseId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "caseId"); + } + if (caseParameter == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "caseParameter"); + } + if (caseParameter != null) + { + caseParameter.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("caseId", caseId); + tracingParameters.Add("caseParameter", caseParameter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/cases/{caseId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{caseId}", System.Uri.EscapeDataString(caseId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(caseParameter != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(caseParameter, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete the case. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (caseId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "caseId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("caseId", caseId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/cases/{caseId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{caseId}", System.Uri.EscapeDataString(caseId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a case comment. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Case comment ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public async Task> GetCommentWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string caseCommentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (caseId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "caseId"); + } + if (caseCommentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "caseCommentId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("caseId", caseId); + tracingParameters.Add("caseCommentId", caseCommentId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetComment", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/cases/{caseId}/comments/{caseCommentId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{caseId}", System.Uri.EscapeDataString(caseId)); + _url = _url.Replace("{caseCommentId}", System.Uri.EscapeDataString(caseCommentId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all cases. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CasesOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CasesOperationsExtensions.cs new file mode 100644 index 000000000000..00ad6e6356d3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CasesOperationsExtensions.cs @@ -0,0 +1,384 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CasesOperations. + /// + public static partial class CasesOperationsExtensions + { + /// + /// Gets all cases. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Filters the results, based on a Boolean condition. Optional. + /// + /// + /// Sorts the results. Optional. + /// + /// + /// Returns only the first n results. Optional. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. Optional. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static IPage List(this ICasesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), string skipToken = default(string)) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, filter, orderby, top, skipToken).GetAwaiter().GetResult(); + } + + /// + /// Gets all cases. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Filters the results, based on a Boolean condition. Optional. + /// + /// + /// Sorts the results. Optional. + /// + /// + /// Returns only the first n results. Optional. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. Optional. + /// + /// + /// The cancellation token. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static async Task> ListAsync(this ICasesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, filter, orderby, top, skipToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a case. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static CaseModel Get(this ICasesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId).GetAwaiter().GetResult(); + } + + /// + /// Gets a case. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// The cancellation token. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static async Task GetAsync(this ICasesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the case. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// The case + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static CaseModel CreateOrUpdate(this ICasesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, CaseModel caseParameter) + { + return operations.CreateOrUpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, caseParameter).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the case. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// The case + /// + /// + /// The cancellation token. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static async Task CreateOrUpdateAsync(this ICasesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, CaseModel caseParameter, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, caseParameter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the case. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static void Delete(this ICasesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId) + { + operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId).GetAwaiter().GetResult(); + } + + /// + /// Delete the case. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// The cancellation token. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static async Task DeleteAsync(this ICasesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a case comment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Case comment ID + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static CaseComment GetComment(this ICasesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string caseCommentId) + { + return operations.GetCommentAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, caseCommentId).GetAwaiter().GetResult(); + } + + /// + /// Gets a case comment. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Case comment ID + /// + /// + /// The cancellation token. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static async Task GetCommentAsync(this ICasesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string caseCommentId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetCommentWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, caseCommentId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all cases. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static IPage ListNext(this ICasesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all cases. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static async Task> ListNextAsync(this ICasesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CommentsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CommentsOperations.cs new file mode 100644 index 000000000000..023ab6354952 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CommentsOperations.cs @@ -0,0 +1,498 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CommentsOperations operations. + /// + internal partial class CommentsOperations : IServiceOperations, ICommentsOperations + { + /// + /// Initializes a new instance of the CommentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CommentsOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// Gets all case comments. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. Optional. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public async Task>> ListByCaseWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (caseId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "caseId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("caseId", caseId); + tracingParameters.Add("skipToken", skipToken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByCase", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/cases/{caseId}/comments").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{caseId}", System.Uri.EscapeDataString(caseId)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (skipToken != null) + { + _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all case comments. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public async Task>> ListByCaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByCaseNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CommentsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CommentsOperationsExtensions.cs new file mode 100644 index 000000000000..d9def2486c77 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/CommentsOperationsExtensions.cs @@ -0,0 +1,138 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CommentsOperations. + /// + public static partial class CommentsOperationsExtensions + { + /// + /// Gets all case comments. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. Optional. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static IPage ListByCase(this ICommentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string)) + { + return operations.ListByCaseAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, odataQuery, skipToken).GetAwaiter().GetResult(); + } + + /// + /// Gets all case comments. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a skiptoken parameter that specifies a + /// starting point to use for subsequent calls. Optional. + /// + /// + /// The cancellation token. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static async Task> ListByCaseAsync(this ICommentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCaseWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, caseId, odataQuery, skipToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all case comments. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static IPage ListByCaseNext(this ICommentsOperations operations, string nextPageLink) + { + return operations.ListByCaseNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all case comments. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + public static async Task> ListByCaseNextAsync(this ICommentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByCaseNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperations.cs new file mode 100644 index 000000000000..2e6a57918805 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperations.cs @@ -0,0 +1,1209 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DataConnectorsOperations operations. + /// + internal partial class DataConnectorsOperations : IServiceOperations, IDataConnectorsOperations + { + /// + /// Initializes a new instance of the DataConnectorsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DataConnectorsOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// Gets all data connectors. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a data connector. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Connector ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (dataConnectorId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataConnectorId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("dataConnectorId", dataConnectorId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{dataConnectorId}", System.Uri.EscapeDataString(dataConnectorId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the data connector. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Connector ID + /// + /// + /// The data connector + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, DataConnector dataConnector, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (dataConnectorId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataConnectorId"); + } + if (dataConnector == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataConnector"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("dataConnectorId", dataConnectorId); + tracingParameters.Add("dataConnector", dataConnector); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{dataConnectorId}", System.Uri.EscapeDataString(dataConnectorId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(dataConnector != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dataConnector, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete the data connector. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Connector ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (dataConnectorId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataConnectorId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("dataConnectorId", dataConnectorId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{dataConnectorId}", System.Uri.EscapeDataString(dataConnectorId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all data connectors. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperationsExtensions.cs new file mode 100644 index 000000000000..5d0922d4f152 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperationsExtensions.cs @@ -0,0 +1,280 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DataConnectorsOperations. + /// + public static partial class DataConnectorsOperationsExtensions + { + /// + /// Gets all data connectors. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + public static IPage List(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets all data connectors. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a data connector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Connector ID + /// + public static DataConnector Get(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorId).GetAwaiter().GetResult(); + } + + /// + /// Gets a data connector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Connector ID + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the data connector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Connector ID + /// + /// + /// The data connector + /// + public static DataConnector CreateOrUpdate(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, DataConnector dataConnector) + { + return operations.CreateOrUpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorId, dataConnector).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the data connector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Connector ID + /// + /// + /// The data connector + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, DataConnector dataConnector, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorId, dataConnector, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the data connector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Connector ID + /// + public static void Delete(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId) + { + operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorId).GetAwaiter().GetResult(); + } + + /// + /// Delete the data connector. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Connector ID + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all data connectors. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IDataConnectorsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all data connectors. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IDataConnectorsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesOperations.cs new file mode 100644 index 000000000000..732c2fa25d6a --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesOperations.cs @@ -0,0 +1,967 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EntitiesOperations operations. + /// + internal partial class EntitiesOperations : IServiceOperations, IEntitiesOperations + { + /// + /// Initializes a new instance of the EntitiesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal EntitiesOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// Gets all entities. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets an entity. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// entity ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (entityId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "entityId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("entityId", entityId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{entityId}", System.Uri.EscapeDataString(entityId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Expands an entity. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// entity ID + /// + /// + /// The parameters required to execute an expand operation on the given entity. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ExpandWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, EntityExpandParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (entityId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "entityId"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("entityId", entityId); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Expand", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/expand").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{entityId}", System.Uri.EscapeDataString(entityId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all entities. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesOperationsExtensions.cs new file mode 100644 index 000000000000..cd81038b5263 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesOperationsExtensions.cs @@ -0,0 +1,227 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for EntitiesOperations. + /// + public static partial class EntitiesOperationsExtensions + { + /// + /// Gets all entities. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + public static IPage List(this IEntitiesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets all entities. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IEntitiesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets an entity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// entity ID + /// + public static Entity Get(this IEntitiesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId).GetAwaiter().GetResult(); + } + + /// + /// Gets an entity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// entity ID + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IEntitiesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Expands an entity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// entity ID + /// + /// + /// The parameters required to execute an expand operation on the given entity. + /// + public static EntityExpandResponse Expand(this IEntitiesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, EntityExpandParameters parameters) + { + return operations.ExpandAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId, parameters).GetAwaiter().GetResult(); + } + + /// + /// Expands an entity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// entity ID + /// + /// + /// The parameters required to execute an expand operation on the given entity. + /// + /// + /// The cancellation token. + /// + public static async Task ExpandAsync(this IEntitiesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, EntityExpandParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ExpandWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all entities. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IEntitiesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all entities. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IEntitiesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityQueriesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityQueriesOperations.cs new file mode 100644 index 000000000000..c043773e31a4 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityQueriesOperations.cs @@ -0,0 +1,708 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EntityQueriesOperations operations. + /// + internal partial class EntityQueriesOperations : IServiceOperations, IEntityQueriesOperations + { + /// + /// Initializes a new instance of the EntityQueriesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal EntityQueriesOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// Gets all entity queries. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets an entity query. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// entity query ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (entityQueryId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "entityQueryId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("entityQueryId", entityQueryId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{entityQueryId}", System.Uri.EscapeDataString(entityQueryId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all entity queries. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityQueriesOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityQueriesOperationsExtensions.cs new file mode 100644 index 000000000000..2d17a4717a3f --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityQueriesOperationsExtensions.cs @@ -0,0 +1,165 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for EntityQueriesOperations. + /// + public static partial class EntityQueriesOperationsExtensions + { + /// + /// Gets all entity queries. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + public static IPage List(this IEntityQueriesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets all entity queries. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IEntityQueriesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets an entity query. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// entity query ID + /// + public static EntityQuery Get(this IEntityQueriesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryId) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityQueryId).GetAwaiter().GetResult(); + } + + /// + /// Gets an entity query. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// entity query ID + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IEntityQueriesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityQueryId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all entity queries. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IEntityQueriesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all entity queries. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IEntityQueriesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IActionsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IActionsOperations.cs new file mode 100644 index 000000000000..11e45b560a26 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IActionsOperations.cs @@ -0,0 +1,82 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ActionsOperations operations. + /// + public partial interface IActionsOperations + { + /// + /// Gets all actions of alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByAlertRuleWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all actions of alert rule. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByAlertRuleNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRuleTemplatesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRuleTemplatesOperations.cs new file mode 100644 index 000000000000..2573788659f7 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRuleTemplatesOperations.cs @@ -0,0 +1,112 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AlertRuleTemplatesOperations operations. + /// + public partial interface IAlertRuleTemplatesOperations + { + /// + /// Gets all alert rule templates. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the alert rule template. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule template ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string alertRuleTemplateId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all alert rule templates. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRulesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRulesOperations.cs new file mode 100644 index 000000000000..6b9895b20b1c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRulesOperations.cs @@ -0,0 +1,289 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AlertRulesOperations operations. + /// + public partial interface IAlertRulesOperations + { + /// + /// Gets all alert rules. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// The alert rule + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, AlertRule alertRule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the action of alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetActionWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the action of alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// Etag of the azure resource + /// + /// + /// Logic App Callback URL for this specific workflow. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateActionWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, string etag = default(string), string triggerUri = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the action of alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteActionWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all alert rules. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarkRelationsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarkRelationsOperations.cs new file mode 100644 index 000000000000..0da38a62f0b9 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarkRelationsOperations.cs @@ -0,0 +1,201 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BookmarkRelationsOperations operations. + /// + public partial interface IBookmarkRelationsOperations + { + /// + /// Gets all bookmark relations. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial + /// result. If a previous response contains a nextLink element, the + /// value of the nextLink element will include a skiptoken parameter + /// that specifies a starting point to use for subsequent calls. + /// Optional. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a bookmark relation. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// Relation Name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetRelationWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates the bookmark relation. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// Relation Name + /// + /// + /// The relation input model + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateRelationWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, RelationsModelInput relationInputModel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the bookmark relation. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// Relation Name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteRelationWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all bookmark relations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarksOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarksOperations.cs new file mode 100644 index 000000000000..31784f89bcbd --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarksOperations.cs @@ -0,0 +1,178 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BookmarksOperations operations. + /// + public partial interface IBookmarksOperations + { + /// + /// Gets all bookmarks. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a bookmark. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the bookmark. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// The bookmark + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, Bookmark bookmark, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the bookmark. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Bookmark ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all bookmarks. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICaseCommentsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICaseCommentsOperations.cs new file mode 100644 index 000000000000..b1caa2c51ad4 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICaseCommentsOperations.cs @@ -0,0 +1,67 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CaseCommentsOperations operations. + /// + public partial interface ICaseCommentsOperations + { + /// + /// Creates the case comment. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Case comment ID + /// + /// + /// The comment message + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + Task> CreateCommentWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string caseCommentId, string message, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICaseRelationsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICaseRelationsOperations.cs new file mode 100644 index 000000000000..8875a66faeb3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICaseRelationsOperations.cs @@ -0,0 +1,206 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CaseRelationsOperations operations. + /// + public partial interface ICaseRelationsOperations + { + /// + /// Gets all case relations. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial + /// result. If a previous response contains a nextLink element, the + /// value of the nextLink element will include a skiptoken parameter + /// that specifies a starting point to use for subsequent calls. + /// Optional. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a case relation. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Relation Name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + Task> GetRelationWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string relationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the case relation. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Relation Name + /// + /// + /// The relation input model + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + Task> CreateOrUpdateRelationWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string relationName, RelationsModelInput relationInputModel, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the case relation. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Relation Name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + Task DeleteRelationWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string relationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all case relations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICasesAggregationsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICasesAggregationsOperations.cs new file mode 100644 index 000000000000..8cd0f0f19c78 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICasesAggregationsOperations.cs @@ -0,0 +1,61 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CasesAggregationsOperations operations. + /// + public partial interface ICasesAggregationsOperations + { + /// + /// Get aggregative result for the given resources under the defined + /// workspace + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The aggregation name. Supports - Cases + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string aggregationsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICasesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICasesOperations.cs new file mode 100644 index 000000000000..fb5c6f4bd6d8 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICasesOperations.cs @@ -0,0 +1,236 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CasesOperations operations. + /// + public partial interface ICasesOperations + { + /// + /// Gets all cases. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Filters the results, based on a Boolean condition. Optional. + /// + /// + /// Sorts the results. Optional. + /// + /// + /// Returns only the first n results. Optional. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial + /// result. If a previous response contains a nextLink element, the + /// value of the nextLink element will include a skiptoken parameter + /// that specifies a starting point to use for subsequent calls. + /// Optional. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a case. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the case. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// The case + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, CaseModel caseParameter, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the case. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a case comment. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// Case comment ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + Task> GetCommentWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, string caseCommentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all cases. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICommentsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICommentsOperations.cs new file mode 100644 index 000000000000..726d66eca36b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ICommentsOperations.cs @@ -0,0 +1,95 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// CommentsOperations operations. + /// + public partial interface ICommentsOperations + { + /// + /// Gets all case comments. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Case ID + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Skiptoken is only used if a previous operation returned a partial + /// result. If a previous response contains a nextLink element, the + /// value of the nextLink element will include a skiptoken parameter + /// that specifies a starting point to use for subsequent calls. + /// Optional. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + Task>> ListByCaseWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string caseId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all case comments. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + [System.Obsolete("This operation is deprecated. Please do not use it any longer.")] + Task>> ListByCaseNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IDataConnectorsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IDataConnectorsOperations.cs new file mode 100644 index 000000000000..dcc790fbb928 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IDataConnectorsOperations.cs @@ -0,0 +1,178 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DataConnectorsOperations operations. + /// + public partial interface IDataConnectorsOperations + { + /// + /// Gets all data connectors. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a data connector. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Connector ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the data connector. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Connector ID + /// + /// + /// The data connector + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, DataConnector dataConnector, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the data connector. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Connector ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all data connectors. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntitiesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntitiesOperations.cs new file mode 100644 index 000000000000..08203df885ef --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntitiesOperations.cs @@ -0,0 +1,149 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EntitiesOperations operations. + /// + public partial interface IEntitiesOperations + { + /// + /// Gets all entities. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets an entity. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// entity ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Expands an entity. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// entity ID + /// + /// + /// The parameters required to execute an expand operation on the given + /// entity. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ExpandWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, EntityExpandParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all entities. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntityQueriesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntityQueriesOperations.cs new file mode 100644 index 000000000000..6385c4d0928f --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntityQueriesOperations.cs @@ -0,0 +1,112 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EntityQueriesOperations operations. + /// + public partial interface IEntityQueriesOperations + { + /// + /// Gets all entity queries. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets an entity query. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// entity query ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all entity queries. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IOfficeConsentsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IOfficeConsentsOperations.cs new file mode 100644 index 000000000000..890e8d73c3c2 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IOfficeConsentsOperations.cs @@ -0,0 +1,142 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OfficeConsentsOperations operations. + /// + public partial interface IOfficeConsentsOperations + { + /// + /// Gets all office365 consents. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets an office365 consent. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// consent ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string consentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the office365 consent. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// consent ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string consentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all office365 consents. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IOperations.cs new file mode 100644 index 000000000000..9ab3684610fd --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IOperations.cs @@ -0,0 +1,70 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Lists all operations available Azure Security Insights Resource + /// Provider. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all operations available Azure Security Insights Resource + /// Provider. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IProductSettingsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IProductSettingsOperations.cs new file mode 100644 index 000000000000..74da9436c19d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IProductSettingsOperations.cs @@ -0,0 +1,96 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ProductSettingsOperations operations. + /// + public partial interface IProductSettingsOperations + { + /// + /// Gets a setting. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The setting name. Supports- Fusion, UEBA + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the setting. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The setting name. Supports- Fusion, UEBA + /// + /// + /// The setting + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName, Settings settings, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ISecurityInsightsClient.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ISecurityInsightsClient.cs new file mode 100644 index 000000000000..41dc077af6b7 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ISecurityInsightsClient.cs @@ -0,0 +1,187 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// API spec for Microsoft.SecurityInsights (Azure Security Insights) + /// resource provider + /// + public partial interface ISecurityInsightsClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// API version for the operation + /// + string ApiVersion { get; } + + /// + /// Azure subscription ID + /// + string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IAlertRulesOperations. + /// + IAlertRulesOperations AlertRules { get; } + + /// + /// Gets the IActionsOperations. + /// + IActionsOperations Actions { get; } + + /// + /// Gets the IAlertRuleTemplatesOperations. + /// + IAlertRuleTemplatesOperations AlertRuleTemplates { get; } + + /// + /// Gets the ICasesOperations. + /// + ICasesOperations Cases { get; } + + /// + /// Gets the ICommentsOperations. + /// + ICommentsOperations Comments { get; } + + /// + /// Gets the ICaseCommentsOperations. + /// + ICaseCommentsOperations CaseComments { get; } + + /// + /// Gets the IBookmarksOperations. + /// + IBookmarksOperations Bookmarks { get; } + + /// + /// Gets the ICaseRelationsOperations. + /// + ICaseRelationsOperations CaseRelations { get; } + + /// + /// Gets the IBookmarkRelationsOperations. + /// + IBookmarkRelationsOperations BookmarkRelations { get; } + + /// + /// Gets the IDataConnectorsOperations. + /// + IDataConnectorsOperations DataConnectors { get; } + + /// + /// Gets the IEntitiesOperations. + /// + IEntitiesOperations Entities { get; } + + /// + /// Gets the IOfficeConsentsOperations. + /// + IOfficeConsentsOperations OfficeConsents { get; } + + /// + /// Gets the IProductSettingsOperations. + /// + IProductSettingsOperations ProductSettings { get; } + + /// + /// Gets the ICasesAggregationsOperations. + /// + ICasesAggregationsOperations CasesAggregations { get; } + + /// + /// Gets the IEntityQueriesOperations. + /// + IEntityQueriesOperations EntityQueries { get; } + + /// + /// Get requirements state for a data connector type. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The kind of the data connector. Possible values include: + /// 'AzureActiveDirectory', 'AzureSecurityCenter', + /// 'MicrosoftCloudAppSecurity', 'ThreatIntelligence', 'Office365', + /// 'AmazonWebServicesCloudTrail', 'AzureAdvancedThreatProtection', + /// 'MicrosoftDefenderAdvancedThreatProtection' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> ListDataConnectorRequirementsWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string operationalInsightsResourceProvider, string kind, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AADCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AADCheckRequirements.cs new file mode 100644 index 000000000000..a420d1dee328 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AADCheckRequirements.cs @@ -0,0 +1,52 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// AAD (Azure Active Directory) requirements check properties. + /// + public partial class AADCheckRequirements + { + /// + /// Initializes a new instance of the AADCheckRequirements class. + /// + public AADCheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AADCheckRequirements class. + /// + /// The tenant id to connect to, and get the + /// data from. + public AADCheckRequirements(string tenantId = default(string)) + { + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AADDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AADDataConnector.cs new file mode 100644 index 000000000000..d820cf358507 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AADDataConnector.cs @@ -0,0 +1,70 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents AAD (Azure Active Directory) data connector. + /// + [Newtonsoft.Json.JsonObject("AzureActiveDirectory")] + [Rest.Serialization.JsonTransformation] + public partial class AADDataConnector : DataConnector + { + /// + /// Initializes a new instance of the AADDataConnector class. + /// + public AADDataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AADDataConnector class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + /// The tenant id to connect to, and get the + /// data from. + /// The available data types for the + /// connector. + public AADDataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string tenantId = default(string), AlertsDataTypeOfDataConnector dataTypes = default(AlertsDataTypeOfDataConnector)) + : base(id, name, type, etag) + { + TenantId = tenantId; + DataTypes = dataTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the available data types for the connector. + /// + [JsonProperty(PropertyName = "properties.dataTypes")] + public AlertsDataTypeOfDataConnector DataTypes { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AATPCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AATPCheckRequirements.cs new file mode 100644 index 000000000000..23dd5b3927e2 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AATPCheckRequirements.cs @@ -0,0 +1,52 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// AATP (Azure Advanced Threat Protection) requirements check properties. + /// + public partial class AATPCheckRequirements + { + /// + /// Initializes a new instance of the AATPCheckRequirements class. + /// + public AATPCheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AATPCheckRequirements class. + /// + /// The tenant id to connect to, and get the + /// data from. + public AATPCheckRequirements(string tenantId = default(string)) + { + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AATPDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AATPDataConnector.cs new file mode 100644 index 000000000000..f9c73a8b99f9 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AATPDataConnector.cs @@ -0,0 +1,70 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents AATP (Azure Advanced Threat Protection) data connector. + /// + [Newtonsoft.Json.JsonObject("AzureAdvancedThreatProtection")] + [Rest.Serialization.JsonTransformation] + public partial class AATPDataConnector : DataConnector + { + /// + /// Initializes a new instance of the AATPDataConnector class. + /// + public AATPDataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AATPDataConnector class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + /// The tenant id to connect to, and get the + /// data from. + /// The available data types for the + /// connector. + public AATPDataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string tenantId = default(string), AlertsDataTypeOfDataConnector dataTypes = default(AlertsDataTypeOfDataConnector)) + : base(id, name, type, etag) + { + TenantId = tenantId; + DataTypes = dataTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the available data types for the connector. + /// + [JsonProperty(PropertyName = "properties.dataTypes")] + public AlertsDataTypeOfDataConnector DataTypes { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ASCCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ASCCheckRequirements.cs new file mode 100644 index 000000000000..8488dc598b0c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ASCCheckRequirements.cs @@ -0,0 +1,69 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// ASC (Azure Security Center) requirements check properties. + /// + public partial class ASCCheckRequirements : DataConnectorsCheckRequirements + { + /// + /// Initializes a new instance of the ASCCheckRequirements class. + /// + public ASCCheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ASCCheckRequirements class. + /// + /// The kind of the data connector. Possible values + /// include: 'AzureActiveDirectory', 'AzureSecurityCenter', + /// 'MicrosoftCloudAppSecurity', 'ThreatIntelligence', 'Office365', + /// 'AmazonWebServicesCloudTrail', 'AzureAdvancedThreatProtection', + /// 'MicrosoftDefenderAdvancedThreatProtection' + /// The subscription id to connect to, and + /// get the data from. + public ASCCheckRequirements(string kind, string subscriptionId = default(string)) + : base(kind) + { + SubscriptionId = subscriptionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the subscription id to connect to, and get the data + /// from. + /// + [JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ASCDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ASCDataConnector.cs new file mode 100644 index 000000000000..b0885c94718d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ASCDataConnector.cs @@ -0,0 +1,71 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents ASC (Azure Security Center) data connector. + /// + [Newtonsoft.Json.JsonObject("AzureSecurityCenter")] + [Rest.Serialization.JsonTransformation] + public partial class ASCDataConnector : DataConnector + { + /// + /// Initializes a new instance of the ASCDataConnector class. + /// + public ASCDataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ASCDataConnector class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + /// The available data types for the + /// connector. + /// The subscription id to connect to, and + /// get the data from. + public ASCDataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), AlertsDataTypeOfDataConnector dataTypes = default(AlertsDataTypeOfDataConnector), string subscriptionId = default(string)) + : base(id, name, type, etag) + { + DataTypes = dataTypes; + SubscriptionId = subscriptionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the available data types for the connector. + /// + [JsonProperty(PropertyName = "properties.dataTypes")] + public AlertsDataTypeOfDataConnector DataTypes { get; set; } + + /// + /// Gets or sets the subscription id to connect to, and get the data + /// from. + /// + [JsonProperty(PropertyName = "properties.subscriptionId")] + public string SubscriptionId { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AccountEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AccountEntity.cs new file mode 100644 index 000000000000..50e4d054c22e --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AccountEntity.cs @@ -0,0 +1,180 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents an account entity. + /// + [Newtonsoft.Json.JsonObject("Account")] + [Rest.Serialization.JsonTransformation] + public partial class AccountEntity : Entity + { + /// + /// Initializes a new instance of the AccountEntity class. + /// + public AccountEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccountEntity class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The Azure Active Directory tenant + /// id. + /// The Azure Active Directory user id. + /// The name of the account. This field + /// should hold only the name without any domain added to it, i.e. + /// administrator. + /// The display name of the account. + /// The Host entity id that contains the + /// account in case it is a local account (not domain joined) + /// Determines whether this is a domain + /// account. + /// The NetBIOS domain name as it appears in the + /// alert format – domain\username. Examples: NT AUTHORITY. + /// The objectGUID attribute is a single-value + /// attribute that is the unique identifier for the object, assigned by + /// active directory. + /// The Azure Active Directory Passport User + /// ID. + /// The account security identifier, e.g. + /// S-1-5-18. + /// The user principal name suffix for the + /// account, in some cases it is also the domain name. Examples: + /// contoso.com. + public AccountEntity(string id = default(string), string name = default(string), string type = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string aadTenantId = default(string), string aadUserId = default(string), string accountName = default(string), string displayName = default(string), string hostEntityId = default(string), bool? isDomainJoined = default(bool?), string ntDomain = default(string), System.Guid? objectGuid = default(System.Guid?), string puid = default(string), string sid = default(string), string upnSuffix = default(string)) + : base(id, name, type) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + AadTenantId = aadTenantId; + AadUserId = aadUserId; + AccountName = accountName; + DisplayName = displayName; + HostEntityId = hostEntityId; + IsDomainJoined = isDomainJoined; + NtDomain = ntDomain; + ObjectGuid = objectGuid; + Puid = puid; + Sid = sid; + UpnSuffix = upnSuffix; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the Azure Active Directory tenant id. + /// + [JsonProperty(PropertyName = "properties.aadTenantId")] + public string AadTenantId { get; private set; } + + /// + /// Gets the Azure Active Directory user id. + /// + [JsonProperty(PropertyName = "properties.aadUserId")] + public string AadUserId { get; private set; } + + /// + /// Gets the name of the account. This field should hold only the name + /// without any domain added to it, i.e. administrator. + /// + [JsonProperty(PropertyName = "properties.accountName")] + public string AccountName { get; private set; } + + /// + /// Gets the display name of the account. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets the Host entity id that contains the account in case it is a + /// local account (not domain joined) + /// + [JsonProperty(PropertyName = "properties.hostEntityId")] + public string HostEntityId { get; private set; } + + /// + /// Gets determines whether this is a domain account. + /// + [JsonProperty(PropertyName = "properties.isDomainJoined")] + public bool? IsDomainJoined { get; private set; } + + /// + /// Gets the NetBIOS domain name as it appears in the alert format – + /// domain\username. Examples: NT AUTHORITY. + /// + [JsonProperty(PropertyName = "properties.ntDomain")] + public string NtDomain { get; private set; } + + /// + /// Gets the objectGUID attribute is a single-value attribute that is + /// the unique identifier for the object, assigned by active directory. + /// + [JsonProperty(PropertyName = "properties.objectGuid")] + public System.Guid? ObjectGuid { get; private set; } + + /// + /// Gets the Azure Active Directory Passport User ID. + /// + [JsonProperty(PropertyName = "properties.puid")] + public string Puid { get; private set; } + + /// + /// Gets the account security identifier, e.g. S-1-5-18. + /// + [JsonProperty(PropertyName = "properties.sid")] + public string Sid { get; private set; } + + /// + /// Gets the user principal name suffix for the account, in some cases + /// it is also the domain name. Examples: contoso.com. + /// + [JsonProperty(PropertyName = "properties.upnSuffix")] + public string UpnSuffix { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActionRequest.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActionRequest.cs new file mode 100644 index 000000000000..822887c04655 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActionRequest.cs @@ -0,0 +1,60 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Action for alert rule. + /// + [Rest.Serialization.JsonTransformation] + public partial class ActionRequest : ResourceWithEtag + { + /// + /// Initializes a new instance of the ActionRequest class. + /// + public ActionRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActionRequest class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + /// Logic App Callback URL for this specific + /// workflow. + public ActionRequest(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string triggerUri = default(string)) + : base(id, name, type, etag) + { + TriggerUri = triggerUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets logic App Callback URL for this specific workflow. + /// + [JsonProperty(PropertyName = "properties.triggerUri")] + public string TriggerUri { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActionResponse.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActionResponse.cs new file mode 100644 index 000000000000..d13a5fb0aed4 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActionResponse.cs @@ -0,0 +1,67 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Action for alert rule. + /// + [Rest.Serialization.JsonTransformation] + public partial class ActionResponse : Resource + { + /// + /// Initializes a new instance of the ActionResponse class. + /// + public ActionResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActionResponse class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the action. + /// The name of the logic app's + /// workflow. + public ActionResponse(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string workflowId = default(string)) + : base(id, name, type) + { + Etag = etag; + WorkflowId = workflowId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets etag of the action. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + /// + /// Gets or sets the name of the logic app's workflow. + /// + [JsonProperty(PropertyName = "properties.workflowId")] + public string WorkflowId { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Aggregations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Aggregations.cs new file mode 100644 index 000000000000..cffbe03a8e07 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Aggregations.cs @@ -0,0 +1,67 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The aggregation. + /// + public partial class Aggregations + { + /// + /// Initializes a new instance of the Aggregations class. + /// + public Aggregations() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Aggregations class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + public Aggregations(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AggregationsKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AggregationsKind.cs new file mode 100644 index 000000000000..a0fe2f365c1c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AggregationsKind.cs @@ -0,0 +1,49 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes an Azure resource with kind. + /// + public partial class AggregationsKind + { + /// + /// Initializes a new instance of the AggregationsKind class. + /// + public AggregationsKind() + { + CustomInit(); + } + + /// + /// Static constructor for AggregationsKind class. + /// + static AggregationsKind() + { + Kind = "CasesAggregation"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// The kind of the setting + /// + [JsonProperty(PropertyName = "kind")] + public static string Kind { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRule.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRule.cs new file mode 100644 index 000000000000..18f1c6b867af --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRule.cs @@ -0,0 +1,75 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Alert rule. + /// + public partial class AlertRule + { + /// + /// Initializes a new instance of the AlertRule class. + /// + public AlertRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertRule class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + public AlertRule(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + { + Id = id; + Name = name; + Type = type; + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets etag of the azure resource + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleKind.cs new file mode 100644 index 000000000000..f5b94178a49b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleKind.cs @@ -0,0 +1,23 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for AlertRuleKind. + /// + public static class AlertRuleKind + { + public const string Scheduled = "Scheduled"; + public const string MicrosoftSecurityIncidentCreation = "MicrosoftSecurityIncidentCreation"; + public const string Fusion = "Fusion"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleKind1.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleKind1.cs new file mode 100644 index 000000000000..7901e4bb066f --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleKind1.cs @@ -0,0 +1,68 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes an Azure resource with kind. + /// + public partial class AlertRuleKind1 + { + /// + /// Initializes a new instance of the AlertRuleKind1 class. + /// + public AlertRuleKind1() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertRuleKind1 class. + /// + /// The kind of the alert rule. Possible values + /// include: 'Scheduled', 'MicrosoftSecurityIncidentCreation', + /// 'Fusion' + public AlertRuleKind1(string kind) + { + Kind = kind; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the kind of the alert rule. Possible values include: + /// 'Scheduled', 'MicrosoftSecurityIncidentCreation', 'Fusion' + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Kind == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Kind"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleTemplate.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleTemplate.cs new file mode 100644 index 000000000000..32838d1301b4 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleTemplate.cs @@ -0,0 +1,67 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Alert rule template. + /// + public partial class AlertRuleTemplate + { + /// + /// Initializes a new instance of the AlertRuleTemplate class. + /// + public AlertRuleTemplate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertRuleTemplate class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + public AlertRuleTemplate(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleTemplatePropertiesBase.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleTemplatePropertiesBase.cs new file mode 100644 index 000000000000..40b74aa5d61e --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleTemplatePropertiesBase.cs @@ -0,0 +1,112 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Base alert rule template property bag. + /// + public partial class AlertRuleTemplatePropertiesBase + { + /// + /// Initializes a new instance of the AlertRuleTemplatePropertiesBase + /// class. + /// + public AlertRuleTemplatePropertiesBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertRuleTemplatePropertiesBase + /// class. + /// + /// the number of alert + /// rules that were created by this template + /// The time that this alert rule template + /// has been added. + /// The description of the alert rule + /// template. + /// The display name for alert rule + /// template. + /// The required data connectors + /// for this template + /// The alert rule template status. Possible + /// values include: 'Installed', 'Available', 'NotAvailable' + /// The tactics of the alert rule + /// template + public AlertRuleTemplatePropertiesBase(int? alertRulesCreatedByTemplateCount = default(int?), System.DateTime? createdDateUTC = default(System.DateTime?), string description = default(string), string displayName = default(string), IList requiredDataConnectors = default(IList), string status = default(string), IList tactics = default(IList)) + { + AlertRulesCreatedByTemplateCount = alertRulesCreatedByTemplateCount; + CreatedDateUTC = createdDateUTC; + Description = description; + DisplayName = displayName; + RequiredDataConnectors = requiredDataConnectors; + Status = status; + Tactics = tactics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of alert rules that were created by this + /// template + /// + [JsonProperty(PropertyName = "alertRulesCreatedByTemplateCount")] + public int? AlertRulesCreatedByTemplateCount { get; set; } + + /// + /// Gets the time that this alert rule template has been added. + /// + [JsonProperty(PropertyName = "createdDateUTC")] + public System.DateTime? CreatedDateUTC { get; private set; } + + /// + /// Gets or sets the description of the alert rule template. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets the display name for alert rule template. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the required data connectors for this template + /// + [JsonProperty(PropertyName = "requiredDataConnectors")] + public IList RequiredDataConnectors { get; set; } + + /// + /// Gets or sets the alert rule template status. Possible values + /// include: 'Installed', 'Available', 'NotAvailable' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the tactics of the alert rule template + /// + [JsonProperty(PropertyName = "tactics")] + public IList Tactics { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertSeverity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertSeverity.cs new file mode 100644 index 000000000000..60b33a09f39c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertSeverity.cs @@ -0,0 +1,36 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for AlertSeverity. + /// + public static class AlertSeverity + { + /// + /// High severity + /// + public const string High = "High"; + /// + /// Medium severity + /// + public const string Medium = "Medium"; + /// + /// Low severity + /// + public const string Low = "Low"; + /// + /// Informational severity + /// + public const string Informational = "Informational"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertStatus.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertStatus.cs new file mode 100644 index 000000000000..adad0750947c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertStatus.cs @@ -0,0 +1,40 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for AlertStatus. + /// + public static class AlertStatus + { + /// + /// Unknown value + /// + public const string Unknown = "Unknown"; + /// + /// New alert + /// + public const string New = "New"; + /// + /// Alert closed after handling + /// + public const string Resolved = "Resolved"; + /// + /// Alert dismissed as false positive + /// + public const string Dismissed = "Dismissed"; + /// + /// Alert is being handled + /// + public const string InProgress = "InProgress"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertsDataTypeOfDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertsDataTypeOfDataConnector.cs new file mode 100644 index 000000000000..816196996f5d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertsDataTypeOfDataConnector.cs @@ -0,0 +1,53 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Alerts data type for data connectors. + /// + public partial class AlertsDataTypeOfDataConnector + { + /// + /// Initializes a new instance of the AlertsDataTypeOfDataConnector + /// class. + /// + public AlertsDataTypeOfDataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertsDataTypeOfDataConnector + /// class. + /// + /// Alerts data type connection. + public AlertsDataTypeOfDataConnector(AlertsDataTypeOfDataConnectorAlerts alerts = default(AlertsDataTypeOfDataConnectorAlerts)) + { + Alerts = alerts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets alerts data type connection. + /// + [JsonProperty(PropertyName = "alerts")] + public AlertsDataTypeOfDataConnectorAlerts Alerts { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertsDataTypeOfDataConnectorAlerts.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertsDataTypeOfDataConnectorAlerts.cs new file mode 100644 index 000000000000..feea8c837044 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertsDataTypeOfDataConnectorAlerts.cs @@ -0,0 +1,48 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using System.Linq; + + /// + /// Alerts data type connection. + /// + public partial class AlertsDataTypeOfDataConnectorAlerts : DataConnectorDataTypeCommon + { + /// + /// Initializes a new instance of the + /// AlertsDataTypeOfDataConnectorAlerts class. + /// + public AlertsDataTypeOfDataConnectorAlerts() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AlertsDataTypeOfDataConnectorAlerts class. + /// + /// Describe whether this data type connection is + /// enabled or not. Possible values include: 'Enabled', + /// 'Disabled' + public AlertsDataTypeOfDataConnectorAlerts(string state = default(string)) + : base(state) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AttackTactic.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AttackTactic.cs new file mode 100644 index 000000000000..69da962ffc7a --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AttackTactic.cs @@ -0,0 +1,32 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for AttackTactic. + /// + public static class AttackTactic + { + public const string InitialAccess = "InitialAccess"; + public const string Execution = "Execution"; + public const string Persistence = "Persistence"; + public const string PrivilegeEscalation = "PrivilegeEscalation"; + public const string DefenseEvasion = "DefenseEvasion"; + public const string CredentialAccess = "CredentialAccess"; + public const string Discovery = "Discovery"; + public const string LateralMovement = "LateralMovement"; + public const string Collection = "Collection"; + public const string Exfiltration = "Exfiltration"; + public const string CommandAndControl = "CommandAndControl"; + public const string Impact = "Impact"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailCheckRequirements.cs new file mode 100644 index 000000000000..2f9fc6f35959 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailCheckRequirements.cs @@ -0,0 +1,60 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using System.Linq; + + /// + /// Amazon Web Services CloudTrail requirements check properties. + /// + public partial class AwsCloudTrailCheckRequirements : DataConnectorsCheckRequirements + { + /// + /// Initializes a new instance of the AwsCloudTrailCheckRequirements + /// class. + /// + public AwsCloudTrailCheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AwsCloudTrailCheckRequirements + /// class. + /// + /// The kind of the data connector. Possible values + /// include: 'AzureActiveDirectory', 'AzureSecurityCenter', + /// 'MicrosoftCloudAppSecurity', 'ThreatIntelligence', 'Office365', + /// 'AmazonWebServicesCloudTrail', 'AzureAdvancedThreatProtection', + /// 'MicrosoftDefenderAdvancedThreatProtection' + public AwsCloudTrailCheckRequirements(string kind) + : base(kind) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnector.cs new file mode 100644 index 000000000000..ee41347c8b5a --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnector.cs @@ -0,0 +1,71 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents Amazon Web Services CloudTrail data connector. + /// + [Newtonsoft.Json.JsonObject("AmazonWebServicesCloudTrail")] + [Rest.Serialization.JsonTransformation] + public partial class AwsCloudTrailDataConnector : DataConnector + { + /// + /// Initializes a new instance of the AwsCloudTrailDataConnector class. + /// + public AwsCloudTrailDataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AwsCloudTrailDataConnector class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + /// The Aws Role Arn (with CloudTrailReadOnly + /// policy) that is used to access the Aws account. + /// The available data types for the + /// connector. + public AwsCloudTrailDataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string awsRoleArn = default(string), AwsCloudTrailDataConnectorDataTypes dataTypes = default(AwsCloudTrailDataConnectorDataTypes)) + : base(id, name, type, etag) + { + AwsRoleArn = awsRoleArn; + DataTypes = dataTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Aws Role Arn (with CloudTrailReadOnly policy) that + /// is used to access the Aws account. + /// + [JsonProperty(PropertyName = "properties.awsRoleArn")] + public string AwsRoleArn { get; set; } + + /// + /// Gets or sets the available data types for the connector. + /// + [JsonProperty(PropertyName = "properties.dataTypes")] + public AwsCloudTrailDataConnectorDataTypes DataTypes { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypes.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypes.cs new file mode 100644 index 000000000000..279ef3f6a6fd --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypes.cs @@ -0,0 +1,54 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The available data types for Amazon Web Services CloudTrail data + /// connector. + /// + public partial class AwsCloudTrailDataConnectorDataTypes + { + /// + /// Initializes a new instance of the + /// AwsCloudTrailDataConnectorDataTypes class. + /// + public AwsCloudTrailDataConnectorDataTypes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AwsCloudTrailDataConnectorDataTypes class. + /// + /// Logs data type. + public AwsCloudTrailDataConnectorDataTypes(AwsCloudTrailDataConnectorDataTypesLogs logs = default(AwsCloudTrailDataConnectorDataTypesLogs)) + { + Logs = logs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets logs data type. + /// + [JsonProperty(PropertyName = "logs")] + public AwsCloudTrailDataConnectorDataTypesLogs Logs { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypesLogs.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypesLogs.cs new file mode 100644 index 000000000000..02803069b81e --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypesLogs.cs @@ -0,0 +1,48 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using System.Linq; + + /// + /// Logs data type. + /// + public partial class AwsCloudTrailDataConnectorDataTypesLogs : DataConnectorDataTypeCommon + { + /// + /// Initializes a new instance of the + /// AwsCloudTrailDataConnectorDataTypesLogs class. + /// + public AwsCloudTrailDataConnectorDataTypesLogs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AwsCloudTrailDataConnectorDataTypesLogs class. + /// + /// Describe whether this data type connection is + /// enabled or not. Possible values include: 'Enabled', + /// 'Disabled' + public AwsCloudTrailDataConnectorDataTypesLogs(string state = default(string)) + : base(state) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AzureResourceEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AzureResourceEntity.cs new file mode 100644 index 000000000000..63e46278a129 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AzureResourceEntity.cs @@ -0,0 +1,84 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents an azure resource entity. + /// + [Newtonsoft.Json.JsonObject("AzureResource")] + [Rest.Serialization.JsonTransformation] + public partial class AzureResourceEntity : Entity + { + /// + /// Initializes a new instance of the AzureResourceEntity class. + /// + public AzureResourceEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureResourceEntity class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The azure resource id of the + /// resource + public AzureResourceEntity(string id = default(string), string name = default(string), string type = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string resourceId = default(string)) + : base(id, name, type) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + ResourceId = resourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the azure resource id of the resource + /// + [JsonProperty(PropertyName = "properties.resourceId")] + public string ResourceId { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Bookmark.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Bookmark.cs new file mode 100644 index 000000000000..9de50a64659b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Bookmark.cs @@ -0,0 +1,159 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a bookmark in Azure Security Insights. + /// + [Rest.Serialization.JsonTransformation] + public partial class Bookmark : ResourceWithEtag + { + /// + /// Initializes a new instance of the Bookmark class. + /// + public Bookmark() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Bookmark class. + /// + /// The display name of the bookmark + /// The query of the bookmark. + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + /// The time the bookmark was created + /// Describes a user that created the + /// bookmark + /// List of labels relevant to this + /// bookmark + /// The notes of the bookmark + /// The query result of the bookmark. + /// The last time the bookmark was + /// updated + /// Describes a user that updated the + /// bookmark + /// Describes an incident that relates to + /// bookmark + public Bookmark(string displayName, string query, string id = default(string), string name = default(string), string type = default(string), string etag = default(string), System.DateTime? created = default(System.DateTime?), UserInfo createdBy = default(UserInfo), IList labels = default(IList), string notes = default(string), string queryResult = default(string), System.DateTime? updated = default(System.DateTime?), UserInfo updatedBy = default(UserInfo), IncidentInfo incidentInfo = default(IncidentInfo)) + : base(id, name, type, etag) + { + Created = created; + CreatedBy = createdBy; + DisplayName = displayName; + Labels = labels; + Notes = notes; + Query = query; + QueryResult = queryResult; + Updated = updated; + UpdatedBy = updatedBy; + IncidentInfo = incidentInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the time the bookmark was created + /// + [JsonProperty(PropertyName = "properties.created")] + public System.DateTime? Created { get; set; } + + /// + /// Gets or sets describes a user that created the bookmark + /// + [JsonProperty(PropertyName = "properties.createdBy")] + public UserInfo CreatedBy { get; set; } + + /// + /// Gets or sets the display name of the bookmark + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets list of labels relevant to this bookmark + /// + [JsonProperty(PropertyName = "properties.labels")] + public IList Labels { get; set; } + + /// + /// Gets or sets the notes of the bookmark + /// + [JsonProperty(PropertyName = "properties.notes")] + public string Notes { get; set; } + + /// + /// Gets or sets the query of the bookmark. + /// + [JsonProperty(PropertyName = "properties.query")] + public string Query { get; set; } + + /// + /// Gets or sets the query result of the bookmark. + /// + [JsonProperty(PropertyName = "properties.queryResult")] + public string QueryResult { get; set; } + + /// + /// Gets or sets the last time the bookmark was updated + /// + [JsonProperty(PropertyName = "properties.updated")] + public System.DateTime? Updated { get; set; } + + /// + /// Gets or sets describes a user that updated the bookmark + /// + [JsonProperty(PropertyName = "properties.updatedBy")] + public UserInfo UpdatedBy { get; set; } + + /// + /// Gets or sets describes an incident that relates to bookmark + /// + [JsonProperty(PropertyName = "properties.incidentInfo")] + public IncidentInfo IncidentInfo { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + if (Query == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Query"); + } + if (IncidentInfo != null) + { + IncidentInfo.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/BookmarkRelation.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/BookmarkRelation.cs new file mode 100644 index 000000000000..31334b703494 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/BookmarkRelation.cs @@ -0,0 +1,114 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a bookmark relation + /// + [Rest.Serialization.JsonTransformation] + public partial class BookmarkRelation : RelationBase + { + /// + /// Initializes a new instance of the BookmarkRelation class. + /// + public BookmarkRelation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BookmarkRelation class. + /// + /// Name of relation + /// The case related bookmark id + /// The case identifier + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// The type of relation node. Possible values + /// include: 'CasesToBookmarks' + /// ETag for relation + /// The case title + /// The case severity + public BookmarkRelation(string relationName, string bookmarkId, string caseIdentifier, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string etag = default(string), string caseTitle = default(string), string caseSeverity = default(string)) + : base(id, name, type, kind, etag) + { + RelationName = relationName; + BookmarkId = bookmarkId; + CaseIdentifier = caseIdentifier; + CaseTitle = caseTitle; + CaseSeverity = caseSeverity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of relation + /// + [JsonProperty(PropertyName = "properties.relationName")] + public string RelationName { get; set; } + + /// + /// Gets or sets the case related bookmark id + /// + [JsonProperty(PropertyName = "properties.bookmarkId")] + public string BookmarkId { get; set; } + + /// + /// Gets or sets the case identifier + /// + [JsonProperty(PropertyName = "properties.caseIdentifier")] + public string CaseIdentifier { get; set; } + + /// + /// Gets or sets the case title + /// + [JsonProperty(PropertyName = "properties.caseTitle")] + public string CaseTitle { get; set; } + + /// + /// Gets or sets the case severity + /// + [JsonProperty(PropertyName = "properties.caseSeverity")] + public string CaseSeverity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RelationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RelationName"); + } + if (BookmarkId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BookmarkId"); + } + if (CaseIdentifier == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CaseIdentifier"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseComment.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseComment.cs new file mode 100644 index 000000000000..f687c8259380 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseComment.cs @@ -0,0 +1,89 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a case comment + /// + [Rest.Serialization.JsonTransformation] + public partial class CaseComment : Resource + { + /// + /// Initializes a new instance of the CaseComment class. + /// + public CaseComment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CaseComment class. + /// + /// The comment message + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// The time the comment was + /// created + /// Describes the user that created the + /// comment + public CaseComment(string message, string id = default(string), string name = default(string), string type = default(string), System.DateTime? createdTimeUtc = default(System.DateTime?), UserInfo userInfo = default(UserInfo)) + : base(id, name, type) + { + CreatedTimeUtc = createdTimeUtc; + Message = message; + UserInfo = userInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the time the comment was created + /// + [JsonProperty(PropertyName = "properties.createdTimeUtc")] + public System.DateTime? CreatedTimeUtc { get; private set; } + + /// + /// Gets or sets the comment message + /// + [JsonProperty(PropertyName = "properties.message")] + public string Message { get; set; } + + /// + /// Gets describes the user that created the comment + /// + [JsonProperty(PropertyName = "properties.userInfo")] + public UserInfo UserInfo { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Message == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Message"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseModel.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseModel.cs new file mode 100644 index 000000000000..5053f40f33f4 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseModel.cs @@ -0,0 +1,216 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a case in Azure Security Insights. + /// + [Rest.Serialization.JsonTransformation] + public partial class CaseModel : ResourceWithEtag + { + /// + /// Initializes a new instance of the CaseModel class. + /// + public CaseModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CaseModel class. + /// + /// The severity of the case. Possible values + /// include: 'Critical', 'High', 'Medium', 'Low', + /// 'Informational' + /// The start time of the case + /// The status of the case. Possible values + /// include: 'Draft', 'New', 'InProgress', 'Closed' + /// The title of the case + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + /// a sequential number + /// The reason the case was closed. Possible + /// values include: 'Resolved', 'Dismissed', 'TruePositive', + /// 'FalsePositive', 'Other' + /// the case close reason + /// details + /// The time the case was created + /// The description of the case + /// The end time of the case + /// List of labels relevant to this case + /// the last comment in the case + /// The last time the case was + /// updated + /// Describes a user that the case is assigned + /// to + /// List of related alert + /// identifiers + /// the number of total comments in the + /// case + public CaseModel(string severity, System.DateTime startTimeUtc, string status, string title, string id = default(string), string name = default(string), string type = default(string), string etag = default(string), int? caseNumber = default(int?), string closeReason = default(string), string closedReasonText = default(string), System.DateTime? createdTimeUtc = default(System.DateTime?), string description = default(string), System.DateTime? endTimeUtc = default(System.DateTime?), IList labels = default(IList), string lastComment = default(string), System.DateTime? lastUpdatedTimeUtc = default(System.DateTime?), UserInfo owner = default(UserInfo), IList relatedAlertIds = default(IList), int? totalComments = default(int?)) + : base(id, name, type, etag) + { + CaseNumber = caseNumber; + CloseReason = closeReason; + ClosedReasonText = closedReasonText; + CreatedTimeUtc = createdTimeUtc; + Description = description; + EndTimeUtc = endTimeUtc; + Labels = labels; + LastComment = lastComment; + LastUpdatedTimeUtc = lastUpdatedTimeUtc; + Owner = owner; + RelatedAlertIds = relatedAlertIds; + Severity = severity; + StartTimeUtc = startTimeUtc; + Status = status; + Title = title; + TotalComments = totalComments; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a sequential number + /// + [JsonProperty(PropertyName = "properties.caseNumber")] + public int? CaseNumber { get; private set; } + + /// + /// Gets or sets the reason the case was closed. Possible values + /// include: 'Resolved', 'Dismissed', 'TruePositive', 'FalsePositive', + /// 'Other' + /// + [JsonProperty(PropertyName = "properties.closeReason")] + public string CloseReason { get; set; } + + /// + /// Gets or sets the case close reason details + /// + [JsonProperty(PropertyName = "properties.closedReasonText")] + public string ClosedReasonText { get; set; } + + /// + /// Gets the time the case was created + /// + [JsonProperty(PropertyName = "properties.createdTimeUtc")] + public System.DateTime? CreatedTimeUtc { get; private set; } + + /// + /// Gets or sets the description of the case + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the end time of the case + /// + [JsonProperty(PropertyName = "properties.endTimeUtc")] + public System.DateTime? EndTimeUtc { get; set; } + + /// + /// Gets or sets list of labels relevant to this case + /// + [JsonProperty(PropertyName = "properties.labels")] + public IList Labels { get; set; } + + /// + /// Gets the last comment in the case + /// + [JsonProperty(PropertyName = "properties.lastComment")] + public string LastComment { get; private set; } + + /// + /// Gets the last time the case was updated + /// + [JsonProperty(PropertyName = "properties.lastUpdatedTimeUtc")] + public System.DateTime? LastUpdatedTimeUtc { get; private set; } + + /// + /// Gets or sets describes a user that the case is assigned to + /// + [JsonProperty(PropertyName = "properties.owner")] + public UserInfo Owner { get; set; } + + /// + /// Gets list of related alert identifiers + /// + [JsonProperty(PropertyName = "properties.relatedAlertIds")] + public IList RelatedAlertIds { get; private set; } + + /// + /// Gets or sets the severity of the case. Possible values include: + /// 'Critical', 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "properties.severity")] + public string Severity { get; set; } + + /// + /// Gets or sets the start time of the case + /// + [JsonProperty(PropertyName = "properties.startTimeUtc")] + public System.DateTime StartTimeUtc { get; set; } + + /// + /// Gets or sets the status of the case. Possible values include: + /// 'Draft', 'New', 'InProgress', 'Closed' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets the title of the case + /// + [JsonProperty(PropertyName = "properties.title")] + public string Title { get; set; } + + /// + /// Gets the number of total comments in the case + /// + [JsonProperty(PropertyName = "properties.totalComments")] + public int? TotalComments { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Severity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Severity"); + } + if (Status == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Status"); + } + if (Title == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Title"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseRelation.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseRelation.cs new file mode 100644 index 000000000000..b75a46347c64 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseRelation.cs @@ -0,0 +1,106 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a case relation + /// + [Rest.Serialization.JsonTransformation] + public partial class CaseRelation : RelationBase + { + /// + /// Initializes a new instance of the CaseRelation class. + /// + public CaseRelation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CaseRelation class. + /// + /// Name of relation + /// The case related bookmark id + /// The case identifier + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// The type of relation node. Possible values + /// include: 'CasesToBookmarks' + /// ETag for relation + /// The case related bookmark name + public CaseRelation(string relationName, string bookmarkId, string caseIdentifier, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string etag = default(string), string bookmarkName = default(string)) + : base(id, name, type, kind, etag) + { + RelationName = relationName; + BookmarkId = bookmarkId; + CaseIdentifier = caseIdentifier; + BookmarkName = bookmarkName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of relation + /// + [JsonProperty(PropertyName = "properties.relationName")] + public string RelationName { get; set; } + + /// + /// Gets or sets the case related bookmark id + /// + [JsonProperty(PropertyName = "properties.bookmarkId")] + public string BookmarkId { get; set; } + + /// + /// Gets or sets the case identifier + /// + [JsonProperty(PropertyName = "properties.caseIdentifier")] + public string CaseIdentifier { get; set; } + + /// + /// Gets or sets the case related bookmark name + /// + [JsonProperty(PropertyName = "properties.bookmarkName")] + public string BookmarkName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RelationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RelationName"); + } + if (BookmarkId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BookmarkId"); + } + if (CaseIdentifier == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CaseIdentifier"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseSeverity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseSeverity.cs new file mode 100644 index 000000000000..c6780bb5236a --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseSeverity.cs @@ -0,0 +1,40 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for CaseSeverity. + /// + public static class CaseSeverity + { + /// + /// Critical severity + /// + public const string Critical = "Critical"; + /// + /// High severity + /// + public const string High = "High"; + /// + /// Medium severity + /// + public const string Medium = "Medium"; + /// + /// Low severity + /// + public const string Low = "Low"; + /// + /// Informational severity + /// + public const string Informational = "Informational"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseStatus.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseStatus.cs new file mode 100644 index 000000000000..cb5b3e9e2bbc --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseStatus.cs @@ -0,0 +1,36 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for CaseStatus. + /// + public static class CaseStatus + { + /// + /// Case that wasn't promoted yet to active + /// + public const string Draft = "Draft"; + /// + /// An active case which isn't handled currently + /// + public const string New = "New"; + /// + /// An active case which is handled + /// + public const string InProgress = "InProgress"; + /// + /// A non active case + /// + public const string Closed = "Closed"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CasesAggregation.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CasesAggregation.cs new file mode 100644 index 000000000000..55684583f0c4 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CasesAggregation.cs @@ -0,0 +1,68 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents aggregations results for cases. + /// + [Rest.Serialization.JsonTransformation] + public partial class CasesAggregation : Aggregations + { + /// + /// Initializes a new instance of the CasesAggregation class. + /// + public CasesAggregation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CasesAggregation class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Aggregations results by case + /// severity. + /// Aggregations results by case + /// status. + public CasesAggregation(string id = default(string), string name = default(string), string type = default(string), CasesAggregationBySeverityProperties aggregationBySeverity = default(CasesAggregationBySeverityProperties), CasesAggregationByStatusProperties aggregationByStatus = default(CasesAggregationByStatusProperties)) + : base(id, name, type) + { + AggregationBySeverity = aggregationBySeverity; + AggregationByStatus = aggregationByStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets aggregations results by case severity. + /// + [JsonProperty(PropertyName = "properties.aggregationBySeverity")] + public CasesAggregationBySeverityProperties AggregationBySeverity { get; set; } + + /// + /// Gets or sets aggregations results by case status. + /// + [JsonProperty(PropertyName = "properties.aggregationByStatus")] + public CasesAggregationByStatusProperties AggregationByStatus { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CasesAggregationBySeverityProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CasesAggregationBySeverityProperties.cs new file mode 100644 index 000000000000..56d4c7372b0a --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CasesAggregationBySeverityProperties.cs @@ -0,0 +1,90 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Aggregative results of cases by severity property bag. + /// + public partial class CasesAggregationBySeverityProperties + { + /// + /// Initializes a new instance of the + /// CasesAggregationBySeverityProperties class. + /// + public CasesAggregationBySeverityProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CasesAggregationBySeverityProperties class. + /// + /// Total amount of open cases with + /// severity Critical + /// Total amount of open cases with + /// severity High + /// Total amount of open cases + /// with severity Informational + /// Total amount of open cases with + /// severity Low + /// Total amount of open cases with + /// severity medium + public CasesAggregationBySeverityProperties(int? totalCriticalSeverity = default(int?), int? totalHighSeverity = default(int?), int? totalInformationalSeverity = default(int?), int? totalLowSeverity = default(int?), int? totalMediumSeverity = default(int?)) + { + TotalCriticalSeverity = totalCriticalSeverity; + TotalHighSeverity = totalHighSeverity; + TotalInformationalSeverity = totalInformationalSeverity; + TotalLowSeverity = totalLowSeverity; + TotalMediumSeverity = totalMediumSeverity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets total amount of open cases with severity Critical + /// + [JsonProperty(PropertyName = "totalCriticalSeverity")] + public int? TotalCriticalSeverity { get; private set; } + + /// + /// Gets total amount of open cases with severity High + /// + [JsonProperty(PropertyName = "totalHighSeverity")] + public int? TotalHighSeverity { get; private set; } + + /// + /// Gets total amount of open cases with severity Informational + /// + [JsonProperty(PropertyName = "totalInformationalSeverity")] + public int? TotalInformationalSeverity { get; private set; } + + /// + /// Gets total amount of open cases with severity Low + /// + [JsonProperty(PropertyName = "totalLowSeverity")] + public int? TotalLowSeverity { get; private set; } + + /// + /// Gets total amount of open cases with severity medium + /// + [JsonProperty(PropertyName = "totalMediumSeverity")] + public int? TotalMediumSeverity { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CasesAggregationByStatusProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CasesAggregationByStatusProperties.cs new file mode 100644 index 000000000000..7884e2bfefc8 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CasesAggregationByStatusProperties.cs @@ -0,0 +1,81 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Aggregative results of cases by status property bag. + /// + public partial class CasesAggregationByStatusProperties + { + /// + /// Initializes a new instance of the + /// CasesAggregationByStatusProperties class. + /// + public CasesAggregationByStatusProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CasesAggregationByStatusProperties class. + /// + /// Total amount of open cases with + /// status Dismissed + /// Total amount of open cases with + /// status InProgress + /// Total amount of open cases with status + /// New + /// Total amount of open cases with + /// status Resolved + public CasesAggregationByStatusProperties(int? totalDismissedStatus = default(int?), int? totalInProgressStatus = default(int?), int? totalNewStatus = default(int?), int? totalResolvedStatus = default(int?)) + { + TotalDismissedStatus = totalDismissedStatus; + TotalInProgressStatus = totalInProgressStatus; + TotalNewStatus = totalNewStatus; + TotalResolvedStatus = totalResolvedStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets total amount of open cases with status Dismissed + /// + [JsonProperty(PropertyName = "totalDismissedStatus")] + public int? TotalDismissedStatus { get; private set; } + + /// + /// Gets total amount of open cases with status InProgress + /// + [JsonProperty(PropertyName = "totalInProgressStatus")] + public int? TotalInProgressStatus { get; private set; } + + /// + /// Gets total amount of open cases with status New + /// + [JsonProperty(PropertyName = "totalNewStatus")] + public int? TotalNewStatus { get; private set; } + + /// + /// Gets total amount of open cases with status Resolved + /// + [JsonProperty(PropertyName = "totalResolvedStatus")] + public int? TotalResolvedStatus { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CloseReason.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CloseReason.cs new file mode 100644 index 000000000000..81e7376b76b0 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CloseReason.cs @@ -0,0 +1,40 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for CloseReason. + /// + public static class CloseReason + { + /// + /// Case was resolved + /// + public const string Resolved = "Resolved"; + /// + /// Case was dismissed + /// + public const string Dismissed = "Dismissed"; + /// + /// Case was true positive + /// + public const string TruePositive = "TruePositive"; + /// + /// Case was false positive + /// + public const string FalsePositive = "FalsePositive"; + /// + /// Case was closed for another reason + /// + public const string Other = "Other"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CloudApplicationEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CloudApplicationEntity.cs new file mode 100644 index 000000000000..6ad768b3ec42 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CloudApplicationEntity.cs @@ -0,0 +1,105 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a cloud application entity. + /// + [Newtonsoft.Json.JsonObject("CloudApplication")] + [Rest.Serialization.JsonTransformation] + public partial class CloudApplicationEntity : Entity + { + /// + /// Initializes a new instance of the CloudApplicationEntity class. + /// + public CloudApplicationEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudApplicationEntity class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The technical identifier of the + /// application. + /// The name of the related cloud + /// application. + /// The user defined instance name of the + /// cloud application. It is often used to distinguish between several + /// applications of the same type that a customer has. + public CloudApplicationEntity(string id = default(string), string name = default(string), string type = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), int? appId = default(int?), string appName = default(string), string instanceName = default(string)) + : base(id, name, type) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + AppId = appId; + AppName = appName; + InstanceName = instanceName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the technical identifier of the application. + /// + [JsonProperty(PropertyName = "properties.appId")] + public int? AppId { get; private set; } + + /// + /// Gets the name of the related cloud application. + /// + [JsonProperty(PropertyName = "properties.appName")] + public string AppName { get; private set; } + + /// + /// Gets the user defined instance name of the cloud application. It is + /// often used to distinguish between several applications of the same + /// type that a customer has. + /// + [JsonProperty(PropertyName = "properties.instanceName")] + public string InstanceName { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConfidenceLevel.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConfidenceLevel.cs new file mode 100644 index 000000000000..8cc0d1c0ca29 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConfidenceLevel.cs @@ -0,0 +1,33 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for ConfidenceLevel. + /// + public static class ConfidenceLevel + { + /// + /// Unknown confidence, the is the default value + /// + public const string Unknown = "Unknown"; + /// + /// Low confidence, meaning we have some doubts this is indeed + /// malicious or part of an attack + /// + public const string Low = "Low"; + /// + /// High confidence that the alert is true positive malicious + /// + public const string High = "High"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConfidenceScoreStatus.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConfidenceScoreStatus.cs new file mode 100644 index 000000000000..954928060d6c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConfidenceScoreStatus.cs @@ -0,0 +1,39 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for ConfidenceScoreStatus. + /// + public static class ConfidenceScoreStatus + { + /// + /// Score will not be calculated for this alert as it is not supported + /// by virtual analyst + /// + public const string NotApplicable = "NotApplicable"; + /// + /// No score was set yet and calculation is in progress + /// + public const string InProcess = "InProcess"; + /// + /// Score is calculated and shown as part of the alert, but may be + /// updated again at a later time following the processing of + /// additional data + /// + public const string NotFinal = "NotFinal"; + /// + /// Final score was calculated and available + /// + public const string Final = "Final"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnector.cs new file mode 100644 index 000000000000..3a34ae8c80c2 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnector.cs @@ -0,0 +1,75 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Data connector. + /// + public partial class DataConnector + { + /// + /// Initializes a new instance of the DataConnector class. + /// + public DataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataConnector class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + public DataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + { + Id = id; + Name = name; + Type = type; + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets etag of the azure resource + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorAuthorizationState.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorAuthorizationState.cs new file mode 100644 index 000000000000..2a43f735cd07 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorAuthorizationState.cs @@ -0,0 +1,22 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for DataConnectorAuthorizationState. + /// + public static class DataConnectorAuthorizationState + { + public const string Valid = "Valid"; + public const string Invalid = "Invalid"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorDataTypeCommon.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorDataTypeCommon.cs new file mode 100644 index 000000000000..322fd804d6c7 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorDataTypeCommon.cs @@ -0,0 +1,56 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Common field for data type in data connectors. + /// + public partial class DataConnectorDataTypeCommon + { + /// + /// Initializes a new instance of the DataConnectorDataTypeCommon + /// class. + /// + public DataConnectorDataTypeCommon() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataConnectorDataTypeCommon + /// class. + /// + /// Describe whether this data type connection is + /// enabled or not. Possible values include: 'Enabled', + /// 'Disabled' + public DataConnectorDataTypeCommon(string state = default(string)) + { + State = state; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describe whether this data type connection is enabled + /// or not. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "state")] + public string State { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorKind.cs new file mode 100644 index 000000000000..6db67ec03c55 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorKind.cs @@ -0,0 +1,28 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for DataConnectorKind. + /// + public static class DataConnectorKind + { + public const string AzureActiveDirectory = "AzureActiveDirectory"; + public const string AzureSecurityCenter = "AzureSecurityCenter"; + public const string MicrosoftCloudAppSecurity = "MicrosoftCloudAppSecurity"; + public const string ThreatIntelligence = "ThreatIntelligence"; + public const string Office365 = "Office365"; + public const string AmazonWebServicesCloudTrail = "AmazonWebServicesCloudTrail"; + public const string AzureAdvancedThreatProtection = "AzureAdvancedThreatProtection"; + public const string MicrosoftDefenderAdvancedThreatProtection = "MicrosoftDefenderAdvancedThreatProtection"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorKind1.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorKind1.cs new file mode 100644 index 000000000000..27c8fda34895 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorKind1.cs @@ -0,0 +1,73 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes an Azure resource with kind. + /// + public partial class DataConnectorKind1 + { + /// + /// Initializes a new instance of the DataConnectorKind1 class. + /// + public DataConnectorKind1() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataConnectorKind1 class. + /// + /// The kind of the data connector. Possible values + /// include: 'AzureActiveDirectory', 'AzureSecurityCenter', + /// 'MicrosoftCloudAppSecurity', 'ThreatIntelligence', 'Office365', + /// 'AmazonWebServicesCloudTrail', 'AzureAdvancedThreatProtection', + /// 'MicrosoftDefenderAdvancedThreatProtection' + public DataConnectorKind1(string kind) + { + Kind = kind; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the kind of the data connector. Possible values + /// include: 'AzureActiveDirectory', 'AzureSecurityCenter', + /// 'MicrosoftCloudAppSecurity', 'ThreatIntelligence', 'Office365', + /// 'AmazonWebServicesCloudTrail', 'AzureAdvancedThreatProtection', + /// 'MicrosoftDefenderAdvancedThreatProtection' + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Kind == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Kind"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorLicenseState.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorLicenseState.cs new file mode 100644 index 000000000000..231fab963a02 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorLicenseState.cs @@ -0,0 +1,23 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for DataConnectorLicenseState. + /// + public static class DataConnectorLicenseState + { + public const string Valid = "Valid"; + public const string Invalid = "Invalid"; + public const string Unknown = "Unknown"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorRequirementsState.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorRequirementsState.cs new file mode 100644 index 000000000000..a213cdd5427e --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorRequirementsState.cs @@ -0,0 +1,65 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Data connector requirements status. + /// + public partial class DataConnectorRequirementsState + { + /// + /// Initializes a new instance of the DataConnectorRequirementsState + /// class. + /// + public DataConnectorRequirementsState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataConnectorRequirementsState + /// class. + /// + /// Authorization state for this + /// connector. Possible values include: 'Valid', 'Invalid' + /// License state for this connector. + /// Possible values include: 'Valid', 'Invalid', 'Unknown' + public DataConnectorRequirementsState(string authorizationState = default(string), string licenseState = default(string)) + { + AuthorizationState = authorizationState; + LicenseState = licenseState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets authorization state for this connector. Possible + /// values include: 'Valid', 'Invalid' + /// + [JsonProperty(PropertyName = "authorizationState")] + public string AuthorizationState { get; set; } + + /// + /// Gets or sets license state for this connector. Possible values + /// include: 'Valid', 'Invalid', 'Unknown' + /// + [JsonProperty(PropertyName = "licenseState")] + public string LicenseState { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorStatus.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorStatus.cs new file mode 100644 index 000000000000..0b6d3776cbf2 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorStatus.cs @@ -0,0 +1,61 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// alert rule template data connector status + /// + public partial class DataConnectorStatus + { + /// + /// Initializes a new instance of the DataConnectorStatus class. + /// + public DataConnectorStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataConnectorStatus class. + /// + /// the connector id + /// The data types availability map + public DataConnectorStatus(string connectorId = default(string), IDictionary dataTypes = default(IDictionary)) + { + ConnectorId = connectorId; + DataTypes = dataTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the connector id + /// + [JsonProperty(PropertyName = "connectorId")] + public string ConnectorId { get; set; } + + /// + /// Gets or sets the data types availability map + /// + [JsonProperty(PropertyName = "dataTypes")] + public IDictionary DataTypes { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorTenantId.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorTenantId.cs new file mode 100644 index 000000000000..58c3b3457f4c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorTenantId.cs @@ -0,0 +1,52 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties data connector on tenant level. + /// + public partial class DataConnectorTenantId + { + /// + /// Initializes a new instance of the DataConnectorTenantId class. + /// + public DataConnectorTenantId() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataConnectorTenantId class. + /// + /// The tenant id to connect to, and get the + /// data from. + public DataConnectorTenantId(string tenantId = default(string)) + { + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorWithAlertsProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorWithAlertsProperties.cs new file mode 100644 index 000000000000..b11f7fa33d1b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorWithAlertsProperties.cs @@ -0,0 +1,54 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Data connector properties. + /// + public partial class DataConnectorWithAlertsProperties + { + /// + /// Initializes a new instance of the DataConnectorWithAlertsProperties + /// class. + /// + public DataConnectorWithAlertsProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataConnectorWithAlertsProperties + /// class. + /// + /// The available data types for the + /// connector. + public DataConnectorWithAlertsProperties(AlertsDataTypeOfDataConnector dataTypes = default(AlertsDataTypeOfDataConnector)) + { + DataTypes = dataTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the available data types for the connector. + /// + [JsonProperty(PropertyName = "dataTypes")] + public AlertsDataTypeOfDataConnector DataTypes { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorsCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorsCheckRequirements.cs new file mode 100644 index 000000000000..3c3894b8896c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorsCheckRequirements.cs @@ -0,0 +1,60 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using System.Linq; + + /// + /// Data connector requirements properties. + /// + public partial class DataConnectorsCheckRequirements : DataConnectorKind1 + { + /// + /// Initializes a new instance of the DataConnectorsCheckRequirements + /// class. + /// + public DataConnectorsCheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataConnectorsCheckRequirements + /// class. + /// + /// The kind of the data connector. Possible values + /// include: 'AzureActiveDirectory', 'AzureSecurityCenter', + /// 'MicrosoftCloudAppSecurity', 'ThreatIntelligence', 'Office365', + /// 'AmazonWebServicesCloudTrail', 'AzureAdvancedThreatProtection', + /// 'MicrosoftDefenderAdvancedThreatProtection' + public DataConnectorsCheckRequirements(string kind) + : base(kind) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataTypeState.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataTypeState.cs new file mode 100644 index 000000000000..e2cdbff7312b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataTypeState.cs @@ -0,0 +1,22 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for DataTypeState. + /// + public static class DataTypeState + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataTypeStatus.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataTypeStatus.cs new file mode 100644 index 000000000000..1ab63ded5fff --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataTypeStatus.cs @@ -0,0 +1,22 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for DataTypeStatus. + /// + public static class DataTypeStatus + { + public const string Exist = "Exist"; + public const string NotExist = "NotExist"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DnsEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DnsEntity.cs new file mode 100644 index 000000000000..75c0c48ebb36 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DnsEntity.cs @@ -0,0 +1,111 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a dns entity. + /// + [Newtonsoft.Json.JsonObject("DnsResolution")] + [Rest.Serialization.JsonTransformation] + public partial class DnsEntity : Entity + { + /// + /// Initializes a new instance of the DnsEntity class. + /// + public DnsEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DnsEntity class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// An ip entity id for the dns + /// server resolving the request + /// The name of the dns record associated with + /// the alert + /// An ip entity id for the dns + /// request client + /// Ip entity identifiers for the + /// resolved ip address. + public DnsEntity(string id = default(string), string name = default(string), string type = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string dnsServerIpEntityId = default(string), string domainName = default(string), string hostIpAddressEntityId = default(string), IList ipAddressEntityIds = default(IList)) + : base(id, name, type) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + DnsServerIpEntityId = dnsServerIpEntityId; + DomainName = domainName; + HostIpAddressEntityId = hostIpAddressEntityId; + IpAddressEntityIds = ipAddressEntityIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets an ip entity id for the dns server resolving the request + /// + [JsonProperty(PropertyName = "properties.dnsServerIpEntityId")] + public string DnsServerIpEntityId { get; private set; } + + /// + /// Gets the name of the dns record associated with the alert + /// + [JsonProperty(PropertyName = "properties.domainName")] + public string DomainName { get; private set; } + + /// + /// Gets an ip entity id for the dns request client + /// + [JsonProperty(PropertyName = "properties.hostIpAddressEntityId")] + public string HostIpAddressEntityId { get; private set; } + + /// + /// Gets ip entity identifiers for the resolved ip address. + /// + [JsonProperty(PropertyName = "properties.ipAddressEntityIds")] + public IList IpAddressEntityIds { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ElevationToken.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ElevationToken.cs new file mode 100644 index 000000000000..810dfb319f6e --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ElevationToken.cs @@ -0,0 +1,75 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ElevationToken. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ElevationToken + { + /// + /// Default elevation token + /// + [EnumMember(Value = "Default")] + Default, + /// + /// Full elevation token + /// + [EnumMember(Value = "Full")] + Full, + /// + /// Limited elevation token + /// + [EnumMember(Value = "Limited")] + Limited + } + internal static class ElevationTokenEnumExtension + { + internal static string ToSerializedValue(this ElevationToken? value) + { + return value == null ? null : ((ElevationToken)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ElevationToken value) + { + switch( value ) + { + case ElevationToken.Default: + return "Default"; + case ElevationToken.Full: + return "Full"; + case ElevationToken.Limited: + return "Limited"; + } + return null; + } + + internal static ElevationToken? ParseElevationToken(this string value) + { + switch( value ) + { + case "Default": + return ElevationToken.Default; + case "Full": + return ElevationToken.Full; + case "Limited": + return ElevationToken.Limited; + } + return null; + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Entity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Entity.cs new file mode 100644 index 000000000000..d14bca973cf9 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Entity.cs @@ -0,0 +1,67 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specific entity. + /// + public partial class Entity + { + /// + /// Initializes a new instance of the Entity class. + /// + public Entity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Entity class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + public Entity(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityCommonProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityCommonProperties.cs new file mode 100644 index 000000000000..1ea2909c2bb8 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityCommonProperties.cs @@ -0,0 +1,67 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Entity common property bag. + /// + public partial class EntityCommonProperties + { + /// + /// Initializes a new instance of the EntityCommonProperties class. + /// + public EntityCommonProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityCommonProperties class. + /// + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + public EntityCommonProperties(IDictionary additionalData = default(IDictionary), string friendlyName = default(string)) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "friendlyName")] + public string FriendlyName { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandParameters.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandParameters.cs new file mode 100644 index 000000000000..5a7f826262f8 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandParameters.cs @@ -0,0 +1,73 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The parameters required to execute an expand operation on the given + /// entity. + /// + public partial class EntityExpandParameters + { + /// + /// Initializes a new instance of the EntityExpandParameters class. + /// + public EntityExpandParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityExpandParameters class. + /// + /// The end date filter, so the only expansion + /// results returned are before this date. + /// The Id of the expansion to + /// perform. + /// The start date filter, so the only + /// expansion results returned are after this date. + public EntityExpandParameters(System.DateTime? endTime = default(System.DateTime?), System.Guid? expansionId = default(System.Guid?), System.DateTime? startTime = default(System.DateTime?)) + { + EndTime = endTime; + ExpansionId = expansionId; + StartTime = startTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the end date filter, so the only expansion results + /// returned are before this date. + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime? EndTime { get; set; } + + /// + /// Gets or sets the Id of the expansion to perform. + /// + [JsonProperty(PropertyName = "expansionId")] + public System.Guid? ExpansionId { get; set; } + + /// + /// Gets or sets the start date filter, so the only expansion results + /// returned are after this date. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandResponse.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandResponse.cs new file mode 100644 index 000000000000..d530f5493f6b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandResponse.cs @@ -0,0 +1,60 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The entity expansion result operation response. + /// + public partial class EntityExpandResponse + { + /// + /// Initializes a new instance of the EntityExpandResponse class. + /// + public EntityExpandResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityExpandResponse class. + /// + /// The metadata from the expansion operation + /// results. + /// The expansion result values. + public EntityExpandResponse(ExpansionResultsMetadata metaData = default(ExpansionResultsMetadata), EntityExpandResponseValue value = default(EntityExpandResponseValue)) + { + MetaData = metaData; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the metadata from the expansion operation results. + /// + [JsonProperty(PropertyName = "metaData")] + public ExpansionResultsMetadata MetaData { get; set; } + + /// + /// Gets or sets the expansion result values. + /// + [JsonProperty(PropertyName = "value")] + public EntityExpandResponseValue Value { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandResponseValue.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandResponseValue.cs new file mode 100644 index 000000000000..611edec95d9c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandResponseValue.cs @@ -0,0 +1,54 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The expansion result values. + /// + public partial class EntityExpandResponseValue + { + /// + /// Initializes a new instance of the EntityExpandResponseValue class. + /// + public EntityExpandResponseValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityExpandResponseValue class. + /// + /// Array of the expansion result + /// entities. + public EntityExpandResponseValue(IList entities = default(IList)) + { + Entities = entities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of the expansion result entities. + /// + [JsonProperty(PropertyName = "entities")] + public IList Entities { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityKind.cs new file mode 100644 index 000000000000..711ace691eba --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityKind.cs @@ -0,0 +1,88 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for EntityKind. + /// + public static class EntityKind + { + /// + /// Entity represents account in the system. + /// + public const string Account = "Account"; + /// + /// Entity represents host in the system. + /// + public const string Host = "Host"; + /// + /// Entity represents file in the system. + /// + public const string File = "File"; + /// + /// Entity represents azure resource in the system. + /// + public const string AzureResource = "AzureResource"; + /// + /// Entity represents cloud application in the system. + /// + public const string CloudApplication = "CloudApplication"; + /// + /// Entity represents dns resolution in the system. + /// + public const string DnsResolution = "DnsResolution"; + /// + /// Entity represents file hash in the system. + /// + public const string FileHash = "FileHash"; + /// + /// Entity represents ip in the system. + /// + public const string Ip = "Ip"; + /// + /// Entity represents malware in the system. + /// + public const string Malware = "Malware"; + /// + /// Entity represents process in the system. + /// + public const string Process = "Process"; + /// + /// Entity represents registry key in the system. + /// + public const string RegistryKey = "RegistryKey"; + /// + /// Entity represents registry value in the system. + /// + public const string RegistryValue = "RegistryValue"; + /// + /// Entity represents security group in the system. + /// + public const string SecurityGroup = "SecurityGroup"; + /// + /// Entity represents url in the system. + /// + public const string Url = "Url"; + /// + /// Entity represents IoT device in the system. + /// + public const string IoTDevice = "IoTDevice"; + /// + /// Entity represents security alert in the system. + /// + public const string SecurityAlert = "SecurityAlert"; + /// + /// Entity represents bookmark in the system. + /// + public const string Bookmark = "Bookmark"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityKind1.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityKind1.cs new file mode 100644 index 000000000000..4e4c8c9e5145 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityKind1.cs @@ -0,0 +1,73 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes an entity with kind. + /// + public partial class EntityKind1 + { + /// + /// Initializes a new instance of the EntityKind1 class. + /// + public EntityKind1() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityKind1 class. + /// + /// The kind of the entity. Possible values include: + /// 'Account', 'Host', 'File', 'AzureResource', 'CloudApplication', + /// 'DnsResolution', 'FileHash', 'Ip', 'Malware', 'Process', + /// 'RegistryKey', 'RegistryValue', 'SecurityGroup', 'Url', + /// 'IoTDevice', 'SecurityAlert', 'Bookmark' + public EntityKind1(string kind) + { + Kind = kind; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the kind of the entity. Possible values include: + /// 'Account', 'Host', 'File', 'AzureResource', 'CloudApplication', + /// 'DnsResolution', 'FileHash', 'Ip', 'Malware', 'Process', + /// 'RegistryKey', 'RegistryValue', 'SecurityGroup', 'Url', + /// 'IoTDevice', 'SecurityAlert', 'Bookmark' + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Kind == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Kind"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQuery.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQuery.cs new file mode 100644 index 000000000000..619e9a2c474c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQuery.cs @@ -0,0 +1,116 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specific entity query. + /// + [Rest.Serialization.JsonTransformation] + public partial class EntityQuery : Resource + { + /// + /// Initializes a new instance of the EntityQuery class. + /// + public EntityQuery() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityQuery class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// List of the data sources that are + /// required to run the query + /// The query display name + /// The type of the query's source + /// entity. Possible values include: 'Account', 'Host', 'File', + /// 'AzureResource', 'CloudApplication', 'DNS', 'FileHash', 'IP', + /// 'Malware', 'Process', 'RegistryKey', 'RegistryValue', + /// 'SecurityGroup', 'URL', 'IoTDevice', 'SecurityAlert', + /// 'HuntingBookmark' + /// List of the fields of the source entity + /// that are required to run the query + /// List of the desired output types to + /// be constructed from the result + /// The template query string to be parsed + /// and formatted + public EntityQuery(string id = default(string), string name = default(string), string type = default(string), IList dataSources = default(IList), string displayName = default(string), string inputEntityType = default(string), IList inputFields = default(IList), IList outputEntityTypes = default(IList), string queryTemplate = default(string)) + : base(id, name, type) + { + DataSources = dataSources; + DisplayName = displayName; + InputEntityType = inputEntityType; + InputFields = inputFields; + OutputEntityTypes = outputEntityTypes; + QueryTemplate = queryTemplate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of the data sources that are required to run the + /// query + /// + [JsonProperty(PropertyName = "properties.dataSources")] + public IList DataSources { get; set; } + + /// + /// Gets or sets the query display name + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the type of the query's source entity. Possible values + /// include: 'Account', 'Host', 'File', 'AzureResource', + /// 'CloudApplication', 'DNS', 'FileHash', 'IP', 'Malware', 'Process', + /// 'RegistryKey', 'RegistryValue', 'SecurityGroup', 'URL', + /// 'IoTDevice', 'SecurityAlert', 'HuntingBookmark' + /// + [JsonProperty(PropertyName = "properties.inputEntityType")] + public string InputEntityType { get; set; } + + /// + /// Gets or sets list of the fields of the source entity that are + /// required to run the query + /// + [JsonProperty(PropertyName = "properties.inputFields")] + public IList InputFields { get; set; } + + /// + /// Gets or sets list of the desired output types to be constructed + /// from the result + /// + [JsonProperty(PropertyName = "properties.outputEntityTypes")] + public IList OutputEntityTypes { get; set; } + + /// + /// Gets or sets the template query string to be parsed and formatted + /// + [JsonProperty(PropertyName = "properties.queryTemplate")] + public string QueryTemplate { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityType.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityType.cs new file mode 100644 index 000000000000..a3e80c7d9acb --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityType.cs @@ -0,0 +1,88 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for EntityType. + /// + public static class EntityType + { + /// + /// Entity represents account in the system. + /// + public const string Account = "Account"; + /// + /// Entity represents host in the system. + /// + public const string Host = "Host"; + /// + /// Entity represents file in the system. + /// + public const string File = "File"; + /// + /// Entity represents azure resource in the system. + /// + public const string AzureResource = "AzureResource"; + /// + /// Entity represents cloud application in the system. + /// + public const string CloudApplication = "CloudApplication"; + /// + /// Entity represents dns in the system. + /// + public const string DNS = "DNS"; + /// + /// Entity represents file hash in the system. + /// + public const string FileHash = "FileHash"; + /// + /// Entity represents ip in the system. + /// + public const string IP = "IP"; + /// + /// Entity represents malware in the system. + /// + public const string Malware = "Malware"; + /// + /// Entity represents process in the system. + /// + public const string Process = "Process"; + /// + /// Entity represents registry key in the system. + /// + public const string RegistryKey = "RegistryKey"; + /// + /// Entity represents registry value in the system. + /// + public const string RegistryValue = "RegistryValue"; + /// + /// Entity represents security group in the system. + /// + public const string SecurityGroup = "SecurityGroup"; + /// + /// Entity represents url in the system. + /// + public const string URL = "URL"; + /// + /// Entity represents IoT device in the system. + /// + public const string IoTDevice = "IoTDevice"; + /// + /// Entity represents security alert in the system. + /// + public const string SecurityAlert = "SecurityAlert"; + /// + /// Entity represents HuntingBookmark in the system. + /// + public const string HuntingBookmark = "HuntingBookmark"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ExpansionResultAggregation.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ExpansionResultAggregation.cs new file mode 100644 index 000000000000..b520deccdb64 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ExpansionResultAggregation.cs @@ -0,0 +1,103 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information of a specific aggregation in the expansion result. + /// + public partial class ExpansionResultAggregation + { + /// + /// Initializes a new instance of the ExpansionResultAggregation class. + /// + public ExpansionResultAggregation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExpansionResultAggregation class. + /// + /// Total number of aggregations of the given kind + /// (and aggregationType if given) in the expansion result. + /// The kind of the aggregated entity. + /// Possible values include: 'Account', 'Host', 'File', + /// 'AzureResource', 'CloudApplication', 'DnsResolution', 'FileHash', + /// 'Ip', 'Malware', 'Process', 'RegistryKey', 'RegistryValue', + /// 'SecurityGroup', 'Url', 'IoTDevice', 'SecurityAlert', + /// 'Bookmark' + /// The common type of the aggregation. + /// (for e.g. entity field name) + /// The display name of the aggregation by + /// type. + public ExpansionResultAggregation(int count, string entityKind, string aggregationType = default(string), string displayName = default(string)) + { + AggregationType = aggregationType; + Count = count; + DisplayName = displayName; + EntityKind = entityKind; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the common type of the aggregation. (for e.g. entity + /// field name) + /// + [JsonProperty(PropertyName = "aggregationType")] + public string AggregationType { get; set; } + + /// + /// Gets or sets total number of aggregations of the given kind (and + /// aggregationType if given) in the expansion result. + /// + [JsonProperty(PropertyName = "count")] + public int Count { get; set; } + + /// + /// Gets or sets the display name of the aggregation by type. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the kind of the aggregated entity. Possible values + /// include: 'Account', 'Host', 'File', 'AzureResource', + /// 'CloudApplication', 'DnsResolution', 'FileHash', 'Ip', 'Malware', + /// 'Process', 'RegistryKey', 'RegistryValue', 'SecurityGroup', 'Url', + /// 'IoTDevice', 'SecurityAlert', 'Bookmark' + /// + [JsonProperty(PropertyName = "entityKind")] + public string EntityKind { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EntityKind == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "EntityKind"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ExpansionResultsMetadata.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ExpansionResultsMetadata.cs new file mode 100644 index 000000000000..49e89971e9aa --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ExpansionResultsMetadata.cs @@ -0,0 +1,55 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Expansion result metadata. + /// + public partial class ExpansionResultsMetadata + { + /// + /// Initializes a new instance of the ExpansionResultsMetadata class. + /// + public ExpansionResultsMetadata() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExpansionResultsMetadata class. + /// + /// Information of the aggregated nodes in + /// the expansion result. + public ExpansionResultsMetadata(IList aggregations = default(IList)) + { + Aggregations = aggregations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets information of the aggregated nodes in the expansion + /// result. + /// + [JsonProperty(PropertyName = "aggregations")] + public IList Aggregations { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileEntity.cs new file mode 100644 index 000000000000..7020e70fcc92 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileEntity.cs @@ -0,0 +1,111 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a file entity. + /// + [Newtonsoft.Json.JsonObject("File")] + [Rest.Serialization.JsonTransformation] + public partial class FileEntity : Entity + { + /// + /// Initializes a new instance of the FileEntity class. + /// + public FileEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FileEntity class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The full path to the file. + /// The file hash entity identifiers + /// associated with this file + /// The file name without path (some alerts + /// might not include path). + /// The Host entity id which the file + /// belongs to + public FileEntity(string id = default(string), string name = default(string), string type = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string directory = default(string), IList fileHashEntityIds = default(IList), string fileName = default(string), string hostEntityId = default(string)) + : base(id, name, type) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + Directory = directory; + FileHashEntityIds = fileHashEntityIds; + FileName = fileName; + HostEntityId = hostEntityId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the full path to the file. + /// + [JsonProperty(PropertyName = "properties.directory")] + public string Directory { get; private set; } + + /// + /// Gets the file hash entity identifiers associated with this file + /// + [JsonProperty(PropertyName = "properties.fileHashEntityIds")] + public IList FileHashEntityIds { get; private set; } + + /// + /// Gets the file name without path (some alerts might not include + /// path). + /// + [JsonProperty(PropertyName = "properties.fileName")] + public string FileName { get; private set; } + + /// + /// Gets the Host entity id which the file belongs to + /// + [JsonProperty(PropertyName = "properties.hostEntityId")] + public string HostEntityId { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileHashAlgorithm.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileHashAlgorithm.cs new file mode 100644 index 000000000000..c0bdf6b8df93 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileHashAlgorithm.cs @@ -0,0 +1,40 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for FileHashAlgorithm. + /// + public static class FileHashAlgorithm + { + /// + /// Unknown hash algorithm + /// + public const string Unknown = "Unknown"; + /// + /// MD5 hash type + /// + public const string MD5 = "MD5"; + /// + /// SHA1 hash type + /// + public const string SHA1 = "SHA1"; + /// + /// SHA256 hash type + /// + public const string SHA256 = "SHA256"; + /// + /// SHA256 Authenticode hash type + /// + public const string SHA256AC = "SHA256AC"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileHashEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileHashEntity.cs new file mode 100644 index 000000000000..c25718880059 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileHashEntity.cs @@ -0,0 +1,93 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a file hash entity. + /// + [Newtonsoft.Json.JsonObject("FileHash")] + [Rest.Serialization.JsonTransformation] + public partial class FileHashEntity : Entity + { + /// + /// Initializes a new instance of the FileHashEntity class. + /// + public FileHashEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FileHashEntity class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The hash algorithm type. Possible values + /// include: 'Unknown', 'MD5', 'SHA1', 'SHA256', 'SHA256AC' + /// The file hash value. + public FileHashEntity(string id = default(string), string name = default(string), string type = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string algorithm = default(string), string hashValue = default(string)) + : base(id, name, type) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + Algorithm = algorithm; + HashValue = hashValue; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the hash algorithm type. Possible values include: 'Unknown', + /// 'MD5', 'SHA1', 'SHA256', 'SHA256AC' + /// + [JsonProperty(PropertyName = "properties.algorithm")] + public string Algorithm { get; private set; } + + /// + /// Gets the file hash value. + /// + [JsonProperty(PropertyName = "properties.hashValue")] + public string HashValue { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FusionAlertRule.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FusionAlertRule.cs new file mode 100644 index 000000000000..c47cecd45ac3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FusionAlertRule.cs @@ -0,0 +1,133 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents Fusion alert rule. + /// + [Newtonsoft.Json.JsonObject("Fusion")] + [Rest.Serialization.JsonTransformation] + public partial class FusionAlertRule : AlertRule + { + /// + /// Initializes a new instance of the FusionAlertRule class. + /// + public FusionAlertRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FusionAlertRule class. + /// + /// The Name of the alert rule + /// template used to create this rule. + /// Determines whether this alert rule is enabled + /// or disabled. + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + /// The description of the alert + /// rule. + /// The display name for alerts created by + /// this alert rule. + /// The last time that this alert has + /// been modified. + /// The severity for alerts created by this + /// alert rule. Possible values include: 'High', 'Medium', 'Low', + /// 'Informational' + /// The tactics of the alert rule + public FusionAlertRule(string alertRuleTemplateName, bool enabled, string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string description = default(string), string displayName = default(string), System.DateTime? lastModifiedUtc = default(System.DateTime?), string severity = default(string), IList tactics = default(IList)) + : base(id, name, type, etag) + { + AlertRuleTemplateName = alertRuleTemplateName; + Description = description; + DisplayName = displayName; + Enabled = enabled; + LastModifiedUtc = lastModifiedUtc; + Severity = severity; + Tactics = tactics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Name of the alert rule template used to create + /// this rule. + /// + [JsonProperty(PropertyName = "properties.alertRuleTemplateName")] + public string AlertRuleTemplateName { get; set; } + + /// + /// Gets the description of the alert rule. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets the display name for alerts created by this alert rule. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets or sets determines whether this alert rule is enabled or + /// disabled. + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool Enabled { get; set; } + + /// + /// Gets the last time that this alert has been modified. + /// + [JsonProperty(PropertyName = "properties.lastModifiedUtc")] + public System.DateTime? LastModifiedUtc { get; private set; } + + /// + /// Gets the severity for alerts created by this alert rule. Possible + /// values include: 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "properties.severity")] + public string Severity { get; private set; } + + /// + /// Gets the tactics of the alert rule + /// + [JsonProperty(PropertyName = "properties.tactics")] + public IList Tactics { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AlertRuleTemplateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AlertRuleTemplateName"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FusionAlertRuleTemplate.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FusionAlertRuleTemplate.cs new file mode 100644 index 000000000000..78fe4a3d7162 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FusionAlertRuleTemplate.cs @@ -0,0 +1,142 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents Fusion alert rule template. + /// + [Newtonsoft.Json.JsonObject("Fusion")] + [Rest.Serialization.JsonTransformation] + public partial class FusionAlertRuleTemplate : AlertRuleTemplate + { + /// + /// Initializes a new instance of the FusionAlertRuleTemplate class. + /// + public FusionAlertRuleTemplate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FusionAlertRuleTemplate class. + /// + /// The severity for alerts created by this + /// alert rule. Possible values include: 'High', 'Medium', 'Low', + /// 'Informational' + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// the number of alert + /// rules that were created by this template + /// The time that this alert rule template + /// has been added. + /// The description of the alert rule + /// template. + /// The display name for alert rule + /// template. + /// The required data connectors + /// for this template + /// The alert rule template status. Possible + /// values include: 'Installed', 'Available', 'NotAvailable' + /// The tactics of the alert rule + /// template + public FusionAlertRuleTemplate(string severity, string id = default(string), string name = default(string), string type = default(string), int? alertRulesCreatedByTemplateCount = default(int?), System.DateTime? createdDateUTC = default(System.DateTime?), string description = default(string), string displayName = default(string), IList requiredDataConnectors = default(IList), string status = default(string), IList tactics = default(IList)) + : base(id, name, type) + { + AlertRulesCreatedByTemplateCount = alertRulesCreatedByTemplateCount; + CreatedDateUTC = createdDateUTC; + Description = description; + DisplayName = displayName; + RequiredDataConnectors = requiredDataConnectors; + Status = status; + Tactics = tactics; + Severity = severity; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of alert rules that were created by this + /// template + /// + [JsonProperty(PropertyName = "properties.alertRulesCreatedByTemplateCount")] + public int? AlertRulesCreatedByTemplateCount { get; set; } + + /// + /// Gets the time that this alert rule template has been added. + /// + [JsonProperty(PropertyName = "properties.createdDateUTC")] + public System.DateTime? CreatedDateUTC { get; private set; } + + /// + /// Gets or sets the description of the alert rule template. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the display name for alert rule template. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the required data connectors for this template + /// + [JsonProperty(PropertyName = "properties.requiredDataConnectors")] + public IList RequiredDataConnectors { get; set; } + + /// + /// Gets or sets the alert rule template status. Possible values + /// include: 'Installed', 'Available', 'NotAvailable' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets the tactics of the alert rule template + /// + [JsonProperty(PropertyName = "properties.tactics")] + public IList Tactics { get; set; } + + /// + /// Gets or sets the severity for alerts created by this alert rule. + /// Possible values include: 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "properties.severity")] + public string Severity { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Severity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Severity"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GeoLocation.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GeoLocation.cs new file mode 100644 index 000000000000..5538c24adb38 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GeoLocation.cs @@ -0,0 +1,116 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The geo-location context attached to the ip entity + /// + public partial class GeoLocation + { + /// + /// Initializes a new instance of the GeoLocation class. + /// + public GeoLocation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoLocation class. + /// + /// Autonomous System Number + /// City name + /// The country code according to ISO 3166 + /// format + /// Country name according to ISO 3166 Alpha + /// 2: the lowercase of the English Short Name + /// The longitude of the identified location, + /// expressed as a floating point number with range of -180 to 180, + /// with positive numbers representing East and negative numbers + /// representing West. Latitude and longitude are derived from the city + /// or postal code. + /// The latitude of the identified location, + /// expressed as a floating point number with range of - 90 to 90, with + /// positive numbers representing North and negative numbers + /// representing South. Latitude and longitude are derived from the + /// city or postal code. + /// State name + public GeoLocation(int? asn = default(int?), string city = default(string), string countryCode = default(string), string countryName = default(string), double? latitude = default(double?), double? longitude = default(double?), string state = default(string)) + { + Asn = asn; + City = city; + CountryCode = countryCode; + CountryName = countryName; + Latitude = latitude; + Longitude = longitude; + State = state; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets autonomous System Number + /// + [JsonProperty(PropertyName = "asn")] + public int? Asn { get; private set; } + + /// + /// Gets city name + /// + [JsonProperty(PropertyName = "city")] + public string City { get; private set; } + + /// + /// Gets the country code according to ISO 3166 format + /// + [JsonProperty(PropertyName = "countryCode")] + public string CountryCode { get; private set; } + + /// + /// Gets country name according to ISO 3166 Alpha 2: the lowercase of + /// the English Short Name + /// + [JsonProperty(PropertyName = "countryName")] + public string CountryName { get; private set; } + + /// + /// Gets the longitude of the identified location, expressed as a + /// floating point number with range of -180 to 180, with positive + /// numbers representing East and negative numbers representing West. + /// Latitude and longitude are derived from the city or postal code. + /// + [JsonProperty(PropertyName = "latitude")] + public double? Latitude { get; private set; } + + /// + /// Gets the latitude of the identified location, expressed as a + /// floating point number with range of - 90 to 90, with positive + /// numbers representing North and negative numbers representing South. + /// Latitude and longitude are derived from the city or postal code. + /// + [JsonProperty(PropertyName = "longitude")] + public double? Longitude { get; private set; } + + /// + /// Gets state name + /// + [JsonProperty(PropertyName = "state")] + public string State { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/HostEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/HostEntity.cs new file mode 100644 index 000000000000..2b388e286ab6 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/HostEntity.cs @@ -0,0 +1,160 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a host entity. + /// + [Newtonsoft.Json.JsonObject("Host")] + [Rest.Serialization.JsonTransformation] + public partial class HostEntity : Entity + { + /// + /// Initializes a new instance of the HostEntity class. + /// + public HostEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HostEntity class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The azure resource id of the VM. + /// The DNS domain that this host belongs to. + /// Should contain the compete DNS suffix for the domain + /// The hostname without the domain + /// suffix. + /// Determines whether this host belongs + /// to a domain. + /// The host name (pre-windows2000). + /// The NT domain that this host belongs + /// to. + /// The OMS agent id, if the host has OMS + /// agent installed. + /// The operating system type. Possible values + /// include: 'Linux', 'Windows', 'Android', 'IOS' + /// A free text representation of the operating + /// system. This field is meant to hold specific versions the are more + /// fine grained than OSFamily or future values not supported by + /// OSFamily enumeration + public HostEntity(string id = default(string), string name = default(string), string type = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string azureID = default(string), string dnsDomain = default(string), string hostName = default(string), bool? isDomainJoined = default(bool?), string netBiosName = default(string), string ntDomain = default(string), string omsAgentID = default(string), OSFamily? osFamily = default(OSFamily?), string osVersion = default(string)) + : base(id, name, type) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + AzureID = azureID; + DnsDomain = dnsDomain; + HostName = hostName; + IsDomainJoined = isDomainJoined; + NetBiosName = netBiosName; + NtDomain = ntDomain; + OmsAgentID = omsAgentID; + OsFamily = osFamily; + OsVersion = osVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the azure resource id of the VM. + /// + [JsonProperty(PropertyName = "properties.azureID")] + public string AzureID { get; private set; } + + /// + /// Gets the DNS domain that this host belongs to. Should contain the + /// compete DNS suffix for the domain + /// + [JsonProperty(PropertyName = "properties.dnsDomain")] + public string DnsDomain { get; private set; } + + /// + /// Gets the hostname without the domain suffix. + /// + [JsonProperty(PropertyName = "properties.hostName")] + public string HostName { get; private set; } + + /// + /// Gets determines whether this host belongs to a domain. + /// + [JsonProperty(PropertyName = "properties.isDomainJoined")] + public bool? IsDomainJoined { get; private set; } + + /// + /// Gets the host name (pre-windows2000). + /// + [JsonProperty(PropertyName = "properties.netBiosName")] + public string NetBiosName { get; private set; } + + /// + /// Gets the NT domain that this host belongs to. + /// + [JsonProperty(PropertyName = "properties.ntDomain")] + public string NtDomain { get; private set; } + + /// + /// Gets the OMS agent id, if the host has OMS agent installed. + /// + [JsonProperty(PropertyName = "properties.omsAgentID")] + public string OmsAgentID { get; private set; } + + /// + /// Gets or sets the operating system type. Possible values include: + /// 'Linux', 'Windows', 'Android', 'IOS' + /// + [JsonProperty(PropertyName = "properties.osFamily")] + public OSFamily? OsFamily { get; set; } + + /// + /// Gets a free text representation of the operating system. This field + /// is meant to hold specific versions the are more fine grained than + /// OSFamily or future values not supported by OSFamily enumeration + /// + [JsonProperty(PropertyName = "properties.osVersion")] + public string OsVersion { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentInfo.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentInfo.cs new file mode 100644 index 000000000000..20fb058fc188 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentInfo.cs @@ -0,0 +1,104 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes related incident information for the bookmark + /// + public partial class IncidentInfo + { + /// + /// Initializes a new instance of the IncidentInfo class. + /// + public IncidentInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IncidentInfo class. + /// + /// Incident Id + /// The severity of the incident. Possible + /// values include: 'Critical', 'High', 'Medium', 'Low', + /// 'Informational' + /// The title of the incident + /// Relation Name + public IncidentInfo(string incidentId, string severity, string title, string relationName) + { + IncidentId = incidentId; + Severity = severity; + Title = title; + RelationName = relationName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets incident Id + /// + [JsonProperty(PropertyName = "incidentId")] + public string IncidentId { get; set; } + + /// + /// Gets or sets the severity of the incident. Possible values include: + /// 'Critical', 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "severity")] + public string Severity { get; set; } + + /// + /// Gets or sets the title of the incident + /// + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + + /// + /// Gets or sets relation Name + /// + [JsonProperty(PropertyName = "relationName")] + public string RelationName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (IncidentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "IncidentId"); + } + if (Severity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Severity"); + } + if (Title == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Title"); + } + if (RelationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RelationName"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentSeverity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentSeverity.cs new file mode 100644 index 000000000000..afd45645df27 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentSeverity.cs @@ -0,0 +1,40 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for IncidentSeverity. + /// + public static class IncidentSeverity + { + /// + /// Critical severity + /// + public const string Critical = "Critical"; + /// + /// High severity + /// + public const string High = "High"; + /// + /// Medium severity + /// + public const string Medium = "Medium"; + /// + /// Low severity + /// + public const string Low = "Low"; + /// + /// Informational severity + /// + public const string Informational = "Informational"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IoTDeviceEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IoTDeviceEntity.cs new file mode 100644 index 000000000000..53835f4d27a0 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IoTDeviceEntity.cs @@ -0,0 +1,144 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents an IoT device entity. + /// + [Newtonsoft.Json.JsonObject("IoTDevice")] + [Rest.Serialization.JsonTransformation] + public partial class IoTDeviceEntity : Entity + { + /// + /// Initializes a new instance of the IoTDeviceEntity class. + /// + public IoTDeviceEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IoTDeviceEntity class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The ID of the IoT Device in the IoT + /// Hub + /// The ID of the security agent + /// running on the device + /// The type of the device + /// The vendor of the device + /// The ID of the edge device + /// The AzureResource entity id of the IoT + /// Hub + /// The Host entity id of this + /// device + /// A list of TI contexts attached to + /// the IoTDevice entity. + public IoTDeviceEntity(string id = default(string), string name = default(string), string type = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string deviceId = default(string), System.Guid? iotSecurityAgentId = default(System.Guid?), string deviceType = default(string), string vendor = default(string), string edgeId = default(string), string iotHubEntityId = default(string), string hostEntityId = default(string), IList threatIntelligence = default(IList)) + : base(id, name, type) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + DeviceId = deviceId; + IotSecurityAgentId = iotSecurityAgentId; + DeviceType = deviceType; + Vendor = vendor; + EdgeId = edgeId; + IotHubEntityId = iotHubEntityId; + HostEntityId = hostEntityId; + ThreatIntelligence = threatIntelligence; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the ID of the IoT Device in the IoT Hub + /// + [JsonProperty(PropertyName = "properties.deviceId")] + public string DeviceId { get; private set; } + + /// + /// Gets the ID of the security agent running on the device + /// + [JsonProperty(PropertyName = "properties.iotSecurityAgentId")] + public System.Guid? IotSecurityAgentId { get; private set; } + + /// + /// Gets the type of the device + /// + [JsonProperty(PropertyName = "properties.deviceType")] + public string DeviceType { get; private set; } + + /// + /// Gets the vendor of the device + /// + [JsonProperty(PropertyName = "properties.vendor")] + public string Vendor { get; private set; } + + /// + /// Gets the ID of the edge device + /// + [JsonProperty(PropertyName = "properties.edgeId")] + public string EdgeId { get; private set; } + + /// + /// Gets the AzureResource entity id of the IoT Hub + /// + [JsonProperty(PropertyName = "properties.iotHubEntityId")] + public string IotHubEntityId { get; private set; } + + /// + /// Gets the Host entity id of this device + /// + [JsonProperty(PropertyName = "properties.hostEntityId")] + public string HostEntityId { get; private set; } + + /// + /// Gets a list of TI contexts attached to the IoTDevice entity. + /// + [JsonProperty(PropertyName = "properties.threatIntelligence")] + public IList ThreatIntelligence { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IpEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IpEntity.cs new file mode 100644 index 000000000000..024556264b19 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IpEntity.cs @@ -0,0 +1,103 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents an ip entity. + /// + [Newtonsoft.Json.JsonObject("Ip")] + [Rest.Serialization.JsonTransformation] + public partial class IpEntity : Entity + { + /// + /// Initializes a new instance of the IpEntity class. + /// + public IpEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IpEntity class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The IP address as string, e.g. 127.0.0.1 + /// (either in Ipv4 or Ipv6) + /// The geo-location context attached to the ip + /// entity + /// A list of TI contexts attached to + /// the ip entity. + public IpEntity(string id = default(string), string name = default(string), string type = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string address = default(string), GeoLocation location = default(GeoLocation), IList threatIntelligence = default(IList)) + : base(id, name, type) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + Address = address; + Location = location; + ThreatIntelligence = threatIntelligence; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the IP address as string, e.g. 127.0.0.1 (either in Ipv4 or + /// Ipv6) + /// + [JsonProperty(PropertyName = "properties.address")] + public string Address { get; private set; } + + /// + /// Gets or sets the geo-location context attached to the ip entity + /// + [JsonProperty(PropertyName = "properties.location")] + public GeoLocation Location { get; set; } + + /// + /// Gets a list of TI contexts attached to the ip entity. + /// + [JsonProperty(PropertyName = "properties.threatIntelligence")] + public IList ThreatIntelligence { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/KillChainIntent.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/KillChainIntent.cs new file mode 100644 index 000000000000..8fe2ba76d431 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/KillChainIntent.cs @@ -0,0 +1,136 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for KillChainIntent. + /// + public static class KillChainIntent + { + /// + /// The default value. + /// + public const string Unknown = "Unknown"; + /// + /// Probing could be an attempt to access a certain resource regardless + /// of a malicious intent or a failed attempt to gain access to a + /// target system to gather information prior to exploitation. This + /// step is usually detected as an attempt originating from outside the + /// network in attempt to scan the target system and find a way in. + /// + public const string Probing = "Probing"; + /// + /// Exploitation is the stage where an attacker manage to get foothold + /// on the attacked resource. This stage is applicable not only for + /// compute hosts, but also for resources such as user accounts, + /// certificates etc. Adversaries will often be able to control the + /// resource after this stage. + /// + public const string Exploitation = "Exploitation"; + /// + /// Persistence is any access, action, or configuration change to a + /// system that gives an adversary a persistent presence on that + /// system. Adversaries will often need to maintain access to systems + /// through interruptions such as system restarts, loss of credentials, + /// or other failures that would require a remote access tool to + /// restart or alternate backdoor for them to regain access. + /// + public const string Persistence = "Persistence"; + /// + /// Privilege escalation is the result of actions that allow an + /// adversary to obtain a higher level of permissions on a system or + /// network. Certain tools or actions require a higher level of + /// privilege to work and are likely necessary at many points + /// throughout an operation. User accounts with permissions to access + /// specific systems or perform specific functions necessary for + /// adversaries to achieve their objective may also be considered an + /// escalation of privilege. + /// + public const string PrivilegeEscalation = "PrivilegeEscalation"; + /// + /// Defense evasion consists of techniques an adversary may use to + /// evade detection or avoid other defenses. Sometimes these actions + /// are the same as or variations of techniques in other categories + /// that have the added benefit of subverting a particular defense or + /// mitigation. + /// + public const string DefenseEvasion = "DefenseEvasion"; + /// + /// Credential access represents techniques resulting in access to or + /// control over system, domain, or service credentials that are used + /// within an enterprise environment. Adversaries will likely attempt + /// to obtain legitimate credentials from users or administrator + /// accounts (local system administrator or domain users with + /// administrator access) to use within the network. With sufficient + /// access within a network, an adversary can create accounts for later + /// use within the environment. + /// + public const string CredentialAccess = "CredentialAccess"; + /// + /// Discovery consists of techniques that allow the adversary to gain + /// knowledge about the system and internal network. When adversaries + /// gain access to a new system, they must orient themselves to what + /// they now have control of and what benefits operating from that + /// system give to their current objective or overall goals during the + /// intrusion. The operating system provides many native tools that aid + /// in this post-compromise information-gathering phase. + /// + public const string Discovery = "Discovery"; + /// + /// Lateral movement consists of techniques that enable an adversary to + /// access and control remote systems on a network and could, but does + /// not necessarily, include execution of tools on remote systems. The + /// lateral movement techniques could allow an adversary to gather + /// information from a system without needing additional tools, such as + /// a remote access tool. An adversary can use lateral movement for + /// many purposes, including remote Execution of tools, pivoting to + /// additional systems, access to specific information or files, access + /// to additional credentials, or to cause an effect. + /// + public const string LateralMovement = "LateralMovement"; + /// + /// The execution tactic represents techniques that result in execution + /// of adversary-controlled code on a local or remote system. This + /// tactic is often used in conjunction with lateral movement to expand + /// access to remote systems on a network. + /// + public const string Execution = "Execution"; + /// + /// Collection consists of techniques used to identify and gather + /// information, such as sensitive files, from a target network prior + /// to exfiltration. This category also covers locations on a system or + /// network where the adversary may look for information to exfiltrate. + /// + public const string Collection = "Collection"; + /// + /// Exfiltration refers to techniques and attributes that result or aid + /// in the adversary removing files and information from a target + /// network. This category also covers locations on a system or network + /// where the adversary may look for information to exfiltrate. + /// + public const string Exfiltration = "Exfiltration"; + /// + /// The command and control tactic represents how adversaries + /// communicate with systems under their control within a target + /// network. + /// + public const string CommandAndControl = "CommandAndControl"; + /// + /// The impact intent primary objective is to directly reduce the + /// availability or integrity of a system, service, or network; + /// including manipulation of data to impact a business or operational + /// process. This would often refer to techniques such as ransom-ware, + /// defacement, data manipulation and others. + /// + public const string Impact = "Impact"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/LicenseStatus.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/LicenseStatus.cs new file mode 100644 index 000000000000..5791bdcbd9b9 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/LicenseStatus.cs @@ -0,0 +1,22 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for LicenseStatus. + /// + public static class LicenseStatus + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASCheckRequirements.cs new file mode 100644 index 000000000000..618b33160f06 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASCheckRequirements.cs @@ -0,0 +1,52 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// MCAS (Microsoft Cloud App Security) requirements check properties. + /// + public partial class MCASCheckRequirements + { + /// + /// Initializes a new instance of the MCASCheckRequirements class. + /// + public MCASCheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MCASCheckRequirements class. + /// + /// The tenant id to connect to, and get the + /// data from. + public MCASCheckRequirements(string tenantId = default(string)) + { + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnector.cs new file mode 100644 index 000000000000..77df2ea8a073 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnector.cs @@ -0,0 +1,70 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents MCAS (Microsoft Cloud App Security) data connector. + /// + [Newtonsoft.Json.JsonObject("MicrosoftCloudAppSecurity")] + [Rest.Serialization.JsonTransformation] + public partial class MCASDataConnector : DataConnector + { + /// + /// Initializes a new instance of the MCASDataConnector class. + /// + public MCASDataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MCASDataConnector class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + /// The tenant id to connect to, and get the + /// data from. + /// The available data types for the + /// connector. + public MCASDataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string tenantId = default(string), MCASDataConnectorDataTypes dataTypes = default(MCASDataConnectorDataTypes)) + : base(id, name, type, etag) + { + TenantId = tenantId; + DataTypes = dataTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the available data types for the connector. + /// + [JsonProperty(PropertyName = "properties.dataTypes")] + public MCASDataConnectorDataTypes DataTypes { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnectorDataTypes.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnectorDataTypes.cs new file mode 100644 index 000000000000..d67e9ce81f55 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnectorDataTypes.cs @@ -0,0 +1,55 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The available data types for MCAS (Microsoft Cloud App Security) data + /// connector. + /// + public partial class MCASDataConnectorDataTypes : AlertsDataTypeOfDataConnector + { + /// + /// Initializes a new instance of the MCASDataConnectorDataTypes class. + /// + public MCASDataConnectorDataTypes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MCASDataConnectorDataTypes class. + /// + /// Alerts data type connection. + /// Discovery log data type + /// connection. + public MCASDataConnectorDataTypes(AlertsDataTypeOfDataConnectorAlerts alerts = default(AlertsDataTypeOfDataConnectorAlerts), MCASDataConnectorDataTypesDiscoveryLogs discoveryLogs = default(MCASDataConnectorDataTypesDiscoveryLogs)) + : base(alerts) + { + DiscoveryLogs = discoveryLogs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets discovery log data type connection. + /// + [JsonProperty(PropertyName = "discoveryLogs")] + public MCASDataConnectorDataTypesDiscoveryLogs DiscoveryLogs { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnectorDataTypesDiscoveryLogs.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnectorDataTypesDiscoveryLogs.cs new file mode 100644 index 000000000000..76e1ed23a353 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnectorDataTypesDiscoveryLogs.cs @@ -0,0 +1,48 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using System.Linq; + + /// + /// Discovery log data type connection. + /// + public partial class MCASDataConnectorDataTypesDiscoveryLogs : DataConnectorDataTypeCommon + { + /// + /// Initializes a new instance of the + /// MCASDataConnectorDataTypesDiscoveryLogs class. + /// + public MCASDataConnectorDataTypesDiscoveryLogs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// MCASDataConnectorDataTypesDiscoveryLogs class. + /// + /// Describe whether this data type connection is + /// enabled or not. Possible values include: 'Enabled', + /// 'Disabled' + public MCASDataConnectorDataTypesDiscoveryLogs(string state = default(string)) + : base(state) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MDATPCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MDATPCheckRequirements.cs new file mode 100644 index 000000000000..63d17b36442a --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MDATPCheckRequirements.cs @@ -0,0 +1,53 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// MDATP (Microsoft Defender Advanced Threat Protection) requirements + /// check properties. + /// + public partial class MDATPCheckRequirements + { + /// + /// Initializes a new instance of the MDATPCheckRequirements class. + /// + public MDATPCheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MDATPCheckRequirements class. + /// + /// The tenant id to connect to, and get the + /// data from. + public MDATPCheckRequirements(string tenantId = default(string)) + { + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MDATPDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MDATPDataConnector.cs new file mode 100644 index 000000000000..5cbec5f4150b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MDATPDataConnector.cs @@ -0,0 +1,71 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents MDATP (Microsoft Defender Advanced Threat Protection) data + /// connector. + /// + [Newtonsoft.Json.JsonObject("MicrosoftDefenderAdvancedThreatProtection")] + [Rest.Serialization.JsonTransformation] + public partial class MDATPDataConnector : DataConnector + { + /// + /// Initializes a new instance of the MDATPDataConnector class. + /// + public MDATPDataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MDATPDataConnector class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + /// The tenant id to connect to, and get the + /// data from. + /// The available data types for the + /// connector. + public MDATPDataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string tenantId = default(string), AlertsDataTypeOfDataConnector dataTypes = default(AlertsDataTypeOfDataConnector)) + : base(id, name, type, etag) + { + TenantId = tenantId; + DataTypes = dataTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the available data types for the connector. + /// + [JsonProperty(PropertyName = "properties.dataTypes")] + public AlertsDataTypeOfDataConnector DataTypes { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MalwareEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MalwareEntity.cs new file mode 100644 index 000000000000..c888d84b26bd --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MalwareEntity.cs @@ -0,0 +1,113 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a malware entity. + /// + [Newtonsoft.Json.JsonObject("Malware")] + [Rest.Serialization.JsonTransformation] + public partial class MalwareEntity : Entity + { + /// + /// Initializes a new instance of the MalwareEntity class. + /// + public MalwareEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MalwareEntity class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The malware category by the vendor, e.g. + /// Trojan + /// List of linked file entity identifiers + /// on which the malware was found + /// The malware name by the vendor, e.g. + /// Win32/Toga!rfn + /// List of linked process entity + /// identifiers on which the malware was found. + public MalwareEntity(string id = default(string), string name = default(string), string type = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string category = default(string), IList fileEntityIds = default(IList), string malwareName = default(string), IList processEntityIds = default(IList)) + : base(id, name, type) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + Category = category; + FileEntityIds = fileEntityIds; + MalwareName = malwareName; + ProcessEntityIds = processEntityIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the malware category by the vendor, e.g. Trojan + /// + [JsonProperty(PropertyName = "properties.category")] + public string Category { get; private set; } + + /// + /// Gets list of linked file entity identifiers on which the malware + /// was found + /// + [JsonProperty(PropertyName = "properties.fileEntityIds")] + public IList FileEntityIds { get; private set; } + + /// + /// Gets the malware name by the vendor, e.g. Win32/Toga!rfn + /// + [JsonProperty(PropertyName = "properties.malwareName")] + public string MalwareName { get; private set; } + + /// + /// Gets list of linked process entity identifiers on which the malware + /// was found. + /// + [JsonProperty(PropertyName = "properties.processEntityIds")] + public IList ProcessEntityIds { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRule.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRule.cs new file mode 100644 index 000000000000..7f66c239e333 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRule.cs @@ -0,0 +1,165 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents MicrosoftSecurityIncidentCreation rule. + /// + [Newtonsoft.Json.JsonObject("MicrosoftSecurityIncidentCreation")] + [Rest.Serialization.JsonTransformation] + public partial class MicrosoftSecurityIncidentCreationAlertRule : AlertRule + { + /// + /// Initializes a new instance of the + /// MicrosoftSecurityIncidentCreationAlertRule class. + /// + public MicrosoftSecurityIncidentCreationAlertRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// MicrosoftSecurityIncidentCreationAlertRule class. + /// + /// The alerts' productName on which the + /// cases will be generated. Possible values include: 'Microsoft Cloud + /// App Security', 'Azure Security Center', 'Azure Advanced Threat + /// Protection', 'Azure Active Directory Identity Protection', 'Azure + /// Security Center for IoT' + /// The display name for alerts created by + /// this alert rule. + /// Determines whether this alert rule is enabled + /// or disabled. + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + /// the alerts' displayNames on which + /// the cases will be generated + /// the alerts' severities on which the + /// cases will be generated + /// The Name of the alert rule + /// template used to create this rule. + /// The description of the alert + /// rule. + /// The last time that this alert has + /// been modified. + /// The tactics of the alert rule + public MicrosoftSecurityIncidentCreationAlertRule(string productFilter, string displayName, bool enabled, string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IList displayNamesFilter = default(IList), IList severitiesFilter = default(IList), string alertRuleTemplateName = default(string), string description = default(string), System.DateTime? lastModifiedUtc = default(System.DateTime?), IList tactics = default(IList)) + : base(id, name, type, etag) + { + DisplayNamesFilter = displayNamesFilter; + ProductFilter = productFilter; + SeveritiesFilter = severitiesFilter; + AlertRuleTemplateName = alertRuleTemplateName; + Description = description; + DisplayName = displayName; + Enabled = enabled; + LastModifiedUtc = lastModifiedUtc; + Tactics = tactics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the alerts' displayNames on which the cases will be + /// generated + /// + [JsonProperty(PropertyName = "properties.displayNamesFilter")] + public IList DisplayNamesFilter { get; set; } + + /// + /// Gets or sets the alerts' productName on which the cases will be + /// generated. Possible values include: 'Microsoft Cloud App Security', + /// 'Azure Security Center', 'Azure Advanced Threat Protection', 'Azure + /// Active Directory Identity Protection', 'Azure Security Center for + /// IoT' + /// + [JsonProperty(PropertyName = "properties.productFilter")] + public string ProductFilter { get; set; } + + /// + /// Gets or sets the alerts' severities on which the cases will be + /// generated + /// + [JsonProperty(PropertyName = "properties.severitiesFilter")] + public IList SeveritiesFilter { get; set; } + + /// + /// Gets or sets the Name of the alert rule template used to create + /// this rule. + /// + [JsonProperty(PropertyName = "properties.alertRuleTemplateName")] + public string AlertRuleTemplateName { get; set; } + + /// + /// Gets or sets the description of the alert rule. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the display name for alerts created by this alert + /// rule. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets determines whether this alert rule is enabled or + /// disabled. + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool Enabled { get; set; } + + /// + /// Gets the last time that this alert has been modified. + /// + [JsonProperty(PropertyName = "properties.lastModifiedUtc")] + public System.DateTime? LastModifiedUtc { get; private set; } + + /// + /// Gets or sets the tactics of the alert rule + /// + [JsonProperty(PropertyName = "properties.tactics")] + public IList Tactics { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ProductFilter == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ProductFilter"); + } + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRuleCommonProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRuleCommonProperties.cs new file mode 100644 index 000000000000..e8388bac8b3c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRuleCommonProperties.cs @@ -0,0 +1,97 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// MicrosoftSecurityIncidentCreation rule common property bag. + /// + public partial class MicrosoftSecurityIncidentCreationAlertRuleCommonProperties + { + /// + /// Initializes a new instance of the + /// MicrosoftSecurityIncidentCreationAlertRuleCommonProperties class. + /// + public MicrosoftSecurityIncidentCreationAlertRuleCommonProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// MicrosoftSecurityIncidentCreationAlertRuleCommonProperties class. + /// + /// The alerts' productName on which the + /// cases will be generated. Possible values include: 'Microsoft Cloud + /// App Security', 'Azure Security Center', 'Azure Advanced Threat + /// Protection', 'Azure Active Directory Identity Protection', 'Azure + /// Security Center for IoT' + /// the alerts' displayNames on which + /// the cases will be generated + /// the alerts' severities on which the + /// cases will be generated + public MicrosoftSecurityIncidentCreationAlertRuleCommonProperties(string productFilter, IList displayNamesFilter = default(IList), IList severitiesFilter = default(IList)) + { + DisplayNamesFilter = displayNamesFilter; + ProductFilter = productFilter; + SeveritiesFilter = severitiesFilter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the alerts' displayNames on which the cases will be + /// generated + /// + [JsonProperty(PropertyName = "displayNamesFilter")] + public IList DisplayNamesFilter { get; set; } + + /// + /// Gets or sets the alerts' productName on which the cases will be + /// generated. Possible values include: 'Microsoft Cloud App Security', + /// 'Azure Security Center', 'Azure Advanced Threat Protection', 'Azure + /// Active Directory Identity Protection', 'Azure Security Center for + /// IoT' + /// + [JsonProperty(PropertyName = "productFilter")] + public string ProductFilter { get; set; } + + /// + /// Gets or sets the alerts' severities on which the cases will be + /// generated + /// + [JsonProperty(PropertyName = "severitiesFilter")] + public IList SeveritiesFilter { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ProductFilter == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ProductFilter"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRuleTemplate.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRuleTemplate.cs new file mode 100644 index 000000000000..77230f8aa4c7 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRuleTemplate.cs @@ -0,0 +1,181 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents MicrosoftSecurityIncidentCreation rule template. + /// + [Newtonsoft.Json.JsonObject("MicrosoftSecurityIncidentCreation")] + [Rest.Serialization.JsonTransformation] + public partial class MicrosoftSecurityIncidentCreationAlertRuleTemplate : AlertRuleTemplate + { + /// + /// Initializes a new instance of the + /// MicrosoftSecurityIncidentCreationAlertRuleTemplate class. + /// + public MicrosoftSecurityIncidentCreationAlertRuleTemplate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// MicrosoftSecurityIncidentCreationAlertRuleTemplate class. + /// + /// the number of alert + /// rules that were created by this template + /// The time that this alert rule template + /// has been added. + /// The description of the alert rule + /// template. + /// The display name for alert rule + /// template. + /// The alert rule template status. Possible + /// values include: 'Installed', 'Available', 'NotAvailable' + /// The alerts' productName on which the + /// cases will be generated. Possible values include: 'Microsoft Cloud + /// App Security', 'Azure Security Center', 'Azure Advanced Threat + /// Protection', 'Azure Active Directory Identity Protection', 'Azure + /// Security Center for IoT' + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// The required data connectors + /// for this template + /// The tactics of the alert rule + /// template + /// the alerts' displayNames on which + /// the cases will be generated + /// the alerts' severities on which the + /// cases will be generated + public MicrosoftSecurityIncidentCreationAlertRuleTemplate(int alertRulesCreatedByTemplateCount, System.DateTime createdDateUTC, string description, string displayName, string status, string productFilter, string id = default(string), string name = default(string), string type = default(string), IList requiredDataConnectors = default(IList), IList tactics = default(IList), IList displayNamesFilter = default(IList), IList severitiesFilter = default(IList)) + : base(id, name, type) + { + AlertRulesCreatedByTemplateCount = alertRulesCreatedByTemplateCount; + CreatedDateUTC = createdDateUTC; + Description = description; + DisplayName = displayName; + RequiredDataConnectors = requiredDataConnectors; + Status = status; + Tactics = tactics; + DisplayNamesFilter = displayNamesFilter; + ProductFilter = productFilter; + SeveritiesFilter = severitiesFilter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of alert rules that were created by this + /// template + /// + [JsonProperty(PropertyName = "properties.alertRulesCreatedByTemplateCount")] + public int AlertRulesCreatedByTemplateCount { get; set; } + + /// + /// Gets the time that this alert rule template has been added. + /// + [JsonProperty(PropertyName = "properties.createdDateUTC")] + public System.DateTime CreatedDateUTC { get; private set; } + + /// + /// Gets or sets the description of the alert rule template. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the display name for alert rule template. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the required data connectors for this template + /// + [JsonProperty(PropertyName = "properties.requiredDataConnectors")] + public IList RequiredDataConnectors { get; set; } + + /// + /// Gets or sets the alert rule template status. Possible values + /// include: 'Installed', 'Available', 'NotAvailable' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets the tactics of the alert rule template + /// + [JsonProperty(PropertyName = "properties.tactics")] + public IList Tactics { get; set; } + + /// + /// Gets or sets the alerts' displayNames on which the cases will be + /// generated + /// + [JsonProperty(PropertyName = "properties.displayNamesFilter")] + public IList DisplayNamesFilter { get; set; } + + /// + /// Gets or sets the alerts' productName on which the cases will be + /// generated. Possible values include: 'Microsoft Cloud App Security', + /// 'Azure Security Center', 'Azure Advanced Threat Protection', 'Azure + /// Active Directory Identity Protection', 'Azure Security Center for + /// IoT' + /// + [JsonProperty(PropertyName = "properties.productFilter")] + public string ProductFilter { get; set; } + + /// + /// Gets or sets the alerts' severities on which the cases will be + /// generated + /// + [JsonProperty(PropertyName = "properties.severitiesFilter")] + public IList SeveritiesFilter { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Description == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Description"); + } + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + if (Status == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Status"); + } + if (ProductFilter == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ProductFilter"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityProductName.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityProductName.cs new file mode 100644 index 000000000000..253b3b48f9ca --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityProductName.cs @@ -0,0 +1,25 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for MicrosoftSecurityProductName. + /// + public static class MicrosoftSecurityProductName + { + public const string MicrosoftCloudAppSecurity = "Microsoft Cloud App Security"; + public const string AzureSecurityCenter = "Azure Security Center"; + public const string AzureAdvancedThreatProtection = "Azure Advanced Threat Protection"; + public const string AzureActiveDirectoryIdentityProtection = "Azure Active Directory Identity Protection"; + public const string AzureSecurityCenterforIoT = "Azure Security Center for IoT"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OSFamily.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OSFamily.cs new file mode 100644 index 000000000000..7d095a4da94c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OSFamily.cs @@ -0,0 +1,84 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for OSFamily. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum OSFamily + { + /// + /// Host with Linux operating system. + /// + [EnumMember(Value = "Linux")] + Linux, + /// + /// Host with Windows operating system. + /// + [EnumMember(Value = "Windows")] + Windows, + /// + /// Host with Android operating system. + /// + [EnumMember(Value = "Android")] + Android, + /// + /// Host with IOS operating system. + /// + [EnumMember(Value = "IOS")] + IOS + } + internal static class OSFamilyEnumExtension + { + internal static string ToSerializedValue(this OSFamily? value) + { + return value == null ? null : ((OSFamily)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this OSFamily value) + { + switch( value ) + { + case OSFamily.Linux: + return "Linux"; + case OSFamily.Windows: + return "Windows"; + case OSFamily.Android: + return "Android"; + case OSFamily.IOS: + return "IOS"; + } + return null; + } + + internal static OSFamily? ParseOSFamily(this string value) + { + switch( value ) + { + case "Linux": + return OSFamily.Linux; + case "Windows": + return OSFamily.Windows; + case "Android": + return OSFamily.Android; + case "IOS": + return OSFamily.IOS; + } + return null; + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeConsent.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeConsent.cs new file mode 100644 index 000000000000..d07012d86d16 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeConsent.cs @@ -0,0 +1,68 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Consent for Office365 tenant that already made. + /// + [Rest.Serialization.JsonTransformation] + public partial class OfficeConsent : Resource + { + /// + /// Initializes a new instance of the OfficeConsent class. + /// + public OfficeConsent() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OfficeConsent class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// The tenantId of the Office365 with the + /// consent. + /// The tenant name of the Office365 with the + /// consent. + public OfficeConsent(string id = default(string), string name = default(string), string type = default(string), string tenantId = default(string), string tenantName = default(string)) + : base(id, name, type) + { + TenantId = tenantId; + TenantName = tenantName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenantId of the Office365 with the consent. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets the tenant name of the Office365 with the consent. + /// + [JsonProperty(PropertyName = "properties.tenantName")] + public string TenantName { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnector.cs new file mode 100644 index 000000000000..425a8b2bf0a3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnector.cs @@ -0,0 +1,70 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents office data connector. + /// + [Newtonsoft.Json.JsonObject("Office365")] + [Rest.Serialization.JsonTransformation] + public partial class OfficeDataConnector : DataConnector + { + /// + /// Initializes a new instance of the OfficeDataConnector class. + /// + public OfficeDataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OfficeDataConnector class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + /// The tenant id to connect to, and get the + /// data from. + /// The available data types for the + /// connector. + public OfficeDataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string tenantId = default(string), OfficeDataConnectorDataTypes dataTypes = default(OfficeDataConnectorDataTypes)) + : base(id, name, type, etag) + { + TenantId = tenantId; + DataTypes = dataTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the available data types for the connector. + /// + [JsonProperty(PropertyName = "properties.dataTypes")] + public OfficeDataConnectorDataTypes DataTypes { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypes.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypes.cs new file mode 100644 index 000000000000..bef6879e2668 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypes.cs @@ -0,0 +1,61 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The available data types for office data connector. + /// + public partial class OfficeDataConnectorDataTypes + { + /// + /// Initializes a new instance of the OfficeDataConnectorDataTypes + /// class. + /// + public OfficeDataConnectorDataTypes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OfficeDataConnectorDataTypes + /// class. + /// + /// Exchange data type connection. + /// SharePoint data type connection. + public OfficeDataConnectorDataTypes(OfficeDataConnectorDataTypesExchange exchange = default(OfficeDataConnectorDataTypesExchange), OfficeDataConnectorDataTypesSharePoint sharePoint = default(OfficeDataConnectorDataTypesSharePoint)) + { + Exchange = exchange; + SharePoint = sharePoint; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets exchange data type connection. + /// + [JsonProperty(PropertyName = "exchange")] + public OfficeDataConnectorDataTypesExchange Exchange { get; set; } + + /// + /// Gets or sets sharePoint data type connection. + /// + [JsonProperty(PropertyName = "sharePoint")] + public OfficeDataConnectorDataTypesSharePoint SharePoint { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesExchange.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesExchange.cs new file mode 100644 index 000000000000..b06d0c806844 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesExchange.cs @@ -0,0 +1,48 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using System.Linq; + + /// + /// Exchange data type connection. + /// + public partial class OfficeDataConnectorDataTypesExchange : DataConnectorDataTypeCommon + { + /// + /// Initializes a new instance of the + /// OfficeDataConnectorDataTypesExchange class. + /// + public OfficeDataConnectorDataTypesExchange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// OfficeDataConnectorDataTypesExchange class. + /// + /// Describe whether this data type connection is + /// enabled or not. Possible values include: 'Enabled', + /// 'Disabled' + public OfficeDataConnectorDataTypesExchange(string state = default(string)) + : base(state) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesSharePoint.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesSharePoint.cs new file mode 100644 index 000000000000..ffe852f24652 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesSharePoint.cs @@ -0,0 +1,48 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using System.Linq; + + /// + /// SharePoint data type connection. + /// + public partial class OfficeDataConnectorDataTypesSharePoint : DataConnectorDataTypeCommon + { + /// + /// Initializes a new instance of the + /// OfficeDataConnectorDataTypesSharePoint class. + /// + public OfficeDataConnectorDataTypesSharePoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// OfficeDataConnectorDataTypesSharePoint class. + /// + /// Describe whether this data type connection is + /// enabled or not. Possible values include: 'Enabled', + /// 'Disabled' + public OfficeDataConnectorDataTypesSharePoint(string state = default(string)) + : base(state) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Operation.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..c5d3af3929eb --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Operation.cs @@ -0,0 +1,59 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Operation provided by provider + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + /// Properties of the operation + /// Name of the operation + public Operation(OperationDisplay display = default(OperationDisplay), string name = default(string)) + { + Display = display; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of the operation + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + /// + /// Gets or sets name of the operation + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OperationDisplay.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..02a3a631d929 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,75 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of the operation + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + /// Description of the operation + /// Operation name + /// Provider name + /// Resource name + public OperationDisplay(string description = default(string), string operation = default(string), string provider = default(string), string resource = default(string)) + { + Description = description; + Operation = operation; + Provider = provider; + Resource = resource; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets description of the operation + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets operation name + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets provider name + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets resource name + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Page.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Page.cs new file mode 100644 index 000000000000..2fd049f3d3fb --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Page.cs @@ -0,0 +1,53 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ProcessEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ProcessEntity.cs new file mode 100644 index 000000000000..b9f1184589c4 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ProcessEntity.cs @@ -0,0 +1,156 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a process entity. + /// + [Newtonsoft.Json.JsonObject("Process")] + [Rest.Serialization.JsonTransformation] + public partial class ProcessEntity : Entity + { + /// + /// Initializes a new instance of the ProcessEntity class. + /// + public ProcessEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProcessEntity class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The account entity id running the + /// processes. + /// The command line used to create the + /// process + /// The time when the process started to + /// run + /// The elevation token associated with + /// the process. Possible values include: 'Default', 'Full', + /// 'Limited' + /// The host entity id on which the process + /// was running + /// The session entity id in + /// which the process was running + /// Image file entity id + /// The parent process entity + /// id. + /// The process ID + public ProcessEntity(string id = default(string), string name = default(string), string type = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string accountEntityId = default(string), string commandLine = default(string), System.DateTime? creationTimeUtc = default(System.DateTime?), ElevationToken? elevationToken = default(ElevationToken?), string hostEntityId = default(string), string hostLogonSessionEntityId = default(string), string imageFileEntityId = default(string), string parentProcessEntityId = default(string), string processId = default(string)) + : base(id, name, type) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + AccountEntityId = accountEntityId; + CommandLine = commandLine; + CreationTimeUtc = creationTimeUtc; + ElevationToken = elevationToken; + HostEntityId = hostEntityId; + HostLogonSessionEntityId = hostLogonSessionEntityId; + ImageFileEntityId = imageFileEntityId; + ParentProcessEntityId = parentProcessEntityId; + ProcessId = processId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the account entity id running the processes. + /// + [JsonProperty(PropertyName = "properties.accountEntityId")] + public string AccountEntityId { get; private set; } + + /// + /// Gets the command line used to create the process + /// + [JsonProperty(PropertyName = "properties.commandLine")] + public string CommandLine { get; private set; } + + /// + /// Gets the time when the process started to run + /// + [JsonProperty(PropertyName = "properties.creationTimeUtc")] + public System.DateTime? CreationTimeUtc { get; private set; } + + /// + /// Gets or sets the elevation token associated with the process. + /// Possible values include: 'Default', 'Full', 'Limited' + /// + [JsonProperty(PropertyName = "properties.elevationToken")] + public ElevationToken? ElevationToken { get; set; } + + /// + /// Gets the host entity id on which the process was running + /// + [JsonProperty(PropertyName = "properties.hostEntityId")] + public string HostEntityId { get; private set; } + + /// + /// Gets the session entity id in which the process was running + /// + [JsonProperty(PropertyName = "properties.hostLogonSessionEntityId")] + public string HostLogonSessionEntityId { get; private set; } + + /// + /// Gets image file entity id + /// + [JsonProperty(PropertyName = "properties.imageFileEntityId")] + public string ImageFileEntityId { get; private set; } + + /// + /// Gets the parent process entity id. + /// + [JsonProperty(PropertyName = "properties.parentProcessEntityId")] + public string ParentProcessEntityId { get; private set; } + + /// + /// Gets the process ID + /// + [JsonProperty(PropertyName = "properties.processId")] + public string ProcessId { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryHive.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryHive.cs new file mode 100644 index 000000000000..0860ca0264f8 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryHive.cs @@ -0,0 +1,60 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for RegistryHive. + /// + public static class RegistryHive + { + /// + /// HKEY_LOCAL_MACHINE + /// + public const string HKEYLOCALMACHINE = "HKEY_LOCAL_MACHINE"; + /// + /// HKEY_CLASSES_ROOT + /// + public const string HKEYCLASSESROOT = "HKEY_CLASSES_ROOT"; + /// + /// HKEY_CURRENT_CONFIG + /// + public const string HKEYCURRENTCONFIG = "HKEY_CURRENT_CONFIG"; + /// + /// HKEY_USERS + /// + public const string HKEYUSERS = "HKEY_USERS"; + /// + /// HKEY_CURRENT_USER_LOCAL_SETTINGS + /// + public const string HKEYCURRENTUSERLOCALSETTINGS = "HKEY_CURRENT_USER_LOCAL_SETTINGS"; + /// + /// HKEY_PERFORMANCE_DATA + /// + public const string HKEYPERFORMANCEDATA = "HKEY_PERFORMANCE_DATA"; + /// + /// HKEY_PERFORMANCE_NLSTEXT + /// + public const string HKEYPERFORMANCENLSTEXT = "HKEY_PERFORMANCE_NLSTEXT"; + /// + /// HKEY_PERFORMANCE_TEXT + /// + public const string HKEYPERFORMANCETEXT = "HKEY_PERFORMANCE_TEXT"; + /// + /// HKEY_A + /// + public const string HKEYA = "HKEY_A"; + /// + /// HKEY_CURRENT_USER + /// + public const string HKEYCURRENTUSER = "HKEY_CURRENT_USER"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryKeyEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryKeyEntity.cs new file mode 100644 index 000000000000..30e6f51002f7 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryKeyEntity.cs @@ -0,0 +1,100 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a registry key entity. + /// + [Newtonsoft.Json.JsonObject("RegistryKey")] + [Rest.Serialization.JsonTransformation] + public partial class RegistryKeyEntity : Entity + { + /// + /// Initializes a new instance of the RegistryKeyEntity class. + /// + public RegistryKeyEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RegistryKeyEntity class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// the hive that holds the registry key. Possible + /// values include: 'HKEY_LOCAL_MACHINE', 'HKEY_CLASSES_ROOT', + /// 'HKEY_CURRENT_CONFIG', 'HKEY_USERS', + /// 'HKEY_CURRENT_USER_LOCAL_SETTINGS', 'HKEY_PERFORMANCE_DATA', + /// 'HKEY_PERFORMANCE_NLSTEXT', 'HKEY_PERFORMANCE_TEXT', 'HKEY_A', + /// 'HKEY_CURRENT_USER' + /// The registry key path. + public RegistryKeyEntity(string id = default(string), string name = default(string), string type = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string hive = default(string), string key = default(string)) + : base(id, name, type) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + Hive = hive; + Key = key; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the hive that holds the registry key. Possible values include: + /// 'HKEY_LOCAL_MACHINE', 'HKEY_CLASSES_ROOT', 'HKEY_CURRENT_CONFIG', + /// 'HKEY_USERS', 'HKEY_CURRENT_USER_LOCAL_SETTINGS', + /// 'HKEY_PERFORMANCE_DATA', 'HKEY_PERFORMANCE_NLSTEXT', + /// 'HKEY_PERFORMANCE_TEXT', 'HKEY_A', 'HKEY_CURRENT_USER' + /// + [JsonProperty(PropertyName = "properties.hive")] + public string Hive { get; private set; } + + /// + /// Gets the registry key path. + /// + [JsonProperty(PropertyName = "properties.key")] + public string Key { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryValueEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryValueEntity.cs new file mode 100644 index 000000000000..8c3368fbe5cb --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryValueEntity.cs @@ -0,0 +1,115 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a registry value entity. + /// + [Newtonsoft.Json.JsonObject("RegistryValue")] + [Rest.Serialization.JsonTransformation] + public partial class RegistryValueEntity : Entity + { + /// + /// Initializes a new instance of the RegistryValueEntity class. + /// + public RegistryValueEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RegistryValueEntity class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The registry key entity id. + /// String formatted representation of the + /// value data. + /// The registry value name. + /// Specifies the data types to use when + /// storing values in the registry, or identifies the data type of a + /// value in the registry. Possible values include: 'None', 'Unknown', + /// 'String', 'ExpandString', 'Binary', 'DWord', 'MultiString', + /// 'QWord' + public RegistryValueEntity(string id = default(string), string name = default(string), string type = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string keyEntityId = default(string), string valueData = default(string), string valueName = default(string), string valueType = default(string)) + : base(id, name, type) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + KeyEntityId = keyEntityId; + ValueData = valueData; + ValueName = valueName; + ValueType = valueType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the registry key entity id. + /// + [JsonProperty(PropertyName = "properties.keyEntityId")] + public string KeyEntityId { get; private set; } + + /// + /// Gets string formatted representation of the value data. + /// + [JsonProperty(PropertyName = "properties.valueData")] + public string ValueData { get; private set; } + + /// + /// Gets the registry value name. + /// + [JsonProperty(PropertyName = "properties.valueName")] + public string ValueName { get; private set; } + + /// + /// Gets specifies the data types to use when storing values in the + /// registry, or identifies the data type of a value in the registry. + /// Possible values include: 'None', 'Unknown', 'String', + /// 'ExpandString', 'Binary', 'DWord', 'MultiString', 'QWord' + /// + [JsonProperty(PropertyName = "properties.valueType")] + public string ValueType { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryValueKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryValueKind.cs new file mode 100644 index 000000000000..76710dc81847 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryValueKind.cs @@ -0,0 +1,52 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for RegistryValueKind. + /// + public static class RegistryValueKind + { + /// + /// None + /// + public const string None = "None"; + /// + /// Unknown value type + /// + public const string Unknown = "Unknown"; + /// + /// String value type + /// + public const string String = "String"; + /// + /// ExpandString value type + /// + public const string ExpandString = "ExpandString"; + /// + /// Binary value type + /// + public const string Binary = "Binary"; + /// + /// DWord value type + /// + public const string DWord = "DWord"; + /// + /// MultiString value type + /// + public const string MultiString = "MultiString"; + /// + /// QWord value type + /// + public const string QWord = "QWord"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationBase.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationBase.cs new file mode 100644 index 000000000000..28e1732a008f --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationBase.cs @@ -0,0 +1,65 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a relation + /// + public partial class RelationBase : Resource + { + /// + /// Initializes a new instance of the RelationBase class. + /// + public RelationBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RelationBase class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// The type of relation node. Possible values + /// include: 'CasesToBookmarks' + /// ETag for relation + public RelationBase(string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string etag = default(string)) + : base(id, name, type) + { + Kind = kind; + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the type of relation node. Possible values include: + /// 'CasesToBookmarks' + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; private set; } + + /// + /// Gets or sets eTag for relation + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationNode.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationNode.cs new file mode 100644 index 000000000000..f0f92d643a50 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationNode.cs @@ -0,0 +1,80 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Relation node + /// + public partial class RelationNode + { + /// + /// Initializes a new instance of the RelationNode class. + /// + public RelationNode() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RelationNode class. + /// + /// Relation Node Id + /// The type of relation node. Possible + /// values include: 'Case', 'Bookmark' + /// Etag for relation node + /// Additional set of + /// properties + public RelationNode(string relationNodeId = default(string), string relationNodeKind = default(string), string etag = default(string), IDictionary relationAdditionalProperties = default(IDictionary)) + { + RelationNodeId = relationNodeId; + RelationNodeKind = relationNodeKind; + Etag = etag; + RelationAdditionalProperties = relationAdditionalProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets relation Node Id + /// + [JsonProperty(PropertyName = "relationNodeId")] + public string RelationNodeId { get; set; } + + /// + /// Gets the type of relation node. Possible values include: 'Case', + /// 'Bookmark' + /// + [JsonProperty(PropertyName = "relationNodeKind")] + public string RelationNodeKind { get; private set; } + + /// + /// Gets or sets etag for relation node + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + /// + /// Gets or sets additional set of properties + /// + [JsonProperty(PropertyName = "relationAdditionalProperties")] + public IDictionary RelationAdditionalProperties { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationNodeKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationNodeKind.cs new file mode 100644 index 000000000000..13dd8386a619 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationNodeKind.cs @@ -0,0 +1,28 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for RelationNodeKind. + /// + public static class RelationNodeKind + { + /// + /// Case node part of the relation + /// + public const string Case = "Case"; + /// + /// Bookmark node part of the relation + /// + public const string Bookmark = "Bookmark"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationTypes.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationTypes.cs new file mode 100644 index 000000000000..1b359c8466d2 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationTypes.cs @@ -0,0 +1,24 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for RelationTypes. + /// + public static class RelationTypes + { + /// + /// Relations between cases and bookmarks + /// + public const string CasesToBookmarks = "CasesToBookmarks"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationsModelInput.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationsModelInput.cs new file mode 100644 index 000000000000..51aac6ea59b5 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RelationsModelInput.cs @@ -0,0 +1,77 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Relation input model + /// + [Rest.Serialization.JsonTransformation] + public partial class RelationsModelInput : RelationBase + { + /// + /// Initializes a new instance of the RelationsModelInput class. + /// + public RelationsModelInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RelationsModelInput class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// The type of relation node. Possible values + /// include: 'CasesToBookmarks' + /// ETag for relation + /// Name of relation + /// Relation source node + /// Relation target node + public RelationsModelInput(string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string etag = default(string), string relationName = default(string), RelationNode sourceRelationNode = default(RelationNode), RelationNode targetRelationNode = default(RelationNode)) + : base(id, name, type, kind, etag) + { + RelationName = relationName; + SourceRelationNode = sourceRelationNode; + TargetRelationNode = targetRelationNode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of relation + /// + [JsonProperty(PropertyName = "properties.relationName")] + public string RelationName { get; set; } + + /// + /// Gets or sets relation source node + /// + [JsonProperty(PropertyName = "properties.sourceRelationNode")] + public RelationNode SourceRelationNode { get; set; } + + /// + /// Gets or sets relation target node + /// + [JsonProperty(PropertyName = "properties.targetRelationNode")] + public RelationNode TargetRelationNode { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Resource.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Resource.cs new file mode 100644 index 000000000000..d200b48f9b42 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Resource.cs @@ -0,0 +1,69 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An azure resource object + /// + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + public Resource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ResourceWithEtag.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ResourceWithEtag.cs new file mode 100644 index 000000000000..16b8a40cb14b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ResourceWithEtag.cs @@ -0,0 +1,77 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// An azure resource object with an Etag property + /// + public partial class ResourceWithEtag : IResource + { + /// + /// Initializes a new instance of the ResourceWithEtag class. + /// + public ResourceWithEtag() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceWithEtag class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + public ResourceWithEtag(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + { + Id = id; + Name = name; + Type = type; + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets etag of the azure resource + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRule.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRule.cs new file mode 100644 index 000000000000..cc53fa1d1090 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRule.cs @@ -0,0 +1,205 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents scheduled alert rule. + /// + [Newtonsoft.Json.JsonObject("Scheduled")] + [Rest.Serialization.JsonTransformation] + public partial class ScheduledAlertRule : AlertRule + { + /// + /// Initializes a new instance of the ScheduledAlertRule class. + /// + public ScheduledAlertRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScheduledAlertRule class. + /// + /// The display name for alerts created by + /// this alert rule. + /// Determines whether this alert rule is enabled + /// or disabled. + /// The suppression (in ISO 8601 + /// duration format) to wait since last time this alert rule been + /// triggered. + /// Determines whether the suppression + /// for this alert rule is enabled or disabled. + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + /// The query that creates alerts for this + /// rule. + /// The frequency (in ISO 8601 duration + /// format) for this alert rule to run. + /// The period (in ISO 8601 duration format) + /// that this alert rule looks at. + /// The severity for alerts created by this + /// alert rule. Possible values include: 'High', 'Medium', 'Low', + /// 'Informational' + /// The operation against the threshold + /// that triggers alert rule. Possible values include: 'GreaterThan', + /// 'LessThan', 'Equal', 'NotEqual' + /// The threshold triggers this alert + /// rule. + /// The Name of the alert rule + /// template used to create this rule. + /// The description of the alert + /// rule. + /// The last time that this alert rule + /// has been modified. + /// The tactics of the alert rule + public ScheduledAlertRule(string displayName, bool enabled, System.TimeSpan suppressionDuration, bool suppressionEnabled, string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string query = default(string), System.TimeSpan? queryFrequency = default(System.TimeSpan?), System.TimeSpan? queryPeriod = default(System.TimeSpan?), string severity = default(string), TriggerOperator? triggerOperator = default(TriggerOperator?), int? triggerThreshold = default(int?), string alertRuleTemplateName = default(string), string description = default(string), System.DateTime? lastModifiedUtc = default(System.DateTime?), IList tactics = default(IList)) + : base(id, name, type, etag) + { + Query = query; + QueryFrequency = queryFrequency; + QueryPeriod = queryPeriod; + Severity = severity; + TriggerOperator = triggerOperator; + TriggerThreshold = triggerThreshold; + AlertRuleTemplateName = alertRuleTemplateName; + Description = description; + DisplayName = displayName; + Enabled = enabled; + LastModifiedUtc = lastModifiedUtc; + SuppressionDuration = suppressionDuration; + SuppressionEnabled = suppressionEnabled; + Tactics = tactics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the query that creates alerts for this rule. + /// + [JsonProperty(PropertyName = "properties.query")] + public string Query { get; set; } + + /// + /// Gets or sets the frequency (in ISO 8601 duration format) for this + /// alert rule to run. + /// + [JsonProperty(PropertyName = "properties.queryFrequency")] + public System.TimeSpan? QueryFrequency { get; set; } + + /// + /// Gets or sets the period (in ISO 8601 duration format) that this + /// alert rule looks at. + /// + [JsonProperty(PropertyName = "properties.queryPeriod")] + public System.TimeSpan? QueryPeriod { get; set; } + + /// + /// Gets or sets the severity for alerts created by this alert rule. + /// Possible values include: 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "properties.severity")] + public string Severity { get; set; } + + /// + /// Gets or sets the operation against the threshold that triggers + /// alert rule. Possible values include: 'GreaterThan', 'LessThan', + /// 'Equal', 'NotEqual' + /// + [JsonProperty(PropertyName = "properties.triggerOperator")] + public TriggerOperator? TriggerOperator { get; set; } + + /// + /// Gets or sets the threshold triggers this alert rule. + /// + [JsonProperty(PropertyName = "properties.triggerThreshold")] + public int? TriggerThreshold { get; set; } + + /// + /// Gets or sets the Name of the alert rule template used to create + /// this rule. + /// + [JsonProperty(PropertyName = "properties.alertRuleTemplateName")] + public string AlertRuleTemplateName { get; set; } + + /// + /// Gets or sets the description of the alert rule. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the display name for alerts created by this alert + /// rule. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets determines whether this alert rule is enabled or + /// disabled. + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool Enabled { get; set; } + + /// + /// Gets the last time that this alert rule has been modified. + /// + [JsonProperty(PropertyName = "properties.lastModifiedUtc")] + public System.DateTime? LastModifiedUtc { get; private set; } + + /// + /// Gets or sets the suppression (in ISO 8601 duration format) to wait + /// since last time this alert rule been triggered. + /// + [JsonProperty(PropertyName = "properties.suppressionDuration")] + public System.TimeSpan SuppressionDuration { get; set; } + + /// + /// Gets or sets determines whether the suppression for this alert rule + /// is enabled or disabled. + /// + [JsonProperty(PropertyName = "properties.suppressionEnabled")] + public bool SuppressionEnabled { get; set; } + + /// + /// Gets or sets the tactics of the alert rule + /// + [JsonProperty(PropertyName = "properties.tactics")] + public IList Tactics { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRuleCommonProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRuleCommonProperties.cs new file mode 100644 index 000000000000..028dfc8a8eac --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRuleCommonProperties.cs @@ -0,0 +1,106 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Schedule alert rule template property bag. + /// + public partial class ScheduledAlertRuleCommonProperties + { + /// + /// Initializes a new instance of the + /// ScheduledAlertRuleCommonProperties class. + /// + public ScheduledAlertRuleCommonProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ScheduledAlertRuleCommonProperties class. + /// + /// The query that creates alerts for this + /// rule. + /// The frequency (in ISO 8601 duration + /// format) for this alert rule to run. + /// The period (in ISO 8601 duration format) + /// that this alert rule looks at. + /// The severity for alerts created by this + /// alert rule. Possible values include: 'High', 'Medium', 'Low', + /// 'Informational' + /// The operation against the threshold + /// that triggers alert rule. Possible values include: 'GreaterThan', + /// 'LessThan', 'Equal', 'NotEqual' + /// The threshold triggers this alert + /// rule. + public ScheduledAlertRuleCommonProperties(string query = default(string), System.TimeSpan? queryFrequency = default(System.TimeSpan?), System.TimeSpan? queryPeriod = default(System.TimeSpan?), string severity = default(string), TriggerOperator? triggerOperator = default(TriggerOperator?), int? triggerThreshold = default(int?)) + { + Query = query; + QueryFrequency = queryFrequency; + QueryPeriod = queryPeriod; + Severity = severity; + TriggerOperator = triggerOperator; + TriggerThreshold = triggerThreshold; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the query that creates alerts for this rule. + /// + [JsonProperty(PropertyName = "query")] + public string Query { get; set; } + + /// + /// Gets or sets the frequency (in ISO 8601 duration format) for this + /// alert rule to run. + /// + [JsonProperty(PropertyName = "queryFrequency")] + public System.TimeSpan? QueryFrequency { get; set; } + + /// + /// Gets or sets the period (in ISO 8601 duration format) that this + /// alert rule looks at. + /// + [JsonProperty(PropertyName = "queryPeriod")] + public System.TimeSpan? QueryPeriod { get; set; } + + /// + /// Gets or sets the severity for alerts created by this alert rule. + /// Possible values include: 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "severity")] + public string Severity { get; set; } + + /// + /// Gets or sets the operation against the threshold that triggers + /// alert rule. Possible values include: 'GreaterThan', 'LessThan', + /// 'Equal', 'NotEqual' + /// + [JsonProperty(PropertyName = "triggerOperator")] + public TriggerOperator? TriggerOperator { get; set; } + + /// + /// Gets or sets the threshold triggers this alert rule. + /// + [JsonProperty(PropertyName = "triggerThreshold")] + public int? TriggerThreshold { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRuleTemplate.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRuleTemplate.cs new file mode 100644 index 000000000000..50a520163763 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRuleTemplate.cs @@ -0,0 +1,208 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents scheduled alert rule template. + /// + [Newtonsoft.Json.JsonObject("Scheduled")] + [Rest.Serialization.JsonTransformation] + public partial class ScheduledAlertRuleTemplate : AlertRuleTemplate + { + /// + /// Initializes a new instance of the ScheduledAlertRuleTemplate class. + /// + public ScheduledAlertRuleTemplate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScheduledAlertRuleTemplate class. + /// + /// the number of alert + /// rules that were created by this template + /// The description of the alert rule + /// template. + /// The display name for alert rule + /// template. + /// The alert rule template status. Possible + /// values include: 'Installed', 'Available', 'NotAvailable' + /// The query that creates alerts for this + /// rule. + /// The frequency (in ISO 8601 duration + /// format) for this alert rule to run. + /// The period (in ISO 8601 duration format) + /// that this alert rule looks at. + /// The severity for alerts created by this + /// alert rule. Possible values include: 'High', 'Medium', 'Low', + /// 'Informational' + /// The operation against the threshold + /// that triggers alert rule. Possible values include: 'GreaterThan', + /// 'LessThan', 'Equal', 'NotEqual' + /// The threshold triggers this alert + /// rule. + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// The time that this alert rule template + /// has been added. + /// The required data connectors + /// for this template + /// The tactics of the alert rule + /// template + public ScheduledAlertRuleTemplate(int alertRulesCreatedByTemplateCount, string description, string displayName, string status, string query, System.TimeSpan queryFrequency, System.TimeSpan queryPeriod, string severity, TriggerOperator triggerOperator, int triggerThreshold, string id = default(string), string name = default(string), string type = default(string), System.DateTime? createdDateUTC = default(System.DateTime?), IList requiredDataConnectors = default(IList), IList tactics = default(IList)) + : base(id, name, type) + { + AlertRulesCreatedByTemplateCount = alertRulesCreatedByTemplateCount; + CreatedDateUTC = createdDateUTC; + Description = description; + DisplayName = displayName; + RequiredDataConnectors = requiredDataConnectors; + Status = status; + Tactics = tactics; + Query = query; + QueryFrequency = queryFrequency; + QueryPeriod = queryPeriod; + Severity = severity; + TriggerOperator = triggerOperator; + TriggerThreshold = triggerThreshold; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of alert rules that were created by this + /// template + /// + [JsonProperty(PropertyName = "properties.alertRulesCreatedByTemplateCount")] + public int AlertRulesCreatedByTemplateCount { get; set; } + + /// + /// Gets the time that this alert rule template has been added. + /// + [JsonProperty(PropertyName = "properties.createdDateUTC")] + public System.DateTime? CreatedDateUTC { get; private set; } + + /// + /// Gets or sets the description of the alert rule template. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the display name for alert rule template. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the required data connectors for this template + /// + [JsonProperty(PropertyName = "properties.requiredDataConnectors")] + public IList RequiredDataConnectors { get; set; } + + /// + /// Gets or sets the alert rule template status. Possible values + /// include: 'Installed', 'Available', 'NotAvailable' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets the tactics of the alert rule template + /// + [JsonProperty(PropertyName = "properties.tactics")] + public IList Tactics { get; set; } + + /// + /// Gets or sets the query that creates alerts for this rule. + /// + [JsonProperty(PropertyName = "properties.query")] + public string Query { get; set; } + + /// + /// Gets or sets the frequency (in ISO 8601 duration format) for this + /// alert rule to run. + /// + [JsonProperty(PropertyName = "properties.queryFrequency")] + public System.TimeSpan QueryFrequency { get; set; } + + /// + /// Gets or sets the period (in ISO 8601 duration format) that this + /// alert rule looks at. + /// + [JsonProperty(PropertyName = "properties.queryPeriod")] + public System.TimeSpan QueryPeriod { get; set; } + + /// + /// Gets or sets the severity for alerts created by this alert rule. + /// Possible values include: 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "properties.severity")] + public string Severity { get; set; } + + /// + /// Gets or sets the operation against the threshold that triggers + /// alert rule. Possible values include: 'GreaterThan', 'LessThan', + /// 'Equal', 'NotEqual' + /// + [JsonProperty(PropertyName = "properties.triggerOperator")] + public TriggerOperator TriggerOperator { get; set; } + + /// + /// Gets or sets the threshold triggers this alert rule. + /// + [JsonProperty(PropertyName = "properties.triggerThreshold")] + public int TriggerThreshold { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Description == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Description"); + } + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + if (Status == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Status"); + } + if (Query == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Query"); + } + if (Severity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Severity"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityAlert.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityAlert.cs new file mode 100644 index 000000000000..e1ce6512fd4f --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityAlert.cs @@ -0,0 +1,280 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a security alert entity. + /// + [Rest.Serialization.JsonTransformation] + public partial class SecurityAlert : Entity + { + /// + /// Initializes a new instance of the SecurityAlert class. + /// + public SecurityAlert() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecurityAlert class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The display name of the + /// alert. + /// The type name of the alert. + /// Display name of the main entity + /// being reported on. + /// The confidence level of this alert. + /// Possible values include: 'Unknown', 'Low', 'High' + /// The confidence reasons + /// The confidence score of the + /// alert. + /// The confidence score + /// calculation status, i.e. indicating if score calculation is pending + /// for this alert, not applicable or final. Possible values include: + /// 'NotApplicable', 'InProcess', 'NotFinal', 'Final' + /// Alert description. + /// The impact end time of the alert (the time + /// of the last event contributing to the alert). + /// Holds the alert intent stage(s) mapping for + /// this alert. Possible values include: 'Unknown', 'Probing', + /// 'Exploitation', 'Persistence', 'PrivilegeEscalation', + /// 'DefenseEvasion', 'CredentialAccess', 'Discovery', + /// 'LateralMovement', 'Execution', 'Collection', 'Exfiltration', + /// 'CommandAndControl', 'Impact' + /// The time the alert was made + /// available for consumption. + /// The name of a component inside + /// the product which generated the alert. + /// The name of the product which published + /// this alert. + /// The version of the product generating + /// the alert. + /// Manual action items to take to + /// remediate the alert. + /// The severity of the alert. Possible values + /// include: 'High', 'Medium', 'Low', 'Informational' + /// The impact start time of the alert (the + /// time of the first event contributing to the alert). + /// The lifecycle status of the alert. Possible + /// values include: 'Unknown', 'New', 'Resolved', 'Dismissed', + /// 'InProgress' + /// Holds the product identifier of the + /// alert for the product. + /// The time the alert was + /// generated. + /// The name of the vendor that raise the + /// alert. + public SecurityAlert(string id = default(string), string name = default(string), string type = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string alertDisplayName = default(string), string alertType = default(string), string compromisedEntity = default(string), string confidenceLevel = default(string), IList confidenceReasons = default(IList), double? confidenceScore = default(double?), string confidenceScoreStatus = default(string), string description = default(string), System.DateTime? endTimeUtc = default(System.DateTime?), string intent = default(string), System.DateTime? processingEndTime = default(System.DateTime?), string productComponentName = default(string), string productName = default(string), string productVersion = default(string), IList remediationSteps = default(IList), string severity = default(string), System.DateTime? startTimeUtc = default(System.DateTime?), string status = default(string), string systemAlertId = default(string), System.DateTime? timeGenerated = default(System.DateTime?), string vendorName = default(string)) + : base(id, name, type) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + AlertDisplayName = alertDisplayName; + AlertType = alertType; + CompromisedEntity = compromisedEntity; + ConfidenceLevel = confidenceLevel; + ConfidenceReasons = confidenceReasons; + ConfidenceScore = confidenceScore; + ConfidenceScoreStatus = confidenceScoreStatus; + Description = description; + EndTimeUtc = endTimeUtc; + Intent = intent; + ProcessingEndTime = processingEndTime; + ProductComponentName = productComponentName; + ProductName = productName; + ProductVersion = productVersion; + RemediationSteps = remediationSteps; + Severity = severity; + StartTimeUtc = startTimeUtc; + Status = status; + SystemAlertId = systemAlertId; + TimeGenerated = timeGenerated; + VendorName = vendorName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the display name of the alert. + /// + [JsonProperty(PropertyName = "properties.alertDisplayName")] + public string AlertDisplayName { get; private set; } + + /// + /// Gets the type name of the alert. + /// + [JsonProperty(PropertyName = "properties.alertType")] + public string AlertType { get; private set; } + + /// + /// Gets display name of the main entity being reported on. + /// + [JsonProperty(PropertyName = "properties.compromisedEntity")] + public string CompromisedEntity { get; private set; } + + /// + /// Gets the confidence level of this alert. Possible values include: + /// 'Unknown', 'Low', 'High' + /// + [JsonProperty(PropertyName = "properties.confidenceLevel")] + public string ConfidenceLevel { get; private set; } + + /// + /// Gets the confidence reasons + /// + [JsonProperty(PropertyName = "properties.confidenceReasons")] + public IList ConfidenceReasons { get; private set; } + + /// + /// Gets the confidence score of the alert. + /// + [JsonProperty(PropertyName = "properties.confidenceScore")] + public double? ConfidenceScore { get; private set; } + + /// + /// Gets the confidence score calculation status, i.e. indicating if + /// score calculation is pending for this alert, not applicable or + /// final. Possible values include: 'NotApplicable', 'InProcess', + /// 'NotFinal', 'Final' + /// + [JsonProperty(PropertyName = "properties.confidenceScoreStatus")] + public string ConfidenceScoreStatus { get; private set; } + + /// + /// Gets alert description. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets the impact end time of the alert (the time of the last event + /// contributing to the alert). + /// + [JsonProperty(PropertyName = "properties.endTimeUtc")] + public System.DateTime? EndTimeUtc { get; private set; } + + /// + /// Gets holds the alert intent stage(s) mapping for this alert. + /// Possible values include: 'Unknown', 'Probing', 'Exploitation', + /// 'Persistence', 'PrivilegeEscalation', 'DefenseEvasion', + /// 'CredentialAccess', 'Discovery', 'LateralMovement', 'Execution', + /// 'Collection', 'Exfiltration', 'CommandAndControl', 'Impact' + /// + [JsonProperty(PropertyName = "properties.intent")] + public string Intent { get; private set; } + + /// + /// Gets the time the alert was made available for consumption. + /// + [JsonProperty(PropertyName = "properties.processingEndTime")] + public System.DateTime? ProcessingEndTime { get; private set; } + + /// + /// Gets the name of a component inside the product which generated the + /// alert. + /// + [JsonProperty(PropertyName = "properties.productComponentName")] + public string ProductComponentName { get; private set; } + + /// + /// Gets the name of the product which published this alert. + /// + [JsonProperty(PropertyName = "properties.productName")] + public string ProductName { get; private set; } + + /// + /// Gets the version of the product generating the alert. + /// + [JsonProperty(PropertyName = "properties.productVersion")] + public string ProductVersion { get; private set; } + + /// + /// Gets manual action items to take to remediate the alert. + /// + [JsonProperty(PropertyName = "properties.remediationSteps")] + public IList RemediationSteps { get; private set; } + + /// + /// Gets or sets the severity of the alert. Possible values include: + /// 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "properties.severity")] + public string Severity { get; set; } + + /// + /// Gets the impact start time of the alert (the time of the first + /// event contributing to the alert). + /// + [JsonProperty(PropertyName = "properties.startTimeUtc")] + public System.DateTime? StartTimeUtc { get; private set; } + + /// + /// Gets the lifecycle status of the alert. Possible values include: + /// 'Unknown', 'New', 'Resolved', 'Dismissed', 'InProgress' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets holds the product identifier of the alert for the product. + /// + [JsonProperty(PropertyName = "properties.systemAlertId")] + public string SystemAlertId { get; private set; } + + /// + /// Gets the time the alert was generated. + /// + [JsonProperty(PropertyName = "properties.timeGenerated")] + public System.DateTime? TimeGenerated { get; private set; } + + /// + /// Gets the name of the vendor that raise the alert. + /// + [JsonProperty(PropertyName = "properties.vendorName")] + public string VendorName { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityAlertPropertiesConfidenceReasonsItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityAlertPropertiesConfidenceReasonsItem.cs new file mode 100644 index 000000000000..8abc0caf7325 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityAlertPropertiesConfidenceReasonsItem.cs @@ -0,0 +1,61 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// confidence reason item + /// + public partial class SecurityAlertPropertiesConfidenceReasonsItem + { + /// + /// Initializes a new instance of the + /// SecurityAlertPropertiesConfidenceReasonsItem class. + /// + public SecurityAlertPropertiesConfidenceReasonsItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SecurityAlertPropertiesConfidenceReasonsItem class. + /// + /// The reason's description + /// The type (category) of the reason + public SecurityAlertPropertiesConfidenceReasonsItem(string reason = default(string), string reasonType = default(string)) + { + Reason = reason; + ReasonType = reasonType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the reason's description + /// + [JsonProperty(PropertyName = "reason")] + public string Reason { get; private set; } + + /// + /// Gets the type (category) of the reason + /// + [JsonProperty(PropertyName = "reasonType")] + public string ReasonType { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityGroupEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityGroupEntity.cs new file mode 100644 index 000000000000..f4f0297f9f7b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityGroupEntity.cs @@ -0,0 +1,105 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a security group entity. + /// + [Newtonsoft.Json.JsonObject("SecurityGroup")] + [Rest.Serialization.JsonTransformation] + public partial class SecurityGroupEntity : Entity + { + /// + /// Initializes a new instance of the SecurityGroupEntity class. + /// + public SecurityGroupEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecurityGroupEntity class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The group distinguished + /// name + /// A single-value attribute that is the + /// unique identifier for the object, assigned by active + /// directory. + /// The SID attribute is a single-value attribute + /// that specifies the security identifier (SID) of the group + public SecurityGroupEntity(string id = default(string), string name = default(string), string type = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string distinguishedName = default(string), System.Guid? objectGuid = default(System.Guid?), string sid = default(string)) + : base(id, name, type) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + DistinguishedName = distinguishedName; + ObjectGuid = objectGuid; + Sid = sid; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the group distinguished name + /// + [JsonProperty(PropertyName = "properties.distinguishedName")] + public string DistinguishedName { get; private set; } + + /// + /// Gets a single-value attribute that is the unique identifier for the + /// object, assigned by active directory. + /// + [JsonProperty(PropertyName = "properties.objectGuid")] + public System.Guid? ObjectGuid { get; private set; } + + /// + /// Gets the SID attribute is a single-value attribute that specifies + /// the security identifier (SID) of the group + /// + [JsonProperty(PropertyName = "properties.sid")] + public string Sid { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingKind.cs new file mode 100644 index 000000000000..663b0f801f7f --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingKind.cs @@ -0,0 +1,22 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for SettingKind. + /// + public static class SettingKind + { + public const string UebaSettings = "UebaSettings"; + public const string ToggleSettings = "ToggleSettings"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Settings.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Settings.cs new file mode 100644 index 000000000000..ffd8daa61ced --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Settings.cs @@ -0,0 +1,75 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Setting. + /// + public partial class Settings + { + /// + /// Initializes a new instance of the Settings class. + /// + public Settings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Settings class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + public Settings(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + { + Id = id; + Name = name; + Type = type; + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets etag of the azure resource + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingsKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingsKind.cs new file mode 100644 index 000000000000..14b723d14693 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingsKind.cs @@ -0,0 +1,67 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes an Azure resource with kind. + /// + public partial class SettingsKind + { + /// + /// Initializes a new instance of the SettingsKind class. + /// + public SettingsKind() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SettingsKind class. + /// + /// The kind of the setting. Possible values + /// include: 'UebaSettings', 'ToggleSettings' + public SettingsKind(string kind) + { + Kind = kind; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the kind of the setting. Possible values include: + /// 'UebaSettings', 'ToggleSettings' + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Kind == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Kind"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/StatusInMcas.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/StatusInMcas.cs new file mode 100644 index 000000000000..397794960d90 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/StatusInMcas.cs @@ -0,0 +1,22 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for StatusInMcas. + /// + public static class StatusInMcas + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TICheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TICheckRequirements.cs new file mode 100644 index 000000000000..f705d320a6a3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TICheckRequirements.cs @@ -0,0 +1,52 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// TI (Threat Intelligence) requirements check properties. + /// + public partial class TICheckRequirements + { + /// + /// Initializes a new instance of the TICheckRequirements class. + /// + public TICheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TICheckRequirements class. + /// + /// The tenant id to connect to, and get the + /// data from. + public TICheckRequirements(string tenantId = default(string)) + { + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnector.cs new file mode 100644 index 000000000000..c57d7172c390 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnector.cs @@ -0,0 +1,70 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents threat intelligence data connector. + /// + [Newtonsoft.Json.JsonObject("ThreatIntelligence")] + [Rest.Serialization.JsonTransformation] + public partial class TIDataConnector : DataConnector + { + /// + /// Initializes a new instance of the TIDataConnector class. + /// + public TIDataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TIDataConnector class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + /// The tenant id to connect to, and get the + /// data from. + /// The available data types for the + /// connector. + public TIDataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string tenantId = default(string), TIDataConnectorDataTypes dataTypes = default(TIDataConnectorDataTypes)) + : base(id, name, type, etag) + { + TenantId = tenantId; + DataTypes = dataTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the available data types for the connector. + /// + [JsonProperty(PropertyName = "properties.dataTypes")] + public TIDataConnectorDataTypes DataTypes { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypes.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypes.cs new file mode 100644 index 000000000000..92fdaf0c1d61 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypes.cs @@ -0,0 +1,52 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The available data types for TI (Threat Intelligence) data connector. + /// + public partial class TIDataConnectorDataTypes + { + /// + /// Initializes a new instance of the TIDataConnectorDataTypes class. + /// + public TIDataConnectorDataTypes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TIDataConnectorDataTypes class. + /// + /// Data type for indicators + /// connection. + public TIDataConnectorDataTypes(TIDataConnectorDataTypesIndicators indicators = default(TIDataConnectorDataTypesIndicators)) + { + Indicators = indicators; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets data type for indicators connection. + /// + [JsonProperty(PropertyName = "indicators")] + public TIDataConnectorDataTypesIndicators Indicators { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypesIndicators.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypesIndicators.cs new file mode 100644 index 000000000000..75d480973671 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypesIndicators.cs @@ -0,0 +1,48 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using System.Linq; + + /// + /// Data type for indicators connection. + /// + public partial class TIDataConnectorDataTypesIndicators : DataConnectorDataTypeCommon + { + /// + /// Initializes a new instance of the + /// TIDataConnectorDataTypesIndicators class. + /// + public TIDataConnectorDataTypesIndicators() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// TIDataConnectorDataTypesIndicators class. + /// + /// Describe whether this data type connection is + /// enabled or not. Possible values include: 'Enabled', + /// 'Disabled' + public TIDataConnectorDataTypesIndicators(string state = default(string)) + : base(state) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TemplateStatus.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TemplateStatus.cs new file mode 100644 index 000000000000..971d1812de20 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TemplateStatus.cs @@ -0,0 +1,32 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + + /// + /// Defines values for TemplateStatus. + /// + public static class TemplateStatus + { + /// + /// Alert rule template installed. and can not use more then once + /// + public const string Installed = "Installed"; + /// + /// Alert rule template is available. + /// + public const string Available = "Available"; + /// + /// Alert rule template is not available + /// + public const string NotAvailable = "NotAvailable"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligence.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligence.cs new file mode 100644 index 000000000000..3d1096e1c302 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligence.cs @@ -0,0 +1,96 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// ThreatIntelligence property bag. + /// + public partial class ThreatIntelligence + { + /// + /// Initializes a new instance of the ThreatIntelligence class. + /// + public ThreatIntelligence() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThreatIntelligence class. + /// + /// Confidence (must be between 0 and + /// 1) + /// Name of the provider from whom this + /// Threat Intelligence information was received + /// Report link + /// Threat description (free + /// text) + /// Threat name (e.g. "Jedobot + /// malware") + /// Threat type (e.g. "Botnet") + public ThreatIntelligence(double? confidence = default(double?), string providerName = default(string), string reportLink = default(string), string threatDescription = default(string), string threatName = default(string), string threatType = default(string)) + { + Confidence = confidence; + ProviderName = providerName; + ReportLink = reportLink; + ThreatDescription = threatDescription; + ThreatName = threatName; + ThreatType = threatType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets confidence (must be between 0 and 1) + /// + [JsonProperty(PropertyName = "confidence")] + public double? Confidence { get; private set; } + + /// + /// Gets name of the provider from whom this Threat Intelligence + /// information was received + /// + [JsonProperty(PropertyName = "providerName")] + public string ProviderName { get; private set; } + + /// + /// Gets report link + /// + [JsonProperty(PropertyName = "reportLink")] + public string ReportLink { get; private set; } + + /// + /// Gets threat description (free text) + /// + [JsonProperty(PropertyName = "threatDescription")] + public string ThreatDescription { get; private set; } + + /// + /// Gets threat name (e.g. "Jedobot malware") + /// + [JsonProperty(PropertyName = "threatName")] + public string ThreatName { get; private set; } + + /// + /// Gets threat type (e.g. "Botnet") + /// + [JsonProperty(PropertyName = "threatType")] + public string ThreatType { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ToggleSettings.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ToggleSettings.cs new file mode 100644 index 000000000000..076630967b68 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ToggleSettings.cs @@ -0,0 +1,60 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Settings with single toggle. + /// + [Rest.Serialization.JsonTransformation] + public partial class ToggleSettings : Settings + { + /// + /// Initializes a new instance of the ToggleSettings class. + /// + public ToggleSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ToggleSettings class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + /// Determines whether the setting is enable or + /// disabled. + public ToggleSettings(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), bool? isEnabled = default(bool?)) + : base(id, name, type, etag) + { + IsEnabled = isEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets determines whether the setting is enable or disabled. + /// + [JsonProperty(PropertyName = "properties.isEnabled")] + public bool? IsEnabled { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TriggerOperator.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TriggerOperator.cs new file mode 100644 index 000000000000..7a72b4a14fd7 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TriggerOperator.cs @@ -0,0 +1,72 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for TriggerOperator. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum TriggerOperator + { + [EnumMember(Value = "GreaterThan")] + GreaterThan, + [EnumMember(Value = "LessThan")] + LessThan, + [EnumMember(Value = "Equal")] + Equal, + [EnumMember(Value = "NotEqual")] + NotEqual + } + internal static class TriggerOperatorEnumExtension + { + internal static string ToSerializedValue(this TriggerOperator? value) + { + return value == null ? null : ((TriggerOperator)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this TriggerOperator value) + { + switch( value ) + { + case TriggerOperator.GreaterThan: + return "GreaterThan"; + case TriggerOperator.LessThan: + return "LessThan"; + case TriggerOperator.Equal: + return "Equal"; + case TriggerOperator.NotEqual: + return "NotEqual"; + } + return null; + } + + internal static TriggerOperator? ParseTriggerOperator(this string value) + { + switch( value ) + { + case "GreaterThan": + return TriggerOperator.GreaterThan; + case "LessThan": + return TriggerOperator.LessThan; + case "Equal": + return TriggerOperator.Equal; + case "NotEqual": + return TriggerOperator.NotEqual; + } + return null; + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UebaSettings.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UebaSettings.cs new file mode 100644 index 000000000000..840992edae71 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UebaSettings.cs @@ -0,0 +1,84 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents settings for User and Entity Behavior Analytics enablement. + /// + [Rest.Serialization.JsonTransformation] + public partial class UebaSettings : Settings + { + /// + /// Initializes a new instance of the UebaSettings class. + /// + public UebaSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UebaSettings class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Etag of the azure resource + /// Determines whether the tenant has + /// ATP (Advanced Threat Protection) license. Possible values include: + /// 'Enabled', 'Disabled' + /// Determines whether User and Entity Behavior + /// Analytics is enabled for this workspace. + /// Determines whether User and Entity + /// Behavior Analytics is enabled from MCAS (Microsoft Cloud App + /// Security). Possible values include: 'Enabled', 'Disabled' + public UebaSettings(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string atpLicenseStatus = default(string), bool? isEnabled = default(bool?), string statusInMcas = default(string)) + : base(id, name, type, etag) + { + AtpLicenseStatus = atpLicenseStatus; + IsEnabled = isEnabled; + StatusInMcas = statusInMcas; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets determines whether the tenant has ATP (Advanced Threat + /// Protection) license. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.atpLicenseStatus")] + public string AtpLicenseStatus { get; private set; } + + /// + /// Gets or sets determines whether User and Entity Behavior Analytics + /// is enabled for this workspace. + /// + [JsonProperty(PropertyName = "properties.isEnabled")] + public bool? IsEnabled { get; set; } + + /// + /// Gets determines whether User and Entity Behavior Analytics is + /// enabled from MCAS (Microsoft Cloud App Security). Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.statusInMcas")] + public string StatusInMcas { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UrlEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UrlEntity.cs new file mode 100644 index 000000000000..479f13421bfd --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UrlEntity.cs @@ -0,0 +1,83 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a url entity. + /// + [Newtonsoft.Json.JsonObject("Url")] + [Rest.Serialization.JsonTransformation] + public partial class UrlEntity : Entity + { + /// + /// Initializes a new instance of the UrlEntity class. + /// + public UrlEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UrlEntity class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// A full URL the entity points to + public UrlEntity(string id = default(string), string name = default(string), string type = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string url = default(string)) + : base(id, name, type) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + Url = url; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets a full URL the entity points to + /// + [JsonProperty(PropertyName = "properties.url")] + public string Url { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UserInfo.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UserInfo.cs new file mode 100644 index 000000000000..22ee58fb1b3d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UserInfo.cs @@ -0,0 +1,67 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// User information that made some action + /// + public partial class UserInfo + { + /// + /// Initializes a new instance of the UserInfo class. + /// + public UserInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserInfo class. + /// + /// The email of the user. + /// The name of the user. + /// The object id of the user. + public UserInfo(string email = default(string), string name = default(string), System.Guid? objectId = default(System.Guid?)) + { + Email = email; + Name = name; + ObjectId = objectId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the email of the user. + /// + [JsonProperty(PropertyName = "email")] + public string Email { get; private set; } + + /// + /// Gets the name of the user. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets the object id of the user. + /// + [JsonProperty(PropertyName = "objectId")] + public System.Guid? ObjectId { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/OfficeConsentsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/OfficeConsentsOperations.cs new file mode 100644 index 000000000000..a8df643727c3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/OfficeConsentsOperations.cs @@ -0,0 +1,932 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OfficeConsentsOperations operations. + /// + internal partial class OfficeConsentsOperations : IServiceOperations, IOfficeConsentsOperations + { + /// + /// Initializes a new instance of the OfficeConsentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal OfficeConsentsOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// Gets all office365 consents. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets an office365 consent. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// consent ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string consentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (consentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "consentId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("consentId", consentId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{consentId}", System.Uri.EscapeDataString(consentId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete the office365 consent. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// consent ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string consentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (consentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "consentId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("consentId", consentId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/officeConsents/{consentId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{consentId}", System.Uri.EscapeDataString(consentId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all office365 consents. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/OfficeConsentsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/OfficeConsentsOperationsExtensions.cs new file mode 100644 index 000000000000..14979d19a0d7 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/OfficeConsentsOperationsExtensions.cs @@ -0,0 +1,218 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for OfficeConsentsOperations. + /// + public static partial class OfficeConsentsOperationsExtensions + { + /// + /// Gets all office365 consents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + public static IPage List(this IOfficeConsentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets all office365 consents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOfficeConsentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets an office365 consent. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// consent ID + /// + public static OfficeConsent Get(this IOfficeConsentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string consentId) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, consentId).GetAwaiter().GetResult(); + } + + /// + /// Gets an office365 consent. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// consent ID + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IOfficeConsentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string consentId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, consentId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the office365 consent. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// consent ID + /// + public static void Delete(this IOfficeConsentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string consentId) + { + operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, consentId).GetAwaiter().GetResult(); + } + + /// + /// Delete the office365 consent. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// consent ID + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IOfficeConsentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string consentId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, consentId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all office365 consents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOfficeConsentsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all office365 consents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IOfficeConsentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Operations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Operations.cs new file mode 100644 index 000000000000..38e2e487d6de --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Operations.cs @@ -0,0 +1,390 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// Lists all operations available Azure Security Insights Resource Provider. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.SecurityInsights/operations").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all operations available Azure Security Insights Resource Provider. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/OperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..75944a1155d9 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/OperationsExtensions.cs @@ -0,0 +1,87 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Lists all operations available Azure Security Insights Resource Provider. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all operations available Azure Security Insights Resource Provider. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all operations available Azure Security Insights Resource Provider. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all operations available Azure Security Insights Resource Provider. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ProductSettingsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ProductSettingsOperations.cs new file mode 100644 index 000000000000..3d83210743c0 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ProductSettingsOperations.cs @@ -0,0 +1,558 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ProductSettingsOperations operations. + /// + internal partial class ProductSettingsOperations : IServiceOperations, IProductSettingsOperations + { + /// + /// Initializes a new instance of the ProductSettingsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ProductSettingsOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// Gets a setting. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The setting name. Supports- Fusion, UEBA + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (settingsName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "settingsName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("settingsName", settingsName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{settingsName}", System.Uri.EscapeDataString(settingsName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates the setting. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The setting name. Supports- Fusion, UEBA + /// + /// + /// The setting + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName, Settings settings, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (settingsName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "settingsName"); + } + if (settings == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "settings"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("settingsName", settingsName); + tracingParameters.Add("settings", settings); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/settings/{settingsName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{settingsName}", System.Uri.EscapeDataString(settingsName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(settings != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(settings, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ProductSettingsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ProductSettingsOperationsExtensions.cs new file mode 100644 index 000000000000..dff9239aa36c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ProductSettingsOperationsExtensions.cs @@ -0,0 +1,143 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ProductSettingsOperations. + /// + public static partial class ProductSettingsOperationsExtensions + { + /// + /// Gets a setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The setting name. Supports- Fusion, UEBA + /// + public static Settings Get(this IProductSettingsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, settingsName).GetAwaiter().GetResult(); + } + + /// + /// Gets a setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The setting name. Supports- Fusion, UEBA + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IProductSettingsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, settingsName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The setting name. Supports- Fusion, UEBA + /// + /// + /// The setting + /// + public static Settings Update(this IProductSettingsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName, Settings settings) + { + return operations.UpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, settingsName, settings).GetAwaiter().GetResult(); + } + + /// + /// Updates the setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// The setting name. Supports- Fusion, UEBA + /// + /// + /// The setting + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IProductSettingsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName, Settings settings, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, settingsName, settings, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SdkInfo_SecurityInsights.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SdkInfo_SecurityInsights.cs new file mode 100644 index 000000000000..624d0c86cd73 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SdkInfo_SecurityInsights.cs @@ -0,0 +1,43 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_SecurityInsights + { + get + { + return new Tuple[] + { + new Tuple("SecurityInsights", "Actions", "2019-01-01-preview"), + new Tuple("SecurityInsights", "AlertRuleTemplates", "2019-01-01-preview"), + new Tuple("SecurityInsights", "AlertRules", "2019-01-01-preview"), + new Tuple("SecurityInsights", "BookmarkRelations", "2019-01-01-preview"), + new Tuple("SecurityInsights", "Bookmarks", "2019-01-01-preview"), + new Tuple("SecurityInsights", "CaseComments", "2019-01-01-preview"), + new Tuple("SecurityInsights", "CaseRelations", "2019-01-01-preview"), + new Tuple("SecurityInsights", "Cases", "2019-01-01-preview"), + new Tuple("SecurityInsights", "CasesAggregations", "2019-01-01-preview"), + new Tuple("SecurityInsights", "Comments", "2019-01-01-preview"), + new Tuple("SecurityInsights", "DataConnectors", "2019-01-01-preview"), + new Tuple("SecurityInsights", "Entities", "2019-01-01-preview"), + new Tuple("SecurityInsights", "EntityQueries", "2019-01-01-preview"), + new Tuple("SecurityInsights", "OfficeConsents", "2019-01-01-preview"), + new Tuple("SecurityInsights", "Operations", "2019-01-01-preview"), + new Tuple("SecurityInsights", "ProductSettings", "2019-01-01-preview"), + new Tuple("SecurityInsights", "listDataConnectorRequirements", "2019-01-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SecurityInsightsClient.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SecurityInsightsClient.cs new file mode 100644 index 000000000000..c395afd52a22 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SecurityInsightsClient.cs @@ -0,0 +1,724 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// API spec for Microsoft.SecurityInsights (Azure Security Insights) + /// resource provider + /// + public partial class SecurityInsightsClient : ServiceClient, ISecurityInsightsClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// API version for the operation + /// + public string ApiVersion { get; private set; } + + /// + /// Azure subscription ID + /// + public string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the IAlertRulesOperations. + /// + public virtual IAlertRulesOperations AlertRules { get; private set; } + + /// + /// Gets the IActionsOperations. + /// + public virtual IActionsOperations Actions { get; private set; } + + /// + /// Gets the IAlertRuleTemplatesOperations. + /// + public virtual IAlertRuleTemplatesOperations AlertRuleTemplates { get; private set; } + + /// + /// Gets the ICasesOperations. + /// + public virtual ICasesOperations Cases { get; private set; } + + /// + /// Gets the ICommentsOperations. + /// + public virtual ICommentsOperations Comments { get; private set; } + + /// + /// Gets the ICaseCommentsOperations. + /// + public virtual ICaseCommentsOperations CaseComments { get; private set; } + + /// + /// Gets the IBookmarksOperations. + /// + public virtual IBookmarksOperations Bookmarks { get; private set; } + + /// + /// Gets the ICaseRelationsOperations. + /// + public virtual ICaseRelationsOperations CaseRelations { get; private set; } + + /// + /// Gets the IBookmarkRelationsOperations. + /// + public virtual IBookmarkRelationsOperations BookmarkRelations { get; private set; } + + /// + /// Gets the IDataConnectorsOperations. + /// + public virtual IDataConnectorsOperations DataConnectors { get; private set; } + + /// + /// Gets the IEntitiesOperations. + /// + public virtual IEntitiesOperations Entities { get; private set; } + + /// + /// Gets the IOfficeConsentsOperations. + /// + public virtual IOfficeConsentsOperations OfficeConsents { get; private set; } + + /// + /// Gets the IProductSettingsOperations. + /// + public virtual IProductSettingsOperations ProductSettings { get; private set; } + + /// + /// Gets the ICasesAggregationsOperations. + /// + public virtual ICasesAggregationsOperations CasesAggregations { get; private set; } + + /// + /// Gets the IEntityQueriesOperations. + /// + public virtual IEntityQueriesOperations EntityQueries { get; private set; } + + /// + /// Initializes a new instance of the SecurityInsightsClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling SecurityInsightsClient.Dispose(). False: will not dispose provided httpClient + protected SecurityInsightsClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the SecurityInsightsClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected SecurityInsightsClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the SecurityInsightsClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected SecurityInsightsClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the SecurityInsightsClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected SecurityInsightsClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the SecurityInsightsClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected SecurityInsightsClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the SecurityInsightsClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public SecurityInsightsClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the SecurityInsightsClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling SecurityInsightsClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public SecurityInsightsClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the SecurityInsightsClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public SecurityInsightsClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the SecurityInsightsClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public SecurityInsightsClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the SecurityInsightsClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public SecurityInsightsClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + Operations = new Operations(this); + AlertRules = new AlertRulesOperations(this); + Actions = new ActionsOperations(this); + AlertRuleTemplates = new AlertRuleTemplatesOperations(this); + Cases = new CasesOperations(this); + Comments = new CommentsOperations(this); + CaseComments = new CaseCommentsOperations(this); + Bookmarks = new BookmarksOperations(this); + CaseRelations = new CaseRelationsOperations(this); + BookmarkRelations = new BookmarkRelationsOperations(this); + DataConnectors = new DataConnectorsOperations(this); + Entities = new EntitiesOperations(this); + OfficeConsents = new OfficeConsentsOperations(this); + ProductSettings = new ProductSettingsOperations(this); + CasesAggregations = new CasesAggregationsOperations(this); + EntityQueries = new EntityQueriesOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2019-01-01-preview"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + /// + /// Get requirements state for a data connector type. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The kind of the data connector. Possible values include: + /// 'AzureActiveDirectory', 'AzureSecurityCenter', 'MicrosoftCloudAppSecurity', + /// 'ThreatIntelligence', 'Office365', 'AmazonWebServicesCloudTrail', + /// 'AzureAdvancedThreatProtection', + /// 'MicrosoftDefenderAdvancedThreatProtection' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListDataConnectorRequirementsWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string operationalInsightsResourceProvider, string kind, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + if (SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90); + } + if (workspaceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); + } + } + if (operationalInsightsResourceProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider"); + } + if (kind == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "kind"); + } + DataConnectorsCheckRequirements dataConnectorsCheckRequirements = new DataConnectorsCheckRequirements(); + if (kind != null) + { + dataConnectorsCheckRequirements.Kind = kind; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("dataConnectorsCheckRequirements", dataConnectorsCheckRequirements); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListDataConnectorRequirements", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorsCheckRequirements").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider)); + List _queryParameters = new List(); + if (ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(dataConnectorsCheckRequirements != null) + { + _requestContent = SafeJsonConvert.SerializeObject(dataConnectorsCheckRequirements, SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SecurityInsightsClientExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SecurityInsightsClientExtensions.cs new file mode 100644 index 000000000000..85758ff138d0 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SecurityInsightsClientExtensions.cs @@ -0,0 +1,89 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.SecurityInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SecurityInsightsClient. + /// + public static partial class SecurityInsightsClientExtensions + { + /// + /// Get requirements state for a data connector type. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The kind of the data connector. Possible values include: + /// 'AzureActiveDirectory', 'AzureSecurityCenter', 'MicrosoftCloudAppSecurity', + /// 'ThreatIntelligence', 'Office365', 'AmazonWebServicesCloudTrail', + /// 'AzureAdvancedThreatProtection', + /// 'MicrosoftDefenderAdvancedThreatProtection' + /// + public static DataConnectorRequirementsState ListDataConnectorRequirements(this ISecurityInsightsClient operations, string resourceGroupName, string workspaceName, string operationalInsightsResourceProvider, string kind) + { + return operations.ListDataConnectorRequirementsAsync(resourceGroupName, workspaceName, operationalInsightsResourceProvider, kind).GetAwaiter().GetResult(); + } + + /// + /// Get requirements state for a data connector type. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The kind of the data connector. Possible values include: + /// 'AzureActiveDirectory', 'AzureSecurityCenter', 'MicrosoftCloudAppSecurity', + /// 'ThreatIntelligence', 'Office365', 'AmazonWebServicesCloudTrail', + /// 'AzureAdvancedThreatProtection', + /// 'MicrosoftDefenderAdvancedThreatProtection' + /// + /// + /// The cancellation token. + /// + public static async Task ListDataConnectorRequirementsAsync(this ISecurityInsightsClient operations, string resourceGroupName, string workspaceName, string operationalInsightsResourceProvider, string kind, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListDataConnectorRequirementsWithHttpMessagesAsync(resourceGroupName, workspaceName, operationalInsightsResourceProvider, kind, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}