diff --git a/profiles/preview/preview/security/mgmt/security/models.go b/profiles/preview/preview/security/mgmt/security/models.go index 9798ac9547d7..9c7bccc72a46 100644 --- a/profiles/preview/preview/security/mgmt/security/models.go +++ b/profiles/preview/preview/security/mgmt/security/models.go @@ -59,6 +59,15 @@ const ( AlertsToAdminsOn AlertsToAdmins = original.AlertsToAdminsOn ) +type AssessedResourceType = original.AssessedResourceType + +const ( + AssessedResourceTypeAdditionalData AssessedResourceType = original.AssessedResourceTypeAdditionalData + AssessedResourceTypeContainerRegistryVulnerability AssessedResourceType = original.AssessedResourceTypeContainerRegistryVulnerability + AssessedResourceTypeServerVulnerabilityAssessment AssessedResourceType = original.AssessedResourceTypeServerVulnerabilityAssessment + AssessedResourceTypeSQLServerVulnerability AssessedResourceType = original.AssessedResourceTypeSQLServerVulnerability +) + type AutoProvision = original.AutoProvision const ( @@ -114,6 +123,7 @@ type EnforcementMode = original.EnforcementMode const ( Audit EnforcementMode = original.Audit Enforce EnforcementMode = original.Enforce + None EnforcementMode = original.None ) type EnforcementMode1 = original.EnforcementMode1 @@ -121,6 +131,23 @@ type EnforcementMode1 = original.EnforcementMode1 const ( EnforcementMode1Audit EnforcementMode1 = original.EnforcementMode1Audit EnforcementMode1Enforce EnforcementMode1 = original.EnforcementMode1Enforce + EnforcementMode1None EnforcementMode1 = original.EnforcementMode1None +) + +type Exe = original.Exe + +const ( + ExeAudit Exe = original.ExeAudit + ExeEnforce Exe = original.ExeEnforce + ExeNone Exe = original.ExeNone +) + +type Executable = original.Executable + +const ( + ExecutableAudit Executable = original.ExecutableAudit + ExecutableEnforce Executable = original.ExecutableEnforce + ExecutableNone Executable = original.ExecutableNone ) type ExportData = original.ExportData @@ -149,12 +176,12 @@ const ( type FileType = original.FileType const ( - Dll FileType = original.Dll - Exe FileType = original.Exe - Executable FileType = original.Executable - Msi FileType = original.Msi - Script FileType = original.Script - Unknown FileType = original.Unknown + FileTypeDll FileType = original.FileTypeDll + FileTypeExe FileType = original.FileTypeExe + FileTypeExecutable FileType = original.FileTypeExecutable + FileTypeMsi FileType = original.FileTypeMsi + FileTypeScript FileType = original.FileTypeScript + FileTypeUnknown FileType = original.FileTypeUnknown ) type Issue = original.Issue @@ -177,6 +204,14 @@ const ( KindExternalSecuritySolution KindEnum = original.KindExternalSecuritySolution ) +type Msi = original.Msi + +const ( + MsiAudit Msi = original.MsiAudit + MsiEnforce Msi = original.MsiEnforce + MsiNone Msi = original.MsiNone +) + type PricingTier = original.PricingTier const ( @@ -273,6 +308,14 @@ const ( OffByPolicy ResourceStatus = original.OffByPolicy ) +type Script = original.Script + +const ( + ScriptAudit Script = original.ScriptAudit + ScriptEnforce Script = original.ScriptEnforce + ScriptNone Script = original.ScriptNone +) + type SettingKind = original.SettingKind const ( @@ -280,6 +323,14 @@ const ( SettingKindDataExportSetting SettingKind = original.SettingKindDataExportSetting ) +type Severity = original.Severity + +const ( + SeverityHigh Severity = original.SeverityHigh + SeverityLow Severity = original.SeverityLow + SeverityMedium Severity = original.SeverityMedium +) + type SolutionStatus = original.SolutionStatus const ( @@ -287,14 +338,22 @@ const ( SolutionStatusEnabled SolutionStatus = original.SolutionStatusEnabled ) +type Source = original.Source + +const ( + SourceAws Source = original.SourceAws + SourceAzure Source = original.SourceAzure + SourceResourceDetails Source = original.SourceResourceDetails +) + type SourceSystem = original.SourceSystem const ( - AzureAppLocker SourceSystem = original.AzureAppLocker - AzureAuditD SourceSystem = original.AzureAuditD - NonAzureAppLocker SourceSystem = original.NonAzureAppLocker - NonAzureAuditD SourceSystem = original.NonAzureAuditD - None SourceSystem = original.None + SourceSystemAzureAppLocker SourceSystem = original.SourceSystemAzureAppLocker + SourceSystemAzureAuditD SourceSystem = original.SourceSystemAzureAuditD + SourceSystemNonAzureAppLocker SourceSystem = original.SourceSystemNonAzureAppLocker + SourceSystemNonAzureAuditD SourceSystem = original.SourceSystemNonAzureAuditD + SourceSystemNone SourceSystem = original.SourceSystemNone ) type State = original.State @@ -321,6 +380,14 @@ const ( UserRequested StatusReason = original.UserRequested ) +type SubAssessmentStatusCode = original.SubAssessmentStatusCode + +const ( + SubAssessmentStatusCodeHealthy SubAssessmentStatusCode = original.SubAssessmentStatusCodeHealthy + SubAssessmentStatusCodeNotApplicable SubAssessmentStatusCode = original.SubAssessmentStatusCodeNotApplicable + SubAssessmentStatusCodeUnhealthy SubAssessmentStatusCode = original.SubAssessmentStatusCodeUnhealthy +) + type Type = original.Type const ( @@ -332,10 +399,18 @@ const ( VersionAndAboveSignature Type = original.VersionAndAboveSignature ) +type ValueType = original.ValueType + +const ( + IPCidr ValueType = original.IPCidr + String ValueType = original.String +) + type AadConnectivityState1 = original.AadConnectivityState1 type AadExternalSecuritySolution = original.AadExternalSecuritySolution type AadSolutionProperties = original.AadSolutionProperties type AdaptiveApplicationControlsClient = original.AdaptiveApplicationControlsClient +type AdditionalData = original.AdditionalData type AdvancedThreatProtectionClient = original.AdvancedThreatProtectionClient type AdvancedThreatProtectionProperties = original.AdvancedThreatProtectionProperties type AdvancedThreatProtectionSetting = original.AdvancedThreatProtectionSetting @@ -353,6 +428,7 @@ type AllowedConnectionsListIterator = original.AllowedConnectionsListIterator type AllowedConnectionsListPage = original.AllowedConnectionsListPage type AllowedConnectionsResource = original.AllowedConnectionsResource type AllowedConnectionsResourceProperties = original.AllowedConnectionsResourceProperties +type AllowlistCustomAlertRule = original.AllowlistCustomAlertRule type AppWhitelistingGroup = original.AppWhitelistingGroup type AppWhitelistingGroupData = original.AppWhitelistingGroupData type AppWhitelistingGroups = original.AppWhitelistingGroups @@ -370,8 +446,14 @@ type AutoProvisioningSettingListIterator = original.AutoProvisioningSettingListI type AutoProvisioningSettingListPage = original.AutoProvisioningSettingListPage type AutoProvisioningSettingProperties = original.AutoProvisioningSettingProperties type AutoProvisioningSettingsClient = original.AutoProvisioningSettingsClient +type AwsResourceDetails = original.AwsResourceDetails +type AzureResourceDetails = original.AzureResourceDetails type BaseClient = original.BaseClient +type BasicAdditionalData = original.BasicAdditionalData type BasicExternalSecuritySolution = original.BasicExternalSecuritySolution +type BasicResourceDetails = original.BasicResourceDetails +type CVE = original.CVE +type CVSS = original.CVSS type CefExternalSecuritySolution = original.CefExternalSecuritySolution type CefSolutionProperties = original.CefSolutionProperties type CloudError = original.CloudError @@ -398,8 +480,17 @@ type ContactListIterator = original.ContactListIterator type ContactListPage = original.ContactListPage type ContactProperties = original.ContactProperties type ContactsClient = original.ContactsClient +type ContainerRegistryVulnerabilityProperties = original.ContainerRegistryVulnerabilityProperties +type CustomAlertRule = original.CustomAlertRule type DataExportSetting = original.DataExportSetting type DataExportSettingProperties = original.DataExportSettingProperties +type DenylistCustomAlertRule = original.DenylistCustomAlertRule +type DeviceSecurityGroup = original.DeviceSecurityGroup +type DeviceSecurityGroupList = original.DeviceSecurityGroupList +type DeviceSecurityGroupListIterator = original.DeviceSecurityGroupListIterator +type DeviceSecurityGroupListPage = original.DeviceSecurityGroupListPage +type DeviceSecurityGroupProperties = original.DeviceSecurityGroupProperties +type DeviceSecurityGroupsClient = original.DeviceSecurityGroupsClient type DiscoveredSecuritySolution = original.DiscoveredSecuritySolution type DiscoveredSecuritySolutionList = original.DiscoveredSecuritySolutionList type DiscoveredSecuritySolutionListIterator = original.DiscoveredSecuritySolutionListIterator @@ -433,29 +524,22 @@ type IoTSecurityAggregatedRecommendationListIterator = original.IoTSecurityAggre type IoTSecurityAggregatedRecommendationListPage = original.IoTSecurityAggregatedRecommendationListPage type IoTSecurityAggregatedRecommendationProperties = original.IoTSecurityAggregatedRecommendationProperties type IoTSecurityAlertedDevice = original.IoTSecurityAlertedDevice -type IoTSecurityAlertedDevicesList = original.IoTSecurityAlertedDevicesList type IoTSecurityDeviceAlert = original.IoTSecurityDeviceAlert -type IoTSecurityDeviceAlertsList = original.IoTSecurityDeviceAlertsList type IoTSecurityDeviceRecommendation = original.IoTSecurityDeviceRecommendation -type IoTSecurityDeviceRecommendationsList = original.IoTSecurityDeviceRecommendationsList type IoTSecuritySolutionAnalyticsModel = original.IoTSecuritySolutionAnalyticsModel type IoTSecuritySolutionAnalyticsModelList = original.IoTSecuritySolutionAnalyticsModelList type IoTSecuritySolutionAnalyticsModelProperties = original.IoTSecuritySolutionAnalyticsModelProperties type IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem = original.IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem type IoTSecuritySolutionModel = original.IoTSecuritySolutionModel type IoTSecuritySolutionProperties = original.IoTSecuritySolutionProperties -type IoTSecuritySolutionsAnalyticsAggregatedAlertClient = original.IoTSecuritySolutionsAnalyticsAggregatedAlertClient -type IoTSecuritySolutionsAnalyticsAggregatedAlertsClient = original.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient -type IoTSecuritySolutionsAnalyticsClient = original.IoTSecuritySolutionsAnalyticsClient -type IoTSecuritySolutionsAnalyticsRecommendationClient = original.IoTSecuritySolutionsAnalyticsRecommendationClient -type IoTSecuritySolutionsAnalyticsRecommendationsClient = original.IoTSecuritySolutionsAnalyticsRecommendationsClient -type IoTSecuritySolutionsClient = original.IoTSecuritySolutionsClient type IoTSecuritySolutionsList = original.IoTSecuritySolutionsList type IoTSecuritySolutionsListIterator = original.IoTSecuritySolutionsListIterator type IoTSecuritySolutionsListPage = original.IoTSecuritySolutionsListPage -type IoTSecuritySolutionsResourceGroupClient = original.IoTSecuritySolutionsResourceGroupClient type IoTSeverityMetrics = original.IoTSeverityMetrics +type IotSecuritySolutionAnalyticsClient = original.IotSecuritySolutionAnalyticsClient type IotSecuritySolutionClient = original.IotSecuritySolutionClient +type IotSecuritySolutionsAnalyticsAggregatedAlertClient = original.IotSecuritySolutionsAnalyticsAggregatedAlertClient +type IotSecuritySolutionsAnalyticsRecommendationClient = original.IotSecuritySolutionsAnalyticsRecommendationClient type JitNetworkAccessPoliciesClient = original.JitNetworkAccessPoliciesClient type JitNetworkAccessPoliciesList = original.JitNetworkAccessPoliciesList type JitNetworkAccessPoliciesListIterator = original.JitNetworkAccessPoliciesListIterator @@ -471,6 +555,7 @@ type JitNetworkAccessRequest = original.JitNetworkAccessRequest type JitNetworkAccessRequestPort = original.JitNetworkAccessRequestPort type JitNetworkAccessRequestVirtualMachine = original.JitNetworkAccessRequestVirtualMachine type Kind = original.Kind +type ListCustomAlertRule = original.ListCustomAlertRule type Location = original.Location type LocationsClient = original.LocationsClient type Operation = original.Operation @@ -484,6 +569,7 @@ type Pricing = original.Pricing type PricingList = original.PricingList type PricingProperties = original.PricingProperties type PricingsClient = original.PricingsClient +type ProtectionMode = original.ProtectionMode type PublisherInfo = original.PublisherInfo type RecommendationConfigurationProperties = original.RecommendationConfigurationProperties type RegulatoryComplianceAssessment = original.RegulatoryComplianceAssessment @@ -505,17 +591,27 @@ type RegulatoryComplianceStandardListPage = original.RegulatoryComplianceStandar type RegulatoryComplianceStandardProperties = original.RegulatoryComplianceStandardProperties type RegulatoryComplianceStandardsClient = original.RegulatoryComplianceStandardsClient type Resource = original.Resource +type ResourceDetails = original.ResourceDetails +type SQLServerVulnerabilityProperties = original.SQLServerVulnerabilityProperties type SensitivityLabel = original.SensitivityLabel type ServerVulnerabilityAssessment = original.ServerVulnerabilityAssessment type ServerVulnerabilityAssessmentClient = original.ServerVulnerabilityAssessmentClient type ServerVulnerabilityAssessmentProperties = original.ServerVulnerabilityAssessmentProperties type ServerVulnerabilityAssessmentsList = original.ServerVulnerabilityAssessmentsList +type ServerVulnerabilityProperties = original.ServerVulnerabilityProperties type Setting = original.Setting type SettingResource = original.SettingResource type SettingsClient = original.SettingsClient type SettingsList = original.SettingsList type SettingsListIterator = original.SettingsListIterator type SettingsListPage = original.SettingsListPage +type SubAssessment = original.SubAssessment +type SubAssessmentList = original.SubAssessmentList +type SubAssessmentListIterator = original.SubAssessmentListIterator +type SubAssessmentListPage = original.SubAssessmentListPage +type SubAssessmentProperties = original.SubAssessmentProperties +type SubAssessmentStatus = original.SubAssessmentStatus +type SubAssessmentsClient = original.SubAssessmentsClient type TagsResource = original.TagsResource type Task = original.Task type TaskList = original.TaskList @@ -524,6 +620,8 @@ type TaskListPage = original.TaskListPage type TaskParameters = original.TaskParameters type TaskProperties = original.TaskProperties type TasksClient = original.TasksClient +type ThresholdCustomAlertRule = original.ThresholdCustomAlertRule +type TimeWindowCustomAlertRule = original.TimeWindowCustomAlertRule type TopologyClient = original.TopologyClient type TopologyList = original.TopologyList type TopologyListIterator = original.TopologyListIterator @@ -533,10 +631,12 @@ type TopologyResourceProperties = original.TopologyResourceProperties type TopologySingleResource = original.TopologySingleResource type TopologySingleResourceChild = original.TopologySingleResourceChild type TopologySingleResourceParent = original.TopologySingleResourceParent +type UpdateIoTSecuritySolutionProperties = original.UpdateIoTSecuritySolutionProperties type UpdateIotSecuritySolutionData = original.UpdateIotSecuritySolutionData type UserDefinedResourcesProperties = original.UserDefinedResourcesProperties type UserRecommendation = original.UserRecommendation type VMRecommendation = original.VMRecommendation +type VendorReference = original.VendorReference type WorkspaceSetting = original.WorkspaceSetting type WorkspaceSettingList = original.WorkspaceSettingList type WorkspaceSettingListIterator = original.WorkspaceSettingListIterator @@ -637,6 +737,18 @@ func NewContactsClient(subscriptionID string, ascLocation string) ContactsClient func NewContactsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) ContactsClient { return original.NewContactsClientWithBaseURI(baseURI, subscriptionID, ascLocation) } +func NewDeviceSecurityGroupListIterator(page DeviceSecurityGroupListPage) DeviceSecurityGroupListIterator { + return original.NewDeviceSecurityGroupListIterator(page) +} +func NewDeviceSecurityGroupListPage(getNextPage func(context.Context, DeviceSecurityGroupList) (DeviceSecurityGroupList, error)) DeviceSecurityGroupListPage { + return original.NewDeviceSecurityGroupListPage(getNextPage) +} +func NewDeviceSecurityGroupsClient(subscriptionID string, ascLocation string) DeviceSecurityGroupsClient { + return original.NewDeviceSecurityGroupsClient(subscriptionID, ascLocation) +} +func NewDeviceSecurityGroupsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) DeviceSecurityGroupsClient { + return original.NewDeviceSecurityGroupsClientWithBaseURI(baseURI, subscriptionID, ascLocation) +} func NewDiscoveredSecuritySolutionListIterator(page DiscoveredSecuritySolutionListPage) DiscoveredSecuritySolutionListIterator { return original.NewDiscoveredSecuritySolutionListIterator(page) } @@ -685,53 +797,17 @@ func NewIoTSecurityAggregatedRecommendationListIterator(page IoTSecurityAggregat func NewIoTSecurityAggregatedRecommendationListPage(getNextPage func(context.Context, IoTSecurityAggregatedRecommendationList) (IoTSecurityAggregatedRecommendationList, error)) IoTSecurityAggregatedRecommendationListPage { return original.NewIoTSecurityAggregatedRecommendationListPage(getNextPage) } -func NewIoTSecuritySolutionsAnalyticsAggregatedAlertClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsAggregatedAlertClient { - return original.NewIoTSecuritySolutionsAnalyticsAggregatedAlertClient(subscriptionID, ascLocation) -} -func NewIoTSecuritySolutionsAnalyticsAggregatedAlertClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsAggregatedAlertClient { - return original.NewIoTSecuritySolutionsAnalyticsAggregatedAlertClientWithBaseURI(baseURI, subscriptionID, ascLocation) -} -func NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsAggregatedAlertsClient { - return original.NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClient(subscriptionID, ascLocation) -} -func NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsAggregatedAlertsClient { - return original.NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClientWithBaseURI(baseURI, subscriptionID, ascLocation) -} -func NewIoTSecuritySolutionsAnalyticsClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsClient { - return original.NewIoTSecuritySolutionsAnalyticsClient(subscriptionID, ascLocation) -} -func NewIoTSecuritySolutionsAnalyticsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsClient { - return original.NewIoTSecuritySolutionsAnalyticsClientWithBaseURI(baseURI, subscriptionID, ascLocation) -} -func NewIoTSecuritySolutionsAnalyticsRecommendationClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsRecommendationClient { - return original.NewIoTSecuritySolutionsAnalyticsRecommendationClient(subscriptionID, ascLocation) -} -func NewIoTSecuritySolutionsAnalyticsRecommendationClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsRecommendationClient { - return original.NewIoTSecuritySolutionsAnalyticsRecommendationClientWithBaseURI(baseURI, subscriptionID, ascLocation) -} -func NewIoTSecuritySolutionsAnalyticsRecommendationsClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsRecommendationsClient { - return original.NewIoTSecuritySolutionsAnalyticsRecommendationsClient(subscriptionID, ascLocation) -} -func NewIoTSecuritySolutionsAnalyticsRecommendationsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsRecommendationsClient { - return original.NewIoTSecuritySolutionsAnalyticsRecommendationsClientWithBaseURI(baseURI, subscriptionID, ascLocation) -} -func NewIoTSecuritySolutionsClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsClient { - return original.NewIoTSecuritySolutionsClient(subscriptionID, ascLocation) -} -func NewIoTSecuritySolutionsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsClient { - return original.NewIoTSecuritySolutionsClientWithBaseURI(baseURI, subscriptionID, ascLocation) -} func NewIoTSecuritySolutionsListIterator(page IoTSecuritySolutionsListPage) IoTSecuritySolutionsListIterator { return original.NewIoTSecuritySolutionsListIterator(page) } func NewIoTSecuritySolutionsListPage(getNextPage func(context.Context, IoTSecuritySolutionsList) (IoTSecuritySolutionsList, error)) IoTSecuritySolutionsListPage { return original.NewIoTSecuritySolutionsListPage(getNextPage) } -func NewIoTSecuritySolutionsResourceGroupClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsResourceGroupClient { - return original.NewIoTSecuritySolutionsResourceGroupClient(subscriptionID, ascLocation) +func NewIotSecuritySolutionAnalyticsClient(subscriptionID string, ascLocation string) IotSecuritySolutionAnalyticsClient { + return original.NewIotSecuritySolutionAnalyticsClient(subscriptionID, ascLocation) } -func NewIoTSecuritySolutionsResourceGroupClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsResourceGroupClient { - return original.NewIoTSecuritySolutionsResourceGroupClientWithBaseURI(baseURI, subscriptionID, ascLocation) +func NewIotSecuritySolutionAnalyticsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IotSecuritySolutionAnalyticsClient { + return original.NewIotSecuritySolutionAnalyticsClientWithBaseURI(baseURI, subscriptionID, ascLocation) } func NewIotSecuritySolutionClient(subscriptionID string, ascLocation string) IotSecuritySolutionClient { return original.NewIotSecuritySolutionClient(subscriptionID, ascLocation) @@ -739,6 +815,18 @@ func NewIotSecuritySolutionClient(subscriptionID string, ascLocation string) Iot func NewIotSecuritySolutionClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IotSecuritySolutionClient { return original.NewIotSecuritySolutionClientWithBaseURI(baseURI, subscriptionID, ascLocation) } +func NewIotSecuritySolutionsAnalyticsAggregatedAlertClient(subscriptionID string, ascLocation string) IotSecuritySolutionsAnalyticsAggregatedAlertClient { + return original.NewIotSecuritySolutionsAnalyticsAggregatedAlertClient(subscriptionID, ascLocation) +} +func NewIotSecuritySolutionsAnalyticsAggregatedAlertClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IotSecuritySolutionsAnalyticsAggregatedAlertClient { + return original.NewIotSecuritySolutionsAnalyticsAggregatedAlertClientWithBaseURI(baseURI, subscriptionID, ascLocation) +} +func NewIotSecuritySolutionsAnalyticsRecommendationClient(subscriptionID string, ascLocation string) IotSecuritySolutionsAnalyticsRecommendationClient { + return original.NewIotSecuritySolutionsAnalyticsRecommendationClient(subscriptionID, ascLocation) +} +func NewIotSecuritySolutionsAnalyticsRecommendationClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IotSecuritySolutionsAnalyticsRecommendationClient { + return original.NewIotSecuritySolutionsAnalyticsRecommendationClientWithBaseURI(baseURI, subscriptionID, ascLocation) +} func NewJitNetworkAccessPoliciesClient(subscriptionID string, ascLocation string) JitNetworkAccessPoliciesClient { return original.NewJitNetworkAccessPoliciesClient(subscriptionID, ascLocation) } @@ -829,6 +917,18 @@ func NewSettingsListIterator(page SettingsListPage) SettingsListIterator { func NewSettingsListPage(getNextPage func(context.Context, SettingsList) (SettingsList, error)) SettingsListPage { return original.NewSettingsListPage(getNextPage) } +func NewSubAssessmentListIterator(page SubAssessmentListPage) SubAssessmentListIterator { + return original.NewSubAssessmentListIterator(page) +} +func NewSubAssessmentListPage(getNextPage func(context.Context, SubAssessmentList) (SubAssessmentList, error)) SubAssessmentListPage { + return original.NewSubAssessmentListPage(getNextPage) +} +func NewSubAssessmentsClient(subscriptionID string, ascLocation string) SubAssessmentsClient { + return original.NewSubAssessmentsClient(subscriptionID, ascLocation) +} +func NewSubAssessmentsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) SubAssessmentsClient { + return original.NewSubAssessmentsClientWithBaseURI(baseURI, subscriptionID, ascLocation) +} func NewTaskListIterator(page TaskListPage) TaskListIterator { return original.NewTaskListIterator(page) } @@ -880,6 +980,9 @@ func PossibleAlertNotificationsValues() []AlertNotifications { func PossibleAlertsToAdminsValues() []AlertsToAdmins { return original.PossibleAlertsToAdminsValues() } +func PossibleAssessedResourceTypeValues() []AssessedResourceType { + return original.PossibleAssessedResourceTypeValues() +} func PossibleAutoProvisionValues() []AutoProvision { return original.PossibleAutoProvisionValues() } @@ -904,6 +1007,12 @@ func PossibleEnforcementMode1Values() []EnforcementMode1 { func PossibleEnforcementModeValues() []EnforcementMode { return original.PossibleEnforcementModeValues() } +func PossibleExeValues() []Exe { + return original.PossibleExeValues() +} +func PossibleExecutableValues() []Executable { + return original.PossibleExecutableValues() +} func PossibleExportDataValues() []ExportData { return original.PossibleExportDataValues() } @@ -922,6 +1031,9 @@ func PossibleIssueValues() []Issue { func PossibleKindEnumValues() []KindEnum { return original.PossibleKindEnumValues() } +func PossibleMsiValues() []Msi { + return original.PossibleMsiValues() +} func PossiblePricingTierValues() []PricingTier { return original.PossiblePricingTierValues() } @@ -952,15 +1064,24 @@ func PossibleReportedSeverityValues() []ReportedSeverity { func PossibleResourceStatusValues() []ResourceStatus { return original.PossibleResourceStatusValues() } +func PossibleScriptValues() []Script { + return original.PossibleScriptValues() +} func PossibleSettingKindValues() []SettingKind { return original.PossibleSettingKindValues() } +func PossibleSeverityValues() []Severity { + return original.PossibleSeverityValues() +} func PossibleSolutionStatusValues() []SolutionStatus { return original.PossibleSolutionStatusValues() } func PossibleSourceSystemValues() []SourceSystem { return original.PossibleSourceSystemValues() } +func PossibleSourceValues() []Source { + return original.PossibleSourceValues() +} func PossibleStateValues() []State { return original.PossibleStateValues() } @@ -970,9 +1091,15 @@ func PossibleStatusReasonValues() []StatusReason { func PossibleStatusValues() []Status { return original.PossibleStatusValues() } +func PossibleSubAssessmentStatusCodeValues() []SubAssessmentStatusCode { + return original.PossibleSubAssessmentStatusCodeValues() +} func PossibleTypeValues() []Type { return original.PossibleTypeValues() } +func PossibleValueTypeValues() []ValueType { + return original.PossibleValueTypeValues() +} func UserAgent() string { return original.UserAgent() + " profiles/preview" } diff --git a/profiles/preview/preview/security/mgmt/security/securityapi/models.go b/profiles/preview/preview/security/mgmt/security/securityapi/models.go index f3f1649c0b39..6291ca8035f2 100644 --- a/profiles/preview/preview/security/mgmt/security/securityapi/models.go +++ b/profiles/preview/preview/security/mgmt/security/securityapi/models.go @@ -29,17 +29,14 @@ type AutoProvisioningSettingsClientAPI = original.AutoProvisioningSettingsClient type ComplianceResultsClientAPI = original.ComplianceResultsClientAPI type CompliancesClientAPI = original.CompliancesClientAPI type ContactsClientAPI = original.ContactsClientAPI +type DeviceSecurityGroupsClientAPI = original.DeviceSecurityGroupsClientAPI type DiscoveredSecuritySolutionsClientAPI = original.DiscoveredSecuritySolutionsClientAPI type ExternalSecuritySolutionsClientAPI = original.ExternalSecuritySolutionsClientAPI type InformationProtectionPoliciesClientAPI = original.InformationProtectionPoliciesClientAPI -type IoTSecuritySolutionsAnalyticsAggregatedAlertClientAPI = original.IoTSecuritySolutionsAnalyticsAggregatedAlertClientAPI -type IoTSecuritySolutionsAnalyticsAggregatedAlertsClientAPI = original.IoTSecuritySolutionsAnalyticsAggregatedAlertsClientAPI -type IoTSecuritySolutionsAnalyticsClientAPI = original.IoTSecuritySolutionsAnalyticsClientAPI -type IoTSecuritySolutionsAnalyticsRecommendationClientAPI = original.IoTSecuritySolutionsAnalyticsRecommendationClientAPI -type IoTSecuritySolutionsAnalyticsRecommendationsClientAPI = original.IoTSecuritySolutionsAnalyticsRecommendationsClientAPI -type IoTSecuritySolutionsClientAPI = original.IoTSecuritySolutionsClientAPI -type IoTSecuritySolutionsResourceGroupClientAPI = original.IoTSecuritySolutionsResourceGroupClientAPI +type IotSecuritySolutionAnalyticsClientAPI = original.IotSecuritySolutionAnalyticsClientAPI type IotSecuritySolutionClientAPI = original.IotSecuritySolutionClientAPI +type IotSecuritySolutionsAnalyticsAggregatedAlertClientAPI = original.IotSecuritySolutionsAnalyticsAggregatedAlertClientAPI +type IotSecuritySolutionsAnalyticsRecommendationClientAPI = original.IotSecuritySolutionsAnalyticsRecommendationClientAPI type JitNetworkAccessPoliciesClientAPI = original.JitNetworkAccessPoliciesClientAPI type LocationsClientAPI = original.LocationsClientAPI type OperationsClientAPI = original.OperationsClientAPI @@ -49,6 +46,7 @@ type RegulatoryComplianceControlsClientAPI = original.RegulatoryComplianceContro type RegulatoryComplianceStandardsClientAPI = original.RegulatoryComplianceStandardsClientAPI type ServerVulnerabilityAssessmentClientAPI = original.ServerVulnerabilityAssessmentClientAPI type SettingsClientAPI = original.SettingsClientAPI +type SubAssessmentsClientAPI = original.SubAssessmentsClientAPI type TasksClientAPI = original.TasksClientAPI type TopologyClientAPI = original.TopologyClientAPI type WorkspaceSettingsClientAPI = original.WorkspaceSettingsClientAPI diff --git a/services/preview/security/mgmt/v1.0/security/models.go b/services/preview/security/mgmt/v1.0/security/models.go index 6b41a0671d75..f19291c333e0 100644 --- a/services/preview/security/mgmt/v1.0/security/models.go +++ b/services/preview/security/mgmt/v1.0/security/models.go @@ -96,6 +96,25 @@ func PossibleAlertsToAdminsValues() []AlertsToAdmins { return []AlertsToAdmins{AlertsToAdminsOff, AlertsToAdminsOn} } +// AssessedResourceType enumerates the values for assessed resource type. +type AssessedResourceType string + +const ( + // AssessedResourceTypeAdditionalData ... + AssessedResourceTypeAdditionalData AssessedResourceType = "AdditionalData" + // AssessedResourceTypeContainerRegistryVulnerability ... + AssessedResourceTypeContainerRegistryVulnerability AssessedResourceType = "ContainerRegistryVulnerability" + // AssessedResourceTypeServerVulnerabilityAssessment ... + AssessedResourceTypeServerVulnerabilityAssessment AssessedResourceType = "ServerVulnerabilityAssessment" + // AssessedResourceTypeSQLServerVulnerability ... + AssessedResourceTypeSQLServerVulnerability AssessedResourceType = "SqlServerVulnerability" +) + +// PossibleAssessedResourceTypeValues returns an array of possible values for the AssessedResourceType const type. +func PossibleAssessedResourceTypeValues() []AssessedResourceType { + return []AssessedResourceType{AssessedResourceTypeAdditionalData, AssessedResourceTypeContainerRegistryVulnerability, AssessedResourceTypeServerVulnerabilityAssessment, AssessedResourceTypeSQLServerVulnerability} +} + // AutoProvision enumerates the values for auto provision. type AutoProvision string @@ -212,11 +231,13 @@ const ( Audit EnforcementMode = "Audit" // Enforce ... Enforce EnforcementMode = "Enforce" + // None ... + None EnforcementMode = "None" ) // PossibleEnforcementModeValues returns an array of possible values for the EnforcementMode const type. func PossibleEnforcementModeValues() []EnforcementMode { - return []EnforcementMode{Audit, Enforce} + return []EnforcementMode{Audit, Enforce, None} } // EnforcementMode1 enumerates the values for enforcement mode 1. @@ -227,11 +248,47 @@ const ( EnforcementMode1Audit EnforcementMode1 = "Audit" // EnforcementMode1Enforce ... EnforcementMode1Enforce EnforcementMode1 = "Enforce" + // EnforcementMode1None ... + EnforcementMode1None EnforcementMode1 = "None" ) // PossibleEnforcementMode1Values returns an array of possible values for the EnforcementMode1 const type. func PossibleEnforcementMode1Values() []EnforcementMode1 { - return []EnforcementMode1{EnforcementMode1Audit, EnforcementMode1Enforce} + return []EnforcementMode1{EnforcementMode1Audit, EnforcementMode1Enforce, EnforcementMode1None} +} + +// Exe enumerates the values for exe. +type Exe string + +const ( + // ExeAudit ... + ExeAudit Exe = "Audit" + // ExeEnforce ... + ExeEnforce Exe = "Enforce" + // ExeNone ... + ExeNone Exe = "None" +) + +// PossibleExeValues returns an array of possible values for the Exe const type. +func PossibleExeValues() []Exe { + return []Exe{ExeAudit, ExeEnforce, ExeNone} +} + +// Executable enumerates the values for executable. +type Executable string + +const ( + // ExecutableAudit ... + ExecutableAudit Executable = "Audit" + // ExecutableEnforce ... + ExecutableEnforce Executable = "Enforce" + // ExecutableNone ... + ExecutableNone Executable = "None" +) + +// PossibleExecutableValues returns an array of possible values for the Executable const type. +func PossibleExecutableValues() []Executable { + return []Executable{ExecutableAudit, ExecutableEnforce, ExecutableNone} } // ExternalSecuritySolutionKind enumerates the values for external security solution kind. @@ -274,23 +331,23 @@ func PossibleFamilyValues() []Family { type FileType string const ( - // Dll ... - Dll FileType = "Dll" - // Exe ... - Exe FileType = "Exe" - // Executable ... - Executable FileType = "Executable" - // Msi ... - Msi FileType = "Msi" - // Script ... - Script FileType = "Script" - // Unknown ... - Unknown FileType = "Unknown" + // FileTypeDll ... + FileTypeDll FileType = "Dll" + // FileTypeExe ... + FileTypeExe FileType = "Exe" + // FileTypeExecutable ... + FileTypeExecutable FileType = "Executable" + // FileTypeMsi ... + FileTypeMsi FileType = "Msi" + // FileTypeScript ... + FileTypeScript FileType = "Script" + // FileTypeUnknown ... + FileTypeUnknown FileType = "Unknown" ) // PossibleFileTypeValues returns an array of possible values for the FileType const type. func PossibleFileTypeValues() []FileType { - return []FileType{Dll, Exe, Executable, Msi, Script, Unknown} + return []FileType{FileTypeDll, FileTypeExe, FileTypeExecutable, FileTypeMsi, FileTypeScript, FileTypeUnknown} } // Issue enumerates the values for issue. @@ -335,6 +392,23 @@ func PossibleKindEnumValues() []KindEnum { return []KindEnum{KindAAD, KindATA, KindCEF, KindExternalSecuritySolution} } +// Msi enumerates the values for msi. +type Msi string + +const ( + // MsiAudit ... + MsiAudit Msi = "Audit" + // MsiEnforce ... + MsiEnforce Msi = "Enforce" + // MsiNone ... + MsiNone Msi = "None" +) + +// PossibleMsiValues returns an array of possible values for the Msi const type. +func PossibleMsiValues() []Msi { + return []Msi{MsiAudit, MsiEnforce, MsiNone} +} + // PricingTier enumerates the values for pricing tier. type PricingTier string @@ -439,6 +513,23 @@ func PossibleReportedSeverityValues() []ReportedSeverity { return []ReportedSeverity{High, Information, Low, Silent} } +// Script enumerates the values for script. +type Script string + +const ( + // ScriptAudit ... + ScriptAudit Script = "Audit" + // ScriptEnforce ... + ScriptEnforce Script = "Enforce" + // ScriptNone ... + ScriptNone Script = "None" +) + +// PossibleScriptValues returns an array of possible values for the Script const type. +func PossibleScriptValues() []Script { + return []Script{ScriptAudit, ScriptEnforce, ScriptNone} +} + // SettingKind enumerates the values for setting kind. type SettingKind string @@ -454,25 +545,59 @@ func PossibleSettingKindValues() []SettingKind { return []SettingKind{SettingKindAlertSuppressionSetting, SettingKindDataExportSetting} } +// Severity enumerates the values for severity. +type Severity string + +const ( + // SeverityHigh ... + SeverityHigh Severity = "High" + // SeverityLow ... + SeverityLow Severity = "Low" + // SeverityMedium ... + SeverityMedium Severity = "Medium" +) + +// PossibleSeverityValues returns an array of possible values for the Severity const type. +func PossibleSeverityValues() []Severity { + return []Severity{SeverityHigh, SeverityLow, SeverityMedium} +} + +// Source enumerates the values for source. +type Source string + +const ( + // SourceAws ... + SourceAws Source = "Aws" + // SourceAzure ... + SourceAzure Source = "Azure" + // SourceResourceDetails ... + SourceResourceDetails Source = "ResourceDetails" +) + +// PossibleSourceValues returns an array of possible values for the Source const type. +func PossibleSourceValues() []Source { + return []Source{SourceAws, SourceAzure, SourceResourceDetails} +} + // SourceSystem enumerates the values for source system. type SourceSystem string const ( - // AzureAppLocker ... - AzureAppLocker SourceSystem = "Azure_AppLocker" - // AzureAuditD ... - AzureAuditD SourceSystem = "Azure_AuditD" - // NonAzureAppLocker ... - NonAzureAppLocker SourceSystem = "NonAzure_AppLocker" - // NonAzureAuditD ... - NonAzureAuditD SourceSystem = "NonAzure_AuditD" - // None ... - None SourceSystem = "None" + // SourceSystemAzureAppLocker ... + SourceSystemAzureAppLocker SourceSystem = "Azure_AppLocker" + // SourceSystemAzureAuditD ... + SourceSystemAzureAuditD SourceSystem = "Azure_AuditD" + // SourceSystemNonAzureAppLocker ... + SourceSystemNonAzureAppLocker SourceSystem = "NonAzure_AppLocker" + // SourceSystemNonAzureAuditD ... + SourceSystemNonAzureAuditD SourceSystem = "NonAzure_AuditD" + // SourceSystemNone ... + SourceSystemNone SourceSystem = "None" ) // PossibleSourceSystemValues returns an array of possible values for the SourceSystem const type. func PossibleSourceSystemValues() []SourceSystem { - return []SourceSystem{AzureAppLocker, AzureAuditD, NonAzureAppLocker, NonAzureAuditD, None} + return []SourceSystem{SourceSystemAzureAppLocker, SourceSystemAzureAuditD, SourceSystemNonAzureAppLocker, SourceSystemNonAzureAuditD, SourceSystemNone} } // State enumerates the values for state. @@ -527,6 +652,23 @@ func PossibleStatusReasonValues() []StatusReason { return []StatusReason{Expired, NewerRequestInitiated, UserRequested} } +// SubAssessmentStatusCode enumerates the values for sub assessment status code. +type SubAssessmentStatusCode string + +const ( + // Healthy The resource is healthy + Healthy SubAssessmentStatusCode = "Healthy" + // NotApplicable Assessment for this resource did not happen + NotApplicable SubAssessmentStatusCode = "NotApplicable" + // Unhealthy The resource has a security issue that needs to be addressed + Unhealthy SubAssessmentStatusCode = "Unhealthy" +) + +// PossibleSubAssessmentStatusCodeValues returns an array of possible values for the SubAssessmentStatusCode const type. +func PossibleSubAssessmentStatusCodeValues() []SubAssessmentStatusCode { + return []SubAssessmentStatusCode{Healthy, NotApplicable, Unhealthy} +} + // TransportProtocol enumerates the values for transport protocol. type TransportProtocol string @@ -911,6 +1053,100 @@ func NewAdaptiveNetworkHardeningsListPage(getNextPage func(context.Context, Adap return AdaptiveNetworkHardeningsListPage{fn: getNextPage} } +// BasicAdditionalData details of the sub-assessment +type BasicAdditionalData interface { + AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) + AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) + AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) + AsAdditionalData() (*AdditionalData, bool) +} + +// AdditionalData details of the sub-assessment +type AdditionalData struct { + // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' + AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` +} + +func unmarshalBasicAdditionalData(body []byte) (BasicAdditionalData, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["assessedResourceType"] { + case string(AssessedResourceTypeSQLServerVulnerability): + var ssvp SQLServerVulnerabilityProperties + err := json.Unmarshal(body, &ssvp) + return ssvp, err + case string(AssessedResourceTypeContainerRegistryVulnerability): + var crvp ContainerRegistryVulnerabilityProperties + err := json.Unmarshal(body, &crvp) + return crvp, err + case string(AssessedResourceTypeServerVulnerabilityAssessment): + var svp ServerVulnerabilityProperties + err := json.Unmarshal(body, &svp) + return svp, err + default: + var ad AdditionalData + err := json.Unmarshal(body, &ad) + return ad, err + } +} +func unmarshalBasicAdditionalDataArray(body []byte) ([]BasicAdditionalData, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + adArray := make([]BasicAdditionalData, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ad, err := unmarshalBasicAdditionalData(*rawMessage) + if err != nil { + return nil, err + } + adArray[index] = ad + } + return adArray, nil +} + +// MarshalJSON is the custom marshaler for AdditionalData. +func (ad AdditionalData) MarshalJSON() ([]byte, error) { + ad.AssessedResourceType = AssessedResourceTypeAdditionalData + objectMap := make(map[string]interface{}) + if ad.AssessedResourceType != "" { + objectMap["assessedResourceType"] = ad.AssessedResourceType + } + return json.Marshal(objectMap) +} + +// AsSQLServerVulnerabilityProperties is the BasicAdditionalData implementation for AdditionalData. +func (ad AdditionalData) AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsContainerRegistryVulnerabilityProperties is the BasicAdditionalData implementation for AdditionalData. +func (ad AdditionalData) AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) { + return nil, false +} + +// AsServerVulnerabilityProperties is the BasicAdditionalData implementation for AdditionalData. +func (ad AdditionalData) AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsAdditionalData is the BasicAdditionalData implementation for AdditionalData. +func (ad AdditionalData) AsAdditionalData() (*AdditionalData, bool) { + return &ad, true +} + +// AsBasicAdditionalData is the BasicAdditionalData implementation for AdditionalData. +func (ad AdditionalData) AsBasicAdditionalData() (BasicAdditionalData, bool) { + return &ad, true +} + // AdvancedThreatProtectionProperties the Advanced Threat Protection settings. type AdvancedThreatProtectionProperties struct { // IsEnabled - Indicates whether Advanced Threat Protection is enabled. @@ -1671,14 +1907,15 @@ func (awg *AppWhitelistingGroup) UnmarshalJSON(body []byte) error { // AppWhitelistingGroupData represents a VM/server group and set of rules that are Recommended by Azure // Security Center to be allowed type AppWhitelistingGroupData struct { - // EnforcementMode - Possible values include: 'Audit', 'Enforce' + // EnforcementMode - Possible values include: 'Audit', 'Enforce', 'None' EnforcementMode EnforcementMode `json:"enforcementMode,omitempty"` + ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` // ConfigurationStatus - Possible values include: 'ConfigurationStatus2Configured', 'ConfigurationStatus2NotConfigured', 'ConfigurationStatus2InProgress', 'ConfigurationStatus2Failed', 'ConfigurationStatus2NoStatus' ConfigurationStatus ConfigurationStatus2 `json:"configurationStatus,omitempty"` // RecommendationStatus - Possible values include: 'RecommendationStatusRecommended', 'RecommendationStatusNotRecommended', 'RecommendationStatusNotAvailable', 'RecommendationStatusNoStatus' RecommendationStatus RecommendationStatus `json:"recommendationStatus,omitempty"` Issues *[]AppWhitelistingIssueSummary `json:"issues,omitempty"` - // SourceSystem - Possible values include: 'AzureAppLocker', 'AzureAuditD', 'NonAzureAppLocker', 'NonAzureAuditD', 'None' + // SourceSystem - Possible values include: 'SourceSystemAzureAppLocker', 'SourceSystemAzureAuditD', 'SourceSystemNonAzureAppLocker', 'SourceSystemNonAzureAuditD', 'SourceSystemNone' SourceSystem SourceSystem `json:"sourceSystem,omitempty"` VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` @@ -1701,8 +1938,10 @@ type AppWhitelistingIssueSummary struct { // AppWhitelistingPutGroupData the altered data of the recommended VM/server group policy type AppWhitelistingPutGroupData struct { - // EnforcementMode - Possible values include: 'EnforcementMode1Audit', 'EnforcementMode1Enforce' - EnforcementMode EnforcementMode1 `json:"enforcementMode,omitempty"` + // EnforcementMode - The enforcement mode of the group. Can also be defined per collection type by using ProtectionMode. Possible values include: 'EnforcementMode1Audit', 'EnforcementMode1Enforce', 'EnforcementMode1None' + EnforcementMode EnforcementMode1 `json:"enforcementMode,omitempty"` + // ProtectionMode - The protection mode of the group per collection type. Can also be defined for all collection types by using EnforcementMode + ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` } @@ -2238,6 +2477,84 @@ type AutoProvisioningSettingProperties struct { AutoProvision AutoProvision `json:"autoProvision,omitempty"` } +// AwsResourceDetails details of the resource that was assessed +type AwsResourceDetails struct { + // AccountID - READ-ONLY; AWS account ID + AccountID *string `json:"accountId,omitempty"` + // AwsResourceID - READ-ONLY; AWS resource ID. can be ARN or other + AwsResourceID *string `json:"awsResourceId,omitempty"` + // Source - Possible values include: 'SourceResourceDetails', 'SourceAzure', 'SourceAws' + Source Source `json:"source,omitempty"` +} + +// MarshalJSON is the custom marshaler for AwsResourceDetails. +func (ard AwsResourceDetails) MarshalJSON() ([]byte, error) { + ard.Source = SourceAws + objectMap := make(map[string]interface{}) + if ard.Source != "" { + objectMap["source"] = ard.Source + } + return json.Marshal(objectMap) +} + +// AsAzureResourceDetails is the BasicResourceDetails implementation for AwsResourceDetails. +func (ard AwsResourceDetails) AsAzureResourceDetails() (*AzureResourceDetails, bool) { + return nil, false +} + +// AsAwsResourceDetails is the BasicResourceDetails implementation for AwsResourceDetails. +func (ard AwsResourceDetails) AsAwsResourceDetails() (*AwsResourceDetails, bool) { + return &ard, true +} + +// AsResourceDetails is the BasicResourceDetails implementation for AwsResourceDetails. +func (ard AwsResourceDetails) AsResourceDetails() (*ResourceDetails, bool) { + return nil, false +} + +// AsBasicResourceDetails is the BasicResourceDetails implementation for AwsResourceDetails. +func (ard AwsResourceDetails) AsBasicResourceDetails() (BasicResourceDetails, bool) { + return &ard, true +} + +// AzureResourceDetails details of the resource that was assessed +type AzureResourceDetails struct { + // ID - READ-ONLY; Azure resource ID of the assessed resource + ID *string `json:"id,omitempty"` + // Source - Possible values include: 'SourceResourceDetails', 'SourceAzure', 'SourceAws' + Source Source `json:"source,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureResourceDetails. +func (ard AzureResourceDetails) MarshalJSON() ([]byte, error) { + ard.Source = SourceAzure + objectMap := make(map[string]interface{}) + if ard.Source != "" { + objectMap["source"] = ard.Source + } + return json.Marshal(objectMap) +} + +// AsAzureResourceDetails is the BasicResourceDetails implementation for AzureResourceDetails. +func (ard AzureResourceDetails) AsAzureResourceDetails() (*AzureResourceDetails, bool) { + return &ard, true +} + +// AsAwsResourceDetails is the BasicResourceDetails implementation for AzureResourceDetails. +func (ard AzureResourceDetails) AsAwsResourceDetails() (*AwsResourceDetails, bool) { + return nil, false +} + +// AsResourceDetails is the BasicResourceDetails implementation for AzureResourceDetails. +func (ard AzureResourceDetails) AsResourceDetails() (*ResourceDetails, bool) { + return nil, false +} + +// AsBasicResourceDetails is the BasicResourceDetails implementation for AzureResourceDetails. +func (ard AzureResourceDetails) AsBasicResourceDetails() (BasicResourceDetails, bool) { + return &ard, true +} + // CefExternalSecuritySolution represents a security solution which sends CEF logs to an OMS workspace type CefExternalSecuritySolution struct { Properties *CefSolutionProperties `json:"properties,omitempty"` @@ -2954,6 +3271,64 @@ type ContactProperties struct { AlertsToAdmins AlertsToAdmins `json:"alertsToAdmins,omitempty"` } +// ContainerRegistryVulnerabilityProperties additional context fields for container registry Vulnerability +// assessment +type ContainerRegistryVulnerabilityProperties struct { + // Type - READ-ONLY; Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, Information Gathered, Vulnerability + Type *string `json:"type,omitempty"` + // Cvss - READ-ONLY; Dictionary from cvss version to cvss details object + Cvss map[string]*CVSS `json:"cvss"` + // Patchable - READ-ONLY; Indicates whether a patch is available or not + Patchable *bool `json:"patchable,omitempty"` + // Cve - READ-ONLY; List of CVEs + Cve *[]CVE `json:"cve,omitempty"` + // PublishedTime - READ-ONLY; Published time + PublishedTime *date.Time `json:"publishedTime,omitempty"` + // VendorReferences - READ-ONLY + VendorReferences *[]VendorReference `json:"vendorReferences,omitempty"` + // RepositoryName - READ-ONLY; Name of the repository which the vulnerable image belongs to + RepositoryName *string `json:"repositoryName,omitempty"` + // ImageDigest - READ-ONLY; Digest of the vulnerable image + ImageDigest *string `json:"imageDigest,omitempty"` + // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' + AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) MarshalJSON() ([]byte, error) { + crvp.AssessedResourceType = AssessedResourceTypeContainerRegistryVulnerability + objectMap := make(map[string]interface{}) + if crvp.AssessedResourceType != "" { + objectMap["assessedResourceType"] = crvp.AssessedResourceType + } + return json.Marshal(objectMap) +} + +// AsSQLServerVulnerabilityProperties is the BasicAdditionalData implementation for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsContainerRegistryVulnerabilityProperties is the BasicAdditionalData implementation for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) { + return &crvp, true +} + +// AsServerVulnerabilityProperties is the BasicAdditionalData implementation for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsAdditionalData is the BasicAdditionalData implementation for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) AsAdditionalData() (*AdditionalData, bool) { + return nil, false +} + +// AsBasicAdditionalData is the BasicAdditionalData implementation for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) AsBasicAdditionalData() (BasicAdditionalData, bool) { + return &crvp, true +} + // CustomAlertRule a custom alert rule type CustomAlertRule struct { // DisplayName - READ-ONLY; The display name of the custom alert. @@ -2966,6 +3341,20 @@ type CustomAlertRule struct { RuleType *string `json:"ruleType,omitempty"` } +// CVE CVE details +type CVE struct { + // Title - READ-ONLY; CVE title + Title *string `json:"title,omitempty"` + // Link - READ-ONLY; Link url + Link *string `json:"link,omitempty"` +} + +// CVSS CVSS details +type CVSS struct { + // Base - READ-ONLY; CVSS base + Base *float64 `json:"base,omitempty"` +} + // DataExportSetting represents a data export setting type DataExportSetting struct { // DataExportSettingProperties - Data export setting data @@ -4468,6 +4857,8 @@ type JitNetworkAccessPolicyInitiatePort struct { type JitNetworkAccessPolicyInitiateRequest struct { // VirtualMachines - A list of virtual machines & ports to open access for VirtualMachines *[]JitNetworkAccessPolicyInitiateVirtualMachine `json:"virtualMachines,omitempty"` + // Justification - The justification for making the initiate request + Justification *string `json:"justification,omitempty"` } // JitNetworkAccessPolicyInitiateVirtualMachine ... @@ -4518,6 +4909,8 @@ type JitNetworkAccessRequest struct { StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"` // Requestor - The identity of the person who made the request Requestor *string `json:"requestor,omitempty"` + // Justification - The justification for making the initiate request + Justification *string `json:"justification,omitempty"` } // JitNetworkAccessRequestPort ... @@ -4751,7 +5144,7 @@ type PathRecommendation struct { Common *bool `json:"common,omitempty"` UserSids *[]string `json:"userSids,omitempty"` Usernames *[]UserRecommendation `json:"usernames,omitempty"` - // FileType - Possible values include: 'Exe', 'Dll', 'Msi', 'Script', 'Executable', 'Unknown' + // FileType - Possible values include: 'FileTypeExe', 'FileTypeDll', 'FileTypeMsi', 'FileTypeScript', 'FileTypeExecutable', 'FileTypeUnknown' FileType FileType `json:"fileType,omitempty"` // ConfigurationStatus - Possible values include: 'ConfigurationStatus1Configured', 'ConfigurationStatus1NotConfigured', 'ConfigurationStatus1InProgress', 'ConfigurationStatus1Failed', 'ConfigurationStatus1NoStatus' ConfigurationStatus ConfigurationStatus1 `json:"configurationStatus,omitempty"` @@ -4982,6 +5375,19 @@ type PricingProperties struct { PricingTier PricingTier `json:"pricingTier,omitempty"` } +// ProtectionMode the protection mode of the collection/file types. Exe/Msi/Script are used for Windows, +// Executable is used for Linux. +type ProtectionMode struct { + // Exe - Possible values include: 'ExeAudit', 'ExeEnforce', 'ExeNone' + Exe Exe `json:"exe,omitempty"` + // Msi - Possible values include: 'MsiAudit', 'MsiEnforce', 'MsiNone' + Msi Msi `json:"msi,omitempty"` + // Script - Possible values include: 'ScriptAudit', 'ScriptEnforce', 'ScriptNone' + Script Script `json:"script,omitempty"` + // Executable - Possible values include: 'ExecutableAudit', 'ExecutableEnforce', 'ExecutableNone' + Executable Executable `json:"executable,omitempty"` +} + // PublisherInfo represents the publisher information of a process/rule type PublisherInfo struct { // PublisherName - The Subject field of the x.509 certificate used to sign the code, using the following fields - O = Organization, L = Locality, S = State or Province, and C = Country @@ -5710,6 +6116,90 @@ type Resource struct { Type *string `json:"type,omitempty"` } +// BasicResourceDetails details of the resource that was assessed +type BasicResourceDetails interface { + AsAzureResourceDetails() (*AzureResourceDetails, bool) + AsAwsResourceDetails() (*AwsResourceDetails, bool) + AsResourceDetails() (*ResourceDetails, bool) +} + +// ResourceDetails details of the resource that was assessed +type ResourceDetails struct { + // Source - Possible values include: 'SourceResourceDetails', 'SourceAzure', 'SourceAws' + Source Source `json:"source,omitempty"` +} + +func unmarshalBasicResourceDetails(body []byte) (BasicResourceDetails, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["source"] { + case string(SourceAzure): + var ard AzureResourceDetails + err := json.Unmarshal(body, &ard) + return ard, err + case string(SourceAws): + var ard AwsResourceDetails + err := json.Unmarshal(body, &ard) + return ard, err + default: + var rd ResourceDetails + err := json.Unmarshal(body, &rd) + return rd, err + } +} +func unmarshalBasicResourceDetailsArray(body []byte) ([]BasicResourceDetails, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + rdArray := make([]BasicResourceDetails, len(rawMessages)) + + for index, rawMessage := range rawMessages { + rd, err := unmarshalBasicResourceDetails(*rawMessage) + if err != nil { + return nil, err + } + rdArray[index] = rd + } + return rdArray, nil +} + +// MarshalJSON is the custom marshaler for ResourceDetails. +func (rd ResourceDetails) MarshalJSON() ([]byte, error) { + rd.Source = SourceResourceDetails + objectMap := make(map[string]interface{}) + if rd.Source != "" { + objectMap["source"] = rd.Source + } + return json.Marshal(objectMap) +} + +// AsAzureResourceDetails is the BasicResourceDetails implementation for ResourceDetails. +func (rd ResourceDetails) AsAzureResourceDetails() (*AzureResourceDetails, bool) { + return nil, false +} + +// AsAwsResourceDetails is the BasicResourceDetails implementation for ResourceDetails. +func (rd ResourceDetails) AsAwsResourceDetails() (*AwsResourceDetails, bool) { + return nil, false +} + +// AsResourceDetails is the BasicResourceDetails implementation for ResourceDetails. +func (rd ResourceDetails) AsResourceDetails() (*ResourceDetails, bool) { + return &rd, true +} + +// AsBasicResourceDetails is the BasicResourceDetails implementation for ResourceDetails. +func (rd ResourceDetails) AsBasicResourceDetails() (BasicResourceDetails, bool) { + return &rd, true +} + // Rule describes remote addresses that is recommended to communicate with the Azure resource on some // (Protocol, Port, Direction). All other remote addresses are recommended to be blocked type Rule struct { @@ -5735,6 +6225,61 @@ type SensitivityLabel struct { Enabled *bool `json:"enabled,omitempty"` } +// ServerVulnerabilityProperties additional context fields for server vulnerability assessment +type ServerVulnerabilityProperties struct { + // Type - READ-ONLY; Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, Information Gathered + Type *string `json:"type,omitempty"` + // Cvss - READ-ONLY; Dictionary from cvss version to cvss details object + Cvss map[string]*CVSS `json:"cvss"` + // Patchable - READ-ONLY; Indicates whether a patch is available or not + Patchable *bool `json:"patchable,omitempty"` + // Cve - READ-ONLY; List of CVEs + Cve *[]CVE `json:"cve,omitempty"` + // Threat - READ-ONLY; Threat name + Threat *string `json:"threat,omitempty"` + // PublishedTime - READ-ONLY; Published time + PublishedTime *date.Time `json:"publishedTime,omitempty"` + // VendorReferences - READ-ONLY + VendorReferences *[]VendorReference `json:"vendorReferences,omitempty"` + // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' + AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { + svp.AssessedResourceType = AssessedResourceTypeServerVulnerabilityAssessment + objectMap := make(map[string]interface{}) + if svp.AssessedResourceType != "" { + objectMap["assessedResourceType"] = svp.AssessedResourceType + } + return json.Marshal(objectMap) +} + +// AsSQLServerVulnerabilityProperties is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsContainerRegistryVulnerabilityProperties is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) { + return nil, false +} + +// AsServerVulnerabilityProperties is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) { + return &svp, true +} + +// AsAdditionalData is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsAdditionalData() (*AdditionalData, bool) { + return nil, false +} + +// AsBasicAdditionalData is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsBasicAdditionalData() (BasicAdditionalData, bool) { + return &svp, true +} + // Setting represents a security setting in Azure Security Center. type Setting struct { autorest.Response `json:"-"` @@ -5906,6 +6451,405 @@ func NewSettingsListPage(getNextPage func(context.Context, SettingsList) (Settin return SettingsListPage{fn: getNextPage} } +// SQLServerVulnerabilityProperties details of the resource that was assessed +type SQLServerVulnerabilityProperties struct { + // Type - READ-ONLY; The resource type the sub assessment refers to in its resource details + Type *string `json:"type,omitempty"` + // Query - READ-ONLY; The T-SQL query that runs on your SQL database to perform the particular check + Query *string `json:"query,omitempty"` + // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' + AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { + ssvp.AssessedResourceType = AssessedResourceTypeSQLServerVulnerability + objectMap := make(map[string]interface{}) + if ssvp.AssessedResourceType != "" { + objectMap["assessedResourceType"] = ssvp.AssessedResourceType + } + return json.Marshal(objectMap) +} + +// AsSQLServerVulnerabilityProperties is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) { + return &ssvp, true +} + +// AsContainerRegistryVulnerabilityProperties is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) { + return nil, false +} + +// AsServerVulnerabilityProperties is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsAdditionalData is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) AsAdditionalData() (*AdditionalData, bool) { + return nil, false +} + +// AsBasicAdditionalData is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) AsBasicAdditionalData() (BasicAdditionalData, bool) { + return &ssvp, true +} + +// SubAssessment security sub-assessment on a resource +type SubAssessment struct { + autorest.Response `json:"-"` + *SubAssessmentProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubAssessment. +func (sa SubAssessment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sa.SubAssessmentProperties != nil { + objectMap["properties"] = sa.SubAssessmentProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SubAssessment struct. +func (sa *SubAssessment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var subAssessmentProperties SubAssessmentProperties + err = json.Unmarshal(*v, &subAssessmentProperties) + if err != nil { + return err + } + sa.SubAssessmentProperties = &subAssessmentProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sa.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sa.Type = &typeVar + } + } + } + + return nil +} + +// SubAssessmentList list of security sub-assessments +type SubAssessmentList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY + Value *[]SubAssessment `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// SubAssessmentListIterator provides access to a complete listing of SubAssessment values. +type SubAssessmentListIterator struct { + i int + page SubAssessmentListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SubAssessmentListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SubAssessmentListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SubAssessmentListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SubAssessmentListIterator) Response() SubAssessmentList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SubAssessmentListIterator) Value() SubAssessment { + if !iter.page.NotDone() { + return SubAssessment{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SubAssessmentListIterator type. +func NewSubAssessmentListIterator(page SubAssessmentListPage) SubAssessmentListIterator { + return SubAssessmentListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sal SubAssessmentList) IsEmpty() bool { + return sal.Value == nil || len(*sal.Value) == 0 +} + +// subAssessmentListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sal SubAssessmentList) subAssessmentListPreparer(ctx context.Context) (*http.Request, error) { + if sal.NextLink == nil || len(to.String(sal.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sal.NextLink))) +} + +// SubAssessmentListPage contains a page of SubAssessment values. +type SubAssessmentListPage struct { + fn func(context.Context, SubAssessmentList) (SubAssessmentList, error) + sal SubAssessmentList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SubAssessmentListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.sal) + if err != nil { + return err + } + page.sal = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SubAssessmentListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SubAssessmentListPage) NotDone() bool { + return !page.sal.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SubAssessmentListPage) Response() SubAssessmentList { + return page.sal +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SubAssessmentListPage) Values() []SubAssessment { + if page.sal.IsEmpty() { + return nil + } + return *page.sal.Value +} + +// Creates a new instance of the SubAssessmentListPage type. +func NewSubAssessmentListPage(getNextPage func(context.Context, SubAssessmentList) (SubAssessmentList, error)) SubAssessmentListPage { + return SubAssessmentListPage{fn: getNextPage} +} + +// SubAssessmentProperties describes properties of an sub-assessment. +type SubAssessmentProperties struct { + // ID - READ-ONLY; Vulnerability ID + ID *string `json:"id,omitempty"` + // DisplayName - READ-ONLY; User friendly display name of the sub-assessment + DisplayName *string `json:"displayName,omitempty"` + Status *SubAssessmentStatus `json:"status,omitempty"` + // Remediation - READ-ONLY; Information on how to remediate this sub-assessment + Remediation *string `json:"remediation,omitempty"` + // Impact - READ-ONLY; Description of the impact of this sub-assessment + Impact *string `json:"impact,omitempty"` + // Category - READ-ONLY; Category of the sub-assessment + Category *string `json:"category,omitempty"` + // Description - READ-ONLY; Human readable description of the assessment status + Description *string `json:"description,omitempty"` + // TimeGenerated - READ-ONLY; The date and time the sub-assessment was generated + TimeGenerated *date.Time `json:"timeGenerated,omitempty"` + ResourceDetails BasicResourceDetails `json:"resourceDetails,omitempty"` + AdditionalData BasicAdditionalData `json:"additionalData,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for SubAssessmentProperties struct. +func (sap *SubAssessmentProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sap.ID = &ID + } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + sap.DisplayName = &displayName + } + case "status": + if v != nil { + var status SubAssessmentStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + sap.Status = &status + } + case "remediation": + if v != nil { + var remediation string + err = json.Unmarshal(*v, &remediation) + if err != nil { + return err + } + sap.Remediation = &remediation + } + case "impact": + if v != nil { + var impact string + err = json.Unmarshal(*v, &impact) + if err != nil { + return err + } + sap.Impact = &impact + } + case "category": + if v != nil { + var category string + err = json.Unmarshal(*v, &category) + if err != nil { + return err + } + sap.Category = &category + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + sap.Description = &description + } + case "timeGenerated": + if v != nil { + var timeGenerated date.Time + err = json.Unmarshal(*v, &timeGenerated) + if err != nil { + return err + } + sap.TimeGenerated = &timeGenerated + } + case "resourceDetails": + if v != nil { + resourceDetails, err := unmarshalBasicResourceDetails(*v) + if err != nil { + return err + } + sap.ResourceDetails = resourceDetails + } + case "additionalData": + if v != nil { + additionalData, err := unmarshalBasicAdditionalData(*v) + if err != nil { + return err + } + sap.AdditionalData = additionalData + } + } + } + + return nil +} + +// SubAssessmentStatus status of the sub-assessment +type SubAssessmentStatus struct { + // Code - READ-ONLY; Programmatic code for the status of the assessment. Possible values include: 'Healthy', 'Unhealthy', 'NotApplicable' + Code SubAssessmentStatusCode `json:"code,omitempty"` + // Cause - READ-ONLY; Programmatic code for the cause of the assessment status + Cause *string `json:"cause,omitempty"` + // Description - READ-ONLY; Human readable description of the assessment status + Description *string `json:"description,omitempty"` + // Severity - READ-ONLY; The sub-assessment severity level. Possible values include: 'SeverityLow', 'SeverityMedium', 'SeverityHigh' + Severity Severity `json:"severity,omitempty"` +} + // Task security task that we recommend to do in order to strengthen security type Task struct { autorest.Response `json:"-"` @@ -6502,6 +7446,14 @@ type UserRecommendation struct { RecommendationAction RecommendationAction1 `json:"recommendationAction,omitempty"` } +// VendorReference vendor reference +type VendorReference struct { + // Title - READ-ONLY; Link title + Title *string `json:"title,omitempty"` + // Link - READ-ONLY; Link url + Link *string `json:"link,omitempty"` +} + // VMRecommendation represents a machine that is part of a VM/server group type VMRecommendation struct { // ConfigurationStatus - Possible values include: 'Configured', 'NotConfigured', 'InProgress', 'Failed', 'NoStatus' diff --git a/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go b/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go index 06c5df144765..811063e3ef89 100644 --- a/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go @@ -23,6 +23,15 @@ import ( "github.com/Azure/go-autorest/autorest" ) +// SubAssessmentsClientAPI contains the set of methods on the SubAssessmentsClient type. +type SubAssessmentsClientAPI interface { + Get(ctx context.Context, scope string, assessmentName string, subAssessmentName string) (result security.SubAssessment, err error) + List(ctx context.Context, scope string, assessmentName string) (result security.SubAssessmentListPage, err error) + ListAll(ctx context.Context, scope string) (result security.SubAssessmentListPage, err error) +} + +var _ SubAssessmentsClientAPI = (*security.SubAssessmentsClient)(nil) + // RegulatoryComplianceStandardsClientAPI contains the set of methods on the RegulatoryComplianceStandardsClient type. type RegulatoryComplianceStandardsClientAPI interface { Get(ctx context.Context, regulatoryComplianceStandardName string) (result security.RegulatoryComplianceStandard, err error) diff --git a/services/preview/security/mgmt/v1.0/security/subassessments.go b/services/preview/security/mgmt/v1.0/security/subassessments.go new file mode 100644 index 000000000000..4fa19d8e398d --- /dev/null +++ b/services/preview/security/mgmt/v1.0/security/subassessments.go @@ -0,0 +1,348 @@ +package security + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SubAssessmentsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type SubAssessmentsClient struct { + BaseClient +} + +// NewSubAssessmentsClient creates an instance of the SubAssessmentsClient client. +func NewSubAssessmentsClient(subscriptionID string, ascLocation string) SubAssessmentsClient { + return NewSubAssessmentsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewSubAssessmentsClientWithBaseURI creates an instance of the SubAssessmentsClient client. +func NewSubAssessmentsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) SubAssessmentsClient { + return SubAssessmentsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// Get get a security sub-assessment on your scanned resource +// Parameters: +// scope - scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or +// management group (/providers/Microsoft.Management/managementGroups/mgName). +// assessmentName - the Assessment Key - Unique key for the assessment type +// subAssessmentName - the Sub-Assessment Key - Unique key for the sub-assessment type +func (client SubAssessmentsClient) Get(ctx context.Context, scope string, assessmentName string, subAssessmentName string) (result SubAssessment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, scope, assessmentName, subAssessmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SubAssessmentsClient) GetPreparer(ctx context.Context, scope string, assessmentName string, subAssessmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "assessmentName": autorest.Encode("path", assessmentName), + "scope": autorest.Encode("path", scope), + "subAssessmentName": autorest.Encode("path", subAssessmentName), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SubAssessmentsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SubAssessmentsClient) GetResponder(resp *http.Response) (result SubAssessment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get security sub-assessments on all your scanned resources inside a scope +// Parameters: +// scope - scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or +// management group (/providers/Microsoft.Management/managementGroups/mgName). +// assessmentName - the Assessment Key - Unique key for the assessment type +func (client SubAssessmentsClient) List(ctx context.Context, scope string, assessmentName string) (result SubAssessmentListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentsClient.List") + defer func() { + sc := -1 + if result.sal.Response.Response != nil { + sc = result.sal.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, scope, assessmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sal.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "List", resp, "Failure sending request") + return + } + + result.sal, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SubAssessmentsClient) ListPreparer(ctx context.Context, scope string, assessmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "assessmentName": autorest.Encode("path", assessmentName), + "scope": autorest.Encode("path", scope), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SubAssessmentsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SubAssessmentsClient) ListResponder(resp *http.Response) (result SubAssessmentList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SubAssessmentsClient) listNextResults(ctx context.Context, lastResults SubAssessmentList) (result SubAssessmentList, err error) { + req, err := lastResults.subAssessmentListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SubAssessmentsClient) ListComplete(ctx context.Context, scope string, assessmentName string) (result SubAssessmentListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, scope, assessmentName) + return +} + +// ListAll get security sub-assessments on all your scanned resources inside a subscription scope +// Parameters: +// scope - scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or +// management group (/providers/Microsoft.Management/managementGroups/mgName). +func (client SubAssessmentsClient) ListAll(ctx context.Context, scope string) (result SubAssessmentListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentsClient.ListAll") + defer func() { + sc := -1 + if result.sal.Response.Response != nil { + sc = result.sal.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx, scope) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.sal.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "ListAll", resp, "Failure sending request") + return + } + + result.sal, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client SubAssessmentsClient) ListAllPreparer(ctx context.Context, scope string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": autorest.Encode("path", scope), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/subAssessments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client SubAssessmentsClient) ListAllSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client SubAssessmentsClient) ListAllResponder(resp *http.Response) (result SubAssessmentList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client SubAssessmentsClient) listAllNextResults(ctx context.Context, lastResults SubAssessmentList) (result SubAssessmentList, err error) { + req, err := lastResults.subAssessmentListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client SubAssessmentsClient) ListAllComplete(ctx context.Context, scope string) (result SubAssessmentListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentsClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx, scope) + return +} diff --git a/services/preview/security/mgmt/v2.0/security/models.go b/services/preview/security/mgmt/v2.0/security/models.go index 01ae7161a81d..b6c26676de8d 100644 --- a/services/preview/security/mgmt/v2.0/security/models.go +++ b/services/preview/security/mgmt/v2.0/security/models.go @@ -96,6 +96,25 @@ func PossibleAlertsToAdminsValues() []AlertsToAdmins { return []AlertsToAdmins{AlertsToAdminsOff, AlertsToAdminsOn} } +// AssessedResourceType enumerates the values for assessed resource type. +type AssessedResourceType string + +const ( + // AssessedResourceTypeAdditionalData ... + AssessedResourceTypeAdditionalData AssessedResourceType = "AdditionalData" + // AssessedResourceTypeContainerRegistryVulnerability ... + AssessedResourceTypeContainerRegistryVulnerability AssessedResourceType = "ContainerRegistryVulnerability" + // AssessedResourceTypeServerVulnerabilityAssessment ... + AssessedResourceTypeServerVulnerabilityAssessment AssessedResourceType = "ServerVulnerabilityAssessment" + // AssessedResourceTypeSQLServerVulnerability ... + AssessedResourceTypeSQLServerVulnerability AssessedResourceType = "SqlServerVulnerability" +) + +// PossibleAssessedResourceTypeValues returns an array of possible values for the AssessedResourceType const type. +func PossibleAssessedResourceTypeValues() []AssessedResourceType { + return []AssessedResourceType{AssessedResourceTypeAdditionalData, AssessedResourceTypeContainerRegistryVulnerability, AssessedResourceTypeServerVulnerabilityAssessment, AssessedResourceTypeSQLServerVulnerability} +} + // AutoProvision enumerates the values for auto provision. type AutoProvision string @@ -225,11 +244,13 @@ const ( Audit EnforcementMode = "Audit" // Enforce ... Enforce EnforcementMode = "Enforce" + // None ... + None EnforcementMode = "None" ) // PossibleEnforcementModeValues returns an array of possible values for the EnforcementMode const type. func PossibleEnforcementModeValues() []EnforcementMode { - return []EnforcementMode{Audit, Enforce} + return []EnforcementMode{Audit, Enforce, None} } // EnforcementMode1 enumerates the values for enforcement mode 1. @@ -240,11 +261,47 @@ const ( EnforcementMode1Audit EnforcementMode1 = "Audit" // EnforcementMode1Enforce ... EnforcementMode1Enforce EnforcementMode1 = "Enforce" + // EnforcementMode1None ... + EnforcementMode1None EnforcementMode1 = "None" ) // PossibleEnforcementMode1Values returns an array of possible values for the EnforcementMode1 const type. func PossibleEnforcementMode1Values() []EnforcementMode1 { - return []EnforcementMode1{EnforcementMode1Audit, EnforcementMode1Enforce} + return []EnforcementMode1{EnforcementMode1Audit, EnforcementMode1Enforce, EnforcementMode1None} +} + +// Exe enumerates the values for exe. +type Exe string + +const ( + // ExeAudit ... + ExeAudit Exe = "Audit" + // ExeEnforce ... + ExeEnforce Exe = "Enforce" + // ExeNone ... + ExeNone Exe = "None" +) + +// PossibleExeValues returns an array of possible values for the Exe const type. +func PossibleExeValues() []Exe { + return []Exe{ExeAudit, ExeEnforce, ExeNone} +} + +// Executable enumerates the values for executable. +type Executable string + +const ( + // ExecutableAudit ... + ExecutableAudit Executable = "Audit" + // ExecutableEnforce ... + ExecutableEnforce Executable = "Enforce" + // ExecutableNone ... + ExecutableNone Executable = "None" +) + +// PossibleExecutableValues returns an array of possible values for the Executable const type. +func PossibleExecutableValues() []Executable { + return []Executable{ExecutableAudit, ExecutableEnforce, ExecutableNone} } // ExportData enumerates the values for export data. @@ -300,23 +357,23 @@ func PossibleFamilyValues() []Family { type FileType string const ( - // Dll ... - Dll FileType = "Dll" - // Exe ... - Exe FileType = "Exe" - // Executable ... - Executable FileType = "Executable" - // Msi ... - Msi FileType = "Msi" - // Script ... - Script FileType = "Script" - // Unknown ... - Unknown FileType = "Unknown" + // FileTypeDll ... + FileTypeDll FileType = "Dll" + // FileTypeExe ... + FileTypeExe FileType = "Exe" + // FileTypeExecutable ... + FileTypeExecutable FileType = "Executable" + // FileTypeMsi ... + FileTypeMsi FileType = "Msi" + // FileTypeScript ... + FileTypeScript FileType = "Script" + // FileTypeUnknown ... + FileTypeUnknown FileType = "Unknown" ) // PossibleFileTypeValues returns an array of possible values for the FileType const type. func PossibleFileTypeValues() []FileType { - return []FileType{Dll, Exe, Executable, Msi, Script, Unknown} + return []FileType{FileTypeDll, FileTypeExe, FileTypeExecutable, FileTypeMsi, FileTypeScript, FileTypeUnknown} } // Issue enumerates the values for issue. @@ -361,6 +418,23 @@ func PossibleKindEnumValues() []KindEnum { return []KindEnum{KindAAD, KindATA, KindCEF, KindExternalSecuritySolution} } +// Msi enumerates the values for msi. +type Msi string + +const ( + // MsiAudit ... + MsiAudit Msi = "Audit" + // MsiEnforce ... + MsiEnforce Msi = "Enforce" + // MsiNone ... + MsiNone Msi = "None" +) + +// PossibleMsiValues returns an array of possible values for the Msi const type. +func PossibleMsiValues() []Msi { + return []Msi{MsiAudit, MsiEnforce, MsiNone} +} + // PricingTier enumerates the values for pricing tier. type PricingTier string @@ -535,6 +609,23 @@ func PossibleReportedSeverityValues() []ReportedSeverity { return []ReportedSeverity{High, Informational, Low, Medium} } +// Script enumerates the values for script. +type Script string + +const ( + // ScriptAudit ... + ScriptAudit Script = "Audit" + // ScriptEnforce ... + ScriptEnforce Script = "Enforce" + // ScriptNone ... + ScriptNone Script = "None" +) + +// PossibleScriptValues returns an array of possible values for the Script const type. +func PossibleScriptValues() []Script { + return []Script{ScriptAudit, ScriptEnforce, ScriptNone} +} + // SettingKind enumerates the values for setting kind. type SettingKind string @@ -550,6 +641,23 @@ func PossibleSettingKindValues() []SettingKind { return []SettingKind{SettingKindAlertSuppressionSetting, SettingKindDataExportSetting} } +// Severity enumerates the values for severity. +type Severity string + +const ( + // SeverityHigh ... + SeverityHigh Severity = "High" + // SeverityLow ... + SeverityLow Severity = "Low" + // SeverityMedium ... + SeverityMedium Severity = "Medium" +) + +// PossibleSeverityValues returns an array of possible values for the Severity const type. +func PossibleSeverityValues() []Severity { + return []Severity{SeverityHigh, SeverityLow, SeverityMedium} +} + // SolutionStatus enumerates the values for solution status. type SolutionStatus string @@ -565,25 +673,42 @@ func PossibleSolutionStatusValues() []SolutionStatus { return []SolutionStatus{SolutionStatusDisabled, SolutionStatusEnabled} } +// Source enumerates the values for source. +type Source string + +const ( + // SourceAws ... + SourceAws Source = "Aws" + // SourceAzure ... + SourceAzure Source = "Azure" + // SourceResourceDetails ... + SourceResourceDetails Source = "ResourceDetails" +) + +// PossibleSourceValues returns an array of possible values for the Source const type. +func PossibleSourceValues() []Source { + return []Source{SourceAws, SourceAzure, SourceResourceDetails} +} + // SourceSystem enumerates the values for source system. type SourceSystem string const ( - // AzureAppLocker ... - AzureAppLocker SourceSystem = "Azure_AppLocker" - // AzureAuditD ... - AzureAuditD SourceSystem = "Azure_AuditD" - // NonAzureAppLocker ... - NonAzureAppLocker SourceSystem = "NonAzure_AppLocker" - // NonAzureAuditD ... - NonAzureAuditD SourceSystem = "NonAzure_AuditD" - // None ... - None SourceSystem = "None" + // SourceSystemAzureAppLocker ... + SourceSystemAzureAppLocker SourceSystem = "Azure_AppLocker" + // SourceSystemAzureAuditD ... + SourceSystemAzureAuditD SourceSystem = "Azure_AuditD" + // SourceSystemNonAzureAppLocker ... + SourceSystemNonAzureAppLocker SourceSystem = "NonAzure_AppLocker" + // SourceSystemNonAzureAuditD ... + SourceSystemNonAzureAuditD SourceSystem = "NonAzure_AuditD" + // SourceSystemNone ... + SourceSystemNone SourceSystem = "None" ) // PossibleSourceSystemValues returns an array of possible values for the SourceSystem const type. func PossibleSourceSystemValues() []SourceSystem { - return []SourceSystem{AzureAppLocker, AzureAuditD, NonAzureAppLocker, NonAzureAuditD, None} + return []SourceSystem{SourceSystemAzureAppLocker, SourceSystemAzureAuditD, SourceSystemNonAzureAppLocker, SourceSystemNonAzureAuditD, SourceSystemNone} } // State enumerates the values for state. @@ -638,6 +763,23 @@ func PossibleStatusReasonValues() []StatusReason { return []StatusReason{Expired, NewerRequestInitiated, UserRequested} } +// SubAssessmentStatusCode enumerates the values for sub assessment status code. +type SubAssessmentStatusCode string + +const ( + // Healthy The resource is healthy + Healthy SubAssessmentStatusCode = "Healthy" + // NotApplicable Assessment for this resource did not happen + NotApplicable SubAssessmentStatusCode = "NotApplicable" + // Unhealthy The resource has a security issue that needs to be addressed + Unhealthy SubAssessmentStatusCode = "Unhealthy" +) + +// PossibleSubAssessmentStatusCodeValues returns an array of possible values for the SubAssessmentStatusCode const type. +func PossibleSubAssessmentStatusCodeValues() []SubAssessmentStatusCode { + return []SubAssessmentStatusCode{Healthy, NotApplicable, Unhealthy} +} + // TransportProtocol enumerates the values for transport protocol. type TransportProtocol string @@ -1022,6 +1164,100 @@ func NewAdaptiveNetworkHardeningsListPage(getNextPage func(context.Context, Adap return AdaptiveNetworkHardeningsListPage{fn: getNextPage} } +// BasicAdditionalData details of the sub-assessment +type BasicAdditionalData interface { + AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) + AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) + AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) + AsAdditionalData() (*AdditionalData, bool) +} + +// AdditionalData details of the sub-assessment +type AdditionalData struct { + // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' + AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` +} + +func unmarshalBasicAdditionalData(body []byte) (BasicAdditionalData, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["assessedResourceType"] { + case string(AssessedResourceTypeSQLServerVulnerability): + var ssvp SQLServerVulnerabilityProperties + err := json.Unmarshal(body, &ssvp) + return ssvp, err + case string(AssessedResourceTypeContainerRegistryVulnerability): + var crvp ContainerRegistryVulnerabilityProperties + err := json.Unmarshal(body, &crvp) + return crvp, err + case string(AssessedResourceTypeServerVulnerabilityAssessment): + var svp ServerVulnerabilityProperties + err := json.Unmarshal(body, &svp) + return svp, err + default: + var ad AdditionalData + err := json.Unmarshal(body, &ad) + return ad, err + } +} +func unmarshalBasicAdditionalDataArray(body []byte) ([]BasicAdditionalData, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + adArray := make([]BasicAdditionalData, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ad, err := unmarshalBasicAdditionalData(*rawMessage) + if err != nil { + return nil, err + } + adArray[index] = ad + } + return adArray, nil +} + +// MarshalJSON is the custom marshaler for AdditionalData. +func (ad AdditionalData) MarshalJSON() ([]byte, error) { + ad.AssessedResourceType = AssessedResourceTypeAdditionalData + objectMap := make(map[string]interface{}) + if ad.AssessedResourceType != "" { + objectMap["assessedResourceType"] = ad.AssessedResourceType + } + return json.Marshal(objectMap) +} + +// AsSQLServerVulnerabilityProperties is the BasicAdditionalData implementation for AdditionalData. +func (ad AdditionalData) AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsContainerRegistryVulnerabilityProperties is the BasicAdditionalData implementation for AdditionalData. +func (ad AdditionalData) AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) { + return nil, false +} + +// AsServerVulnerabilityProperties is the BasicAdditionalData implementation for AdditionalData. +func (ad AdditionalData) AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsAdditionalData is the BasicAdditionalData implementation for AdditionalData. +func (ad AdditionalData) AsAdditionalData() (*AdditionalData, bool) { + return &ad, true +} + +// AsBasicAdditionalData is the BasicAdditionalData implementation for AdditionalData. +func (ad AdditionalData) AsBasicAdditionalData() (BasicAdditionalData, bool) { + return &ad, true +} + // AdvancedThreatProtectionProperties the Advanced Threat Protection settings. type AdvancedThreatProtectionProperties struct { // IsEnabled - Indicates whether Advanced Threat Protection is enabled. @@ -1782,14 +2018,15 @@ func (awg *AppWhitelistingGroup) UnmarshalJSON(body []byte) error { // AppWhitelistingGroupData represents a VM/server group and set of rules that are Recommended by Azure // Security Center to be allowed type AppWhitelistingGroupData struct { - // EnforcementMode - Possible values include: 'Audit', 'Enforce' + // EnforcementMode - Possible values include: 'Audit', 'Enforce', 'None' EnforcementMode EnforcementMode `json:"enforcementMode,omitempty"` + ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` // ConfigurationStatus - Possible values include: 'ConfigurationStatus2Configured', 'ConfigurationStatus2NotConfigured', 'ConfigurationStatus2InProgress', 'ConfigurationStatus2Failed', 'ConfigurationStatus2NoStatus' ConfigurationStatus ConfigurationStatus2 `json:"configurationStatus,omitempty"` // RecommendationStatus - Possible values include: 'RecommendationStatusRecommended', 'RecommendationStatusNotRecommended', 'RecommendationStatusNotAvailable', 'RecommendationStatusNoStatus' RecommendationStatus RecommendationStatus `json:"recommendationStatus,omitempty"` Issues *[]AppWhitelistingIssueSummary `json:"issues,omitempty"` - // SourceSystem - Possible values include: 'AzureAppLocker', 'AzureAuditD', 'NonAzureAppLocker', 'NonAzureAuditD', 'None' + // SourceSystem - Possible values include: 'SourceSystemAzureAppLocker', 'SourceSystemAzureAuditD', 'SourceSystemNonAzureAppLocker', 'SourceSystemNonAzureAuditD', 'SourceSystemNone' SourceSystem SourceSystem `json:"sourceSystem,omitempty"` VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` @@ -1812,8 +2049,10 @@ type AppWhitelistingIssueSummary struct { // AppWhitelistingPutGroupData the altered data of the recommended VM/server group policy type AppWhitelistingPutGroupData struct { - // EnforcementMode - Possible values include: 'EnforcementMode1Audit', 'EnforcementMode1Enforce' - EnforcementMode EnforcementMode1 `json:"enforcementMode,omitempty"` + // EnforcementMode - The enforcement mode of the group. Can also be defined per collection type by using ProtectionMode. Possible values include: 'EnforcementMode1Audit', 'EnforcementMode1Enforce', 'EnforcementMode1None' + EnforcementMode EnforcementMode1 `json:"enforcementMode,omitempty"` + // ProtectionMode - The protection mode of the group per collection type. Can also be defined for all collection types by using EnforcementMode + ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` } @@ -2349,6 +2588,84 @@ type AutoProvisioningSettingProperties struct { AutoProvision AutoProvision `json:"autoProvision,omitempty"` } +// AwsResourceDetails details of the resource that was assessed +type AwsResourceDetails struct { + // AccountID - READ-ONLY; AWS account ID + AccountID *string `json:"accountId,omitempty"` + // AwsResourceID - READ-ONLY; AWS resource ID. can be ARN or other + AwsResourceID *string `json:"awsResourceId,omitempty"` + // Source - Possible values include: 'SourceResourceDetails', 'SourceAzure', 'SourceAws' + Source Source `json:"source,omitempty"` +} + +// MarshalJSON is the custom marshaler for AwsResourceDetails. +func (ard AwsResourceDetails) MarshalJSON() ([]byte, error) { + ard.Source = SourceAws + objectMap := make(map[string]interface{}) + if ard.Source != "" { + objectMap["source"] = ard.Source + } + return json.Marshal(objectMap) +} + +// AsAzureResourceDetails is the BasicResourceDetails implementation for AwsResourceDetails. +func (ard AwsResourceDetails) AsAzureResourceDetails() (*AzureResourceDetails, bool) { + return nil, false +} + +// AsAwsResourceDetails is the BasicResourceDetails implementation for AwsResourceDetails. +func (ard AwsResourceDetails) AsAwsResourceDetails() (*AwsResourceDetails, bool) { + return &ard, true +} + +// AsResourceDetails is the BasicResourceDetails implementation for AwsResourceDetails. +func (ard AwsResourceDetails) AsResourceDetails() (*ResourceDetails, bool) { + return nil, false +} + +// AsBasicResourceDetails is the BasicResourceDetails implementation for AwsResourceDetails. +func (ard AwsResourceDetails) AsBasicResourceDetails() (BasicResourceDetails, bool) { + return &ard, true +} + +// AzureResourceDetails details of the resource that was assessed +type AzureResourceDetails struct { + // ID - READ-ONLY; Azure resource ID of the assessed resource + ID *string `json:"id,omitempty"` + // Source - Possible values include: 'SourceResourceDetails', 'SourceAzure', 'SourceAws' + Source Source `json:"source,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureResourceDetails. +func (ard AzureResourceDetails) MarshalJSON() ([]byte, error) { + ard.Source = SourceAzure + objectMap := make(map[string]interface{}) + if ard.Source != "" { + objectMap["source"] = ard.Source + } + return json.Marshal(objectMap) +} + +// AsAzureResourceDetails is the BasicResourceDetails implementation for AzureResourceDetails. +func (ard AzureResourceDetails) AsAzureResourceDetails() (*AzureResourceDetails, bool) { + return &ard, true +} + +// AsAwsResourceDetails is the BasicResourceDetails implementation for AzureResourceDetails. +func (ard AzureResourceDetails) AsAwsResourceDetails() (*AwsResourceDetails, bool) { + return nil, false +} + +// AsResourceDetails is the BasicResourceDetails implementation for AzureResourceDetails. +func (ard AzureResourceDetails) AsResourceDetails() (*ResourceDetails, bool) { + return nil, false +} + +// AsBasicResourceDetails is the BasicResourceDetails implementation for AzureResourceDetails. +func (ard AzureResourceDetails) AsBasicResourceDetails() (BasicResourceDetails, bool) { + return &ard, true +} + // CefExternalSecuritySolution represents a security solution which sends CEF logs to an OMS workspace type CefExternalSecuritySolution struct { Properties *CefSolutionProperties `json:"properties,omitempty"` @@ -3065,6 +3382,64 @@ type ContactProperties struct { AlertsToAdmins AlertsToAdmins `json:"alertsToAdmins,omitempty"` } +// ContainerRegistryVulnerabilityProperties additional context fields for container registry Vulnerability +// assessment +type ContainerRegistryVulnerabilityProperties struct { + // Type - READ-ONLY; Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, Information Gathered, Vulnerability + Type *string `json:"type,omitempty"` + // Cvss - READ-ONLY; Dictionary from cvss version to cvss details object + Cvss map[string]*CVSS `json:"cvss"` + // Patchable - READ-ONLY; Indicates whether a patch is available or not + Patchable *bool `json:"patchable,omitempty"` + // Cve - READ-ONLY; List of CVEs + Cve *[]CVE `json:"cve,omitempty"` + // PublishedTime - READ-ONLY; Published time + PublishedTime *date.Time `json:"publishedTime,omitempty"` + // VendorReferences - READ-ONLY + VendorReferences *[]VendorReference `json:"vendorReferences,omitempty"` + // RepositoryName - READ-ONLY; Name of the repository which the vulnerable image belongs to + RepositoryName *string `json:"repositoryName,omitempty"` + // ImageDigest - READ-ONLY; Digest of the vulnerable image + ImageDigest *string `json:"imageDigest,omitempty"` + // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' + AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) MarshalJSON() ([]byte, error) { + crvp.AssessedResourceType = AssessedResourceTypeContainerRegistryVulnerability + objectMap := make(map[string]interface{}) + if crvp.AssessedResourceType != "" { + objectMap["assessedResourceType"] = crvp.AssessedResourceType + } + return json.Marshal(objectMap) +} + +// AsSQLServerVulnerabilityProperties is the BasicAdditionalData implementation for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsContainerRegistryVulnerabilityProperties is the BasicAdditionalData implementation for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) { + return &crvp, true +} + +// AsServerVulnerabilityProperties is the BasicAdditionalData implementation for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsAdditionalData is the BasicAdditionalData implementation for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) AsAdditionalData() (*AdditionalData, bool) { + return nil, false +} + +// AsBasicAdditionalData is the BasicAdditionalData implementation for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) AsBasicAdditionalData() (BasicAdditionalData, bool) { + return &crvp, true +} + // CustomAlertRule a custom alert rule type CustomAlertRule struct { // DisplayName - READ-ONLY; The display name of the custom alert. @@ -3077,6 +3452,20 @@ type CustomAlertRule struct { RuleType *string `json:"ruleType,omitempty"` } +// CVE CVE details +type CVE struct { + // Title - READ-ONLY; CVE title + Title *string `json:"title,omitempty"` + // Link - READ-ONLY; Link url + Link *string `json:"link,omitempty"` +} + +// CVSS CVSS details +type CVSS struct { + // Base - READ-ONLY; CVSS base + Base *float64 `json:"base,omitempty"` +} + // DataExportSetting represents a data export setting type DataExportSetting struct { // DataExportSettingProperties - Data export setting data @@ -5539,6 +5928,8 @@ type JitNetworkAccessPolicyInitiatePort struct { type JitNetworkAccessPolicyInitiateRequest struct { // VirtualMachines - A list of virtual machines & ports to open access for VirtualMachines *[]JitNetworkAccessPolicyInitiateVirtualMachine `json:"virtualMachines,omitempty"` + // Justification - The justification for making the initiate request + Justification *string `json:"justification,omitempty"` } // JitNetworkAccessPolicyInitiateVirtualMachine ... @@ -5589,6 +5980,8 @@ type JitNetworkAccessRequest struct { StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"` // Requestor - The identity of the person who made the request Requestor *string `json:"requestor,omitempty"` + // Justification - The justification for making the initiate request + Justification *string `json:"justification,omitempty"` } // JitNetworkAccessRequestPort ... @@ -5822,7 +6215,7 @@ type PathRecommendation struct { Common *bool `json:"common,omitempty"` UserSids *[]string `json:"userSids,omitempty"` Usernames *[]UserRecommendation `json:"usernames,omitempty"` - // FileType - Possible values include: 'Exe', 'Dll', 'Msi', 'Script', 'Executable', 'Unknown' + // FileType - Possible values include: 'FileTypeExe', 'FileTypeDll', 'FileTypeMsi', 'FileTypeScript', 'FileTypeExecutable', 'FileTypeUnknown' FileType FileType `json:"fileType,omitempty"` // ConfigurationStatus - Possible values include: 'ConfigurationStatus1Configured', 'ConfigurationStatus1NotConfigured', 'ConfigurationStatus1InProgress', 'ConfigurationStatus1Failed', 'ConfigurationStatus1NoStatus' ConfigurationStatus ConfigurationStatus1 `json:"configurationStatus,omitempty"` @@ -5918,6 +6311,19 @@ type PricingProperties struct { FreeTrialRemainingTime *string `json:"freeTrialRemainingTime,omitempty"` } +// ProtectionMode the protection mode of the collection/file types. Exe/Msi/Script are used for Windows, +// Executable is used for Linux. +type ProtectionMode struct { + // Exe - Possible values include: 'ExeAudit', 'ExeEnforce', 'ExeNone' + Exe Exe `json:"exe,omitempty"` + // Msi - Possible values include: 'MsiAudit', 'MsiEnforce', 'MsiNone' + Msi Msi `json:"msi,omitempty"` + // Script - Possible values include: 'ScriptAudit', 'ScriptEnforce', 'ScriptNone' + Script Script `json:"script,omitempty"` + // Executable - Possible values include: 'ExecutableAudit', 'ExecutableEnforce', 'ExecutableNone' + Executable Executable `json:"executable,omitempty"` +} + // PublisherInfo represents the publisher information of a process/rule type PublisherInfo struct { // PublisherName - The Subject field of the x.509 certificate used to sign the code, using the following fields - O = Organization, L = Locality, S = State or Province, and C = Country @@ -6656,6 +7062,90 @@ type Resource struct { Type *string `json:"type,omitempty"` } +// BasicResourceDetails details of the resource that was assessed +type BasicResourceDetails interface { + AsAzureResourceDetails() (*AzureResourceDetails, bool) + AsAwsResourceDetails() (*AwsResourceDetails, bool) + AsResourceDetails() (*ResourceDetails, bool) +} + +// ResourceDetails details of the resource that was assessed +type ResourceDetails struct { + // Source - Possible values include: 'SourceResourceDetails', 'SourceAzure', 'SourceAws' + Source Source `json:"source,omitempty"` +} + +func unmarshalBasicResourceDetails(body []byte) (BasicResourceDetails, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["source"] { + case string(SourceAzure): + var ard AzureResourceDetails + err := json.Unmarshal(body, &ard) + return ard, err + case string(SourceAws): + var ard AwsResourceDetails + err := json.Unmarshal(body, &ard) + return ard, err + default: + var rd ResourceDetails + err := json.Unmarshal(body, &rd) + return rd, err + } +} +func unmarshalBasicResourceDetailsArray(body []byte) ([]BasicResourceDetails, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + rdArray := make([]BasicResourceDetails, len(rawMessages)) + + for index, rawMessage := range rawMessages { + rd, err := unmarshalBasicResourceDetails(*rawMessage) + if err != nil { + return nil, err + } + rdArray[index] = rd + } + return rdArray, nil +} + +// MarshalJSON is the custom marshaler for ResourceDetails. +func (rd ResourceDetails) MarshalJSON() ([]byte, error) { + rd.Source = SourceResourceDetails + objectMap := make(map[string]interface{}) + if rd.Source != "" { + objectMap["source"] = rd.Source + } + return json.Marshal(objectMap) +} + +// AsAzureResourceDetails is the BasicResourceDetails implementation for ResourceDetails. +func (rd ResourceDetails) AsAzureResourceDetails() (*AzureResourceDetails, bool) { + return nil, false +} + +// AsAwsResourceDetails is the BasicResourceDetails implementation for ResourceDetails. +func (rd ResourceDetails) AsAwsResourceDetails() (*AwsResourceDetails, bool) { + return nil, false +} + +// AsResourceDetails is the BasicResourceDetails implementation for ResourceDetails. +func (rd ResourceDetails) AsResourceDetails() (*ResourceDetails, bool) { + return &rd, true +} + +// AsBasicResourceDetails is the BasicResourceDetails implementation for ResourceDetails. +func (rd ResourceDetails) AsBasicResourceDetails() (BasicResourceDetails, bool) { + return &rd, true +} + // Rule describes remote addresses that is recommended to communicate with the Azure resource on some // (Protocol, Port, Direction). All other remote addresses are recommended to be blocked type Rule struct { @@ -6681,6 +7171,61 @@ type SensitivityLabel struct { Enabled *bool `json:"enabled,omitempty"` } +// ServerVulnerabilityProperties additional context fields for server vulnerability assessment +type ServerVulnerabilityProperties struct { + // Type - READ-ONLY; Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, Information Gathered + Type *string `json:"type,omitempty"` + // Cvss - READ-ONLY; Dictionary from cvss version to cvss details object + Cvss map[string]*CVSS `json:"cvss"` + // Patchable - READ-ONLY; Indicates whether a patch is available or not + Patchable *bool `json:"patchable,omitempty"` + // Cve - READ-ONLY; List of CVEs + Cve *[]CVE `json:"cve,omitempty"` + // Threat - READ-ONLY; Threat name + Threat *string `json:"threat,omitempty"` + // PublishedTime - READ-ONLY; Published time + PublishedTime *date.Time `json:"publishedTime,omitempty"` + // VendorReferences - READ-ONLY + VendorReferences *[]VendorReference `json:"vendorReferences,omitempty"` + // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' + AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { + svp.AssessedResourceType = AssessedResourceTypeServerVulnerabilityAssessment + objectMap := make(map[string]interface{}) + if svp.AssessedResourceType != "" { + objectMap["assessedResourceType"] = svp.AssessedResourceType + } + return json.Marshal(objectMap) +} + +// AsSQLServerVulnerabilityProperties is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsContainerRegistryVulnerabilityProperties is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) { + return nil, false +} + +// AsServerVulnerabilityProperties is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) { + return &svp, true +} + +// AsAdditionalData is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsAdditionalData() (*AdditionalData, bool) { + return nil, false +} + +// AsBasicAdditionalData is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsBasicAdditionalData() (BasicAdditionalData, bool) { + return &svp, true +} + // Setting represents a security setting in Azure Security Center. type Setting struct { autorest.Response `json:"-"` @@ -6852,6 +7397,405 @@ func NewSettingsListPage(getNextPage func(context.Context, SettingsList) (Settin return SettingsListPage{fn: getNextPage} } +// SQLServerVulnerabilityProperties details of the resource that was assessed +type SQLServerVulnerabilityProperties struct { + // Type - READ-ONLY; The resource type the sub assessment refers to in its resource details + Type *string `json:"type,omitempty"` + // Query - READ-ONLY; The T-SQL query that runs on your SQL database to perform the particular check + Query *string `json:"query,omitempty"` + // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' + AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { + ssvp.AssessedResourceType = AssessedResourceTypeSQLServerVulnerability + objectMap := make(map[string]interface{}) + if ssvp.AssessedResourceType != "" { + objectMap["assessedResourceType"] = ssvp.AssessedResourceType + } + return json.Marshal(objectMap) +} + +// AsSQLServerVulnerabilityProperties is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) { + return &ssvp, true +} + +// AsContainerRegistryVulnerabilityProperties is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) { + return nil, false +} + +// AsServerVulnerabilityProperties is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsAdditionalData is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) AsAdditionalData() (*AdditionalData, bool) { + return nil, false +} + +// AsBasicAdditionalData is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) AsBasicAdditionalData() (BasicAdditionalData, bool) { + return &ssvp, true +} + +// SubAssessment security sub-assessment on a resource +type SubAssessment struct { + autorest.Response `json:"-"` + *SubAssessmentProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubAssessment. +func (sa SubAssessment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sa.SubAssessmentProperties != nil { + objectMap["properties"] = sa.SubAssessmentProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SubAssessment struct. +func (sa *SubAssessment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var subAssessmentProperties SubAssessmentProperties + err = json.Unmarshal(*v, &subAssessmentProperties) + if err != nil { + return err + } + sa.SubAssessmentProperties = &subAssessmentProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sa.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sa.Type = &typeVar + } + } + } + + return nil +} + +// SubAssessmentList list of security sub-assessments +type SubAssessmentList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY + Value *[]SubAssessment `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// SubAssessmentListIterator provides access to a complete listing of SubAssessment values. +type SubAssessmentListIterator struct { + i int + page SubAssessmentListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SubAssessmentListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SubAssessmentListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SubAssessmentListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SubAssessmentListIterator) Response() SubAssessmentList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SubAssessmentListIterator) Value() SubAssessment { + if !iter.page.NotDone() { + return SubAssessment{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SubAssessmentListIterator type. +func NewSubAssessmentListIterator(page SubAssessmentListPage) SubAssessmentListIterator { + return SubAssessmentListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sal SubAssessmentList) IsEmpty() bool { + return sal.Value == nil || len(*sal.Value) == 0 +} + +// subAssessmentListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sal SubAssessmentList) subAssessmentListPreparer(ctx context.Context) (*http.Request, error) { + if sal.NextLink == nil || len(to.String(sal.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sal.NextLink))) +} + +// SubAssessmentListPage contains a page of SubAssessment values. +type SubAssessmentListPage struct { + fn func(context.Context, SubAssessmentList) (SubAssessmentList, error) + sal SubAssessmentList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SubAssessmentListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.sal) + if err != nil { + return err + } + page.sal = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SubAssessmentListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SubAssessmentListPage) NotDone() bool { + return !page.sal.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SubAssessmentListPage) Response() SubAssessmentList { + return page.sal +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SubAssessmentListPage) Values() []SubAssessment { + if page.sal.IsEmpty() { + return nil + } + return *page.sal.Value +} + +// Creates a new instance of the SubAssessmentListPage type. +func NewSubAssessmentListPage(getNextPage func(context.Context, SubAssessmentList) (SubAssessmentList, error)) SubAssessmentListPage { + return SubAssessmentListPage{fn: getNextPage} +} + +// SubAssessmentProperties describes properties of an sub-assessment. +type SubAssessmentProperties struct { + // ID - READ-ONLY; Vulnerability ID + ID *string `json:"id,omitempty"` + // DisplayName - READ-ONLY; User friendly display name of the sub-assessment + DisplayName *string `json:"displayName,omitempty"` + Status *SubAssessmentStatus `json:"status,omitempty"` + // Remediation - READ-ONLY; Information on how to remediate this sub-assessment + Remediation *string `json:"remediation,omitempty"` + // Impact - READ-ONLY; Description of the impact of this sub-assessment + Impact *string `json:"impact,omitempty"` + // Category - READ-ONLY; Category of the sub-assessment + Category *string `json:"category,omitempty"` + // Description - READ-ONLY; Human readable description of the assessment status + Description *string `json:"description,omitempty"` + // TimeGenerated - READ-ONLY; The date and time the sub-assessment was generated + TimeGenerated *date.Time `json:"timeGenerated,omitempty"` + ResourceDetails BasicResourceDetails `json:"resourceDetails,omitempty"` + AdditionalData BasicAdditionalData `json:"additionalData,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for SubAssessmentProperties struct. +func (sap *SubAssessmentProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sap.ID = &ID + } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + sap.DisplayName = &displayName + } + case "status": + if v != nil { + var status SubAssessmentStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + sap.Status = &status + } + case "remediation": + if v != nil { + var remediation string + err = json.Unmarshal(*v, &remediation) + if err != nil { + return err + } + sap.Remediation = &remediation + } + case "impact": + if v != nil { + var impact string + err = json.Unmarshal(*v, &impact) + if err != nil { + return err + } + sap.Impact = &impact + } + case "category": + if v != nil { + var category string + err = json.Unmarshal(*v, &category) + if err != nil { + return err + } + sap.Category = &category + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + sap.Description = &description + } + case "timeGenerated": + if v != nil { + var timeGenerated date.Time + err = json.Unmarshal(*v, &timeGenerated) + if err != nil { + return err + } + sap.TimeGenerated = &timeGenerated + } + case "resourceDetails": + if v != nil { + resourceDetails, err := unmarshalBasicResourceDetails(*v) + if err != nil { + return err + } + sap.ResourceDetails = resourceDetails + } + case "additionalData": + if v != nil { + additionalData, err := unmarshalBasicAdditionalData(*v) + if err != nil { + return err + } + sap.AdditionalData = additionalData + } + } + } + + return nil +} + +// SubAssessmentStatus status of the sub-assessment +type SubAssessmentStatus struct { + // Code - READ-ONLY; Programmatic code for the status of the assessment. Possible values include: 'Healthy', 'Unhealthy', 'NotApplicable' + Code SubAssessmentStatusCode `json:"code,omitempty"` + // Cause - READ-ONLY; Programmatic code for the cause of the assessment status + Cause *string `json:"cause,omitempty"` + // Description - READ-ONLY; Human readable description of the assessment status + Description *string `json:"description,omitempty"` + // Severity - READ-ONLY; The sub-assessment severity level. Possible values include: 'SeverityLow', 'SeverityMedium', 'SeverityHigh' + Severity Severity `json:"severity,omitempty"` +} + // TagsResource a container holding only the Tags for a resource, allowing the user to update the tags. type TagsResource struct { // Tags - Resource tags @@ -7494,6 +8438,14 @@ type UserRecommendation struct { RecommendationAction RecommendationAction1 `json:"recommendationAction,omitempty"` } +// VendorReference vendor reference +type VendorReference struct { + // Title - READ-ONLY; Link title + Title *string `json:"title,omitempty"` + // Link - READ-ONLY; Link url + Link *string `json:"link,omitempty"` +} + // VMRecommendation represents a machine that is part of a VM/server group type VMRecommendation struct { // ConfigurationStatus - Possible values include: 'Configured', 'NotConfigured', 'InProgress', 'Failed', 'NoStatus' diff --git a/services/preview/security/mgmt/v2.0/security/securityapi/interfaces.go b/services/preview/security/mgmt/v2.0/security/securityapi/interfaces.go index dde4288d926e..dec22bd03f50 100644 --- a/services/preview/security/mgmt/v2.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v2.0/security/securityapi/interfaces.go @@ -23,6 +23,15 @@ import ( "github.com/Azure/go-autorest/autorest" ) +// SubAssessmentsClientAPI contains the set of methods on the SubAssessmentsClient type. +type SubAssessmentsClientAPI interface { + Get(ctx context.Context, scope string, assessmentName string, subAssessmentName string) (result security.SubAssessment, err error) + List(ctx context.Context, scope string, assessmentName string) (result security.SubAssessmentListPage, err error) + ListAll(ctx context.Context, scope string) (result security.SubAssessmentListPage, err error) +} + +var _ SubAssessmentsClientAPI = (*security.SubAssessmentsClient)(nil) + // RegulatoryComplianceStandardsClientAPI contains the set of methods on the RegulatoryComplianceStandardsClient type. type RegulatoryComplianceStandardsClientAPI interface { Get(ctx context.Context, regulatoryComplianceStandardName string) (result security.RegulatoryComplianceStandard, err error) diff --git a/services/preview/security/mgmt/v2.0/security/subassessments.go b/services/preview/security/mgmt/v2.0/security/subassessments.go new file mode 100644 index 000000000000..4fa19d8e398d --- /dev/null +++ b/services/preview/security/mgmt/v2.0/security/subassessments.go @@ -0,0 +1,348 @@ +package security + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SubAssessmentsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type SubAssessmentsClient struct { + BaseClient +} + +// NewSubAssessmentsClient creates an instance of the SubAssessmentsClient client. +func NewSubAssessmentsClient(subscriptionID string, ascLocation string) SubAssessmentsClient { + return NewSubAssessmentsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewSubAssessmentsClientWithBaseURI creates an instance of the SubAssessmentsClient client. +func NewSubAssessmentsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) SubAssessmentsClient { + return SubAssessmentsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// Get get a security sub-assessment on your scanned resource +// Parameters: +// scope - scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or +// management group (/providers/Microsoft.Management/managementGroups/mgName). +// assessmentName - the Assessment Key - Unique key for the assessment type +// subAssessmentName - the Sub-Assessment Key - Unique key for the sub-assessment type +func (client SubAssessmentsClient) Get(ctx context.Context, scope string, assessmentName string, subAssessmentName string) (result SubAssessment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, scope, assessmentName, subAssessmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SubAssessmentsClient) GetPreparer(ctx context.Context, scope string, assessmentName string, subAssessmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "assessmentName": autorest.Encode("path", assessmentName), + "scope": autorest.Encode("path", scope), + "subAssessmentName": autorest.Encode("path", subAssessmentName), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SubAssessmentsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SubAssessmentsClient) GetResponder(resp *http.Response) (result SubAssessment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get security sub-assessments on all your scanned resources inside a scope +// Parameters: +// scope - scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or +// management group (/providers/Microsoft.Management/managementGroups/mgName). +// assessmentName - the Assessment Key - Unique key for the assessment type +func (client SubAssessmentsClient) List(ctx context.Context, scope string, assessmentName string) (result SubAssessmentListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentsClient.List") + defer func() { + sc := -1 + if result.sal.Response.Response != nil { + sc = result.sal.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, scope, assessmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sal.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "List", resp, "Failure sending request") + return + } + + result.sal, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SubAssessmentsClient) ListPreparer(ctx context.Context, scope string, assessmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "assessmentName": autorest.Encode("path", assessmentName), + "scope": autorest.Encode("path", scope), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SubAssessmentsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SubAssessmentsClient) ListResponder(resp *http.Response) (result SubAssessmentList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SubAssessmentsClient) listNextResults(ctx context.Context, lastResults SubAssessmentList) (result SubAssessmentList, err error) { + req, err := lastResults.subAssessmentListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SubAssessmentsClient) ListComplete(ctx context.Context, scope string, assessmentName string) (result SubAssessmentListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, scope, assessmentName) + return +} + +// ListAll get security sub-assessments on all your scanned resources inside a subscription scope +// Parameters: +// scope - scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or +// management group (/providers/Microsoft.Management/managementGroups/mgName). +func (client SubAssessmentsClient) ListAll(ctx context.Context, scope string) (result SubAssessmentListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentsClient.ListAll") + defer func() { + sc := -1 + if result.sal.Response.Response != nil { + sc = result.sal.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx, scope) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.sal.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "ListAll", resp, "Failure sending request") + return + } + + result.sal, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client SubAssessmentsClient) ListAllPreparer(ctx context.Context, scope string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": autorest.Encode("path", scope), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/subAssessments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client SubAssessmentsClient) ListAllSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client SubAssessmentsClient) ListAllResponder(resp *http.Response) (result SubAssessmentList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client SubAssessmentsClient) listAllNextResults(ctx context.Context, lastResults SubAssessmentList) (result SubAssessmentList, err error) { + req, err := lastResults.subAssessmentListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client SubAssessmentsClient) ListAllComplete(ctx context.Context, scope string) (result SubAssessmentListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentsClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx, scope) + return +} diff --git a/services/preview/security/mgmt/v3.0/security/devicesecuritygroups.go b/services/preview/security/mgmt/v3.0/security/devicesecuritygroups.go new file mode 100644 index 000000000000..00a09f9bf766 --- /dev/null +++ b/services/preview/security/mgmt/v3.0/security/devicesecuritygroups.go @@ -0,0 +1,386 @@ +package security + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DeviceSecurityGroupsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type DeviceSecurityGroupsClient struct { + BaseClient +} + +// NewDeviceSecurityGroupsClient creates an instance of the DeviceSecurityGroupsClient client. +func NewDeviceSecurityGroupsClient(subscriptionID string, ascLocation string) DeviceSecurityGroupsClient { + return NewDeviceSecurityGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewDeviceSecurityGroupsClientWithBaseURI creates an instance of the DeviceSecurityGroupsClient client. +func NewDeviceSecurityGroupsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) DeviceSecurityGroupsClient { + return DeviceSecurityGroupsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// CreateOrUpdate use this method to creates or updates the device security group on a specified IoT Hub resource. +// Parameters: +// resourceID - the identifier of the resource. +// deviceSecurityGroupName - the name of the device security group. Note that the name of the device security +// group is case insensitive. +// deviceSecurityGroup - security group object. +func (client DeviceSecurityGroupsClient) CreateOrUpdate(ctx context.Context, resourceID string, deviceSecurityGroupName string, deviceSecurityGroup DeviceSecurityGroup) (result DeviceSecurityGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeviceSecurityGroupsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceID, deviceSecurityGroupName, deviceSecurityGroup) + if err != nil { + err = autorest.NewErrorWithError(err, "security.DeviceSecurityGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.DeviceSecurityGroupsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.DeviceSecurityGroupsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DeviceSecurityGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceID string, deviceSecurityGroupName string, deviceSecurityGroup DeviceSecurityGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceSecurityGroupName": autorest.Encode("path", deviceSecurityGroupName), + "resourceId": autorest.Encode("path", resourceID), + } + + const APIVersion = "2019-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}", pathParameters), + autorest.WithJSON(deviceSecurityGroup), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DeviceSecurityGroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DeviceSecurityGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result DeviceSecurityGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete user this method to deletes the device security group. +// Parameters: +// resourceID - the identifier of the resource. +// deviceSecurityGroupName - the name of the device security group. Note that the name of the device security +// group is case insensitive. +func (client DeviceSecurityGroupsClient) Delete(ctx context.Context, resourceID string, deviceSecurityGroupName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeviceSecurityGroupsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceID, deviceSecurityGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.DeviceSecurityGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.DeviceSecurityGroupsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.DeviceSecurityGroupsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DeviceSecurityGroupsClient) DeletePreparer(ctx context.Context, resourceID string, deviceSecurityGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceSecurityGroupName": autorest.Encode("path", deviceSecurityGroupName), + "resourceId": autorest.Encode("path", resourceID), + } + + const APIVersion = "2019-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DeviceSecurityGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DeviceSecurityGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get use this method to get the device security group for the specified IoT Hub resource. +// Parameters: +// resourceID - the identifier of the resource. +// deviceSecurityGroupName - the name of the device security group. Note that the name of the device security +// group is case insensitive. +func (client DeviceSecurityGroupsClient) Get(ctx context.Context, resourceID string, deviceSecurityGroupName string) (result DeviceSecurityGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeviceSecurityGroupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceID, deviceSecurityGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.DeviceSecurityGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.DeviceSecurityGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.DeviceSecurityGroupsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DeviceSecurityGroupsClient) GetPreparer(ctx context.Context, resourceID string, deviceSecurityGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceSecurityGroupName": autorest.Encode("path", deviceSecurityGroupName), + "resourceId": autorest.Encode("path", resourceID), + } + + const APIVersion = "2019-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DeviceSecurityGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DeviceSecurityGroupsClient) GetResponder(resp *http.Response) (result DeviceSecurityGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List use this method get the list of device security groups for the specified IoT Hub resource. +// Parameters: +// resourceID - the identifier of the resource. +func (client DeviceSecurityGroupsClient) List(ctx context.Context, resourceID string) (result DeviceSecurityGroupListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeviceSecurityGroupsClient.List") + defer func() { + sc := -1 + if result.dsgl.Response.Response != nil { + sc = result.dsgl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceID) + if err != nil { + err = autorest.NewErrorWithError(err, "security.DeviceSecurityGroupsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dsgl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.DeviceSecurityGroupsClient", "List", resp, "Failure sending request") + return + } + + result.dsgl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.DeviceSecurityGroupsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DeviceSecurityGroupsClient) ListPreparer(ctx context.Context, resourceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceId": autorest.Encode("path", resourceID), + } + + const APIVersion = "2019-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DeviceSecurityGroupsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DeviceSecurityGroupsClient) ListResponder(resp *http.Response) (result DeviceSecurityGroupList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client DeviceSecurityGroupsClient) listNextResults(ctx context.Context, lastResults DeviceSecurityGroupList) (result DeviceSecurityGroupList, err error) { + req, err := lastResults.deviceSecurityGroupListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.DeviceSecurityGroupsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.DeviceSecurityGroupsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.DeviceSecurityGroupsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeviceSecurityGroupsClient) ListComplete(ctx context.Context, resourceID string) (result DeviceSecurityGroupListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeviceSecurityGroupsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceID) + return +} diff --git a/services/preview/security/mgmt/v3.0/security/iotsecuritysolution.go b/services/preview/security/mgmt/v3.0/security/iotsecuritysolution.go index 69320fae227d..10b731aa211f 100644 --- a/services/preview/security/mgmt/v3.0/security/iotsecuritysolution.go +++ b/services/preview/security/mgmt/v3.0/security/iotsecuritysolution.go @@ -41,15 +41,15 @@ func NewIotSecuritySolutionClientWithBaseURI(baseURI string, subscriptionID stri return IotSecuritySolutionClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} } -// Create create new solution manager +// CreateOrUpdate use this method to create or update yours IoT Security solution // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. The name is case // insensitive. -// solutionName - the solution manager name +// solutionName - the name of the IoT Security solution. // iotSecuritySolutionData - the security solution data -func (client IotSecuritySolutionClient) Create(ctx context.Context, resourceGroupName string, solutionName string, iotSecuritySolutionData IoTSecuritySolutionModel) (result IoTSecuritySolutionModel, err error) { +func (client IotSecuritySolutionClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, solutionName string, iotSecuritySolutionData IoTSecuritySolutionModel) (result IoTSecuritySolutionModel, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionClient.Create") + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionClient.CreateOrUpdate") defer func() { sc := -1 if result.Response.Response != nil { @@ -75,32 +75,32 @@ func (client IotSecuritySolutionClient) Create(ctx context.Context, resourceGrou {Target: "iotSecuritySolutionData.IoTSecuritySolutionProperties.UserDefinedResources.QuerySubscriptions", Name: validation.Null, Rule: true, Chain: nil}, }}, }}}}}); err != nil { - return result, validation.NewError("security.IotSecuritySolutionClient", "Create", err.Error()) + return result, validation.NewError("security.IotSecuritySolutionClient", "CreateOrUpdate", err.Error()) } - req, err := client.CreatePreparer(ctx, resourceGroupName, solutionName, iotSecuritySolutionData) + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, solutionName, iotSecuritySolutionData) if err != nil { - err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "Create", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "CreateOrUpdate", nil, "Failure preparing request") return } - resp, err := client.CreateSender(req) + resp, err := client.CreateOrUpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "Create", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "CreateOrUpdate", resp, "Failure sending request") return } - result, err = client.CreateResponder(resp) + result, err = client.CreateOrUpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "Create", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "CreateOrUpdate", resp, "Failure responding to request") } return } -// CreatePreparer prepares the Create request. -func (client IotSecuritySolutionClient) CreatePreparer(ctx context.Context, resourceGroupName string, solutionName string, iotSecuritySolutionData IoTSecuritySolutionModel) (*http.Request, error) { +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client IotSecuritySolutionClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, solutionName string, iotSecuritySolutionData IoTSecuritySolutionModel) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "solutionName": autorest.Encode("path", solutionName), @@ -125,16 +125,16 @@ func (client IotSecuritySolutionClient) CreatePreparer(ctx context.Context, reso return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// CreateSender sends the Create request. The method will close the +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. -func (client IotSecuritySolutionClient) CreateSender(req *http.Request) (*http.Response, error) { +func (client IotSecuritySolutionClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) return autorest.SendWithSender(client, req, sd...) } -// CreateResponder handles the response to the Create request. The method always +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. -func (client IotSecuritySolutionClient) CreateResponder(resp *http.Response) (result IoTSecuritySolutionModel, err error) { +func (client IotSecuritySolutionClient) CreateOrUpdateResponder(resp *http.Response) (result IoTSecuritySolutionModel, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -145,11 +145,11 @@ func (client IotSecuritySolutionClient) CreateResponder(resp *http.Response) (re return } -// Delete create new solution manager +// Delete use this method to delete yours IoT Security solution // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. The name is case // insensitive. -// solutionName - the solution manager name +// solutionName - the name of the IoT Security solution. func (client IotSecuritySolutionClient) Delete(ctx context.Context, resourceGroupName string, solutionName string) (result autorest.Response, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionClient.Delete") @@ -232,11 +232,11 @@ func (client IotSecuritySolutionClient) DeleteResponder(resp *http.Response) (re return } -// Get details of a specific iot security solution +// Get user this method to get details of a specific IoT Security solution based on solution name // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. The name is case // insensitive. -// solutionName - the solution manager name +// solutionName - the name of the IoT Security solution. func (client IotSecuritySolutionClient) Get(ctx context.Context, resourceGroupName string, solutionName string) (result IoTSecuritySolutionModel, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionClient.Get") @@ -320,12 +320,261 @@ func (client IotSecuritySolutionClient) GetResponder(resp *http.Response) (resul return } -// Update update existing Security Solution tags or user defined resources. To update other fields use the -// CreateOrUpdate method +// ListByResourceGroup use this method to get the list IoT Security solutions organized by resource group. // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. The name is case // insensitive. -// solutionName - the solution manager name +// filter - filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. +func (client IotSecuritySolutionClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result IoTSecuritySolutionsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.itssl.Response.Response != nil { + sc = result.itssl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.IotSecuritySolutionClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.itssl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.itssl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client IotSecuritySolutionClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client IotSecuritySolutionClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client IotSecuritySolutionClient) ListByResourceGroupResponder(resp *http.Response) (result IoTSecuritySolutionsList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client IotSecuritySolutionClient) listByResourceGroupNextResults(ctx context.Context, lastResults IoTSecuritySolutionsList) (result IoTSecuritySolutionsList, err error) { + req, err := lastResults.ioTSecuritySolutionsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client IotSecuritySolutionClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string) (result IoTSecuritySolutionsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, filter) + return +} + +// ListBySubscription use this method to get the list of IoT Security solutions by subscription. +// Parameters: +// filter - filter the IoT Security solution with OData syntax. Supports filtering by iotHubs. +func (client IotSecuritySolutionClient) ListBySubscription(ctx context.Context, filter string) (result IoTSecuritySolutionsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionClient.ListBySubscription") + defer func() { + sc := -1 + if result.itssl.Response.Response != nil { + sc = result.itssl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.IotSecuritySolutionClient", "ListBySubscription", err.Error()) + } + + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.itssl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.itssl, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client IotSecuritySolutionClient) ListBySubscriptionPreparer(ctx context.Context, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client IotSecuritySolutionClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client IotSecuritySolutionClient) ListBySubscriptionResponder(resp *http.Response) (result IoTSecuritySolutionsList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client IotSecuritySolutionClient) listBySubscriptionNextResults(ctx context.Context, lastResults IoTSecuritySolutionsList) (result IoTSecuritySolutionsList, err error) { + req, err := lastResults.ioTSecuritySolutionsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client IotSecuritySolutionClient) ListBySubscriptionComplete(ctx context.Context, filter string) (result IoTSecuritySolutionsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx, filter) + return +} + +// Update use this method to update existing IoT Security solution tags or user defined resources. To update other +// fields use the CreateOrUpdate method. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// solutionName - the name of the IoT Security solution. // updateIotSecuritySolutionData - the security solution data func (client IotSecuritySolutionClient) Update(ctx context.Context, resourceGroupName string, solutionName string, updateIotSecuritySolutionData UpdateIotSecuritySolutionData) (result IoTSecuritySolutionModel, err error) { if tracing.IsEnabled() { diff --git a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalytics.go b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionanalytics.go similarity index 58% rename from services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalytics.go rename to services/preview/security/mgmt/v3.0/security/iotsecuritysolutionanalytics.go index 22ce11631743..85c4adbf8b00 100644 --- a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalytics.go +++ b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionanalytics.go @@ -26,30 +26,30 @@ import ( "net/http" ) -// IoTSecuritySolutionsAnalyticsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider -type IoTSecuritySolutionsAnalyticsClient struct { +// IotSecuritySolutionAnalyticsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type IotSecuritySolutionAnalyticsClient struct { BaseClient } -// NewIoTSecuritySolutionsAnalyticsClient creates an instance of the IoTSecuritySolutionsAnalyticsClient client. -func NewIoTSecuritySolutionsAnalyticsClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsClient { - return NewIoTSecuritySolutionsAnalyticsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +// NewIotSecuritySolutionAnalyticsClient creates an instance of the IotSecuritySolutionAnalyticsClient client. +func NewIotSecuritySolutionAnalyticsClient(subscriptionID string, ascLocation string) IotSecuritySolutionAnalyticsClient { + return NewIotSecuritySolutionAnalyticsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) } -// NewIoTSecuritySolutionsAnalyticsClientWithBaseURI creates an instance of the IoTSecuritySolutionsAnalyticsClient +// NewIotSecuritySolutionAnalyticsClientWithBaseURI creates an instance of the IotSecuritySolutionAnalyticsClient // client. -func NewIoTSecuritySolutionsAnalyticsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsClient { - return IoTSecuritySolutionsAnalyticsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +func NewIotSecuritySolutionAnalyticsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IotSecuritySolutionAnalyticsClient { + return IotSecuritySolutionAnalyticsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} } -// GetAll security Analytics of a security solution +// Get use this method to get IoT Security Analytics metrics. // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. The name is case // insensitive. -// solutionName - the solution manager name -func (client IoTSecuritySolutionsAnalyticsClient) GetAll(ctx context.Context, resourceGroupName string, solutionName string) (result IoTSecuritySolutionAnalyticsModelList, err error) { +// solutionName - the name of the IoT Security solution. +func (client IotSecuritySolutionAnalyticsClient) Get(ctx context.Context, resourceGroupName string, solutionName string) (result IoTSecuritySolutionAnalyticsModel, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsClient.GetAll") + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionAnalyticsClient.Get") defer func() { sc := -1 if result.Response.Response != nil { @@ -65,32 +65,32 @@ func (client IoTSecuritySolutionsAnalyticsClient) GetAll(ctx context.Context, re Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("security.IoTSecuritySolutionsAnalyticsClient", "GetAll", err.Error()) + return result, validation.NewError("security.IotSecuritySolutionAnalyticsClient", "Get", err.Error()) } - req, err := client.GetAllPreparer(ctx, resourceGroupName, solutionName) + req, err := client.GetPreparer(ctx, resourceGroupName, solutionName) if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsClient", "GetAll", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionAnalyticsClient", "Get", nil, "Failure preparing request") return } - resp, err := client.GetAllSender(req) + resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsClient", "GetAll", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionAnalyticsClient", "Get", resp, "Failure sending request") return } - result, err = client.GetAllResponder(resp) + result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsClient", "GetAll", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionAnalyticsClient", "Get", resp, "Failure responding to request") } return } -// GetAllPreparer prepares the GetAll request. -func (client IoTSecuritySolutionsAnalyticsClient) GetAllPreparer(ctx context.Context, resourceGroupName string, solutionName string) (*http.Request, error) { +// GetPreparer prepares the Get request. +func (client IotSecuritySolutionAnalyticsClient) GetPreparer(ctx context.Context, resourceGroupName string, solutionName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "solutionName": autorest.Encode("path", solutionName), @@ -105,21 +105,21 @@ func (client IoTSecuritySolutionsAnalyticsClient) GetAllPreparer(ctx context.Con preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// GetAllSender sends the GetAll request. The method will close the +// GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client IoTSecuritySolutionsAnalyticsClient) GetAllSender(req *http.Request) (*http.Response, error) { +func (client IotSecuritySolutionAnalyticsClient) GetSender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) return autorest.SendWithSender(client, req, sd...) } -// GetAllResponder handles the response to the GetAll request. The method always +// GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client IoTSecuritySolutionsAnalyticsClient) GetAllResponder(resp *http.Response) (result IoTSecuritySolutionAnalyticsModelList, err error) { +func (client IotSecuritySolutionAnalyticsClient) GetResponder(resp *http.Response) (result IoTSecuritySolutionAnalyticsModel, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -130,14 +130,14 @@ func (client IoTSecuritySolutionsAnalyticsClient) GetAllResponder(resp *http.Res return } -// GetDefault security Analytics of a security solution +// List use this method to get IoT security Analytics metrics in an array. // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. The name is case // insensitive. -// solutionName - the solution manager name -func (client IoTSecuritySolutionsAnalyticsClient) GetDefault(ctx context.Context, resourceGroupName string, solutionName string) (result IoTSecuritySolutionAnalyticsModel, err error) { +// solutionName - the name of the IoT Security solution. +func (client IotSecuritySolutionAnalyticsClient) List(ctx context.Context, resourceGroupName string, solutionName string) (result IoTSecuritySolutionAnalyticsModelList, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsClient.GetDefault") + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionAnalyticsClient.List") defer func() { sc := -1 if result.Response.Response != nil { @@ -153,32 +153,32 @@ func (client IoTSecuritySolutionsAnalyticsClient) GetDefault(ctx context.Context Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("security.IoTSecuritySolutionsAnalyticsClient", "GetDefault", err.Error()) + return result, validation.NewError("security.IotSecuritySolutionAnalyticsClient", "List", err.Error()) } - req, err := client.GetDefaultPreparer(ctx, resourceGroupName, solutionName) + req, err := client.ListPreparer(ctx, resourceGroupName, solutionName) if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsClient", "GetDefault", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionAnalyticsClient", "List", nil, "Failure preparing request") return } - resp, err := client.GetDefaultSender(req) + resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsClient", "GetDefault", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionAnalyticsClient", "List", resp, "Failure sending request") return } - result, err = client.GetDefaultResponder(resp) + result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsClient", "GetDefault", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionAnalyticsClient", "List", resp, "Failure responding to request") } return } -// GetDefaultPreparer prepares the GetDefault request. -func (client IoTSecuritySolutionsAnalyticsClient) GetDefaultPreparer(ctx context.Context, resourceGroupName string, solutionName string) (*http.Request, error) { +// ListPreparer prepares the List request. +func (client IotSecuritySolutionAnalyticsClient) ListPreparer(ctx context.Context, resourceGroupName string, solutionName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "solutionName": autorest.Encode("path", solutionName), @@ -193,21 +193,21 @@ func (client IoTSecuritySolutionsAnalyticsClient) GetDefaultPreparer(ctx context preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// GetDefaultSender sends the GetDefault request. The method will close the +// ListSender sends the List request. The method will close the // http.Response Body if it receives an error. -func (client IoTSecuritySolutionsAnalyticsClient) GetDefaultSender(req *http.Request) (*http.Response, error) { +func (client IotSecuritySolutionAnalyticsClient) ListSender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) return autorest.SendWithSender(client, req, sd...) } -// GetDefaultResponder handles the response to the GetDefault request. The method always +// ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client IoTSecuritySolutionsAnalyticsClient) GetDefaultResponder(resp *http.Response) (result IoTSecuritySolutionAnalyticsModel, err error) { +func (client IotSecuritySolutionAnalyticsClient) ListResponder(resp *http.Response) (result IoTSecuritySolutionAnalyticsModelList, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutions.go b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutions.go deleted file mode 100644 index 03b256dad4c7..000000000000 --- a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutions.go +++ /dev/null @@ -1,163 +0,0 @@ -package security - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IoTSecuritySolutionsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider -type IoTSecuritySolutionsClient struct { - BaseClient -} - -// NewIoTSecuritySolutionsClient creates an instance of the IoTSecuritySolutionsClient client. -func NewIoTSecuritySolutionsClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsClient { - return NewIoTSecuritySolutionsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) -} - -// NewIoTSecuritySolutionsClientWithBaseURI creates an instance of the IoTSecuritySolutionsClient client. -func NewIoTSecuritySolutionsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsClient { - return IoTSecuritySolutionsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} -} - -// List list of security solutions -// Parameters: -// filter - filter the Security Solution with OData syntax. supporting filter by iotHubs -func (client IoTSecuritySolutionsClient) List(ctx context.Context, filter string) (result IoTSecuritySolutionsListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsClient.List") - defer func() { - sc := -1 - if result.itssl.Response.Response != nil { - sc = result.itssl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("security.IoTSecuritySolutionsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.itssl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsClient", "List", resp, "Failure sending request") - return - } - - result.itssl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client IoTSecuritySolutionsClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client IoTSecuritySolutionsClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client IoTSecuritySolutionsClient) ListResponder(resp *http.Response) (result IoTSecuritySolutionsList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client IoTSecuritySolutionsClient) listNextResults(ctx context.Context, lastResults IoTSecuritySolutionsList) (result IoTSecuritySolutionsList, err error) { - req, err := lastResults.ioTSecuritySolutionsListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client IoTSecuritySolutionsClient) ListComplete(ctx context.Context, filter string) (result IoTSecuritySolutionsListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, filter) - return -} diff --git a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsaggregatedalert.go b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsaggregatedalert.go index 27eddd6c8c14..b84aaf8df622 100644 --- a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsaggregatedalert.go +++ b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsaggregatedalert.go @@ -26,33 +26,33 @@ import ( "net/http" ) -// IoTSecuritySolutionsAnalyticsAggregatedAlertClient is the API spec for Microsoft.Security (Azure Security Center) +// IotSecuritySolutionsAnalyticsAggregatedAlertClient is the API spec for Microsoft.Security (Azure Security Center) // resource provider -type IoTSecuritySolutionsAnalyticsAggregatedAlertClient struct { +type IotSecuritySolutionsAnalyticsAggregatedAlertClient struct { BaseClient } -// NewIoTSecuritySolutionsAnalyticsAggregatedAlertClient creates an instance of the -// IoTSecuritySolutionsAnalyticsAggregatedAlertClient client. -func NewIoTSecuritySolutionsAnalyticsAggregatedAlertClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsAggregatedAlertClient { - return NewIoTSecuritySolutionsAnalyticsAggregatedAlertClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +// NewIotSecuritySolutionsAnalyticsAggregatedAlertClient creates an instance of the +// IotSecuritySolutionsAnalyticsAggregatedAlertClient client. +func NewIotSecuritySolutionsAnalyticsAggregatedAlertClient(subscriptionID string, ascLocation string) IotSecuritySolutionsAnalyticsAggregatedAlertClient { + return NewIotSecuritySolutionsAnalyticsAggregatedAlertClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) } -// NewIoTSecuritySolutionsAnalyticsAggregatedAlertClientWithBaseURI creates an instance of the -// IoTSecuritySolutionsAnalyticsAggregatedAlertClient client. -func NewIoTSecuritySolutionsAnalyticsAggregatedAlertClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsAggregatedAlertClient { - return IoTSecuritySolutionsAnalyticsAggregatedAlertClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +// NewIotSecuritySolutionsAnalyticsAggregatedAlertClientWithBaseURI creates an instance of the +// IotSecuritySolutionsAnalyticsAggregatedAlertClient client. +func NewIotSecuritySolutionsAnalyticsAggregatedAlertClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IotSecuritySolutionsAnalyticsAggregatedAlertClient { + return IotSecuritySolutionsAnalyticsAggregatedAlertClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} } -// Dismiss security Analytics of a security solution +// Dismiss use this method to dismiss an aggregated IoT Security Solution Alert. // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. The name is case // insensitive. -// solutionName - the solution manager name -// aggregatedAlertName - identifier of the aggregated alert -func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) Dismiss(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string) (result autorest.Response, err error) { +// solutionName - the name of the IoT Security solution. +// aggregatedAlertName - identifier of the aggregated alert. +func (client IotSecuritySolutionsAnalyticsAggregatedAlertClient) Dismiss(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string) (result autorest.Response, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsAggregatedAlertClient.Dismiss") + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionsAnalyticsAggregatedAlertClient.Dismiss") defer func() { sc := -1 if result.Response != nil { @@ -68,32 +68,32 @@ func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) Dismiss(ctx con Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("security.IoTSecuritySolutionsAnalyticsAggregatedAlertClient", "Dismiss", err.Error()) + return result, validation.NewError("security.IotSecuritySolutionsAnalyticsAggregatedAlertClient", "Dismiss", err.Error()) } req, err := client.DismissPreparer(ctx, resourceGroupName, solutionName, aggregatedAlertName) if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertClient", "Dismiss", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsAggregatedAlertClient", "Dismiss", nil, "Failure preparing request") return } resp, err := client.DismissSender(req) if err != nil { result.Response = resp - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertClient", "Dismiss", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsAggregatedAlertClient", "Dismiss", resp, "Failure sending request") return } result, err = client.DismissResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertClient", "Dismiss", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsAggregatedAlertClient", "Dismiss", resp, "Failure responding to request") } return } // DismissPreparer prepares the Dismiss request. -func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) DismissPreparer(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string) (*http.Request, error) { +func (client IotSecuritySolutionsAnalyticsAggregatedAlertClient) DismissPreparer(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "aggregatedAlertName": autorest.Encode("path", aggregatedAlertName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -116,14 +116,14 @@ func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) DismissPreparer // DismissSender sends the Dismiss request. The method will close the // http.Response Body if it receives an error. -func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) DismissSender(req *http.Request) (*http.Response, error) { +func (client IotSecuritySolutionsAnalyticsAggregatedAlertClient) DismissSender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) return autorest.SendWithSender(client, req, sd...) } // DismissResponder handles the response to the Dismiss request. The method always // closes the http.Response Body. -func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) DismissResponder(resp *http.Response) (result autorest.Response, err error) { +func (client IotSecuritySolutionsAnalyticsAggregatedAlertClient) DismissResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -133,15 +133,16 @@ func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) DismissResponde return } -// Get security Analytics of a security solution +// Get use this method to get a single the aggregated alert of yours IoT Security solution. This aggregation is +// performed by alert name. // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. The name is case // insensitive. -// solutionName - the solution manager name -// aggregatedAlertName - identifier of the aggregated alert -func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) Get(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string) (result IoTSecurityAggregatedAlert, err error) { +// solutionName - the name of the IoT Security solution. +// aggregatedAlertName - identifier of the aggregated alert. +func (client IotSecuritySolutionsAnalyticsAggregatedAlertClient) Get(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string) (result IoTSecurityAggregatedAlert, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsAggregatedAlertClient.Get") + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionsAnalyticsAggregatedAlertClient.Get") defer func() { sc := -1 if result.Response.Response != nil { @@ -157,32 +158,32 @@ func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) Get(ctx context Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("security.IoTSecuritySolutionsAnalyticsAggregatedAlertClient", "Get", err.Error()) + return result, validation.NewError("security.IotSecuritySolutionsAnalyticsAggregatedAlertClient", "Get", err.Error()) } req, err := client.GetPreparer(ctx, resourceGroupName, solutionName, aggregatedAlertName) if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsAggregatedAlertClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsAggregatedAlertClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsAggregatedAlertClient", "Get", resp, "Failure responding to request") } return } // GetPreparer prepares the Get request. -func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) GetPreparer(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string) (*http.Request, error) { +func (client IotSecuritySolutionsAnalyticsAggregatedAlertClient) GetPreparer(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "aggregatedAlertName": autorest.Encode("path", aggregatedAlertName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -205,14 +206,14 @@ func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) GetPreparer(ctx // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) GetSender(req *http.Request) (*http.Response, error) { +func (client IotSecuritySolutionsAnalyticsAggregatedAlertClient) GetSender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) return autorest.SendWithSender(client, req, sd...) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) GetResponder(resp *http.Response) (result IoTSecurityAggregatedAlert, err error) { +func (client IotSecuritySolutionsAnalyticsAggregatedAlertClient) GetResponder(resp *http.Response) (result IoTSecurityAggregatedAlert, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -222,3 +223,133 @@ func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) GetResponder(re result.Response = autorest.Response{Response: resp} return } + +// List use this method to get the aggregated alert list of yours IoT Security solution. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// solutionName - the name of the IoT Security solution. +// top - number of results to retrieve. +func (client IotSecuritySolutionsAnalyticsAggregatedAlertClient) List(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (result IoTSecurityAggregatedAlertListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionsAnalyticsAggregatedAlertClient.List") + defer func() { + sc := -1 + if result.itsaal.Response.Response != nil { + sc = result.itsaal.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.IotSecuritySolutionsAnalyticsAggregatedAlertClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, solutionName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsAggregatedAlertClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.itsaal.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsAggregatedAlertClient", "List", resp, "Failure sending request") + return + } + + result.itsaal, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsAggregatedAlertClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client IotSecuritySolutionsAnalyticsAggregatedAlertClient) ListPreparer(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "solutionName": autorest.Encode("path", solutionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client IotSecuritySolutionsAnalyticsAggregatedAlertClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client IotSecuritySolutionsAnalyticsAggregatedAlertClient) ListResponder(resp *http.Response) (result IoTSecurityAggregatedAlertList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client IotSecuritySolutionsAnalyticsAggregatedAlertClient) listNextResults(ctx context.Context, lastResults IoTSecurityAggregatedAlertList) (result IoTSecurityAggregatedAlertList, err error) { + req, err := lastResults.ioTSecurityAggregatedAlertListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsAggregatedAlertClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsAggregatedAlertClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsAggregatedAlertClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client IotSecuritySolutionsAnalyticsAggregatedAlertClient) ListComplete(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (result IoTSecurityAggregatedAlertListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionsAnalyticsAggregatedAlertClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, solutionName, top) + return +} diff --git a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsaggregatedalerts.go b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsaggregatedalerts.go deleted file mode 100644 index 1cc08c1c364a..000000000000 --- a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsaggregatedalerts.go +++ /dev/null @@ -1,175 +0,0 @@ -package security - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IoTSecuritySolutionsAnalyticsAggregatedAlertsClient is the API spec for Microsoft.Security (Azure Security Center) -// resource provider -type IoTSecuritySolutionsAnalyticsAggregatedAlertsClient struct { - BaseClient -} - -// NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClient creates an instance of the -// IoTSecuritySolutionsAnalyticsAggregatedAlertsClient client. -func NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsAggregatedAlertsClient { - return NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) -} - -// NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClientWithBaseURI creates an instance of the -// IoTSecuritySolutionsAnalyticsAggregatedAlertsClient client. -func NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsAggregatedAlertsClient { - return IoTSecuritySolutionsAnalyticsAggregatedAlertsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} -} - -// List security Analytics of a security solution -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// solutionName - the solution manager name -// top - the number of results to retrieve. -func (client IoTSecuritySolutionsAnalyticsAggregatedAlertsClient) List(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (result IoTSecurityAggregatedAlertListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsAggregatedAlertsClient.List") - defer func() { - sc := -1 - if result.itsaal.Response.Response != nil { - sc = result.itsaal.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("security.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, solutionName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.itsaal.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient", "List", resp, "Failure sending request") - return - } - - result.itsaal, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client IoTSecuritySolutionsAnalyticsAggregatedAlertsClient) ListPreparer(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "solutionName": autorest.Encode("path", solutionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client IoTSecuritySolutionsAnalyticsAggregatedAlertsClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client IoTSecuritySolutionsAnalyticsAggregatedAlertsClient) ListResponder(resp *http.Response) (result IoTSecurityAggregatedAlertList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client IoTSecuritySolutionsAnalyticsAggregatedAlertsClient) listNextResults(ctx context.Context, lastResults IoTSecurityAggregatedAlertList) (result IoTSecurityAggregatedAlertList, err error) { - req, err := lastResults.ioTSecurityAggregatedAlertListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client IoTSecuritySolutionsAnalyticsAggregatedAlertsClient) ListComplete(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (result IoTSecurityAggregatedAlertListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsAggregatedAlertsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, solutionName, top) - return -} diff --git a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsrecommendation.go b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsrecommendation.go index ead902a83498..e48bacc087da 100644 --- a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsrecommendation.go +++ b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsrecommendation.go @@ -26,33 +26,34 @@ import ( "net/http" ) -// IoTSecuritySolutionsAnalyticsRecommendationClient is the API spec for Microsoft.Security (Azure Security Center) +// IotSecuritySolutionsAnalyticsRecommendationClient is the API spec for Microsoft.Security (Azure Security Center) // resource provider -type IoTSecuritySolutionsAnalyticsRecommendationClient struct { +type IotSecuritySolutionsAnalyticsRecommendationClient struct { BaseClient } -// NewIoTSecuritySolutionsAnalyticsRecommendationClient creates an instance of the -// IoTSecuritySolutionsAnalyticsRecommendationClient client. -func NewIoTSecuritySolutionsAnalyticsRecommendationClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsRecommendationClient { - return NewIoTSecuritySolutionsAnalyticsRecommendationClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +// NewIotSecuritySolutionsAnalyticsRecommendationClient creates an instance of the +// IotSecuritySolutionsAnalyticsRecommendationClient client. +func NewIotSecuritySolutionsAnalyticsRecommendationClient(subscriptionID string, ascLocation string) IotSecuritySolutionsAnalyticsRecommendationClient { + return NewIotSecuritySolutionsAnalyticsRecommendationClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) } -// NewIoTSecuritySolutionsAnalyticsRecommendationClientWithBaseURI creates an instance of the -// IoTSecuritySolutionsAnalyticsRecommendationClient client. -func NewIoTSecuritySolutionsAnalyticsRecommendationClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsRecommendationClient { - return IoTSecuritySolutionsAnalyticsRecommendationClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +// NewIotSecuritySolutionsAnalyticsRecommendationClientWithBaseURI creates an instance of the +// IotSecuritySolutionsAnalyticsRecommendationClient client. +func NewIotSecuritySolutionsAnalyticsRecommendationClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IotSecuritySolutionsAnalyticsRecommendationClient { + return IotSecuritySolutionsAnalyticsRecommendationClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} } -// Get security Analytics of a security solution +// Get use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This +// aggregation is performed by recommendation name. // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. The name is case // insensitive. -// solutionName - the solution manager name -// aggregatedRecommendationName - identifier of the aggregated recommendation -func (client IoTSecuritySolutionsAnalyticsRecommendationClient) Get(ctx context.Context, resourceGroupName string, solutionName string, aggregatedRecommendationName string) (result IoTSecurityAggregatedRecommendation, err error) { +// solutionName - the name of the IoT Security solution. +// aggregatedRecommendationName - name of the recommendation aggregated for this query. +func (client IotSecuritySolutionsAnalyticsRecommendationClient) Get(ctx context.Context, resourceGroupName string, solutionName string, aggregatedRecommendationName string) (result IoTSecurityAggregatedRecommendation, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsRecommendationClient.Get") + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionsAnalyticsRecommendationClient.Get") defer func() { sc := -1 if result.Response.Response != nil { @@ -68,32 +69,32 @@ func (client IoTSecuritySolutionsAnalyticsRecommendationClient) Get(ctx context. Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("security.IoTSecuritySolutionsAnalyticsRecommendationClient", "Get", err.Error()) + return result, validation.NewError("security.IotSecuritySolutionsAnalyticsRecommendationClient", "Get", err.Error()) } req, err := client.GetPreparer(ctx, resourceGroupName, solutionName, aggregatedRecommendationName) if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsRecommendationClient", "Get", nil, "Failure preparing request") return } resp, err := client.GetSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsRecommendationClient", "Get", resp, "Failure sending request") return } result, err = client.GetResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsRecommendationClient", "Get", resp, "Failure responding to request") } return } // GetPreparer prepares the Get request. -func (client IoTSecuritySolutionsAnalyticsRecommendationClient) GetPreparer(ctx context.Context, resourceGroupName string, solutionName string, aggregatedRecommendationName string) (*http.Request, error) { +func (client IotSecuritySolutionsAnalyticsRecommendationClient) GetPreparer(ctx context.Context, resourceGroupName string, solutionName string, aggregatedRecommendationName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "aggregatedRecommendationName": autorest.Encode("path", aggregatedRecommendationName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -116,14 +117,14 @@ func (client IoTSecuritySolutionsAnalyticsRecommendationClient) GetPreparer(ctx // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client IoTSecuritySolutionsAnalyticsRecommendationClient) GetSender(req *http.Request) (*http.Response, error) { +func (client IotSecuritySolutionsAnalyticsRecommendationClient) GetSender(req *http.Request) (*http.Response, error) { sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) return autorest.SendWithSender(client, req, sd...) } // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client IoTSecuritySolutionsAnalyticsRecommendationClient) GetResponder(resp *http.Response) (result IoTSecurityAggregatedRecommendation, err error) { +func (client IotSecuritySolutionsAnalyticsRecommendationClient) GetResponder(resp *http.Response) (result IoTSecurityAggregatedRecommendation, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -133,3 +134,134 @@ func (client IoTSecuritySolutionsAnalyticsRecommendationClient) GetResponder(res result.Response = autorest.Response{Response: resp} return } + +// List use this method to get the list of aggregated security analytics recommendations of yours IoT Security +// solution. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// solutionName - the name of the IoT Security solution. +// top - number of results to retrieve. +func (client IotSecuritySolutionsAnalyticsRecommendationClient) List(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (result IoTSecurityAggregatedRecommendationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionsAnalyticsRecommendationClient.List") + defer func() { + sc := -1 + if result.itsarl.Response.Response != nil { + sc = result.itsarl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.IotSecuritySolutionsAnalyticsRecommendationClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, solutionName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsRecommendationClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.itsarl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsRecommendationClient", "List", resp, "Failure sending request") + return + } + + result.itsarl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsRecommendationClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client IotSecuritySolutionsAnalyticsRecommendationClient) ListPreparer(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "solutionName": autorest.Encode("path", solutionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client IotSecuritySolutionsAnalyticsRecommendationClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client IotSecuritySolutionsAnalyticsRecommendationClient) ListResponder(resp *http.Response) (result IoTSecurityAggregatedRecommendationList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client IotSecuritySolutionsAnalyticsRecommendationClient) listNextResults(ctx context.Context, lastResults IoTSecurityAggregatedRecommendationList) (result IoTSecurityAggregatedRecommendationList, err error) { + req, err := lastResults.ioTSecurityAggregatedRecommendationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsRecommendationClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsRecommendationClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionsAnalyticsRecommendationClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client IotSecuritySolutionsAnalyticsRecommendationClient) ListComplete(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (result IoTSecurityAggregatedRecommendationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionsAnalyticsRecommendationClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, solutionName, top) + return +} diff --git a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsrecommendations.go b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsrecommendations.go deleted file mode 100644 index 0a4201655260..000000000000 --- a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsrecommendations.go +++ /dev/null @@ -1,175 +0,0 @@ -package security - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IoTSecuritySolutionsAnalyticsRecommendationsClient is the API spec for Microsoft.Security (Azure Security Center) -// resource provider -type IoTSecuritySolutionsAnalyticsRecommendationsClient struct { - BaseClient -} - -// NewIoTSecuritySolutionsAnalyticsRecommendationsClient creates an instance of the -// IoTSecuritySolutionsAnalyticsRecommendationsClient client. -func NewIoTSecuritySolutionsAnalyticsRecommendationsClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsRecommendationsClient { - return NewIoTSecuritySolutionsAnalyticsRecommendationsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) -} - -// NewIoTSecuritySolutionsAnalyticsRecommendationsClientWithBaseURI creates an instance of the -// IoTSecuritySolutionsAnalyticsRecommendationsClient client. -func NewIoTSecuritySolutionsAnalyticsRecommendationsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsRecommendationsClient { - return IoTSecuritySolutionsAnalyticsRecommendationsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} -} - -// List security Analytics of a security solution -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// solutionName - the solution manager name -// top - the number of results to retrieve. -func (client IoTSecuritySolutionsAnalyticsRecommendationsClient) List(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (result IoTSecurityAggregatedRecommendationListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsRecommendationsClient.List") - defer func() { - sc := -1 - if result.itsarl.Response.Response != nil { - sc = result.itsarl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("security.IoTSecuritySolutionsAnalyticsRecommendationsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, solutionName, top) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.itsarl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationsClient", "List", resp, "Failure sending request") - return - } - - result.itsarl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client IoTSecuritySolutionsAnalyticsRecommendationsClient) ListPreparer(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "solutionName": autorest.Encode("path", solutionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if top != nil { - queryParameters["$top"] = autorest.Encode("query", *top) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client IoTSecuritySolutionsAnalyticsRecommendationsClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client IoTSecuritySolutionsAnalyticsRecommendationsClient) ListResponder(resp *http.Response) (result IoTSecurityAggregatedRecommendationList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client IoTSecuritySolutionsAnalyticsRecommendationsClient) listNextResults(ctx context.Context, lastResults IoTSecurityAggregatedRecommendationList) (result IoTSecurityAggregatedRecommendationList, err error) { - req, err := lastResults.ioTSecurityAggregatedRecommendationListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client IoTSecuritySolutionsAnalyticsRecommendationsClient) ListComplete(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (result IoTSecurityAggregatedRecommendationListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsRecommendationsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, solutionName, top) - return -} diff --git a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsresourcegroup.go b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsresourcegroup.go deleted file mode 100644 index a2214a0bdf94..000000000000 --- a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsresourcegroup.go +++ /dev/null @@ -1,173 +0,0 @@ -package security - -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// IoTSecuritySolutionsResourceGroupClient is the API spec for Microsoft.Security (Azure Security Center) resource -// provider -type IoTSecuritySolutionsResourceGroupClient struct { - BaseClient -} - -// NewIoTSecuritySolutionsResourceGroupClient creates an instance of the IoTSecuritySolutionsResourceGroupClient -// client. -func NewIoTSecuritySolutionsResourceGroupClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsResourceGroupClient { - return NewIoTSecuritySolutionsResourceGroupClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) -} - -// NewIoTSecuritySolutionsResourceGroupClientWithBaseURI creates an instance of the -// IoTSecuritySolutionsResourceGroupClient client. -func NewIoTSecuritySolutionsResourceGroupClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsResourceGroupClient { - return IoTSecuritySolutionsResourceGroupClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} -} - -// List list of security solutions -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// filter - filter the Security Solution with OData syntax. supporting filter by iotHubs -func (client IoTSecuritySolutionsResourceGroupClient) List(ctx context.Context, resourceGroupName string, filter string) (result IoTSecuritySolutionsListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsResourceGroupClient.List") - defer func() { - sc := -1 - if result.itssl.Response.Response != nil { - sc = result.itssl.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("security.IoTSecuritySolutionsResourceGroupClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsResourceGroupClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.itssl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsResourceGroupClient", "List", resp, "Failure sending request") - return - } - - result.itssl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsResourceGroupClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client IoTSecuritySolutionsResourceGroupClient) ListPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client IoTSecuritySolutionsResourceGroupClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client IoTSecuritySolutionsResourceGroupClient) ListResponder(resp *http.Response) (result IoTSecuritySolutionsList, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client IoTSecuritySolutionsResourceGroupClient) listNextResults(ctx context.Context, lastResults IoTSecuritySolutionsList) (result IoTSecuritySolutionsList, err error) { - req, err := lastResults.ioTSecuritySolutionsListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsResourceGroupClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsResourceGroupClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsResourceGroupClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client IoTSecuritySolutionsResourceGroupClient) ListComplete(ctx context.Context, resourceGroupName string, filter string) (result IoTSecuritySolutionsListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsResourceGroupClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, filter) - return -} diff --git a/services/preview/security/mgmt/v3.0/security/models.go b/services/preview/security/mgmt/v3.0/security/models.go index 5e32802273f0..1f0482eb5644 100644 --- a/services/preview/security/mgmt/v3.0/security/models.go +++ b/services/preview/security/mgmt/v3.0/security/models.go @@ -95,6 +95,25 @@ func PossibleAlertsToAdminsValues() []AlertsToAdmins { return []AlertsToAdmins{AlertsToAdminsOff, AlertsToAdminsOn} } +// AssessedResourceType enumerates the values for assessed resource type. +type AssessedResourceType string + +const ( + // AssessedResourceTypeAdditionalData ... + AssessedResourceTypeAdditionalData AssessedResourceType = "AdditionalData" + // AssessedResourceTypeContainerRegistryVulnerability ... + AssessedResourceTypeContainerRegistryVulnerability AssessedResourceType = "ContainerRegistryVulnerability" + // AssessedResourceTypeServerVulnerabilityAssessment ... + AssessedResourceTypeServerVulnerabilityAssessment AssessedResourceType = "ServerVulnerabilityAssessment" + // AssessedResourceTypeSQLServerVulnerability ... + AssessedResourceTypeSQLServerVulnerability AssessedResourceType = "SqlServerVulnerability" +) + +// PossibleAssessedResourceTypeValues returns an array of possible values for the AssessedResourceType const type. +func PossibleAssessedResourceTypeValues() []AssessedResourceType { + return []AssessedResourceType{AssessedResourceTypeAdditionalData, AssessedResourceTypeContainerRegistryVulnerability, AssessedResourceTypeServerVulnerabilityAssessment, AssessedResourceTypeSQLServerVulnerability} +} + // AutoProvision enumerates the values for auto provision. type AutoProvision string @@ -209,11 +228,13 @@ const ( Audit EnforcementMode = "Audit" // Enforce ... Enforce EnforcementMode = "Enforce" + // None ... + None EnforcementMode = "None" ) // PossibleEnforcementModeValues returns an array of possible values for the EnforcementMode const type. func PossibleEnforcementModeValues() []EnforcementMode { - return []EnforcementMode{Audit, Enforce} + return []EnforcementMode{Audit, Enforce, None} } // EnforcementMode1 enumerates the values for enforcement mode 1. @@ -224,11 +245,47 @@ const ( EnforcementMode1Audit EnforcementMode1 = "Audit" // EnforcementMode1Enforce ... EnforcementMode1Enforce EnforcementMode1 = "Enforce" + // EnforcementMode1None ... + EnforcementMode1None EnforcementMode1 = "None" ) // PossibleEnforcementMode1Values returns an array of possible values for the EnforcementMode1 const type. func PossibleEnforcementMode1Values() []EnforcementMode1 { - return []EnforcementMode1{EnforcementMode1Audit, EnforcementMode1Enforce} + return []EnforcementMode1{EnforcementMode1Audit, EnforcementMode1Enforce, EnforcementMode1None} +} + +// Exe enumerates the values for exe. +type Exe string + +const ( + // ExeAudit ... + ExeAudit Exe = "Audit" + // ExeEnforce ... + ExeEnforce Exe = "Enforce" + // ExeNone ... + ExeNone Exe = "None" +) + +// PossibleExeValues returns an array of possible values for the Exe const type. +func PossibleExeValues() []Exe { + return []Exe{ExeAudit, ExeEnforce, ExeNone} +} + +// Executable enumerates the values for executable. +type Executable string + +const ( + // ExecutableAudit ... + ExecutableAudit Executable = "Audit" + // ExecutableEnforce ... + ExecutableEnforce Executable = "Enforce" + // ExecutableNone ... + ExecutableNone Executable = "None" +) + +// PossibleExecutableValues returns an array of possible values for the Executable const type. +func PossibleExecutableValues() []Executable { + return []Executable{ExecutableAudit, ExecutableEnforce, ExecutableNone} } // ExportData enumerates the values for export data. @@ -284,23 +341,23 @@ func PossibleFamilyValues() []Family { type FileType string const ( - // Dll ... - Dll FileType = "Dll" - // Exe ... - Exe FileType = "Exe" - // Executable ... - Executable FileType = "Executable" - // Msi ... - Msi FileType = "Msi" - // Script ... - Script FileType = "Script" - // Unknown ... - Unknown FileType = "Unknown" + // FileTypeDll ... + FileTypeDll FileType = "Dll" + // FileTypeExe ... + FileTypeExe FileType = "Exe" + // FileTypeExecutable ... + FileTypeExecutable FileType = "Executable" + // FileTypeMsi ... + FileTypeMsi FileType = "Msi" + // FileTypeScript ... + FileTypeScript FileType = "Script" + // FileTypeUnknown ... + FileTypeUnknown FileType = "Unknown" ) // PossibleFileTypeValues returns an array of possible values for the FileType const type. func PossibleFileTypeValues() []FileType { - return []FileType{Dll, Exe, Executable, Msi, Script, Unknown} + return []FileType{FileTypeDll, FileTypeExe, FileTypeExecutable, FileTypeMsi, FileTypeScript, FileTypeUnknown} } // Issue enumerates the values for issue. @@ -345,6 +402,23 @@ func PossibleKindEnumValues() []KindEnum { return []KindEnum{KindAAD, KindATA, KindCEF, KindExternalSecuritySolution} } +// Msi enumerates the values for msi. +type Msi string + +const ( + // MsiAudit ... + MsiAudit Msi = "Audit" + // MsiEnforce ... + MsiEnforce Msi = "Enforce" + // MsiNone ... + MsiNone Msi = "None" +) + +// PossibleMsiValues returns an array of possible values for the Msi const type. +func PossibleMsiValues() []Msi { + return []Msi{MsiAudit, MsiEnforce, MsiNone} +} + // PricingTier enumerates the values for pricing tier. type PricingTier string @@ -559,6 +633,23 @@ func PossibleResourceStatusValues() []ResourceStatus { return []ResourceStatus{Healthy, NotApplicable, NotHealthy, OffByPolicy} } +// Script enumerates the values for script. +type Script string + +const ( + // ScriptAudit ... + ScriptAudit Script = "Audit" + // ScriptEnforce ... + ScriptEnforce Script = "Enforce" + // ScriptNone ... + ScriptNone Script = "None" +) + +// PossibleScriptValues returns an array of possible values for the Script const type. +func PossibleScriptValues() []Script { + return []Script{ScriptAudit, ScriptEnforce, ScriptNone} +} + // SettingKind enumerates the values for setting kind. type SettingKind string @@ -574,6 +665,23 @@ func PossibleSettingKindValues() []SettingKind { return []SettingKind{SettingKindAlertSuppressionSetting, SettingKindDataExportSetting} } +// Severity enumerates the values for severity. +type Severity string + +const ( + // SeverityHigh ... + SeverityHigh Severity = "High" + // SeverityLow ... + SeverityLow Severity = "Low" + // SeverityMedium ... + SeverityMedium Severity = "Medium" +) + +// PossibleSeverityValues returns an array of possible values for the Severity const type. +func PossibleSeverityValues() []Severity { + return []Severity{SeverityHigh, SeverityLow, SeverityMedium} +} + // SolutionStatus enumerates the values for solution status. type SolutionStatus string @@ -589,25 +697,42 @@ func PossibleSolutionStatusValues() []SolutionStatus { return []SolutionStatus{SolutionStatusDisabled, SolutionStatusEnabled} } +// Source enumerates the values for source. +type Source string + +const ( + // SourceAws ... + SourceAws Source = "Aws" + // SourceAzure ... + SourceAzure Source = "Azure" + // SourceResourceDetails ... + SourceResourceDetails Source = "ResourceDetails" +) + +// PossibleSourceValues returns an array of possible values for the Source const type. +func PossibleSourceValues() []Source { + return []Source{SourceAws, SourceAzure, SourceResourceDetails} +} + // SourceSystem enumerates the values for source system. type SourceSystem string const ( - // AzureAppLocker ... - AzureAppLocker SourceSystem = "Azure_AppLocker" - // AzureAuditD ... - AzureAuditD SourceSystem = "Azure_AuditD" - // NonAzureAppLocker ... - NonAzureAppLocker SourceSystem = "NonAzure_AppLocker" - // NonAzureAuditD ... - NonAzureAuditD SourceSystem = "NonAzure_AuditD" - // None ... - None SourceSystem = "None" + // SourceSystemAzureAppLocker ... + SourceSystemAzureAppLocker SourceSystem = "Azure_AppLocker" + // SourceSystemAzureAuditD ... + SourceSystemAzureAuditD SourceSystem = "Azure_AuditD" + // SourceSystemNonAzureAppLocker ... + SourceSystemNonAzureAppLocker SourceSystem = "NonAzure_AppLocker" + // SourceSystemNonAzureAuditD ... + SourceSystemNonAzureAuditD SourceSystem = "NonAzure_AuditD" + // SourceSystemNone ... + SourceSystemNone SourceSystem = "None" ) // PossibleSourceSystemValues returns an array of possible values for the SourceSystem const type. func PossibleSourceSystemValues() []SourceSystem { - return []SourceSystem{AzureAppLocker, AzureAuditD, NonAzureAppLocker, NonAzureAuditD, None} + return []SourceSystem{SourceSystemAzureAppLocker, SourceSystemAzureAuditD, SourceSystemNonAzureAppLocker, SourceSystemNonAzureAuditD, SourceSystemNone} } // State enumerates the values for state. @@ -662,6 +787,23 @@ func PossibleStatusReasonValues() []StatusReason { return []StatusReason{Expired, NewerRequestInitiated, UserRequested} } +// SubAssessmentStatusCode enumerates the values for sub assessment status code. +type SubAssessmentStatusCode string + +const ( + // SubAssessmentStatusCodeHealthy The resource is healthy + SubAssessmentStatusCodeHealthy SubAssessmentStatusCode = "Healthy" + // SubAssessmentStatusCodeNotApplicable Assessment for this resource did not happen + SubAssessmentStatusCodeNotApplicable SubAssessmentStatusCode = "NotApplicable" + // SubAssessmentStatusCodeUnhealthy The resource has a security issue that needs to be addressed + SubAssessmentStatusCodeUnhealthy SubAssessmentStatusCode = "Unhealthy" +) + +// PossibleSubAssessmentStatusCodeValues returns an array of possible values for the SubAssessmentStatusCode const type. +func PossibleSubAssessmentStatusCodeValues() []SubAssessmentStatusCode { + return []SubAssessmentStatusCode{SubAssessmentStatusCodeHealthy, SubAssessmentStatusCodeNotApplicable, SubAssessmentStatusCodeUnhealthy} +} + // Type enumerates the values for type. type Type string @@ -685,6 +827,21 @@ func PossibleTypeValues() []Type { return []Type{BinarySignature, File, FileHash, ProductSignature, PublisherSignature, VersionAndAboveSignature} } +// ValueType enumerates the values for value type. +type ValueType string + +const ( + // IPCidr An IP range in CIDR format (e.g. '192.168.0.1/8'). + IPCidr ValueType = "IpCidr" + // String Any string value. + String ValueType = "String" +) + +// PossibleValueTypeValues returns an array of possible values for the ValueType const type. +func PossibleValueTypeValues() []ValueType { + return []ValueType{IPCidr, String} +} + // AadConnectivityState1 describes an Azure resource with kind type AadConnectivityState1 struct { // ConnectivityState - Possible values include: 'Discovered', 'NotLicensed', 'Connected' @@ -754,6 +911,100 @@ type AadSolutionProperties struct { ConnectivityState AadConnectivityState `json:"connectivityState,omitempty"` } +// BasicAdditionalData details of the sub-assessment +type BasicAdditionalData interface { + AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) + AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) + AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) + AsAdditionalData() (*AdditionalData, bool) +} + +// AdditionalData details of the sub-assessment +type AdditionalData struct { + // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' + AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` +} + +func unmarshalBasicAdditionalData(body []byte) (BasicAdditionalData, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["assessedResourceType"] { + case string(AssessedResourceTypeSQLServerVulnerability): + var ssvp SQLServerVulnerabilityProperties + err := json.Unmarshal(body, &ssvp) + return ssvp, err + case string(AssessedResourceTypeContainerRegistryVulnerability): + var crvp ContainerRegistryVulnerabilityProperties + err := json.Unmarshal(body, &crvp) + return crvp, err + case string(AssessedResourceTypeServerVulnerabilityAssessment): + var svp ServerVulnerabilityProperties + err := json.Unmarshal(body, &svp) + return svp, err + default: + var ad AdditionalData + err := json.Unmarshal(body, &ad) + return ad, err + } +} +func unmarshalBasicAdditionalDataArray(body []byte) ([]BasicAdditionalData, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + adArray := make([]BasicAdditionalData, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ad, err := unmarshalBasicAdditionalData(*rawMessage) + if err != nil { + return nil, err + } + adArray[index] = ad + } + return adArray, nil +} + +// MarshalJSON is the custom marshaler for AdditionalData. +func (ad AdditionalData) MarshalJSON() ([]byte, error) { + ad.AssessedResourceType = AssessedResourceTypeAdditionalData + objectMap := make(map[string]interface{}) + if ad.AssessedResourceType != "" { + objectMap["assessedResourceType"] = ad.AssessedResourceType + } + return json.Marshal(objectMap) +} + +// AsSQLServerVulnerabilityProperties is the BasicAdditionalData implementation for AdditionalData. +func (ad AdditionalData) AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsContainerRegistryVulnerabilityProperties is the BasicAdditionalData implementation for AdditionalData. +func (ad AdditionalData) AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) { + return nil, false +} + +// AsServerVulnerabilityProperties is the BasicAdditionalData implementation for AdditionalData. +func (ad AdditionalData) AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsAdditionalData is the BasicAdditionalData implementation for AdditionalData. +func (ad AdditionalData) AsAdditionalData() (*AdditionalData, bool) { + return &ad, true +} + +// AsBasicAdditionalData is the BasicAdditionalData implementation for AdditionalData. +func (ad AdditionalData) AsBasicAdditionalData() (BasicAdditionalData, bool) { + return &ad, true +} + // AdvancedThreatProtectionProperties the Advanced Threat Protection settings. type AdvancedThreatProtectionProperties struct { // IsEnabled - Indicates whether Advanced Threat Protection is enabled. @@ -1411,6 +1662,23 @@ type AllowedConnectionsResourceProperties struct { ConnectableResources *[]ConnectableResource `json:"connectableResources,omitempty"` } +// AllowlistCustomAlertRule a custom alert rule that checks if a value (depends on the custom alert type) +// is allowed. +type AllowlistCustomAlertRule struct { + // AllowlistValues - The values to allow. The format of the values depends on the rule type. + AllowlistValues *[]string `json:"allowlistValues,omitempty"` + // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'IPCidr', 'String' + ValueType ValueType `json:"valueType,omitempty"` + // DisplayName - READ-ONLY; The display name of the custom alert. + DisplayName *string `json:"displayName,omitempty"` + // Description - READ-ONLY; The description of the custom alert. + Description *string `json:"description,omitempty"` + // IsEnabled - Status of the custom alert. + IsEnabled *bool `json:"isEnabled,omitempty"` + // RuleType - The type of the custom alert rule. + RuleType *string `json:"ruleType,omitempty"` +} + // AppWhitelistingGroup ... type AppWhitelistingGroup struct { autorest.Response `json:"-"` @@ -1497,14 +1765,15 @@ func (awg *AppWhitelistingGroup) UnmarshalJSON(body []byte) error { // AppWhitelistingGroupData represents a VM/server group and set of rules that are Recommended by Azure // Security Center to be allowed type AppWhitelistingGroupData struct { - // EnforcementMode - Possible values include: 'Audit', 'Enforce' + // EnforcementMode - Possible values include: 'Audit', 'Enforce', 'None' EnforcementMode EnforcementMode `json:"enforcementMode,omitempty"` + ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` // ConfigurationStatus - Possible values include: 'ConfigurationStatus2Configured', 'ConfigurationStatus2NotConfigured', 'ConfigurationStatus2InProgress', 'ConfigurationStatus2Failed', 'ConfigurationStatus2NoStatus' ConfigurationStatus ConfigurationStatus2 `json:"configurationStatus,omitempty"` // RecommendationStatus - Possible values include: 'RecommendationStatusRecommended', 'RecommendationStatusNotRecommended', 'RecommendationStatusNotAvailable', 'RecommendationStatusNoStatus' RecommendationStatus RecommendationStatus `json:"recommendationStatus,omitempty"` Issues *[]AppWhitelistingIssueSummary `json:"issues,omitempty"` - // SourceSystem - Possible values include: 'AzureAppLocker', 'AzureAuditD', 'NonAzureAppLocker', 'NonAzureAuditD', 'None' + // SourceSystem - Possible values include: 'SourceSystemAzureAppLocker', 'SourceSystemAzureAuditD', 'SourceSystemNonAzureAppLocker', 'SourceSystemNonAzureAuditD', 'SourceSystemNone' SourceSystem SourceSystem `json:"sourceSystem,omitempty"` VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` @@ -1527,8 +1796,10 @@ type AppWhitelistingIssueSummary struct { // AppWhitelistingPutGroupData the altered data of the recommended VM/server group policy type AppWhitelistingPutGroupData struct { - // EnforcementMode - Possible values include: 'EnforcementMode1Audit', 'EnforcementMode1Enforce' - EnforcementMode EnforcementMode1 `json:"enforcementMode,omitempty"` + // EnforcementMode - The enforcement mode of the group. Can also be defined per collection type by using ProtectionMode. Possible values include: 'EnforcementMode1Audit', 'EnforcementMode1Enforce', 'EnforcementMode1None' + EnforcementMode EnforcementMode1 `json:"enforcementMode,omitempty"` + // ProtectionMode - The protection mode of the group per collection type. Can also be defined for all collection types by using EnforcementMode + ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` } @@ -2064,6 +2335,84 @@ type AutoProvisioningSettingProperties struct { AutoProvision AutoProvision `json:"autoProvision,omitempty"` } +// AwsResourceDetails details of the resource that was assessed +type AwsResourceDetails struct { + // AccountID - READ-ONLY; AWS account ID + AccountID *string `json:"accountId,omitempty"` + // AwsResourceID - READ-ONLY; AWS resource ID. can be ARN or other + AwsResourceID *string `json:"awsResourceId,omitempty"` + // Source - Possible values include: 'SourceResourceDetails', 'SourceAzure', 'SourceAws' + Source Source `json:"source,omitempty"` +} + +// MarshalJSON is the custom marshaler for AwsResourceDetails. +func (ard AwsResourceDetails) MarshalJSON() ([]byte, error) { + ard.Source = SourceAws + objectMap := make(map[string]interface{}) + if ard.Source != "" { + objectMap["source"] = ard.Source + } + return json.Marshal(objectMap) +} + +// AsAzureResourceDetails is the BasicResourceDetails implementation for AwsResourceDetails. +func (ard AwsResourceDetails) AsAzureResourceDetails() (*AzureResourceDetails, bool) { + return nil, false +} + +// AsAwsResourceDetails is the BasicResourceDetails implementation for AwsResourceDetails. +func (ard AwsResourceDetails) AsAwsResourceDetails() (*AwsResourceDetails, bool) { + return &ard, true +} + +// AsResourceDetails is the BasicResourceDetails implementation for AwsResourceDetails. +func (ard AwsResourceDetails) AsResourceDetails() (*ResourceDetails, bool) { + return nil, false +} + +// AsBasicResourceDetails is the BasicResourceDetails implementation for AwsResourceDetails. +func (ard AwsResourceDetails) AsBasicResourceDetails() (BasicResourceDetails, bool) { + return &ard, true +} + +// AzureResourceDetails details of the resource that was assessed +type AzureResourceDetails struct { + // ID - READ-ONLY; Azure resource ID of the assessed resource + ID *string `json:"id,omitempty"` + // Source - Possible values include: 'SourceResourceDetails', 'SourceAzure', 'SourceAws' + Source Source `json:"source,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureResourceDetails. +func (ard AzureResourceDetails) MarshalJSON() ([]byte, error) { + ard.Source = SourceAzure + objectMap := make(map[string]interface{}) + if ard.Source != "" { + objectMap["source"] = ard.Source + } + return json.Marshal(objectMap) +} + +// AsAzureResourceDetails is the BasicResourceDetails implementation for AzureResourceDetails. +func (ard AzureResourceDetails) AsAzureResourceDetails() (*AzureResourceDetails, bool) { + return &ard, true +} + +// AsAwsResourceDetails is the BasicResourceDetails implementation for AzureResourceDetails. +func (ard AzureResourceDetails) AsAwsResourceDetails() (*AwsResourceDetails, bool) { + return nil, false +} + +// AsResourceDetails is the BasicResourceDetails implementation for AzureResourceDetails. +func (ard AzureResourceDetails) AsResourceDetails() (*ResourceDetails, bool) { + return nil, false +} + +// AsBasicResourceDetails is the BasicResourceDetails implementation for AzureResourceDetails. +func (ard AzureResourceDetails) AsBasicResourceDetails() (BasicResourceDetails, bool) { + return &ard, true +} + // CefExternalSecuritySolution represents a security solution which sends CEF logs to an OMS workspace type CefExternalSecuritySolution struct { Properties *CefSolutionProperties `json:"properties,omitempty"` @@ -3005,6 +3354,90 @@ type ContactProperties struct { AlertsToAdmins AlertsToAdmins `json:"alertsToAdmins,omitempty"` } +// ContainerRegistryVulnerabilityProperties additional context fields for container registry Vulnerability +// assessment +type ContainerRegistryVulnerabilityProperties struct { + // Type - READ-ONLY; Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, Information Gathered, Vulnerability + Type *string `json:"type,omitempty"` + // Cvss - READ-ONLY; Dictionary from cvss version to cvss details object + Cvss map[string]*CVSS `json:"cvss"` + // Patchable - READ-ONLY; Indicates whether a patch is available or not + Patchable *bool `json:"patchable,omitempty"` + // Cve - READ-ONLY; List of CVEs + Cve *[]CVE `json:"cve,omitempty"` + // PublishedTime - READ-ONLY; Published time + PublishedTime *date.Time `json:"publishedTime,omitempty"` + // VendorReferences - READ-ONLY + VendorReferences *[]VendorReference `json:"vendorReferences,omitempty"` + // RepositoryName - READ-ONLY; Name of the repository which the vulnerable image belongs to + RepositoryName *string `json:"repositoryName,omitempty"` + // ImageDigest - READ-ONLY; Digest of the vulnerable image + ImageDigest *string `json:"imageDigest,omitempty"` + // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' + AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) MarshalJSON() ([]byte, error) { + crvp.AssessedResourceType = AssessedResourceTypeContainerRegistryVulnerability + objectMap := make(map[string]interface{}) + if crvp.AssessedResourceType != "" { + objectMap["assessedResourceType"] = crvp.AssessedResourceType + } + return json.Marshal(objectMap) +} + +// AsSQLServerVulnerabilityProperties is the BasicAdditionalData implementation for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsContainerRegistryVulnerabilityProperties is the BasicAdditionalData implementation for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) { + return &crvp, true +} + +// AsServerVulnerabilityProperties is the BasicAdditionalData implementation for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsAdditionalData is the BasicAdditionalData implementation for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) AsAdditionalData() (*AdditionalData, bool) { + return nil, false +} + +// AsBasicAdditionalData is the BasicAdditionalData implementation for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) AsBasicAdditionalData() (BasicAdditionalData, bool) { + return &crvp, true +} + +// CustomAlertRule a custom alert rule. +type CustomAlertRule struct { + // DisplayName - READ-ONLY; The display name of the custom alert. + DisplayName *string `json:"displayName,omitempty"` + // Description - READ-ONLY; The description of the custom alert. + Description *string `json:"description,omitempty"` + // IsEnabled - Status of the custom alert. + IsEnabled *bool `json:"isEnabled,omitempty"` + // RuleType - The type of the custom alert rule. + RuleType *string `json:"ruleType,omitempty"` +} + +// CVE CVE details +type CVE struct { + // Title - READ-ONLY; CVE title + Title *string `json:"title,omitempty"` + // Link - READ-ONLY; Link url + Link *string `json:"link,omitempty"` +} + +// CVSS CVSS details +type CVSS struct { + // Base - READ-ONLY; CVSS base + Base *float64 `json:"base,omitempty"` +} + // DataExportSetting represents a data export setting type DataExportSetting struct { // DataExportSettingProperties - Data export setting data @@ -3097,31 +3530,47 @@ type DataExportSettingProperties struct { Enabled *bool `json:"enabled,omitempty"` } -// DiscoveredSecuritySolution ... -type DiscoveredSecuritySolution struct { +// DenylistCustomAlertRule a custom alert rule that checks if a value (depends on the custom alert type) is +// denied. +type DenylistCustomAlertRule struct { + // DenylistValues - The values to deny. The format of the values depends on the rule type. + DenylistValues *[]string `json:"denylistValues,omitempty"` + // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'IPCidr', 'String' + ValueType ValueType `json:"valueType,omitempty"` + // DisplayName - READ-ONLY; The display name of the custom alert. + DisplayName *string `json:"displayName,omitempty"` + // Description - READ-ONLY; The description of the custom alert. + Description *string `json:"description,omitempty"` + // IsEnabled - Status of the custom alert. + IsEnabled *bool `json:"isEnabled,omitempty"` + // RuleType - The type of the custom alert rule. + RuleType *string `json:"ruleType,omitempty"` +} + +// DeviceSecurityGroup the device security group resource +type DeviceSecurityGroup struct { autorest.Response `json:"-"` + // DeviceSecurityGroupProperties - Device Security group data + *DeviceSecurityGroupProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name Name *string `json:"name,omitempty"` // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` - // Location - READ-ONLY; Location where the resource is stored - Location *string `json:"location,omitempty"` - *DiscoveredSecuritySolutionProperties `json:"properties,omitempty"` } -// MarshalJSON is the custom marshaler for DiscoveredSecuritySolution. -func (dss DiscoveredSecuritySolution) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for DeviceSecurityGroup. +func (dsg DeviceSecurityGroup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if dss.DiscoveredSecuritySolutionProperties != nil { - objectMap["properties"] = dss.DiscoveredSecuritySolutionProperties + if dsg.DeviceSecurityGroupProperties != nil { + objectMap["properties"] = dsg.DeviceSecurityGroupProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for DiscoveredSecuritySolution struct. -func (dss *DiscoveredSecuritySolution) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for DeviceSecurityGroup struct. +func (dsg *DeviceSecurityGroup) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -3129,6 +3578,15 @@ func (dss *DiscoveredSecuritySolution) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "properties": + if v != nil { + var deviceSecurityGroupProperties DeviceSecurityGroupProperties + err = json.Unmarshal(*v, &deviceSecurityGroupProperties) + if err != nil { + return err + } + dsg.DeviceSecurityGroupProperties = &deviceSecurityGroupProperties + } case "id": if v != nil { var ID string @@ -3136,7 +3594,7 @@ func (dss *DiscoveredSecuritySolution) UnmarshalJSON(body []byte) error { if err != nil { return err } - dss.ID = &ID + dsg.ID = &ID } case "name": if v != nil { @@ -3145,7 +3603,7 @@ func (dss *DiscoveredSecuritySolution) UnmarshalJSON(body []byte) error { if err != nil { return err } - dss.Name = &name + dsg.Name = &name } case "type": if v != nil { @@ -3154,25 +3612,7 @@ func (dss *DiscoveredSecuritySolution) UnmarshalJSON(body []byte) error { if err != nil { return err } - dss.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - dss.Location = &location - } - case "properties": - if v != nil { - var discoveredSecuritySolutionProperties DiscoveredSecuritySolutionProperties - err = json.Unmarshal(*v, &discoveredSecuritySolutionProperties) - if err != nil { - return err - } - dss.DiscoveredSecuritySolutionProperties = &discoveredSecuritySolutionProperties + dsg.Type = &typeVar } } } @@ -3180,26 +3620,26 @@ func (dss *DiscoveredSecuritySolution) UnmarshalJSON(body []byte) error { return nil } -// DiscoveredSecuritySolutionList ... -type DiscoveredSecuritySolutionList struct { +// DeviceSecurityGroupList list of device security groups +type DeviceSecurityGroupList struct { autorest.Response `json:"-"` - Value *[]DiscoveredSecuritySolution `json:"value,omitempty"` + // Value - List of device security group objects + Value *[]DeviceSecurityGroup `json:"value,omitempty"` // NextLink - READ-ONLY; The URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` } -// DiscoveredSecuritySolutionListIterator provides access to a complete listing of -// DiscoveredSecuritySolution values. -type DiscoveredSecuritySolutionListIterator struct { +// DeviceSecurityGroupListIterator provides access to a complete listing of DeviceSecurityGroup values. +type DeviceSecurityGroupListIterator struct { i int - page DiscoveredSecuritySolutionListPage + page DeviceSecurityGroupListPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *DiscoveredSecuritySolutionListIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *DeviceSecurityGroupListIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiscoveredSecuritySolutionListIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/DeviceSecurityGroupListIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -3224,62 +3664,62 @@ func (iter *DiscoveredSecuritySolutionListIterator) NextWithContext(ctx context. // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *DiscoveredSecuritySolutionListIterator) Next() error { +func (iter *DeviceSecurityGroupListIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter DiscoveredSecuritySolutionListIterator) NotDone() bool { +func (iter DeviceSecurityGroupListIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter DiscoveredSecuritySolutionListIterator) Response() DiscoveredSecuritySolutionList { +func (iter DeviceSecurityGroupListIterator) Response() DeviceSecurityGroupList { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter DiscoveredSecuritySolutionListIterator) Value() DiscoveredSecuritySolution { +func (iter DeviceSecurityGroupListIterator) Value() DeviceSecurityGroup { if !iter.page.NotDone() { - return DiscoveredSecuritySolution{} + return DeviceSecurityGroup{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the DiscoveredSecuritySolutionListIterator type. -func NewDiscoveredSecuritySolutionListIterator(page DiscoveredSecuritySolutionListPage) DiscoveredSecuritySolutionListIterator { - return DiscoveredSecuritySolutionListIterator{page: page} +// Creates a new instance of the DeviceSecurityGroupListIterator type. +func NewDeviceSecurityGroupListIterator(page DeviceSecurityGroupListPage) DeviceSecurityGroupListIterator { + return DeviceSecurityGroupListIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (dssl DiscoveredSecuritySolutionList) IsEmpty() bool { - return dssl.Value == nil || len(*dssl.Value) == 0 +func (dsgl DeviceSecurityGroupList) IsEmpty() bool { + return dsgl.Value == nil || len(*dsgl.Value) == 0 } -// discoveredSecuritySolutionListPreparer prepares a request to retrieve the next set of results. +// deviceSecurityGroupListPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (dssl DiscoveredSecuritySolutionList) discoveredSecuritySolutionListPreparer(ctx context.Context) (*http.Request, error) { - if dssl.NextLink == nil || len(to.String(dssl.NextLink)) < 1 { +func (dsgl DeviceSecurityGroupList) deviceSecurityGroupListPreparer(ctx context.Context) (*http.Request, error) { + if dsgl.NextLink == nil || len(to.String(dsgl.NextLink)) < 1 { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(dssl.NextLink))) + autorest.WithBaseURL(to.String(dsgl.NextLink))) } -// DiscoveredSecuritySolutionListPage contains a page of DiscoveredSecuritySolution values. -type DiscoveredSecuritySolutionListPage struct { - fn func(context.Context, DiscoveredSecuritySolutionList) (DiscoveredSecuritySolutionList, error) - dssl DiscoveredSecuritySolutionList +// DeviceSecurityGroupListPage contains a page of DeviceSecurityGroup values. +type DeviceSecurityGroupListPage struct { + fn func(context.Context, DeviceSecurityGroupList) (DeviceSecurityGroupList, error) + dsgl DeviceSecurityGroupList } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *DiscoveredSecuritySolutionListPage) NextWithContext(ctx context.Context) (err error) { +func (page *DeviceSecurityGroupListPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DiscoveredSecuritySolutionListPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/DeviceSecurityGroupListPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -3288,46 +3728,287 @@ func (page *DiscoveredSecuritySolutionListPage) NextWithContext(ctx context.Cont tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.dssl) + next, err := page.fn(ctx, page.dsgl) if err != nil { return err } - page.dssl = next + page.dsgl = next return nil } // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *DiscoveredSecuritySolutionListPage) Next() error { +func (page *DeviceSecurityGroupListPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page DiscoveredSecuritySolutionListPage) NotDone() bool { - return !page.dssl.IsEmpty() +func (page DeviceSecurityGroupListPage) NotDone() bool { + return !page.dsgl.IsEmpty() } // Response returns the raw server response from the last page request. -func (page DiscoveredSecuritySolutionListPage) Response() DiscoveredSecuritySolutionList { - return page.dssl +func (page DeviceSecurityGroupListPage) Response() DeviceSecurityGroupList { + return page.dsgl } // Values returns the slice of values for the current page or nil if there are no values. -func (page DiscoveredSecuritySolutionListPage) Values() []DiscoveredSecuritySolution { - if page.dssl.IsEmpty() { +func (page DeviceSecurityGroupListPage) Values() []DeviceSecurityGroup { + if page.dsgl.IsEmpty() { return nil } - return *page.dssl.Value + return *page.dsgl.Value } -// Creates a new instance of the DiscoveredSecuritySolutionListPage type. -func NewDiscoveredSecuritySolutionListPage(getNextPage func(context.Context, DiscoveredSecuritySolutionList) (DiscoveredSecuritySolutionList, error)) DiscoveredSecuritySolutionListPage { - return DiscoveredSecuritySolutionListPage{fn: getNextPage} +// Creates a new instance of the DeviceSecurityGroupListPage type. +func NewDeviceSecurityGroupListPage(getNextPage func(context.Context, DeviceSecurityGroupList) (DeviceSecurityGroupList, error)) DeviceSecurityGroupListPage { + return DeviceSecurityGroupListPage{fn: getNextPage} } -// DiscoveredSecuritySolutionProperties ... -type DiscoveredSecuritySolutionProperties struct { +// DeviceSecurityGroupProperties describes properties of a security group. +type DeviceSecurityGroupProperties struct { + // ThresholdRules - The list of custom alert threshold rules. + ThresholdRules *[]ThresholdCustomAlertRule `json:"thresholdRules,omitempty"` + // TimeWindowRules - The list of custom alert time-window rules. + TimeWindowRules *[]TimeWindowCustomAlertRule `json:"timeWindowRules,omitempty"` + // AllowlistRules - The allow-list custom alert rules. + AllowlistRules *[]AllowlistCustomAlertRule `json:"allowlistRules,omitempty"` + // DenylistRules - The deny-list custom alert rules. + DenylistRules *[]DenylistCustomAlertRule `json:"denylistRules,omitempty"` +} + +// DiscoveredSecuritySolution ... +type DiscoveredSecuritySolution struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Location where the resource is stored + Location *string `json:"location,omitempty"` + *DiscoveredSecuritySolutionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for DiscoveredSecuritySolution. +func (dss DiscoveredSecuritySolution) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dss.DiscoveredSecuritySolutionProperties != nil { + objectMap["properties"] = dss.DiscoveredSecuritySolutionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DiscoveredSecuritySolution struct. +func (dss *DiscoveredSecuritySolution) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dss.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dss.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dss.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dss.Location = &location + } + case "properties": + if v != nil { + var discoveredSecuritySolutionProperties DiscoveredSecuritySolutionProperties + err = json.Unmarshal(*v, &discoveredSecuritySolutionProperties) + if err != nil { + return err + } + dss.DiscoveredSecuritySolutionProperties = &discoveredSecuritySolutionProperties + } + } + } + + return nil +} + +// DiscoveredSecuritySolutionList ... +type DiscoveredSecuritySolutionList struct { + autorest.Response `json:"-"` + Value *[]DiscoveredSecuritySolution `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// DiscoveredSecuritySolutionListIterator provides access to a complete listing of +// DiscoveredSecuritySolution values. +type DiscoveredSecuritySolutionListIterator struct { + i int + page DiscoveredSecuritySolutionListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DiscoveredSecuritySolutionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiscoveredSecuritySolutionListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DiscoveredSecuritySolutionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DiscoveredSecuritySolutionListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DiscoveredSecuritySolutionListIterator) Response() DiscoveredSecuritySolutionList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DiscoveredSecuritySolutionListIterator) Value() DiscoveredSecuritySolution { + if !iter.page.NotDone() { + return DiscoveredSecuritySolution{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DiscoveredSecuritySolutionListIterator type. +func NewDiscoveredSecuritySolutionListIterator(page DiscoveredSecuritySolutionListPage) DiscoveredSecuritySolutionListIterator { + return DiscoveredSecuritySolutionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dssl DiscoveredSecuritySolutionList) IsEmpty() bool { + return dssl.Value == nil || len(*dssl.Value) == 0 +} + +// discoveredSecuritySolutionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dssl DiscoveredSecuritySolutionList) discoveredSecuritySolutionListPreparer(ctx context.Context) (*http.Request, error) { + if dssl.NextLink == nil || len(to.String(dssl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dssl.NextLink))) +} + +// DiscoveredSecuritySolutionListPage contains a page of DiscoveredSecuritySolution values. +type DiscoveredSecuritySolutionListPage struct { + fn func(context.Context, DiscoveredSecuritySolutionList) (DiscoveredSecuritySolutionList, error) + dssl DiscoveredSecuritySolutionList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DiscoveredSecuritySolutionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DiscoveredSecuritySolutionListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.dssl) + if err != nil { + return err + } + page.dssl = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DiscoveredSecuritySolutionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DiscoveredSecuritySolutionListPage) NotDone() bool { + return !page.dssl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DiscoveredSecuritySolutionListPage) Response() DiscoveredSecuritySolutionList { + return page.dssl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DiscoveredSecuritySolutionListPage) Values() []DiscoveredSecuritySolution { + if page.dssl.IsEmpty() { + return nil + } + return *page.dssl.Value +} + +// Creates a new instance of the DiscoveredSecuritySolutionListPage type. +func NewDiscoveredSecuritySolutionListPage(getNextPage func(context.Context, DiscoveredSecuritySolutionList) (DiscoveredSecuritySolutionList, error)) DiscoveredSecuritySolutionListPage { + return DiscoveredSecuritySolutionListPage{fn: getNextPage} +} + +// DiscoveredSecuritySolutionProperties ... +type DiscoveredSecuritySolutionProperties struct { // SecurityFamily - The security family of the discovered solution. Possible values include: 'Waf', 'Ngfw', 'SaasWaf', 'Va' SecurityFamily Family `json:"securityFamily,omitempty"` // Offer - The security solutions' image offer @@ -4006,7 +4687,7 @@ type IoTSecurityAggregatedAlert struct { Type *string `json:"type,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` - // IoTSecurityAggregatedAlertProperties - Security Solution Aggregated Alert data + // IoTSecurityAggregatedAlertProperties - IoT Security solution aggregated alert details. *IoTSecurityAggregatedAlertProperties `json:"properties,omitempty"` } @@ -4082,12 +4763,12 @@ func (itsaa *IoTSecurityAggregatedAlert) UnmarshalJSON(body []byte) error { return nil } -// IoTSecurityAggregatedAlertList list of IoT aggregated security alerts +// IoTSecurityAggregatedAlertList list of IoT Security solution aggregated alert data. type IoTSecurityAggregatedAlertList struct { autorest.Response `json:"-"` - // Value - List of aggregated alerts data + // Value - List of aggregated alerts data. Value *[]IoTSecurityAggregatedAlert `json:"value,omitempty"` - // NextLink - READ-ONLY; The URI to fetch the next page. + // NextLink - READ-ONLY; When there is too much alert data for one page, use this URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` } @@ -4229,35 +4910,35 @@ func NewIoTSecurityAggregatedAlertListPage(getNextPage func(context.Context, IoT return IoTSecurityAggregatedAlertListPage{fn: getNextPage} } -// IoTSecurityAggregatedAlertProperties security Solution Aggregated Alert data +// IoTSecurityAggregatedAlertProperties ioT Security solution aggregated alert details. type IoTSecurityAggregatedAlertProperties struct { - // AlertType - READ-ONLY; Name of the alert type + // AlertType - READ-ONLY; Name of the alert type. AlertType *string `json:"alertType,omitempty"` - // AlertDisplayName - READ-ONLY; Display name of the alert type + // AlertDisplayName - READ-ONLY; Display name of the alert type. AlertDisplayName *string `json:"alertDisplayName,omitempty"` - // AggregatedDateUtc - READ-ONLY; The date the incidents were detected by the vendor + // AggregatedDateUtc - READ-ONLY; Date of detection. AggregatedDateUtc *date.Date `json:"aggregatedDateUtc,omitempty"` - // VendorName - READ-ONLY; Name of the vendor that discovered the incident + // VendorName - READ-ONLY; Name of the organization that raised the alert. VendorName *string `json:"vendorName,omitempty"` - // ReportedSeverity - READ-ONLY; Estimated severity of this alert. Possible values include: 'Informational', 'Low', 'Medium', 'High' + // ReportedSeverity - READ-ONLY; Assessed alert severity. Possible values include: 'Informational', 'Low', 'Medium', 'High' ReportedSeverity ReportedSeverity `json:"reportedSeverity,omitempty"` - // RemediationSteps - READ-ONLY; Recommended steps for remediation + // RemediationSteps - READ-ONLY; Recommended steps for remediation. RemediationSteps *string `json:"remediationSteps,omitempty"` - // Description - READ-ONLY; Description of the incident and what it means + // Description - READ-ONLY; Description of the suspected vulnerability and meaning. Description *string `json:"description,omitempty"` - // Count - READ-ONLY; Occurrence number of the alert within the aggregated date + // Count - READ-ONLY; Number of alerts occurrences within the aggregated time window. Count *int32 `json:"count,omitempty"` - // EffectedResourceType - READ-ONLY; Azure resource ID of the resource that got the alerts + // EffectedResourceType - READ-ONLY; Azure resource ID of the resource that received the alerts. EffectedResourceType *string `json:"effectedResourceType,omitempty"` - // SystemSource - READ-ONLY; The type of the alerted resource (Azure, Non-Azure) + // SystemSource - READ-ONLY; The type of the alerted resource (Azure, Non-Azure). SystemSource *string `json:"systemSource,omitempty"` - // ActionTaken - READ-ONLY; The action that was taken as a response to the alert (Active, Blocked etc.) + // ActionTaken - READ-ONLY; IoT Security solution alert response. ActionTaken *string `json:"actionTaken,omitempty"` - // LogAnalyticsQuery - READ-ONLY; query in log analytics to get the list of affected devices/alerts + // LogAnalyticsQuery - READ-ONLY; Log analytics query for getting the list of affected devices/alerts. LogAnalyticsQuery *string `json:"logAnalyticsQuery,omitempty"` } -// IoTSecurityAggregatedRecommendation security Solution Recommendation Information +// IoTSecurityAggregatedRecommendation ioT Security solution recommendation information. type IoTSecurityAggregatedRecommendation struct { autorest.Response `json:"-"` // ID - READ-ONLY; Resource Id @@ -4344,12 +5025,12 @@ func (itsar *IoTSecurityAggregatedRecommendation) UnmarshalJSON(body []byte) err return nil } -// IoTSecurityAggregatedRecommendationList list of IoT aggregated security recommendations +// IoTSecurityAggregatedRecommendationList list of IoT Security solution aggregated recommendations. type IoTSecurityAggregatedRecommendationList struct { autorest.Response `json:"-"` - // Value - List of aggregated alerts data + // Value - List of aggregated recommendations data. Value *[]IoTSecurityAggregatedRecommendation `json:"value,omitempty"` - // NextLink - READ-ONLY; The URI to fetch the next page. + // NextLink - READ-ONLY; When there is too much alert data for one page, use this URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` } @@ -4492,82 +5173,63 @@ func NewIoTSecurityAggregatedRecommendationListPage(getNextPage func(context.Con return IoTSecurityAggregatedRecommendationListPage{fn: getNextPage} } -// IoTSecurityAggregatedRecommendationProperties security Solution Recommendation Information +// IoTSecurityAggregatedRecommendationProperties ioT Security solution aggregated recommendation +// information type IoTSecurityAggregatedRecommendationProperties struct { - // RecommendationName - Name of the recommendation + // RecommendationName - Name of the recommendation. RecommendationName *string `json:"recommendationName,omitempty"` // RecommendationDisplayName - READ-ONLY; Display name of the recommendation type. RecommendationDisplayName *string `json:"recommendationDisplayName,omitempty"` - // Description - READ-ONLY; Description of the incident and what it means + // Description - READ-ONLY; Description of the suspected vulnerability and meaning. Description *string `json:"description,omitempty"` - // RecommendationTypeID - READ-ONLY; The recommendation-type GUID. + // RecommendationTypeID - READ-ONLY; Recommendation-type GUID. RecommendationTypeID *string `json:"recommendationTypeId,omitempty"` - // DetectedBy - READ-ONLY; Name of the vendor that discovered the issue + // DetectedBy - READ-ONLY; Name of the organization that made the recommendation. DetectedBy *string `json:"detectedBy,omitempty"` // RemediationSteps - READ-ONLY; Recommended steps for remediation RemediationSteps *string `json:"remediationSteps,omitempty"` - // ReportedSeverity - READ-ONLY; Estimated severity of this recommendation. Possible values include: 'Informational', 'Low', 'Medium', 'High' + // ReportedSeverity - READ-ONLY; Assessed recommendation severity. Possible values include: 'Informational', 'Low', 'Medium', 'High' ReportedSeverity ReportedSeverity `json:"reportedSeverity,omitempty"` - // HealthyDevices - READ-ONLY; the number of the healthy devices within the solution + // HealthyDevices - READ-ONLY; Number of healthy devices within the IoT Security solution. HealthyDevices *int32 `json:"healthyDevices,omitempty"` - // UnhealthyDeviceCount - READ-ONLY; the number of the unhealthy devices within the solution + // UnhealthyDeviceCount - READ-ONLY; Number of unhealthy devices within the IoT Security solution. UnhealthyDeviceCount *int32 `json:"unhealthyDeviceCount,omitempty"` - // LogAnalyticsQuery - READ-ONLY; query in log analytics to get the list of affected devices/alerts + // LogAnalyticsQuery - READ-ONLY; Log analytics query for getting the list of affected devices/alerts. LogAnalyticsQuery *string `json:"logAnalyticsQuery,omitempty"` } -// IoTSecurityAlertedDevice statistic information about the number of alerts per device during the last -// period +// IoTSecurityAlertedDevice statistical information about the number of alerts per device during last set +// number of days. type IoTSecurityAlertedDevice struct { - // DeviceID - READ-ONLY; Name of the alert type + // DeviceID - READ-ONLY; Device identifier. DeviceID *string `json:"deviceId,omitempty"` - // AlertsCount - READ-ONLY; the number of alerts raised for this device + // AlertsCount - READ-ONLY; Number of alerts raised for this device. AlertsCount *int32 `json:"alertsCount,omitempty"` } -// IoTSecurityAlertedDevicesList list of devices with the count of raised alerts -type IoTSecurityAlertedDevicesList struct { - // Value - List of aggregated alerts data - Value *[]IoTSecurityAlertedDevice `json:"value,omitempty"` -} - -// IoTSecurityDeviceAlert statistic information about the number of alerts per alert type during the last -// period +// IoTSecurityDeviceAlert statistical information about the number of alerts per alert type during last set +// number of days type IoTSecurityDeviceAlert struct { // AlertDisplayName - READ-ONLY; Display name of the alert AlertDisplayName *string `json:"alertDisplayName,omitempty"` - // ReportedSeverity - READ-ONLY; Estimated severity of this alert. Possible values include: 'Informational', 'Low', 'Medium', 'High' + // ReportedSeverity - READ-ONLY; Assessed Alert severity. Possible values include: 'Informational', 'Low', 'Medium', 'High' ReportedSeverity ReportedSeverity `json:"reportedSeverity,omitempty"` - // AlertsCount - READ-ONLY; the number of alerts raised for this alert type + // AlertsCount - READ-ONLY; Number of alerts raised for this alert type. AlertsCount *int32 `json:"alertsCount,omitempty"` } -// IoTSecurityDeviceAlertsList list of alerts with the count of raised alerts -type IoTSecurityDeviceAlertsList struct { - // Value - List of top alerts data - Value *[]IoTSecurityDeviceAlert `json:"value,omitempty"` - // NextLink - READ-ONLY; The URI to fetch the next page. - NextLink *string `json:"nextLink,omitempty"` -} - -// IoTSecurityDeviceRecommendation statistic information about the number of recommendations per -// recommendation type +// IoTSecurityDeviceRecommendation statistical information about the number of recommendations per device, +// per recommendation type. type IoTSecurityDeviceRecommendation struct { - // RecommendationDisplayName - READ-ONLY; Display name of the recommendation + // RecommendationDisplayName - READ-ONLY; Display name of the recommendation. RecommendationDisplayName *string `json:"recommendationDisplayName,omitempty"` - // ReportedSeverity - READ-ONLY; Estimated severity of this recommendation. Possible values include: 'Informational', 'Low', 'Medium', 'High' + // ReportedSeverity - READ-ONLY; Assessed recommendation severity. Possible values include: 'Informational', 'Low', 'Medium', 'High' ReportedSeverity ReportedSeverity `json:"reportedSeverity,omitempty"` - // DevicesCount - READ-ONLY; the number of device with this recommendation + // DevicesCount - READ-ONLY; Number of devices with this recommendation. DevicesCount *int32 `json:"devicesCount,omitempty"` } -// IoTSecurityDeviceRecommendationsList list of recommendations with the count of devices -type IoTSecurityDeviceRecommendationsList struct { - // Value - List of aggregated recommendation data - Value *[]IoTSecurityDeviceRecommendation `json:"value,omitempty"` -} - -// IoTSecuritySolutionAnalyticsModel security Analytics of a security solution +// IoTSecuritySolutionAnalyticsModel security analytics of your IoT Security solution type IoTSecuritySolutionAnalyticsModel struct { autorest.Response `json:"-"` // IoTSecuritySolutionAnalyticsModelProperties - Security Solution Aggregated Alert data @@ -4640,40 +5302,40 @@ func (itssam *IoTSecuritySolutionAnalyticsModel) UnmarshalJSON(body []byte) erro return nil } -// IoTSecuritySolutionAnalyticsModelList list of Security Analytics of a security solution +// IoTSecuritySolutionAnalyticsModelList list of Security analytics of your IoT Security solution type IoTSecuritySolutionAnalyticsModelList struct { autorest.Response `json:"-"` - // Value - List of Security Analytics of a security solution + // Value - List of Security analytics of your IoT Security solution Value *[]IoTSecuritySolutionAnalyticsModel `json:"value,omitempty"` - // NextLink - READ-ONLY; The URI to fetch the next page. + // NextLink - READ-ONLY; When there is too much alert data for one page, use this URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` } -// IoTSecuritySolutionAnalyticsModelProperties security Analytics of a security solution properties +// IoTSecuritySolutionAnalyticsModelProperties security analytics properties of your IoT Security solution type IoTSecuritySolutionAnalyticsModelProperties struct { - // Metrics - READ-ONLY; Security Analytics of a security solution + // Metrics - READ-ONLY; Security analytics of your IoT Security solution. Metrics *IoTSeverityMetrics `json:"metrics,omitempty"` - // UnhealthyDeviceCount - READ-ONLY; number of unhealthy devices + // UnhealthyDeviceCount - READ-ONLY; Number of unhealthy devices within your IoT Security solution. UnhealthyDeviceCount *int32 `json:"unhealthyDeviceCount,omitempty"` - // DevicesMetrics - READ-ONLY; The list of devices metrics by the aggregated date. + // DevicesMetrics - READ-ONLY; List of device metrics by the aggregation date. DevicesMetrics *[]IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem `json:"devicesMetrics,omitempty"` - // TopAlertedDevices - The list of top 3 devices with the most attacked. - TopAlertedDevices *IoTSecurityAlertedDevicesList `json:"topAlertedDevices,omitempty"` - // MostPrevalentDeviceAlerts - The list of most prevalent 3 alerts. - MostPrevalentDeviceAlerts *IoTSecurityDeviceAlertsList `json:"mostPrevalentDeviceAlerts,omitempty"` - // MostPrevalentDeviceRecommendations - The list of most prevalent 3 recommendations. - MostPrevalentDeviceRecommendations *IoTSecurityDeviceRecommendationsList `json:"mostPrevalentDeviceRecommendations,omitempty"` + // TopAlertedDevices - List of the 3 devices with the most alerts. + TopAlertedDevices *[]IoTSecurityAlertedDevice `json:"topAlertedDevices,omitempty"` + // MostPrevalentDeviceAlerts - List of the 3 most prevalent device alerts. + MostPrevalentDeviceAlerts *[]IoTSecurityDeviceAlert `json:"mostPrevalentDeviceAlerts,omitempty"` + // MostPrevalentDeviceRecommendations - List of the 3 most prevalent device recommendations. + MostPrevalentDeviceRecommendations *[]IoTSecurityDeviceRecommendation `json:"mostPrevalentDeviceRecommendations,omitempty"` } // IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem ... type IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem struct { - // Date - the date of the metrics + // Date - Aggregation of IoT Security solution device alert metrics by date. Date *date.Time `json:"date,omitempty"` - // DevicesMetrics - devices alerts count by severity. + // DevicesMetrics - Device alert count by severity. DevicesMetrics *IoTSeverityMetrics `json:"devicesMetrics,omitempty"` } -// IoTSecuritySolutionModel security Solution +// IoTSecuritySolutionModel ioT Security solution configuration and resource information. type IoTSecuritySolutionModel struct { autorest.Response `json:"-"` // ID - READ-ONLY; Resource Id @@ -4780,9 +5442,9 @@ type IoTSecuritySolutionProperties struct { Workspace *string `json:"workspace,omitempty"` // DisplayName - Resource display name. DisplayName *string `json:"displayName,omitempty"` - // Status - Security solution status. Possible values include: 'SolutionStatusEnabled', 'SolutionStatusDisabled' + // Status - Status of the IoT Security solution. Possible values include: 'SolutionStatusEnabled', 'SolutionStatusDisabled' Status SolutionStatus `json:"status,omitempty"` - // Export - List of additional export to workspace data options + // Export - List of additional options for exporting to workspace data. Export *[]ExportData `json:"export,omitempty"` // DisabledDataSources - Disabled data sources. Disabling these data sources compromises the system. DisabledDataSources *[]DataSource `json:"disabledDataSources,omitempty"` @@ -4794,10 +5456,10 @@ type IoTSecuritySolutionProperties struct { RecommendationsConfiguration *[]RecommendationConfigurationProperties `json:"recommendationsConfiguration,omitempty"` } -// IoTSecuritySolutionsList list of iot solutions +// IoTSecuritySolutionsList list of IoT Security solutions. type IoTSecuritySolutionsList struct { autorest.Response `json:"-"` - // Value - List of security solutions + // Value - List of IoT Security solutions Value *[]IoTSecuritySolutionModel `json:"value,omitempty"` // NextLink - READ-ONLY; The URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` @@ -4941,13 +5603,13 @@ func NewIoTSecuritySolutionsListPage(getNextPage func(context.Context, IoTSecuri return IoTSecuritySolutionsListPage{fn: getNextPage} } -// IoTSeverityMetrics severity metrics +// IoTSeverityMetrics ioT Security solution analytics severity metrics. type IoTSeverityMetrics struct { - // High - count of high severity items + // High - Count of high severity alerts/recommendations. High *int32 `json:"high,omitempty"` - // Medium - count of medium severity items + // Medium - Count of medium severity alerts/recommendations. Medium *int32 `json:"medium,omitempty"` - // Low - count of low severity items + // Low - Count of low severity alerts/recommendations. Low *int32 `json:"low,omitempty"` } @@ -5207,6 +5869,8 @@ type JitNetworkAccessPolicyInitiatePort struct { type JitNetworkAccessPolicyInitiateRequest struct { // VirtualMachines - A list of virtual machines & ports to open access for VirtualMachines *[]JitNetworkAccessPolicyInitiateVirtualMachine `json:"virtualMachines,omitempty"` + // Justification - The justification for making the initiate request + Justification *string `json:"justification,omitempty"` } // JitNetworkAccessPolicyInitiateVirtualMachine ... @@ -5257,6 +5921,8 @@ type JitNetworkAccessRequest struct { StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"` // Requestor - The identity of the person who made the request Requestor *string `json:"requestor,omitempty"` + // Justification - The justification for making the initiate request + Justification *string `json:"justification,omitempty"` } // JitNetworkAccessRequestPort ... @@ -5290,9 +5956,23 @@ type Kind struct { Kind *string `json:"kind,omitempty"` } -// Location describes an Azure resource with location -type Location struct { - // Location - READ-ONLY; Location where the resource is stored +// ListCustomAlertRule a List custom alert rule. +type ListCustomAlertRule struct { + // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'IPCidr', 'String' + ValueType ValueType `json:"valueType,omitempty"` + // DisplayName - READ-ONLY; The display name of the custom alert. + DisplayName *string `json:"displayName,omitempty"` + // Description - READ-ONLY; The description of the custom alert. + Description *string `json:"description,omitempty"` + // IsEnabled - Status of the custom alert. + IsEnabled *bool `json:"isEnabled,omitempty"` + // RuleType - The type of the custom alert rule. + RuleType *string `json:"ruleType,omitempty"` +} + +// Location describes an Azure resource with location +type Location struct { + // Location - READ-ONLY; Location where the resource is stored Location *string `json:"location,omitempty"` } @@ -5476,7 +6156,7 @@ type PathRecommendation struct { Common *bool `json:"common,omitempty"` UserSids *[]string `json:"userSids,omitempty"` Usernames *[]UserRecommendation `json:"usernames,omitempty"` - // FileType - Possible values include: 'Exe', 'Dll', 'Msi', 'Script', 'Executable', 'Unknown' + // FileType - Possible values include: 'FileTypeExe', 'FileTypeDll', 'FileTypeMsi', 'FileTypeScript', 'FileTypeExecutable', 'FileTypeUnknown' FileType FileType `json:"fileType,omitempty"` // ConfigurationStatus - Possible values include: 'ConfigurationStatus1Configured', 'ConfigurationStatus1NotConfigured', 'ConfigurationStatus1InProgress', 'ConfigurationStatus1Failed', 'ConfigurationStatus1NoStatus' ConfigurationStatus ConfigurationStatus1 `json:"configurationStatus,omitempty"` @@ -5572,6 +6252,19 @@ type PricingProperties struct { FreeTrialRemainingTime *string `json:"freeTrialRemainingTime,omitempty"` } +// ProtectionMode the protection mode of the collection/file types. Exe/Msi/Script are used for Windows, +// Executable is used for Linux. +type ProtectionMode struct { + // Exe - Possible values include: 'ExeAudit', 'ExeEnforce', 'ExeNone' + Exe Exe `json:"exe,omitempty"` + // Msi - Possible values include: 'MsiAudit', 'MsiEnforce', 'MsiNone' + Msi Msi `json:"msi,omitempty"` + // Script - Possible values include: 'ScriptAudit', 'ScriptEnforce', 'ScriptNone' + Script Script `json:"script,omitempty"` + // Executable - Possible values include: 'ExecutableAudit', 'ExecutableEnforce', 'ExecutableNone' + Executable Executable `json:"executable,omitempty"` +} + // PublisherInfo represents the publisher information of a process/rule type PublisherInfo struct { // PublisherName - The Subject field of the x.509 certificate used to sign the code, using the following fields - O = Organization, L = Locality, S = State or Province, and C = Country @@ -5584,13 +6277,13 @@ type PublisherInfo struct { Version *string `json:"version,omitempty"` } -// RecommendationConfigurationProperties recommendation configuration +// RecommendationConfigurationProperties the type of IoT Security recommendation. type RecommendationConfigurationProperties struct { - // RecommendationType - The recommendation type. Possible values include: 'IoTACRAuthentication', 'IoTAgentSendsUnutilizedMessages', 'IoTBaseline', 'IoTEdgeHubMemOptimize', 'IoTEdgeLoggingOptions', 'IoTInconsistentModuleSettings', 'IoTInstallAgent', 'IoTIPFilterDenyAll', 'IoTIPFilterPermissiveRule', 'IoTOpenPorts', 'IoTPermissiveFirewallPolicy', 'IoTPermissiveInputFirewallRules', 'IoTPermissiveOutputFirewallRules', 'IoTPrivilegedDockerOptions', 'IoTSharedCredentials', 'IoTVulnerableTLSCipherSuite' + // RecommendationType - The type of IoT Security recommendation. Possible values include: 'IoTACRAuthentication', 'IoTAgentSendsUnutilizedMessages', 'IoTBaseline', 'IoTEdgeHubMemOptimize', 'IoTEdgeLoggingOptions', 'IoTInconsistentModuleSettings', 'IoTInstallAgent', 'IoTIPFilterDenyAll', 'IoTIPFilterPermissiveRule', 'IoTOpenPorts', 'IoTPermissiveFirewallPolicy', 'IoTPermissiveInputFirewallRules', 'IoTPermissiveOutputFirewallRules', 'IoTPrivilegedDockerOptions', 'IoTSharedCredentials', 'IoTVulnerableTLSCipherSuite' RecommendationType RecommendationType `json:"recommendationType,omitempty"` // Name - READ-ONLY Name *string `json:"name,omitempty"` - // Status - Recommendation status. The recommendation is not generated when the status is disabled. Possible values include: 'Disabled', 'Enabled' + // Status - Recommendation status. When the recommendation status is disabled recommendations are not generated. Possible values include: 'Disabled', 'Enabled' Status RecommendationConfigStatus `json:"status,omitempty"` } @@ -6310,6 +7003,90 @@ type Resource struct { Type *string `json:"type,omitempty"` } +// BasicResourceDetails details of the resource that was assessed +type BasicResourceDetails interface { + AsAzureResourceDetails() (*AzureResourceDetails, bool) + AsAwsResourceDetails() (*AwsResourceDetails, bool) + AsResourceDetails() (*ResourceDetails, bool) +} + +// ResourceDetails details of the resource that was assessed +type ResourceDetails struct { + // Source - Possible values include: 'SourceResourceDetails', 'SourceAzure', 'SourceAws' + Source Source `json:"source,omitempty"` +} + +func unmarshalBasicResourceDetails(body []byte) (BasicResourceDetails, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["source"] { + case string(SourceAzure): + var ard AzureResourceDetails + err := json.Unmarshal(body, &ard) + return ard, err + case string(SourceAws): + var ard AwsResourceDetails + err := json.Unmarshal(body, &ard) + return ard, err + default: + var rd ResourceDetails + err := json.Unmarshal(body, &rd) + return rd, err + } +} +func unmarshalBasicResourceDetailsArray(body []byte) ([]BasicResourceDetails, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + rdArray := make([]BasicResourceDetails, len(rawMessages)) + + for index, rawMessage := range rawMessages { + rd, err := unmarshalBasicResourceDetails(*rawMessage) + if err != nil { + return nil, err + } + rdArray[index] = rd + } + return rdArray, nil +} + +// MarshalJSON is the custom marshaler for ResourceDetails. +func (rd ResourceDetails) MarshalJSON() ([]byte, error) { + rd.Source = SourceResourceDetails + objectMap := make(map[string]interface{}) + if rd.Source != "" { + objectMap["source"] = rd.Source + } + return json.Marshal(objectMap) +} + +// AsAzureResourceDetails is the BasicResourceDetails implementation for ResourceDetails. +func (rd ResourceDetails) AsAzureResourceDetails() (*AzureResourceDetails, bool) { + return nil, false +} + +// AsAwsResourceDetails is the BasicResourceDetails implementation for ResourceDetails. +func (rd ResourceDetails) AsAwsResourceDetails() (*AwsResourceDetails, bool) { + return nil, false +} + +// AsResourceDetails is the BasicResourceDetails implementation for ResourceDetails. +func (rd ResourceDetails) AsResourceDetails() (*ResourceDetails, bool) { + return &rd, true +} + +// AsBasicResourceDetails is the BasicResourceDetails implementation for ResourceDetails. +func (rd ResourceDetails) AsBasicResourceDetails() (BasicResourceDetails, bool) { + return &rd, true +} + // SensitivityLabel the sensitivity label. type SensitivityLabel struct { // DisplayName - The name of the sensitivity label. @@ -6404,6 +7181,61 @@ type ServerVulnerabilityAssessmentsList struct { Value *[]ServerVulnerabilityAssessment `json:"value,omitempty"` } +// ServerVulnerabilityProperties additional context fields for server vulnerability assessment +type ServerVulnerabilityProperties struct { + // Type - READ-ONLY; Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, Information Gathered + Type *string `json:"type,omitempty"` + // Cvss - READ-ONLY; Dictionary from cvss version to cvss details object + Cvss map[string]*CVSS `json:"cvss"` + // Patchable - READ-ONLY; Indicates whether a patch is available or not + Patchable *bool `json:"patchable,omitempty"` + // Cve - READ-ONLY; List of CVEs + Cve *[]CVE `json:"cve,omitempty"` + // Threat - READ-ONLY; Threat name + Threat *string `json:"threat,omitempty"` + // PublishedTime - READ-ONLY; Published time + PublishedTime *date.Time `json:"publishedTime,omitempty"` + // VendorReferences - READ-ONLY + VendorReferences *[]VendorReference `json:"vendorReferences,omitempty"` + // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' + AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { + svp.AssessedResourceType = AssessedResourceTypeServerVulnerabilityAssessment + objectMap := make(map[string]interface{}) + if svp.AssessedResourceType != "" { + objectMap["assessedResourceType"] = svp.AssessedResourceType + } + return json.Marshal(objectMap) +} + +// AsSQLServerVulnerabilityProperties is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsContainerRegistryVulnerabilityProperties is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) { + return nil, false +} + +// AsServerVulnerabilityProperties is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) { + return &svp, true +} + +// AsAdditionalData is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsAdditionalData() (*AdditionalData, bool) { + return nil, false +} + +// AsBasicAdditionalData is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsBasicAdditionalData() (BasicAdditionalData, bool) { + return &svp, true +} + // Setting represents a security setting in Azure Security Center. type Setting struct { autorest.Response `json:"-"` @@ -6575,6 +7407,405 @@ func NewSettingsListPage(getNextPage func(context.Context, SettingsList) (Settin return SettingsListPage{fn: getNextPage} } +// SQLServerVulnerabilityProperties details of the resource that was assessed +type SQLServerVulnerabilityProperties struct { + // Type - READ-ONLY; The resource type the sub assessment refers to in its resource details + Type *string `json:"type,omitempty"` + // Query - READ-ONLY; The T-SQL query that runs on your SQL database to perform the particular check + Query *string `json:"query,omitempty"` + // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' + AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { + ssvp.AssessedResourceType = AssessedResourceTypeSQLServerVulnerability + objectMap := make(map[string]interface{}) + if ssvp.AssessedResourceType != "" { + objectMap["assessedResourceType"] = ssvp.AssessedResourceType + } + return json.Marshal(objectMap) +} + +// AsSQLServerVulnerabilityProperties is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) { + return &ssvp, true +} + +// AsContainerRegistryVulnerabilityProperties is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) { + return nil, false +} + +// AsServerVulnerabilityProperties is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsAdditionalData is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) AsAdditionalData() (*AdditionalData, bool) { + return nil, false +} + +// AsBasicAdditionalData is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) AsBasicAdditionalData() (BasicAdditionalData, bool) { + return &ssvp, true +} + +// SubAssessment security sub-assessment on a resource +type SubAssessment struct { + autorest.Response `json:"-"` + *SubAssessmentProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubAssessment. +func (sa SubAssessment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sa.SubAssessmentProperties != nil { + objectMap["properties"] = sa.SubAssessmentProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SubAssessment struct. +func (sa *SubAssessment) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var subAssessmentProperties SubAssessmentProperties + err = json.Unmarshal(*v, &subAssessmentProperties) + if err != nil { + return err + } + sa.SubAssessmentProperties = &subAssessmentProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sa.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sa.Type = &typeVar + } + } + } + + return nil +} + +// SubAssessmentList list of security sub-assessments +type SubAssessmentList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY + Value *[]SubAssessment `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// SubAssessmentListIterator provides access to a complete listing of SubAssessment values. +type SubAssessmentListIterator struct { + i int + page SubAssessmentListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SubAssessmentListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SubAssessmentListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SubAssessmentListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SubAssessmentListIterator) Response() SubAssessmentList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SubAssessmentListIterator) Value() SubAssessment { + if !iter.page.NotDone() { + return SubAssessment{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SubAssessmentListIterator type. +func NewSubAssessmentListIterator(page SubAssessmentListPage) SubAssessmentListIterator { + return SubAssessmentListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sal SubAssessmentList) IsEmpty() bool { + return sal.Value == nil || len(*sal.Value) == 0 +} + +// subAssessmentListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sal SubAssessmentList) subAssessmentListPreparer(ctx context.Context) (*http.Request, error) { + if sal.NextLink == nil || len(to.String(sal.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sal.NextLink))) +} + +// SubAssessmentListPage contains a page of SubAssessment values. +type SubAssessmentListPage struct { + fn func(context.Context, SubAssessmentList) (SubAssessmentList, error) + sal SubAssessmentList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SubAssessmentListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.sal) + if err != nil { + return err + } + page.sal = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SubAssessmentListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SubAssessmentListPage) NotDone() bool { + return !page.sal.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SubAssessmentListPage) Response() SubAssessmentList { + return page.sal +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SubAssessmentListPage) Values() []SubAssessment { + if page.sal.IsEmpty() { + return nil + } + return *page.sal.Value +} + +// Creates a new instance of the SubAssessmentListPage type. +func NewSubAssessmentListPage(getNextPage func(context.Context, SubAssessmentList) (SubAssessmentList, error)) SubAssessmentListPage { + return SubAssessmentListPage{fn: getNextPage} +} + +// SubAssessmentProperties describes properties of an sub-assessment. +type SubAssessmentProperties struct { + // ID - READ-ONLY; Vulnerability ID + ID *string `json:"id,omitempty"` + // DisplayName - READ-ONLY; User friendly display name of the sub-assessment + DisplayName *string `json:"displayName,omitempty"` + Status *SubAssessmentStatus `json:"status,omitempty"` + // Remediation - READ-ONLY; Information on how to remediate this sub-assessment + Remediation *string `json:"remediation,omitempty"` + // Impact - READ-ONLY; Description of the impact of this sub-assessment + Impact *string `json:"impact,omitempty"` + // Category - READ-ONLY; Category of the sub-assessment + Category *string `json:"category,omitempty"` + // Description - READ-ONLY; Human readable description of the assessment status + Description *string `json:"description,omitempty"` + // TimeGenerated - READ-ONLY; The date and time the sub-assessment was generated + TimeGenerated *date.Time `json:"timeGenerated,omitempty"` + ResourceDetails BasicResourceDetails `json:"resourceDetails,omitempty"` + AdditionalData BasicAdditionalData `json:"additionalData,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for SubAssessmentProperties struct. +func (sap *SubAssessmentProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sap.ID = &ID + } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + sap.DisplayName = &displayName + } + case "status": + if v != nil { + var status SubAssessmentStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + sap.Status = &status + } + case "remediation": + if v != nil { + var remediation string + err = json.Unmarshal(*v, &remediation) + if err != nil { + return err + } + sap.Remediation = &remediation + } + case "impact": + if v != nil { + var impact string + err = json.Unmarshal(*v, &impact) + if err != nil { + return err + } + sap.Impact = &impact + } + case "category": + if v != nil { + var category string + err = json.Unmarshal(*v, &category) + if err != nil { + return err + } + sap.Category = &category + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + sap.Description = &description + } + case "timeGenerated": + if v != nil { + var timeGenerated date.Time + err = json.Unmarshal(*v, &timeGenerated) + if err != nil { + return err + } + sap.TimeGenerated = &timeGenerated + } + case "resourceDetails": + if v != nil { + resourceDetails, err := unmarshalBasicResourceDetails(*v) + if err != nil { + return err + } + sap.ResourceDetails = resourceDetails + } + case "additionalData": + if v != nil { + additionalData, err := unmarshalBasicAdditionalData(*v) + if err != nil { + return err + } + sap.AdditionalData = additionalData + } + } + } + + return nil +} + +// SubAssessmentStatus status of the sub-assessment +type SubAssessmentStatus struct { + // Code - READ-ONLY; Programmatic code for the status of the assessment. Possible values include: 'SubAssessmentStatusCodeHealthy', 'SubAssessmentStatusCodeUnhealthy', 'SubAssessmentStatusCodeNotApplicable' + Code SubAssessmentStatusCode `json:"code,omitempty"` + // Cause - READ-ONLY; Programmatic code for the cause of the assessment status + Cause *string `json:"cause,omitempty"` + // Description - READ-ONLY; Human readable description of the assessment status + Description *string `json:"description,omitempty"` + // Severity - READ-ONLY; The sub-assessment severity level. Possible values include: 'SeverityLow', 'SeverityMedium', 'SeverityHigh' + Severity Severity `json:"severity,omitempty"` +} + // TagsResource a container holding only the Tags for a resource, allowing the user to update the tags. type TagsResource struct { // Tags - Resource tags @@ -6875,6 +8106,42 @@ type TaskProperties struct { SubState *string `json:"subState,omitempty"` } +// ThresholdCustomAlertRule a custom alert rule that checks if a value (depends on the custom alert type) +// is within the given range. +type ThresholdCustomAlertRule struct { + // MinThreshold - The minimum threshold. + MinThreshold *int32 `json:"minThreshold,omitempty"` + // MaxThreshold - The maximum threshold. + MaxThreshold *int32 `json:"maxThreshold,omitempty"` + // DisplayName - READ-ONLY; The display name of the custom alert. + DisplayName *string `json:"displayName,omitempty"` + // Description - READ-ONLY; The description of the custom alert. + Description *string `json:"description,omitempty"` + // IsEnabled - Status of the custom alert. + IsEnabled *bool `json:"isEnabled,omitempty"` + // RuleType - The type of the custom alert rule. + RuleType *string `json:"ruleType,omitempty"` +} + +// TimeWindowCustomAlertRule a custom alert rule that checks if the number of activities (depends on the +// custom alert type) in a time window is within the given range. +type TimeWindowCustomAlertRule struct { + // TimeWindowSize - The time window size in iso8601 format. + TimeWindowSize *string `json:"timeWindowSize,omitempty"` + // MinThreshold - The minimum threshold. + MinThreshold *int32 `json:"minThreshold,omitempty"` + // MaxThreshold - The maximum threshold. + MaxThreshold *int32 `json:"maxThreshold,omitempty"` + // DisplayName - READ-ONLY; The display name of the custom alert. + DisplayName *string `json:"displayName,omitempty"` + // Description - READ-ONLY; The description of the custom alert. + Description *string `json:"description,omitempty"` + // IsEnabled - Status of the custom alert. + IsEnabled *bool `json:"isEnabled,omitempty"` + // RuleType - The type of the custom alert rule. + RuleType *string `json:"ruleType,omitempty"` +} + // TopologyList ... type TopologyList struct { autorest.Response `json:"-"` @@ -7144,8 +8411,8 @@ type TopologySingleResourceParent struct { // UpdateIotSecuritySolutionData ... type UpdateIotSecuritySolutionData struct { - UserDefinedResources *UserDefinedResourcesProperties `json:"userDefinedResources,omitempty"` - RecommendationsConfiguration *[]RecommendationConfigurationProperties `json:"recommendationsConfiguration,omitempty"` + // UpdateIoTSecuritySolutionProperties - Security Solution data + *UpdateIoTSecuritySolutionProperties `json:"properties,omitempty"` // Tags - Resource tags Tags map[string]*string `json:"tags"` } @@ -7153,11 +8420,8 @@ type UpdateIotSecuritySolutionData struct { // MarshalJSON is the custom marshaler for UpdateIotSecuritySolutionData. func (uissd UpdateIotSecuritySolutionData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if uissd.UserDefinedResources != nil { - objectMap["userDefinedResources"] = uissd.UserDefinedResources - } - if uissd.RecommendationsConfiguration != nil { - objectMap["recommendationsConfiguration"] = uissd.RecommendationsConfiguration + if uissd.UpdateIoTSecuritySolutionProperties != nil { + objectMap["properties"] = uissd.UpdateIoTSecuritySolutionProperties } if uissd.Tags != nil { objectMap["tags"] = uissd.Tags @@ -7165,7 +8429,46 @@ func (uissd UpdateIotSecuritySolutionData) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UserDefinedResourcesProperties properties of the solution's user defined resources. +// UnmarshalJSON is the custom unmarshaler for UpdateIotSecuritySolutionData struct. +func (uissd *UpdateIotSecuritySolutionData) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var updateIoTSecuritySolutionProperties UpdateIoTSecuritySolutionProperties + err = json.Unmarshal(*v, &updateIoTSecuritySolutionProperties) + if err != nil { + return err + } + uissd.UpdateIoTSecuritySolutionProperties = &updateIoTSecuritySolutionProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + uissd.Tags = tags + } + } + } + + return nil +} + +// UpdateIoTSecuritySolutionProperties update Security Solution setting data +type UpdateIoTSecuritySolutionProperties struct { + UserDefinedResources *UserDefinedResourcesProperties `json:"userDefinedResources,omitempty"` + RecommendationsConfiguration *[]RecommendationConfigurationProperties `json:"recommendationsConfiguration,omitempty"` +} + +// UserDefinedResourcesProperties properties of the IoT Security solution's user defined resources. type UserDefinedResourcesProperties struct { // Query - Azure Resource Graph query which represents the security solution's user defined resources. Required to start with "where type != "Microsoft.Devices/IotHubs"" Query *string `json:"query,omitempty"` @@ -7181,6 +8484,14 @@ type UserRecommendation struct { RecommendationAction RecommendationAction1 `json:"recommendationAction,omitempty"` } +// VendorReference vendor reference +type VendorReference struct { + // Title - READ-ONLY; Link title + Title *string `json:"title,omitempty"` + // Link - READ-ONLY; Link url + Link *string `json:"link,omitempty"` +} + // VMRecommendation represents a machine that is part of a VM/server group type VMRecommendation struct { // ConfigurationStatus - Possible values include: 'Configured', 'NotConfigured', 'InProgress', 'Failed', 'NoStatus' diff --git a/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go b/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go index c795ece3011d..3b70713dc7cb 100644 --- a/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go @@ -63,66 +63,52 @@ type SettingsClientAPI interface { var _ SettingsClientAPI = (*security.SettingsClient)(nil) -// IoTSecuritySolutionsClientAPI contains the set of methods on the IoTSecuritySolutionsClient type. -type IoTSecuritySolutionsClientAPI interface { - List(ctx context.Context, filter string) (result security.IoTSecuritySolutionsListPage, err error) +// DeviceSecurityGroupsClientAPI contains the set of methods on the DeviceSecurityGroupsClient type. +type DeviceSecurityGroupsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceID string, deviceSecurityGroupName string, deviceSecurityGroup security.DeviceSecurityGroup) (result security.DeviceSecurityGroup, err error) + Delete(ctx context.Context, resourceID string, deviceSecurityGroupName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceID string, deviceSecurityGroupName string) (result security.DeviceSecurityGroup, err error) + List(ctx context.Context, resourceID string) (result security.DeviceSecurityGroupListPage, err error) } -var _ IoTSecuritySolutionsClientAPI = (*security.IoTSecuritySolutionsClient)(nil) - -// IoTSecuritySolutionsResourceGroupClientAPI contains the set of methods on the IoTSecuritySolutionsResourceGroupClient type. -type IoTSecuritySolutionsResourceGroupClientAPI interface { - List(ctx context.Context, resourceGroupName string, filter string) (result security.IoTSecuritySolutionsListPage, err error) -} - -var _ IoTSecuritySolutionsResourceGroupClientAPI = (*security.IoTSecuritySolutionsResourceGroupClient)(nil) +var _ DeviceSecurityGroupsClientAPI = (*security.DeviceSecurityGroupsClient)(nil) // IotSecuritySolutionClientAPI contains the set of methods on the IotSecuritySolutionClient type. type IotSecuritySolutionClientAPI interface { - Create(ctx context.Context, resourceGroupName string, solutionName string, iotSecuritySolutionData security.IoTSecuritySolutionModel) (result security.IoTSecuritySolutionModel, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, solutionName string, iotSecuritySolutionData security.IoTSecuritySolutionModel) (result security.IoTSecuritySolutionModel, err error) Delete(ctx context.Context, resourceGroupName string, solutionName string) (result autorest.Response, err error) Get(ctx context.Context, resourceGroupName string, solutionName string) (result security.IoTSecuritySolutionModel, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result security.IoTSecuritySolutionsListPage, err error) + ListBySubscription(ctx context.Context, filter string) (result security.IoTSecuritySolutionsListPage, err error) Update(ctx context.Context, resourceGroupName string, solutionName string, updateIotSecuritySolutionData security.UpdateIotSecuritySolutionData) (result security.IoTSecuritySolutionModel, err error) } var _ IotSecuritySolutionClientAPI = (*security.IotSecuritySolutionClient)(nil) -// IoTSecuritySolutionsAnalyticsClientAPI contains the set of methods on the IoTSecuritySolutionsAnalyticsClient type. -type IoTSecuritySolutionsAnalyticsClientAPI interface { - GetAll(ctx context.Context, resourceGroupName string, solutionName string) (result security.IoTSecuritySolutionAnalyticsModelList, err error) - GetDefault(ctx context.Context, resourceGroupName string, solutionName string) (result security.IoTSecuritySolutionAnalyticsModel, err error) -} - -var _ IoTSecuritySolutionsAnalyticsClientAPI = (*security.IoTSecuritySolutionsAnalyticsClient)(nil) - -// IoTSecuritySolutionsAnalyticsAggregatedAlertsClientAPI contains the set of methods on the IoTSecuritySolutionsAnalyticsAggregatedAlertsClient type. -type IoTSecuritySolutionsAnalyticsAggregatedAlertsClientAPI interface { - List(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (result security.IoTSecurityAggregatedAlertListPage, err error) +// IotSecuritySolutionAnalyticsClientAPI contains the set of methods on the IotSecuritySolutionAnalyticsClient type. +type IotSecuritySolutionAnalyticsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, solutionName string) (result security.IoTSecuritySolutionAnalyticsModel, err error) + List(ctx context.Context, resourceGroupName string, solutionName string) (result security.IoTSecuritySolutionAnalyticsModelList, err error) } -var _ IoTSecuritySolutionsAnalyticsAggregatedAlertsClientAPI = (*security.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient)(nil) +var _ IotSecuritySolutionAnalyticsClientAPI = (*security.IotSecuritySolutionAnalyticsClient)(nil) -// IoTSecuritySolutionsAnalyticsAggregatedAlertClientAPI contains the set of methods on the IoTSecuritySolutionsAnalyticsAggregatedAlertClient type. -type IoTSecuritySolutionsAnalyticsAggregatedAlertClientAPI interface { +// IotSecuritySolutionsAnalyticsAggregatedAlertClientAPI contains the set of methods on the IotSecuritySolutionsAnalyticsAggregatedAlertClient type. +type IotSecuritySolutionsAnalyticsAggregatedAlertClientAPI interface { Dismiss(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string) (result autorest.Response, err error) Get(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string) (result security.IoTSecurityAggregatedAlert, err error) + List(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (result security.IoTSecurityAggregatedAlertListPage, err error) } -var _ IoTSecuritySolutionsAnalyticsAggregatedAlertClientAPI = (*security.IoTSecuritySolutionsAnalyticsAggregatedAlertClient)(nil) +var _ IotSecuritySolutionsAnalyticsAggregatedAlertClientAPI = (*security.IotSecuritySolutionsAnalyticsAggregatedAlertClient)(nil) -// IoTSecuritySolutionsAnalyticsRecommendationClientAPI contains the set of methods on the IoTSecuritySolutionsAnalyticsRecommendationClient type. -type IoTSecuritySolutionsAnalyticsRecommendationClientAPI interface { +// IotSecuritySolutionsAnalyticsRecommendationClientAPI contains the set of methods on the IotSecuritySolutionsAnalyticsRecommendationClient type. +type IotSecuritySolutionsAnalyticsRecommendationClientAPI interface { Get(ctx context.Context, resourceGroupName string, solutionName string, aggregatedRecommendationName string) (result security.IoTSecurityAggregatedRecommendation, err error) -} - -var _ IoTSecuritySolutionsAnalyticsRecommendationClientAPI = (*security.IoTSecuritySolutionsAnalyticsRecommendationClient)(nil) - -// IoTSecuritySolutionsAnalyticsRecommendationsClientAPI contains the set of methods on the IoTSecuritySolutionsAnalyticsRecommendationsClient type. -type IoTSecuritySolutionsAnalyticsRecommendationsClientAPI interface { List(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (result security.IoTSecurityAggregatedRecommendationListPage, err error) } -var _ IoTSecuritySolutionsAnalyticsRecommendationsClientAPI = (*security.IoTSecuritySolutionsAnalyticsRecommendationsClient)(nil) +var _ IotSecuritySolutionsAnalyticsRecommendationClientAPI = (*security.IotSecuritySolutionsAnalyticsRecommendationClient)(nil) // AllowedConnectionsClientAPI contains the set of methods on the AllowedConnectionsClient type. type AllowedConnectionsClientAPI interface { @@ -300,3 +286,12 @@ type ServerVulnerabilityAssessmentClientAPI interface { } var _ ServerVulnerabilityAssessmentClientAPI = (*security.ServerVulnerabilityAssessmentClient)(nil) + +// SubAssessmentsClientAPI contains the set of methods on the SubAssessmentsClient type. +type SubAssessmentsClientAPI interface { + Get(ctx context.Context, scope string, assessmentName string, subAssessmentName string) (result security.SubAssessment, err error) + List(ctx context.Context, scope string, assessmentName string) (result security.SubAssessmentListPage, err error) + ListAll(ctx context.Context, scope string) (result security.SubAssessmentListPage, err error) +} + +var _ SubAssessmentsClientAPI = (*security.SubAssessmentsClient)(nil) diff --git a/services/preview/security/mgmt/v3.0/security/subassessments.go b/services/preview/security/mgmt/v3.0/security/subassessments.go new file mode 100644 index 000000000000..4fa19d8e398d --- /dev/null +++ b/services/preview/security/mgmt/v3.0/security/subassessments.go @@ -0,0 +1,348 @@ +package security + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SubAssessmentsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type SubAssessmentsClient struct { + BaseClient +} + +// NewSubAssessmentsClient creates an instance of the SubAssessmentsClient client. +func NewSubAssessmentsClient(subscriptionID string, ascLocation string) SubAssessmentsClient { + return NewSubAssessmentsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewSubAssessmentsClientWithBaseURI creates an instance of the SubAssessmentsClient client. +func NewSubAssessmentsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) SubAssessmentsClient { + return SubAssessmentsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// Get get a security sub-assessment on your scanned resource +// Parameters: +// scope - scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or +// management group (/providers/Microsoft.Management/managementGroups/mgName). +// assessmentName - the Assessment Key - Unique key for the assessment type +// subAssessmentName - the Sub-Assessment Key - Unique key for the sub-assessment type +func (client SubAssessmentsClient) Get(ctx context.Context, scope string, assessmentName string, subAssessmentName string) (result SubAssessment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, scope, assessmentName, subAssessmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SubAssessmentsClient) GetPreparer(ctx context.Context, scope string, assessmentName string, subAssessmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "assessmentName": autorest.Encode("path", assessmentName), + "scope": autorest.Encode("path", scope), + "subAssessmentName": autorest.Encode("path", subAssessmentName), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SubAssessmentsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SubAssessmentsClient) GetResponder(resp *http.Response) (result SubAssessment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get security sub-assessments on all your scanned resources inside a scope +// Parameters: +// scope - scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or +// management group (/providers/Microsoft.Management/managementGroups/mgName). +// assessmentName - the Assessment Key - Unique key for the assessment type +func (client SubAssessmentsClient) List(ctx context.Context, scope string, assessmentName string) (result SubAssessmentListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentsClient.List") + defer func() { + sc := -1 + if result.sal.Response.Response != nil { + sc = result.sal.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, scope, assessmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sal.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "List", resp, "Failure sending request") + return + } + + result.sal, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SubAssessmentsClient) ListPreparer(ctx context.Context, scope string, assessmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "assessmentName": autorest.Encode("path", assessmentName), + "scope": autorest.Encode("path", scope), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SubAssessmentsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SubAssessmentsClient) ListResponder(resp *http.Response) (result SubAssessmentList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SubAssessmentsClient) listNextResults(ctx context.Context, lastResults SubAssessmentList) (result SubAssessmentList, err error) { + req, err := lastResults.subAssessmentListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SubAssessmentsClient) ListComplete(ctx context.Context, scope string, assessmentName string) (result SubAssessmentListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, scope, assessmentName) + return +} + +// ListAll get security sub-assessments on all your scanned resources inside a subscription scope +// Parameters: +// scope - scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or +// management group (/providers/Microsoft.Management/managementGroups/mgName). +func (client SubAssessmentsClient) ListAll(ctx context.Context, scope string) (result SubAssessmentListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentsClient.ListAll") + defer func() { + sc := -1 + if result.sal.Response.Response != nil { + sc = result.sal.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx, scope) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.sal.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "ListAll", resp, "Failure sending request") + return + } + + result.sal, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "ListAll", resp, "Failure responding to request") + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client SubAssessmentsClient) ListAllPreparer(ctx context.Context, scope string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": autorest.Encode("path", scope), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/subAssessments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client SubAssessmentsClient) ListAllSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client SubAssessmentsClient) ListAllResponder(resp *http.Response) (result SubAssessmentList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client SubAssessmentsClient) listAllNextResults(ctx context.Context, lastResults SubAssessmentList) (result SubAssessmentList, err error) { + req, err := lastResults.subAssessmentListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SubAssessmentsClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client SubAssessmentsClient) ListAllComplete(ctx context.Context, scope string) (result SubAssessmentListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentsClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx, scope) + return +}