From bb007d4a224e2a885bac9ec5180de60ef1fa1d9b Mon Sep 17 00:00:00 2001 From: Azure SDK Bot Date: Thu, 26 Sep 2019 12:39:19 +0000 Subject: [PATCH] Generated from 672852456614dcf0a9200eb3c4daa56030d126b1 adding securityEmail action type --- .../preview/security/mgmt/security/models.go | 79 +- .../mgmt/security/securityapi/models.go | 1 - .../security/mgmt/v1.0/security/models.go | 2084 ++++++++-------- .../v1.0/security/playbookconfigurations.go | 733 ++++++ .../v1.0/security/securityapi/interfaces.go | 16 +- .../mgmt/v1.0/security/subassessments.go | 348 --- .../security/mgmt/v2.0/security/models.go | 2144 ++++++++--------- .../v2.0/security/playbookconfigurations.go | 733 ++++++ .../v2.0/security/securityapi/interfaces.go | 20 +- .../mgmt/v2.0/security/subassessments.go | 348 --- .../security/mgmt/v3.0/security/models.go | 902 +------ .../v3.0/security/securityapi/interfaces.go | 9 - .../mgmt/v3.0/security/subassessments.go | 348 --- 13 files changed, 3508 insertions(+), 4257 deletions(-) create mode 100644 services/preview/security/mgmt/v1.0/security/playbookconfigurations.go delete mode 100644 services/preview/security/mgmt/v1.0/security/subassessments.go create mode 100644 services/preview/security/mgmt/v2.0/security/playbookconfigurations.go delete mode 100644 services/preview/security/mgmt/v2.0/security/subassessments.go delete mode 100644 services/preview/security/mgmt/v3.0/security/subassessments.go diff --git a/profiles/preview/preview/security/mgmt/security/models.go b/profiles/preview/preview/security/mgmt/security/models.go index 9c7bccc72a46..317517969ffc 100644 --- a/profiles/preview/preview/security/mgmt/security/models.go +++ b/profiles/preview/preview/security/mgmt/security/models.go @@ -59,15 +59,6 @@ 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 ( @@ -323,14 +314,6 @@ 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 ( @@ -338,14 +321,6 @@ 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 ( @@ -380,14 +355,6 @@ 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 ( @@ -410,7 +377,6 @@ 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 @@ -446,14 +412,8 @@ 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 @@ -480,7 +440,6 @@ 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 @@ -497,6 +456,7 @@ type DiscoveredSecuritySolutionListIterator = original.DiscoveredSecuritySolutio type DiscoveredSecuritySolutionListPage = original.DiscoveredSecuritySolutionListPage type DiscoveredSecuritySolutionProperties = original.DiscoveredSecuritySolutionProperties type DiscoveredSecuritySolutionsClient = original.DiscoveredSecuritySolutionsClient +type ETag = original.ETag type ExternalSecuritySolution = original.ExternalSecuritySolution type ExternalSecuritySolutionKind1 = original.ExternalSecuritySolutionKind1 type ExternalSecuritySolutionList = original.ExternalSecuritySolutionList @@ -591,27 +551,18 @@ 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 Tags = original.Tags type TagsResource = original.TagsResource type Task = original.Task type TaskList = original.TaskList @@ -631,12 +582,12 @@ type TopologyResourceProperties = original.TopologyResourceProperties type TopologySingleResource = original.TopologySingleResource type TopologySingleResourceChild = original.TopologySingleResourceChild type TopologySingleResourceParent = original.TopologySingleResourceParent +type TrackedResource = original.TrackedResource 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 @@ -917,18 +868,6 @@ 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) } @@ -980,9 +919,6 @@ func PossibleAlertNotificationsValues() []AlertNotifications { func PossibleAlertsToAdminsValues() []AlertsToAdmins { return original.PossibleAlertsToAdminsValues() } -func PossibleAssessedResourceTypeValues() []AssessedResourceType { - return original.PossibleAssessedResourceTypeValues() -} func PossibleAutoProvisionValues() []AutoProvision { return original.PossibleAutoProvisionValues() } @@ -1070,18 +1006,12 @@ func PossibleScriptValues() []Script { 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() } @@ -1091,9 +1021,6 @@ func PossibleStatusReasonValues() []StatusReason { func PossibleStatusValues() []Status { return original.PossibleStatusValues() } -func PossibleSubAssessmentStatusCodeValues() []SubAssessmentStatusCode { - return original.PossibleSubAssessmentStatusCodeValues() -} func PossibleTypeValues() []Type { return original.PossibleTypeValues() } diff --git a/profiles/preview/preview/security/mgmt/security/securityapi/models.go b/profiles/preview/preview/security/mgmt/security/securityapi/models.go index 6291ca8035f2..ea860e5ae9dc 100644 --- a/profiles/preview/preview/security/mgmt/security/securityapi/models.go +++ b/profiles/preview/preview/security/mgmt/security/securityapi/models.go @@ -46,7 +46,6 @@ 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 4d9c73377ece..b18d5dbba8ab 100644 --- a/services/preview/security/mgmt/v1.0/security/models.go +++ b/services/preview/security/mgmt/v1.0/security/models.go @@ -66,6 +66,23 @@ func PossibleActionValues() []Action { return []Action{Add, Recommended, Remove} } +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // ActionTypeEventHub ... + ActionTypeEventHub ActionType = "EventHub" + // ActionTypeLogicApp ... + ActionTypeLogicApp ActionType = "LogicApp" + // ActionTypePlaybookConfigurationAction ... + ActionTypePlaybookConfigurationAction ActionType = "PlaybookConfigurationAction" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ActionTypeEventHub, ActionTypeLogicApp, ActionTypePlaybookConfigurationAction} +} + // AlertNotifications enumerates the values for alert notifications. type AlertNotifications string @@ -96,25 +113,6 @@ 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 @@ -409,6 +407,39 @@ func PossibleMsiValues() []Msi { return []Msi{MsiAudit, MsiEnforce, MsiNone} } +// Operator enumerates the values for operator. +type Operator string + +const ( + // Contains ... + Contains Operator = "Contains" + // EndsWith ... + EndsWith Operator = "EndsWith" + // Equals ... + Equals Operator = "Equals" + // EqualsIgnoreCase ... + EqualsIgnoreCase Operator = "EqualsIgnoreCase" + // GreaterThan ... + GreaterThan Operator = "GreaterThan" + // GreaterThanOrEqualTo ... + GreaterThanOrEqualTo Operator = "GreaterThanOrEqualTo" + // LesserThan ... + LesserThan Operator = "LesserThan" + // LesserThanOrEqualTo ... + LesserThanOrEqualTo Operator = "LesserThanOrEqualTo" + // NotEquals ... + NotEquals Operator = "NotEquals" + // NotEqualsIgnoreCase ... + NotEqualsIgnoreCase Operator = "NotEqualsIgnoreCase" + // StartsWith ... + StartsWith Operator = "StartsWith" +) + +// PossibleOperatorValues returns an array of possible values for the Operator const type. +func PossibleOperatorValues() []Operator { + return []Operator{Contains, EndsWith, Equals, EqualsIgnoreCase, GreaterThan, GreaterThanOrEqualTo, LesserThan, LesserThanOrEqualTo, NotEquals, NotEqualsIgnoreCase, StartsWith} +} + // PricingTier enumerates the values for pricing tier. type PricingTier string @@ -424,6 +455,25 @@ func PossiblePricingTierValues() []PricingTier { return []PricingTier{Free, Standard} } +// PropertyType enumerates the values for property type. +type PropertyType string + +const ( + // Boolean ... + Boolean PropertyType = "boolean" + // Integer ... + Integer PropertyType = "integer" + // Number ... + Number PropertyType = "number" + // String ... + String PropertyType = "string" +) + +// PossiblePropertyTypeValues returns an array of possible values for the PropertyType const type. +func PossiblePropertyTypeValues() []PropertyType { + return []PropertyType{Boolean, Integer, Number, String} +} + // Protocol enumerates the values for protocol. type Protocol string @@ -545,40 +595,6 @@ 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 @@ -652,23 +668,6 @@ 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 @@ -711,15 +710,15 @@ func PossibleTypeValues() []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" + // ValueTypeIPCidr An IP range in CIDR format (e.g. '192.168.0.1/8'). + ValueTypeIPCidr ValueType = "IpCidr" + // ValueTypeString Any string value. + ValueTypeString ValueType = "String" ) // PossibleValueTypeValues returns an array of possible values for the ValueType const type. func PossibleValueTypeValues() []ValueType { - return []ValueType{IPCidr, String} + return []ValueType{ValueTypeIPCidr, ValueTypeString} } // AadConnectivityState1 describes an Azure resource with kind @@ -1053,100 +1052,6 @@ 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. @@ -1809,7 +1714,7 @@ type AllowedConnectionsResourceProperties struct { 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 - READ-ONLY; The value type of the items in the list. Possible values include: 'ValueTypeIPCidr', 'ValueTypeString' ValueType ValueType `json:"valueType,omitempty"` // DisplayName - READ-ONLY; The display name of the custom alert. DisplayName *string `json:"displayName,omitempty"` @@ -2477,84 +2382,6 @@ 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"` @@ -3271,64 +3098,6 @@ 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. @@ -3341,20 +3110,6 @@ 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 @@ -3452,7 +3207,7 @@ type DataExportSettingProperties struct { 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 - READ-ONLY; The value type of the items in the list. Possible values include: 'ValueTypeIPCidr', 'ValueTypeString' ValueType ValueType `json:"valueType,omitempty"` // DisplayName - READ-ONLY; The display name of the custom alert. DisplayName *string `json:"displayName,omitempty"` @@ -3944,6 +3699,14 @@ type EffectiveNetworkSecurityGroups struct { NetworkSecurityGroups *[]string `json:"networkSecurityGroups,omitempty"` } +// ETag entity tag is used for comparing two or more entities from the same requested resource. ETags may +// be returned for individual resources, and then sent via If-Match / If-None-Match headers for concurrency +// control. +type ETag struct { + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. ETags may be returned for individual resources, and then sent via If-Match / If-None-Match headers for concurrency control. + Etag *string `json:"etag,omitempty"` +} + // BasicExternalSecuritySolution represents a security solution external to Azure Security Center which sends // information to an OMS workspace and whose data is displayed by Azure Security Center. type BasicExternalSecuritySolution interface { @@ -4942,7 +4705,7 @@ type Kind struct { // 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 - READ-ONLY; The value type of the items in the list. Possible values include: 'ValueTypeIPCidr', 'ValueTypeString' ValueType ValueType `json:"valueType,omitempty"` // DisplayName - READ-ONLY; The display name of the custom alert. DisplayName *string `json:"displayName,omitempty"` @@ -5146,30 +4909,47 @@ type PathRecommendation struct { ConfigurationStatus ConfigurationStatus1 `json:"configurationStatus,omitempty"` } -// Pricing pricing tier will be applied for the scope based on the resource ID -type Pricing struct { +// PlaybookConfiguration the playbook configuration resource. +type PlaybookConfiguration struct { autorest.Response `json:"-"` - // PricingProperties - Pricing data - *PricingProperties `json:"properties,omitempty"` + // PlaybookConfigurationProperties - Playbook configuration data + *PlaybookConfigurationProperties `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"` + // Kind - Kind of the resource + Kind *string `json:"kind,omitempty"` + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. ETags may be returned for individual resources, and then sent via If-Match / If-None-Match headers for concurrency control. + Etag *string `json:"etag,omitempty"` + // Tags - A list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` } -// MarshalJSON is the custom marshaler for Pricing. -func (p Pricing) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for PlaybookConfiguration. +func (pc PlaybookConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if p.PricingProperties != nil { - objectMap["properties"] = p.PricingProperties + if pc.PlaybookConfigurationProperties != nil { + objectMap["properties"] = pc.PlaybookConfigurationProperties + } + if pc.Kind != nil { + objectMap["kind"] = pc.Kind + } + if pc.Etag != nil { + objectMap["etag"] = pc.Etag + } + if pc.Tags != nil { + objectMap["tags"] = pc.Tags } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for Pricing struct. -func (p *Pricing) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for PlaybookConfiguration struct. +func (pc *PlaybookConfiguration) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -5179,12 +4959,12 @@ func (p *Pricing) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var pricingProperties PricingProperties - err = json.Unmarshal(*v, &pricingProperties) + var playbookConfigurationProperties PlaybookConfigurationProperties + err = json.Unmarshal(*v, &playbookConfigurationProperties) if err != nil { return err } - p.PricingProperties = &pricingProperties + pc.PlaybookConfigurationProperties = &playbookConfigurationProperties } case "id": if v != nil { @@ -5193,7 +4973,7 @@ func (p *Pricing) UnmarshalJSON(body []byte) error { if err != nil { return err } - p.ID = &ID + pc.ID = &ID } case "name": if v != nil { @@ -5202,7 +4982,7 @@ func (p *Pricing) UnmarshalJSON(body []byte) error { if err != nil { return err } - p.Name = &name + pc.Name = &name } case "type": if v != nil { @@ -5211,7 +4991,43 @@ func (p *Pricing) UnmarshalJSON(body []byte) error { if err != nil { return err } - p.Type = &typeVar + pc.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pc.Location = &location + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + pc.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pc.Etag = &etag + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pc.Tags = tags } } } @@ -5219,106 +5035,282 @@ func (p *Pricing) UnmarshalJSON(body []byte) error { return nil } -// PricingList list of pricing configurations response -type PricingList struct { - autorest.Response `json:"-"` - // Value - List of pricing configurations - Value *[]Pricing `json:"value,omitempty"` - // NextLink - READ-ONLY; The URI to fetch the next page. - NextLink *string `json:"nextLink,omitempty"` +// BasicPlaybookConfigurationAction the action that should be triggered. +type BasicPlaybookConfigurationAction interface { + AsPlaybookConfigurationActionLogicApp() (*PlaybookConfigurationActionLogicApp, bool) + AsPlaybookConfigurationActionEventHub() (*PlaybookConfigurationActionEventHub, bool) + AsPlaybookConfigurationAction() (*PlaybookConfigurationAction, bool) } -// PricingListIterator provides access to a complete listing of Pricing values. -type PricingListIterator struct { - i int - page PricingListPage +// PlaybookConfigurationAction the action that should be triggered. +type PlaybookConfigurationAction struct { + // ActionType - Possible values include: 'ActionTypePlaybookConfigurationAction', 'ActionTypeLogicApp', 'ActionTypeEventHub' + ActionType ActionType `json:"actionType,omitempty"` } -// 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 *PricingListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PricingListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() +func unmarshalBasicPlaybookConfigurationAction(body []byte) (BasicPlaybookConfigurationAction, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil + + switch m["actionType"] { + case string(ActionTypeLogicApp): + var pcala PlaybookConfigurationActionLogicApp + err := json.Unmarshal(body, &pcala) + return pcala, err + case string(ActionTypeEventHub): + var pcaeh PlaybookConfigurationActionEventHub + err := json.Unmarshal(body, &pcaeh) + return pcaeh, err + default: + var pca PlaybookConfigurationAction + err := json.Unmarshal(body, &pca) + return pca, err } - err = iter.page.NextWithContext(ctx) +} +func unmarshalBasicPlaybookConfigurationActionArray(body []byte) ([]BasicPlaybookConfigurationAction, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) if err != nil { - iter.i-- - return err + return nil, err } - iter.i = 0 - return nil + + pcaArray := make([]BasicPlaybookConfigurationAction, len(rawMessages)) + + for index, rawMessage := range rawMessages { + pca, err := unmarshalBasicPlaybookConfigurationAction(*rawMessage) + if err != nil { + return nil, err + } + pcaArray[index] = pca + } + return pcaArray, 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 *PricingListIterator) Next() error { - return iter.NextWithContext(context.Background()) +// MarshalJSON is the custom marshaler for PlaybookConfigurationAction. +func (pca PlaybookConfigurationAction) MarshalJSON() ([]byte, error) { + pca.ActionType = ActionTypePlaybookConfigurationAction + objectMap := make(map[string]interface{}) + if pca.ActionType != "" { + objectMap["actionType"] = pca.ActionType + } + return json.Marshal(objectMap) } -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter PricingListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) +// AsPlaybookConfigurationActionLogicApp is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationAction. +func (pca PlaybookConfigurationAction) AsPlaybookConfigurationActionLogicApp() (*PlaybookConfigurationActionLogicApp, bool) { + return nil, false +} + +// AsPlaybookConfigurationActionEventHub is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationAction. +func (pca PlaybookConfigurationAction) AsPlaybookConfigurationActionEventHub() (*PlaybookConfigurationActionEventHub, bool) { + return nil, false +} + +// AsPlaybookConfigurationAction is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationAction. +func (pca PlaybookConfigurationAction) AsPlaybookConfigurationAction() (*PlaybookConfigurationAction, bool) { + return &pca, true +} + +// AsBasicPlaybookConfigurationAction is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationAction. +func (pca PlaybookConfigurationAction) AsBasicPlaybookConfigurationAction() (BasicPlaybookConfigurationAction, bool) { + return &pca, true +} + +// PlaybookConfigurationActionEventHub the event hub action that should be triggered. +type PlaybookConfigurationActionEventHub struct { + // EventHubResourceID - The event hub resource id. + EventHubResourceID *string `json:"eventHubResourceId,omitempty"` + // ConnectionString - The event hub connection string(the primary or secondary key). + ConnectionString *string `json:"connectionString,omitempty"` + // ActionType - Possible values include: 'ActionTypePlaybookConfigurationAction', 'ActionTypeLogicApp', 'ActionTypeEventHub' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for PlaybookConfigurationActionEventHub. +func (pcaeh PlaybookConfigurationActionEventHub) MarshalJSON() ([]byte, error) { + pcaeh.ActionType = ActionTypeEventHub + objectMap := make(map[string]interface{}) + if pcaeh.EventHubResourceID != nil { + objectMap["eventHubResourceId"] = pcaeh.EventHubResourceID + } + if pcaeh.ConnectionString != nil { + objectMap["connectionString"] = pcaeh.ConnectionString + } + if pcaeh.ActionType != "" { + objectMap["actionType"] = pcaeh.ActionType + } + return json.Marshal(objectMap) +} + +// AsPlaybookConfigurationActionLogicApp is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationActionEventHub. +func (pcaeh PlaybookConfigurationActionEventHub) AsPlaybookConfigurationActionLogicApp() (*PlaybookConfigurationActionLogicApp, bool) { + return nil, false +} + +// AsPlaybookConfigurationActionEventHub is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationActionEventHub. +func (pcaeh PlaybookConfigurationActionEventHub) AsPlaybookConfigurationActionEventHub() (*PlaybookConfigurationActionEventHub, bool) { + return &pcaeh, true +} + +// AsPlaybookConfigurationAction is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationActionEventHub. +func (pcaeh PlaybookConfigurationActionEventHub) AsPlaybookConfigurationAction() (*PlaybookConfigurationAction, bool) { + return nil, false +} + +// AsBasicPlaybookConfigurationAction is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationActionEventHub. +func (pcaeh PlaybookConfigurationActionEventHub) AsBasicPlaybookConfigurationAction() (BasicPlaybookConfigurationAction, bool) { + return &pcaeh, true +} + +// PlaybookConfigurationActionLogicApp the logic app action that should be triggered. +type PlaybookConfigurationActionLogicApp struct { + // LogicAppResourceID - The triggered resource id. + LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` + // URI - The uri that should be triggered by an Http GET request. + URI *string `json:"uri,omitempty"` + // ActionType - Possible values include: 'ActionTypePlaybookConfigurationAction', 'ActionTypeLogicApp', 'ActionTypeEventHub' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for PlaybookConfigurationActionLogicApp. +func (pcala PlaybookConfigurationActionLogicApp) MarshalJSON() ([]byte, error) { + pcala.ActionType = ActionTypeLogicApp + objectMap := make(map[string]interface{}) + if pcala.LogicAppResourceID != nil { + objectMap["logicAppResourceId"] = pcala.LogicAppResourceID + } + if pcala.URI != nil { + objectMap["uri"] = pcala.URI + } + if pcala.ActionType != "" { + objectMap["actionType"] = pcala.ActionType + } + return json.Marshal(objectMap) +} + +// AsPlaybookConfigurationActionLogicApp is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationActionLogicApp. +func (pcala PlaybookConfigurationActionLogicApp) AsPlaybookConfigurationActionLogicApp() (*PlaybookConfigurationActionLogicApp, bool) { + return &pcala, true +} + +// AsPlaybookConfigurationActionEventHub is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationActionLogicApp. +func (pcala PlaybookConfigurationActionLogicApp) AsPlaybookConfigurationActionEventHub() (*PlaybookConfigurationActionEventHub, bool) { + return nil, false +} + +// AsPlaybookConfigurationAction is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationActionLogicApp. +func (pcala PlaybookConfigurationActionLogicApp) AsPlaybookConfigurationAction() (*PlaybookConfigurationAction, bool) { + return nil, false +} + +// AsBasicPlaybookConfigurationAction is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationActionLogicApp. +func (pcala PlaybookConfigurationActionLogicApp) AsBasicPlaybookConfigurationAction() (BasicPlaybookConfigurationAction, bool) { + return &pcala, true +} + +// PlaybookConfigurationList list of playbook configurations response. +type PlaybookConfigurationList struct { + autorest.Response `json:"-"` + // Value - The list of playbook configurations under the given scope. + Value *[]PlaybookConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// PlaybookConfigurationListIterator provides access to a complete listing of PlaybookConfiguration values. +type PlaybookConfigurationListIterator struct { + i int + page PlaybookConfigurationListPage +} + +// 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 *PlaybookConfigurationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationListIterator.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 *PlaybookConfigurationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PlaybookConfigurationListIterator) 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 PricingListIterator) Response() PricingList { +func (iter PlaybookConfigurationListIterator) Response() PlaybookConfigurationList { 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 PricingListIterator) Value() Pricing { +func (iter PlaybookConfigurationListIterator) Value() PlaybookConfiguration { if !iter.page.NotDone() { - return Pricing{} + return PlaybookConfiguration{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the PricingListIterator type. -func NewPricingListIterator(page PricingListPage) PricingListIterator { - return PricingListIterator{page: page} +// Creates a new instance of the PlaybookConfigurationListIterator type. +func NewPlaybookConfigurationListIterator(page PlaybookConfigurationListPage) PlaybookConfigurationListIterator { + return PlaybookConfigurationListIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (pl PricingList) IsEmpty() bool { - return pl.Value == nil || len(*pl.Value) == 0 +func (pcl PlaybookConfigurationList) IsEmpty() bool { + return pcl.Value == nil || len(*pcl.Value) == 0 } -// pricingListPreparer prepares a request to retrieve the next set of results. +// playbookConfigurationListPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (pl PricingList) pricingListPreparer(ctx context.Context) (*http.Request, error) { - if pl.NextLink == nil || len(to.String(pl.NextLink)) < 1 { +func (pcl PlaybookConfigurationList) playbookConfigurationListPreparer(ctx context.Context) (*http.Request, error) { + if pcl.NextLink == nil || len(to.String(pcl.NextLink)) < 1 { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(pl.NextLink))) + autorest.WithBaseURL(to.String(pcl.NextLink))) } -// PricingListPage contains a page of Pricing values. -type PricingListPage struct { - fn func(context.Context, PricingList) (PricingList, error) - pl PricingList +// PlaybookConfigurationListPage contains a page of PlaybookConfiguration values. +type PlaybookConfigurationListPage struct { + fn func(context.Context, PlaybookConfigurationList) (PlaybookConfigurationList, error) + pcl PlaybookConfigurationList } // 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 *PricingListPage) NextWithContext(ctx context.Context) (err error) { +func (page *PlaybookConfigurationListPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PricingListPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationListPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -5327,80 +5319,190 @@ func (page *PricingListPage) NextWithContext(ctx context.Context) (err error) { tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.pl) + next, err := page.fn(ctx, page.pcl) if err != nil { return err } - page.pl = next + page.pcl = 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 *PricingListPage) Next() error { +func (page *PlaybookConfigurationListPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page PricingListPage) NotDone() bool { - return !page.pl.IsEmpty() +func (page PlaybookConfigurationListPage) NotDone() bool { + return !page.pcl.IsEmpty() } // Response returns the raw server response from the last page request. -func (page PricingListPage) Response() PricingList { - return page.pl +func (page PlaybookConfigurationListPage) Response() PlaybookConfigurationList { + return page.pcl } // Values returns the slice of values for the current page or nil if there are no values. -func (page PricingListPage) Values() []Pricing { - if page.pl.IsEmpty() { +func (page PlaybookConfigurationListPage) Values() []PlaybookConfiguration { + if page.pcl.IsEmpty() { return nil } - return *page.pl.Value + return *page.pcl.Value } -// Creates a new instance of the PricingListPage type. -func NewPricingListPage(getNextPage func(context.Context, PricingList) (PricingList, error)) PricingListPage { - return PricingListPage{fn: getNextPage} +// Creates a new instance of the PlaybookConfigurationListPage type. +func NewPlaybookConfigurationListPage(getNextPage func(context.Context, PlaybookConfigurationList) (PlaybookConfigurationList, error)) PlaybookConfigurationListPage { + return PlaybookConfigurationListPage{fn: getNextPage} } -// PricingProperties pricing data -type PricingProperties struct { - // PricingTier - Pricing tier type. Possible values include: 'Free', 'Standard' - PricingTier PricingTier `json:"pricingTier,omitempty"` +// PlaybookConfigurationMetadata the metadata of the playbook configuration resource. +type PlaybookConfigurationMetadata struct { + // CreatedDateTimeUtc - READ-ONLY; The playbook configuration creation date. + CreatedDateTimeUtc *date.Time `json:"createdDateTimeUtc,omitempty"` + // CreatedBy - READ-ONLY; The AAD object ID of the entity that created the playbook configuration. + CreatedBy *string `json:"createdBy,omitempty"` + // LastUpdatedDateTimeUtc - READ-ONLY; The playbook configuration last updated date. + LastUpdatedDateTimeUtc *date.Time `json:"lastUpdatedDateTimeUtc,omitempty"` + // LastUpdatedBy - READ-ONLY; The AAD object ID of the entity that last updated the playbook configuration. + LastUpdatedBy *string `json:"lastUpdatedBy,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"` +// PlaybookConfigurationProperties the playbook configuration data. +type PlaybookConfigurationProperties struct { + // Description - The playbook configuration description. + Description *string `json:"description,omitempty"` + // IsEnabled - Indicates whether the playbook configuration is enabled. + IsEnabled *bool `json:"isEnabled,omitempty"` + // Metadata - The metadata of the playbook configuration resource. + Metadata *PlaybookConfigurationMetadata `json:"metadata,omitempty"` + // Scopes - A collection of the subscription's resources scopes on which the playbook configurations logic is applied. + Scopes *[]PlaybookConfigurationScope `json:"scopes,omitempty"` + // Sources - A collection of the source event types which evaluate the playbook configuration set of rules. + Sources *[]PlaybookConfigurationSource `json:"sources,omitempty"` + // Actions - A collection of the actions which are triggered if all the configured rule set evaluation is true. + Actions *[]BasicPlaybookConfigurationAction `json:"actions,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for PlaybookConfigurationProperties struct. +func (pcp *PlaybookConfigurationProperties) 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 "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + pcp.Description = &description + } + case "isEnabled": + if v != nil { + var isEnabled bool + err = json.Unmarshal(*v, &isEnabled) + if err != nil { + return err + } + pcp.IsEnabled = &isEnabled + } + case "metadata": + if v != nil { + var metadata PlaybookConfigurationMetadata + err = json.Unmarshal(*v, &metadata) + if err != nil { + return err + } + pcp.Metadata = &metadata + } + case "scopes": + if v != nil { + var scopes []PlaybookConfigurationScope + err = json.Unmarshal(*v, &scopes) + if err != nil { + return err + } + pcp.Scopes = &scopes + } + case "sources": + if v != nil { + var sources []PlaybookConfigurationSource + err = json.Unmarshal(*v, &sources) + if err != nil { + return err + } + pcp.Sources = &sources + } + case "actions": + if v != nil { + actions, err := unmarshalBasicPlaybookConfigurationActionArray(*v) + if err != nil { + return err + } + pcp.Actions = &actions + } + } + } + + return nil } -// 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 - PublisherName *string `json:"publisherName,omitempty"` - // ProductName - The product name taken from the file's version resource - ProductName *string `json:"productName,omitempty"` - // BinaryName - The "OriginalName" field taken from the file's version resource - BinaryName *string `json:"binaryName,omitempty"` - // Version - The binary file version taken from the file's version resource - Version *string `json:"version,omitempty"` +// PlaybookConfigurationRuleSet a rule set which evaluates all its rules upon an event interception. +type PlaybookConfigurationRuleSet struct { + Rules *[]PlaybookConfigurationTriggeringRule `json:"rules,omitempty"` } -// RegulatoryComplianceAssessment regulatory compliance assessment details and state -type RegulatoryComplianceAssessment struct { +// PlaybookConfigurationScope the subscription's resources scope +type PlaybookConfigurationScope struct { + // Description - The resources scope description. + Description *string `json:"description,omitempty"` + // ScopePath - The resources scope path. + ScopePath *string `json:"scopePath,omitempty"` +} + +// PlaybookConfigurationSource the source event types which evaluate the playbook configuration set of +// rules. For example - security alerts and recommended tasks. +type PlaybookConfigurationSource struct { + // EventSource - A valid event source type. + EventSource *string `json:"eventSource,omitempty"` + // RuleSets - A set of rules which evaluate upon event interception. + RuleSets *[]PlaybookConfigurationRuleSet `json:"ruleSets,omitempty"` +} + +// PlaybookConfigurationTriggeringRule a logic rule which evaluates upon event interception. The rule is +// configured by comparing the specified expected value, in an expected property within the event model, by +// the specified operator. +type PlaybookConfigurationTriggeringRule struct { + // PropertyJPath - The JPath of the entity model property that should be checked. + PropertyJPath *string `json:"propertyJPath,omitempty"` + // PropertyType - The data type of the compared operands. Possible values include: 'String', 'Integer', 'Number', 'Boolean' + PropertyType PropertyType `json:"propertyType,omitempty"` + // ExpectedValue - The expected value. + ExpectedValue *string `json:"expectedValue,omitempty"` + // Operator - A valid comparer operator to use. Possible values include: 'Equals', 'EqualsIgnoreCase', 'GreaterThan', 'GreaterThanOrEqualTo', 'LesserThan', 'LesserThanOrEqualTo', 'NotEquals', 'NotEqualsIgnoreCase', 'Contains', 'StartsWith', 'EndsWith' + Operator Operator `json:"operator,omitempty"` +} + +// PlaybookConfigurationValidationStatus the playbook configuration model state property bag. +type PlaybookConfigurationValidationStatus struct { autorest.Response `json:"-"` - // RegulatoryComplianceAssessmentProperties - Regulatory compliance assessment data - *RegulatoryComplianceAssessmentProperties `json:"properties,omitempty"` + // IsValid - Indicates whether the model is valid or not. + IsValid *bool `json:"isValid,omitempty"` + // Message - The validation message. + Message *string `json:"message,omitempty"` +} + +// Pricing pricing tier will be applied for the scope based on the resource ID +type Pricing struct { + autorest.Response `json:"-"` + // PricingProperties - Pricing data + *PricingProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name @@ -5409,17 +5511,17 @@ type RegulatoryComplianceAssessment struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for RegulatoryComplianceAssessment. -func (rca RegulatoryComplianceAssessment) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for Pricing. +func (p Pricing) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if rca.RegulatoryComplianceAssessmentProperties != nil { - objectMap["properties"] = rca.RegulatoryComplianceAssessmentProperties + if p.PricingProperties != nil { + objectMap["properties"] = p.PricingProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for RegulatoryComplianceAssessment struct. -func (rca *RegulatoryComplianceAssessment) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for Pricing struct. +func (p *Pricing) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -5429,12 +5531,12 @@ func (rca *RegulatoryComplianceAssessment) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var regulatoryComplianceAssessmentProperties RegulatoryComplianceAssessmentProperties - err = json.Unmarshal(*v, ®ulatoryComplianceAssessmentProperties) + var pricingProperties PricingProperties + err = json.Unmarshal(*v, &pricingProperties) if err != nil { return err } - rca.RegulatoryComplianceAssessmentProperties = ®ulatoryComplianceAssessmentProperties + p.PricingProperties = &pricingProperties } case "id": if v != nil { @@ -5443,7 +5545,7 @@ func (rca *RegulatoryComplianceAssessment) UnmarshalJSON(body []byte) error { if err != nil { return err } - rca.ID = &ID + p.ID = &ID } case "name": if v != nil { @@ -5452,7 +5554,7 @@ func (rca *RegulatoryComplianceAssessment) UnmarshalJSON(body []byte) error { if err != nil { return err } - rca.Name = &name + p.Name = &name } case "type": if v != nil { @@ -5461,7 +5563,7 @@ func (rca *RegulatoryComplianceAssessment) UnmarshalJSON(body []byte) error { if err != nil { return err } - rca.Type = &typeVar + p.Type = &typeVar } } } @@ -5469,26 +5571,26 @@ func (rca *RegulatoryComplianceAssessment) UnmarshalJSON(body []byte) error { return nil } -// RegulatoryComplianceAssessmentList list of regulatory compliance assessment response -type RegulatoryComplianceAssessmentList struct { +// PricingList list of pricing configurations response +type PricingList struct { autorest.Response `json:"-"` - Value *[]RegulatoryComplianceAssessment `json:"value,omitempty"` + // Value - List of pricing configurations + Value *[]Pricing `json:"value,omitempty"` // NextLink - READ-ONLY; The URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` } -// RegulatoryComplianceAssessmentListIterator provides access to a complete listing of -// RegulatoryComplianceAssessment values. -type RegulatoryComplianceAssessmentListIterator struct { +// PricingListIterator provides access to a complete listing of Pricing values. +type PricingListIterator struct { i int - page RegulatoryComplianceAssessmentListPage + page PricingListPage } // 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 *RegulatoryComplianceAssessmentListIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *PricingListIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegulatoryComplianceAssessmentListIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/PricingListIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -5513,31 +5615,281 @@ func (iter *RegulatoryComplianceAssessmentListIterator) NextWithContext(ctx cont // 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 *RegulatoryComplianceAssessmentListIterator) Next() error { +func (iter *PricingListIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RegulatoryComplianceAssessmentListIterator) NotDone() bool { +func (iter PricingListIterator) 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 RegulatoryComplianceAssessmentListIterator) Response() RegulatoryComplianceAssessmentList { +func (iter PricingListIterator) Response() PricingList { 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 RegulatoryComplianceAssessmentListIterator) Value() RegulatoryComplianceAssessment { +func (iter PricingListIterator) Value() Pricing { if !iter.page.NotDone() { - return RegulatoryComplianceAssessment{} + return Pricing{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the RegulatoryComplianceAssessmentListIterator type. -func NewRegulatoryComplianceAssessmentListIterator(page RegulatoryComplianceAssessmentListPage) RegulatoryComplianceAssessmentListIterator { +// Creates a new instance of the PricingListIterator type. +func NewPricingListIterator(page PricingListPage) PricingListIterator { + return PricingListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pl PricingList) IsEmpty() bool { + return pl.Value == nil || len(*pl.Value) == 0 +} + +// pricingListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pl PricingList) pricingListPreparer(ctx context.Context) (*http.Request, error) { + if pl.NextLink == nil || len(to.String(pl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pl.NextLink))) +} + +// PricingListPage contains a page of Pricing values. +type PricingListPage struct { + fn func(context.Context, PricingList) (PricingList, error) + pl PricingList +} + +// 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 *PricingListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PricingListPage.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.pl) + if err != nil { + return err + } + page.pl = 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 *PricingListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PricingListPage) NotDone() bool { + return !page.pl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PricingListPage) Response() PricingList { + return page.pl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PricingListPage) Values() []Pricing { + if page.pl.IsEmpty() { + return nil + } + return *page.pl.Value +} + +// Creates a new instance of the PricingListPage type. +func NewPricingListPage(getNextPage func(context.Context, PricingList) (PricingList, error)) PricingListPage { + return PricingListPage{fn: getNextPage} +} + +// PricingProperties pricing data +type PricingProperties struct { + // PricingTier - Pricing tier type. Possible values include: 'Free', 'Standard' + 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 + PublisherName *string `json:"publisherName,omitempty"` + // ProductName - The product name taken from the file's version resource + ProductName *string `json:"productName,omitempty"` + // BinaryName - The "OriginalName" field taken from the file's version resource + BinaryName *string `json:"binaryName,omitempty"` + // Version - The binary file version taken from the file's version resource + Version *string `json:"version,omitempty"` +} + +// RegulatoryComplianceAssessment regulatory compliance assessment details and state +type RegulatoryComplianceAssessment struct { + autorest.Response `json:"-"` + // RegulatoryComplianceAssessmentProperties - Regulatory compliance assessment data + *RegulatoryComplianceAssessmentProperties `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 RegulatoryComplianceAssessment. +func (rca RegulatoryComplianceAssessment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rca.RegulatoryComplianceAssessmentProperties != nil { + objectMap["properties"] = rca.RegulatoryComplianceAssessmentProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RegulatoryComplianceAssessment struct. +func (rca *RegulatoryComplianceAssessment) 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 regulatoryComplianceAssessmentProperties RegulatoryComplianceAssessmentProperties + err = json.Unmarshal(*v, ®ulatoryComplianceAssessmentProperties) + if err != nil { + return err + } + rca.RegulatoryComplianceAssessmentProperties = ®ulatoryComplianceAssessmentProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rca.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rca.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rca.Type = &typeVar + } + } + } + + return nil +} + +// RegulatoryComplianceAssessmentList list of regulatory compliance assessment response +type RegulatoryComplianceAssessmentList struct { + autorest.Response `json:"-"` + Value *[]RegulatoryComplianceAssessment `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// RegulatoryComplianceAssessmentListIterator provides access to a complete listing of +// RegulatoryComplianceAssessment values. +type RegulatoryComplianceAssessmentListIterator struct { + i int + page RegulatoryComplianceAssessmentListPage +} + +// 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 *RegulatoryComplianceAssessmentListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegulatoryComplianceAssessmentListIterator.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 *RegulatoryComplianceAssessmentListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RegulatoryComplianceAssessmentListIterator) 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 RegulatoryComplianceAssessmentListIterator) Response() RegulatoryComplianceAssessmentList { + 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 RegulatoryComplianceAssessmentListIterator) Value() RegulatoryComplianceAssessment { + if !iter.page.NotDone() { + return RegulatoryComplianceAssessment{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RegulatoryComplianceAssessmentListIterator type. +func NewRegulatoryComplianceAssessmentListIterator(page RegulatoryComplianceAssessmentListPage) RegulatoryComplianceAssessmentListIterator { return RegulatoryComplianceAssessmentListIterator{page: page} } @@ -6070,432 +6422,78 @@ func (page RegulatoryComplianceStandardListPage) NotDone() bool { return !page.rcsl.IsEmpty() } -// Response returns the raw server response from the last page request. -func (page RegulatoryComplianceStandardListPage) Response() RegulatoryComplianceStandardList { - return page.rcsl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page RegulatoryComplianceStandardListPage) Values() []RegulatoryComplianceStandard { - if page.rcsl.IsEmpty() { - return nil - } - return *page.rcsl.Value -} - -// Creates a new instance of the RegulatoryComplianceStandardListPage type. -func NewRegulatoryComplianceStandardListPage(getNextPage func(context.Context, RegulatoryComplianceStandardList) (RegulatoryComplianceStandardList, error)) RegulatoryComplianceStandardListPage { - return RegulatoryComplianceStandardListPage{fn: getNextPage} -} - -// RegulatoryComplianceStandardProperties regulatory compliance standard data -type RegulatoryComplianceStandardProperties struct { - // State - Aggregative state based on the standard's supported controls states. Possible values include: 'StatePassed', 'StateFailed', 'StateSkipped', 'StateUnsupported' - State State `json:"state,omitempty"` - // PassedControls - READ-ONLY; The number of supported regulatory compliance controls of the given standard with a passed state - PassedControls *int32 `json:"passedControls,omitempty"` - // FailedControls - READ-ONLY; The number of supported regulatory compliance controls of the given standard with a failed state - FailedControls *int32 `json:"failedControls,omitempty"` - // SkippedControls - READ-ONLY; The number of supported regulatory compliance controls of the given standard with a skipped state - SkippedControls *int32 `json:"skippedControls,omitempty"` - // UnsupportedControls - READ-ONLY; The number of regulatory compliance controls of the given standard which are unsupported by automated assessments - UnsupportedControls *int32 `json:"unsupportedControls,omitempty"` -} - -// Resource describes an Azure resource. -type Resource struct { - // 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"` -} - -// 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 { - // Name - The name of the rule - Name *string `json:"name,omitempty"` - // Direction - The rule's direction. Possible values include: 'Inbound', 'Outbound' - Direction Direction `json:"direction,omitempty"` - // DestinationPort - The rule's destination port - DestinationPort *int32 `json:"destinationPort,omitempty"` - // Protocols - The rule's transport protocols - Protocols *[]TransportProtocol `json:"protocols,omitempty"` - // IPAddresses - The remote IP addresses that should be able to communicate with the Azure resource on the rule's destination port and protocol - IPAddresses *[]string `json:"ipAddresses,omitempty"` -} - -// SensitivityLabel the sensitivity label. -type SensitivityLabel struct { - // DisplayName - The name of the sensitivity label. - DisplayName *string `json:"displayName,omitempty"` - // Order - The order of the sensitivity label. - Order *float64 `json:"order,omitempty"` - // Enabled - Indicates whether the label is enabled or not. - 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:"-"` - // Kind - the kind of the settings string (DataExportSetting). Possible values include: 'SettingKindDataExportSetting', 'SettingKindAlertSuppressionSetting' - Kind SettingKind `json:"kind,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"` -} - -// SettingResource the kind of the security setting -type SettingResource struct { - // Kind - the kind of the settings string (DataExportSetting). Possible values include: 'SettingKindDataExportSetting', 'SettingKindAlertSuppressionSetting' - Kind SettingKind `json:"kind,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"` -} - -// SettingsList subscription settings list. -type SettingsList struct { - autorest.Response `json:"-"` - // Value - The settings list. - Value *[]Setting `json:"value,omitempty"` - // NextLink - READ-ONLY; The URI to fetch the next page. - NextLink *string `json:"nextLink,omitempty"` -} - -// SettingsListIterator provides access to a complete listing of Setting values. -type SettingsListIterator struct { - i int - page SettingsListPage -} - -// 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 *SettingsListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SettingsListIterator.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 *SettingsListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SettingsListIterator) 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 SettingsListIterator) Response() SettingsList { - 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 SettingsListIterator) Value() Setting { - if !iter.page.NotDone() { - return Setting{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SettingsListIterator type. -func NewSettingsListIterator(page SettingsListPage) SettingsListIterator { - return SettingsListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sl SettingsList) IsEmpty() bool { - return sl.Value == nil || len(*sl.Value) == 0 -} - -// settingsListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sl SettingsList) settingsListPreparer(ctx context.Context) (*http.Request, error) { - if sl.NextLink == nil || len(to.String(sl.NextLink)) < 1 { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sl.NextLink))) -} - -// SettingsListPage contains a page of Setting values. -type SettingsListPage struct { - fn func(context.Context, SettingsList) (SettingsList, error) - sl SettingsList -} - -// 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 *SettingsListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SettingsListPage.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.sl) - if err != nil { - return err - } - page.sl = 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 *SettingsListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SettingsListPage) NotDone() bool { - return !page.sl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SettingsListPage) Response() SettingsList { - return page.sl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SettingsListPage) Values() []Setting { - if page.sl.IsEmpty() { - return nil - } - return *page.sl.Value -} - -// Creates a new instance of the SettingsListPage type. -func NewSettingsListPage(getNextPage func(context.Context, SettingsList) (SettingsList, error)) SettingsListPage { - 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"` +// Response returns the raw server response from the last page request. +func (page RegulatoryComplianceStandardListPage) Response() RegulatoryComplianceStandardList { + return page.rcsl } -// 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 +// Values returns the slice of values for the current page or nil if there are no values. +func (page RegulatoryComplianceStandardListPage) Values() []RegulatoryComplianceStandard { + if page.rcsl.IsEmpty() { + return nil } - return json.Marshal(objectMap) + return *page.rcsl.Value } -// AsSQLServerVulnerabilityProperties is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. -func (ssvp SQLServerVulnerabilityProperties) AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) { - return &ssvp, true +// Creates a new instance of the RegulatoryComplianceStandardListPage type. +func NewRegulatoryComplianceStandardListPage(getNextPage func(context.Context, RegulatoryComplianceStandardList) (RegulatoryComplianceStandardList, error)) RegulatoryComplianceStandardListPage { + return RegulatoryComplianceStandardListPage{fn: getNextPage} } -// AsContainerRegistryVulnerabilityProperties is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. -func (ssvp SQLServerVulnerabilityProperties) AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) { - return nil, false +// RegulatoryComplianceStandardProperties regulatory compliance standard data +type RegulatoryComplianceStandardProperties struct { + // State - Aggregative state based on the standard's supported controls states. Possible values include: 'StatePassed', 'StateFailed', 'StateSkipped', 'StateUnsupported' + State State `json:"state,omitempty"` + // PassedControls - READ-ONLY; The number of supported regulatory compliance controls of the given standard with a passed state + PassedControls *int32 `json:"passedControls,omitempty"` + // FailedControls - READ-ONLY; The number of supported regulatory compliance controls of the given standard with a failed state + FailedControls *int32 `json:"failedControls,omitempty"` + // SkippedControls - READ-ONLY; The number of supported regulatory compliance controls of the given standard with a skipped state + SkippedControls *int32 `json:"skippedControls,omitempty"` + // UnsupportedControls - READ-ONLY; The number of regulatory compliance controls of the given standard which are unsupported by automated assessments + UnsupportedControls *int32 `json:"unsupportedControls,omitempty"` } -// AsServerVulnerabilityProperties is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. -func (ssvp SQLServerVulnerabilityProperties) AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) { - return nil, false +// Resource describes an Azure resource. +type Resource struct { + // 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"` } -// AsAdditionalData is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. -func (ssvp SQLServerVulnerabilityProperties) AsAdditionalData() (*AdditionalData, bool) { - return nil, false +// 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 { + // Name - The name of the rule + Name *string `json:"name,omitempty"` + // Direction - The rule's direction. Possible values include: 'Inbound', 'Outbound' + Direction Direction `json:"direction,omitempty"` + // DestinationPort - The rule's destination port + DestinationPort *int32 `json:"destinationPort,omitempty"` + // Protocols - The rule's transport protocols + Protocols *[]TransportProtocol `json:"protocols,omitempty"` + // IPAddresses - The remote IP addresses that should be able to communicate with the Azure resource on the rule's destination port and protocol + IPAddresses *[]string `json:"ipAddresses,omitempty"` } -// AsBasicAdditionalData is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. -func (ssvp SQLServerVulnerabilityProperties) AsBasicAdditionalData() (BasicAdditionalData, bool) { - return &ssvp, true +// SensitivityLabel the sensitivity label. +type SensitivityLabel struct { + // DisplayName - The name of the sensitivity label. + DisplayName *string `json:"displayName,omitempty"` + // Order - The order of the sensitivity label. + Order *float64 `json:"order,omitempty"` + // Enabled - Indicates whether the label is enabled or not. + Enabled *bool `json:"enabled,omitempty"` } -// SubAssessment security sub-assessment on a resource -type SubAssessment struct { - autorest.Response `json:"-"` - *SubAssessmentProperties `json:"properties,omitempty"` +// Setting represents a security setting in Azure Security Center. +type Setting struct { + autorest.Response `json:"-"` + // Kind - the kind of the settings string (DataExportSetting). Possible values include: 'SettingKindDataExportSetting', 'SettingKindAlertSuppressionSetting' + Kind SettingKind `json:"kind,omitempty"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name @@ -6504,86 +6502,38 @@ type SubAssessment struct { 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 +// SettingResource the kind of the security setting +type SettingResource struct { + // Kind - the kind of the settings string (DataExportSetting). Possible values include: 'SettingKindDataExportSetting', 'SettingKindAlertSuppressionSetting' + Kind SettingKind `json:"kind,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"` } -// SubAssessmentList list of security sub-assessments -type SubAssessmentList struct { +// SettingsList subscription settings list. +type SettingsList struct { autorest.Response `json:"-"` - // Value - READ-ONLY - Value *[]SubAssessment `json:"value,omitempty"` + // Value - The settings list. + Value *[]Setting `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 { +// SettingsListIterator provides access to a complete listing of Setting values. +type SettingsListIterator struct { i int - page SubAssessmentListPage + page SettingsListPage } // 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) { +func (iter *SettingsListIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentListIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/SettingsListIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -6608,62 +6558,62 @@ func (iter *SubAssessmentListIterator) NextWithContext(ctx context.Context) (err // 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 { +func (iter *SettingsListIterator) 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 { +func (iter SettingsListIterator) 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 { +func (iter SettingsListIterator) Response() SettingsList { 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 { +func (iter SettingsListIterator) Value() Setting { if !iter.page.NotDone() { - return SubAssessment{} + return Setting{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the SubAssessmentListIterator type. -func NewSubAssessmentListIterator(page SubAssessmentListPage) SubAssessmentListIterator { - return SubAssessmentListIterator{page: page} +// Creates a new instance of the SettingsListIterator type. +func NewSettingsListIterator(page SettingsListPage) SettingsListIterator { + return SettingsListIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (sal SubAssessmentList) IsEmpty() bool { - return sal.Value == nil || len(*sal.Value) == 0 +func (sl SettingsList) IsEmpty() bool { + return sl.Value == nil || len(*sl.Value) == 0 } -// subAssessmentListPreparer prepares a request to retrieve the next set of results. +// settingsListPreparer 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 { +func (sl SettingsList) settingsListPreparer(ctx context.Context) (*http.Request, error) { + if sl.NextLink == nil || len(to.String(sl.NextLink)) < 1 { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(sal.NextLink))) + autorest.WithBaseURL(to.String(sl.NextLink))) } -// SubAssessmentListPage contains a page of SubAssessment values. -type SubAssessmentListPage struct { - fn func(context.Context, SubAssessmentList) (SubAssessmentList, error) - sal SubAssessmentList +// SettingsListPage contains a page of Setting values. +type SettingsListPage struct { + fn func(context.Context, SettingsList) (SettingsList, error) + sl SettingsList } // 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) { +func (page *SettingsListPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentListPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/SettingsListPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -6672,178 +6622,57 @@ func (page *SubAssessmentListPage) NextWithContext(ctx context.Context) (err err tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.sal) + next, err := page.fn(ctx, page.sl) if err != nil { return err } - page.sal = next + page.sl = 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 { +func (page *SettingsListPage) 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() +func (page SettingsListPage) NotDone() bool { + return !page.sl.IsEmpty() } // Response returns the raw server response from the last page request. -func (page SubAssessmentListPage) Response() SubAssessmentList { - return page.sal +func (page SettingsListPage) Response() SettingsList { + return page.sl } // 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() { +func (page SettingsListPage) Values() []Setting { + if page.sl.IsEmpty() { return nil } - return *page.sal.Value + return *page.sl.Value } -// Creates a new instance of the SubAssessmentListPage type. -func NewSubAssessmentListPage(getNextPage func(context.Context, SubAssessmentList) (SubAssessmentList, error)) SubAssessmentListPage { - return SubAssessmentListPage{fn: getNextPage} +// Creates a new instance of the SettingsListPage type. +func NewSettingsListPage(getNextPage func(context.Context, SettingsList) (SettingsList, error)) SettingsListPage { + return SettingsListPage{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"` +// Tags a list of key value pairs that describe the resource. +type Tags struct { + // Tags - A list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` } -// 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 - } - } +// MarshalJSON is the custom marshaler for Tags. +func (t Tags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.Tags != nil { + objectMap["tags"] = t.Tags } - - 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"` + return json.Marshal(objectMap) } // Task security task that we recommend to do in order to strengthen security @@ -7434,6 +7263,39 @@ type TopologySingleResourceParent struct { ResourceID *string `json:"resourceId,omitempty"` } +// TrackedResource describes an Azure tracked resource. +type TrackedResource struct { + // 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"` + // Kind - Kind of the resource + Kind *string `json:"kind,omitempty"` + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. ETags may be returned for individual resources, and then sent via If-Match / If-None-Match headers for concurrency control. + Etag *string `json:"etag,omitempty"` + // Tags - A list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Kind != nil { + objectMap["kind"] = tr.Kind + } + if tr.Etag != nil { + objectMap["etag"] = tr.Etag + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + // UserRecommendation represents a user that is recommended to be allowed for a certain rule type UserRecommendation struct { // Username - Represents a user that is recommended to be allowed for a certain rule @@ -7442,14 +7304,6 @@ 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/playbookconfigurations.go b/services/preview/security/mgmt/v1.0/security/playbookconfigurations.go new file mode 100644 index 000000000000..ba251d47dc38 --- /dev/null +++ b/services/preview/security/mgmt/v1.0/security/playbookconfigurations.go @@ -0,0 +1,733 @@ +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" +) + +// PlaybookConfigurationsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type PlaybookConfigurationsClient struct { + BaseClient +} + +// NewPlaybookConfigurationsClient creates an instance of the PlaybookConfigurationsClient client. +func NewPlaybookConfigurationsClient(subscriptionID string, ascLocation string) PlaybookConfigurationsClient { + return NewPlaybookConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewPlaybookConfigurationsClientWithBaseURI creates an instance of the PlaybookConfigurationsClient client. +func NewPlaybookConfigurationsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) PlaybookConfigurationsClient { + return PlaybookConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// CreateOrUpdate create or update a playbook configuration. If a playbook configuration is already created and a +// subsequent create request is issued with different properties, the playbook configuration properties will be +// updated. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// playbookConfigurationName - the playbook Configuration name. +// playbookConfiguration - the playbook configuration resource +func (client PlaybookConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration PlaybookConfiguration) (result PlaybookConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.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.PlaybookConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, playbookConfigurationName, playbookConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "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.PlaybookConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PlaybookConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration PlaybookConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "playbookConfigurationName": autorest.Encode("path", playbookConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + 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("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/playbookConfigurations/{playbookConfigurationName}", pathParameters), + autorest.WithJSON(playbookConfiguration), + 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 PlaybookConfigurationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PlaybookConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result PlaybookConfiguration, 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 delete a playbook configuration. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// playbookConfigurationName - the playbook Configuration name. +func (client PlaybookConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, playbookConfigurationName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.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.PlaybookConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, playbookConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PlaybookConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, playbookConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "playbookConfigurationName": autorest.Encode("path", playbookConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/playbookConfigurations/{playbookConfigurationName}", 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 PlaybookConfigurationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PlaybookConfigurationsClient) 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 get the details of a playbook configuration. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// playbookConfigurationName - the playbook Configuration name. +func (client PlaybookConfigurationsClient) Get(ctx context.Context, resourceGroupName string, playbookConfigurationName string) (result PlaybookConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.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.PlaybookConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, playbookConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "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.PlaybookConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client PlaybookConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, playbookConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "playbookConfigurationName": autorest.Encode("path", playbookConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/playbookConfigurations/{playbookConfigurationName}", 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 PlaybookConfigurationsClient) 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 PlaybookConfigurationsClient) GetResponder(resp *http.Response) (result PlaybookConfiguration, 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 all playbook configurations in a subscription. +func (client PlaybookConfigurationsClient) List(ctx context.Context) (result PlaybookConfigurationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.List") + defer func() { + sc := -1 + if result.pcl.Response.Response != nil { + sc = result.pcl.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.PlaybookConfigurationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.pcl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.pcl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client PlaybookConfigurationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/playbookConfigurations", 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 PlaybookConfigurationsClient) 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 PlaybookConfigurationsClient) ListResponder(resp *http.Response) (result PlaybookConfigurationList, 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 PlaybookConfigurationsClient) listNextResults(ctx context.Context, lastResults PlaybookConfigurationList) (result PlaybookConfigurationList, err error) { + req, err := lastResults.playbookConfigurationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "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.PlaybookConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PlaybookConfigurationsClient) ListComplete(ctx context.Context) (result PlaybookConfigurationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.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) + return +} + +// ListByResourceGroup get all playbook configurations in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +func (client PlaybookConfigurationsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result PlaybookConfigurationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.pcl.Response.Response != nil { + sc = result.pcl.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.PlaybookConfigurationsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.pcl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.pcl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client PlaybookConfigurationsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/playbookConfigurations", 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 PlaybookConfigurationsClient) 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 PlaybookConfigurationsClient) ListByResourceGroupResponder(resp *http.Response) (result PlaybookConfigurationList, 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 PlaybookConfigurationsClient) listByResourceGroupNextResults(ctx context.Context, lastResults PlaybookConfigurationList) (result PlaybookConfigurationList, err error) { + req, err := lastResults.playbookConfigurationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "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.PlaybookConfigurationsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client PlaybookConfigurationsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result PlaybookConfigurationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.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) + return +} + +// Patch patch an existing playbook configuration. Supports only Tags +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// playbookConfigurationName - the playbook Configuration name. +// playbookConfiguration - the playbook configuration resource +func (client PlaybookConfigurationsClient) Patch(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration PlaybookConfiguration) (result PlaybookConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.Patch") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.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.PlaybookConfigurationsClient", "Patch", err.Error()) + } + + req, err := client.PatchPreparer(ctx, resourceGroupName, playbookConfigurationName, playbookConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Patch", nil, "Failure preparing request") + return + } + + resp, err := client.PatchSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Patch", resp, "Failure sending request") + return + } + + result, err = client.PatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Patch", resp, "Failure responding to request") + } + + return +} + +// PatchPreparer prepares the Patch request. +func (client PlaybookConfigurationsClient) PatchPreparer(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration PlaybookConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "playbookConfigurationName": autorest.Encode("path", playbookConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/playbookConfigurations/{playbookConfigurationName}", pathParameters), + autorest.WithJSON(playbookConfiguration), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client PlaybookConfigurationsClient) PatchSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client PlaybookConfigurationsClient) PatchResponder(resp *http.Response) (result PlaybookConfiguration, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Validate validate the playbook configuration model before create or update. Any validation errors are returned to +// the client. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// playbookConfigurationName - the playbook Configuration name. +// playbookConfiguration - the playbook configuration resource +func (client PlaybookConfigurationsClient) Validate(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration PlaybookConfiguration) (result PlaybookConfigurationValidationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.Validate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.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.PlaybookConfigurationsClient", "Validate", err.Error()) + } + + req, err := client.ValidatePreparer(ctx, resourceGroupName, playbookConfigurationName, playbookConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Validate", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Validate", resp, "Failure sending request") + return + } + + result, err = client.ValidateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Validate", resp, "Failure responding to request") + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client PlaybookConfigurationsClient) ValidatePreparer(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration PlaybookConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "playbookConfigurationName": autorest.Encode("path", playbookConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/playbookConfigurations/{playbookConfigurationName}/validate", pathParameters), + autorest.WithJSON(playbookConfiguration), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client PlaybookConfigurationsClient) ValidateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +func (client PlaybookConfigurationsClient) ValidateResponder(resp *http.Response) (result PlaybookConfigurationValidationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} 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 811063e3ef89..d8afe6e8098d 100644 --- a/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go @@ -23,14 +23,18 @@ 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) +// PlaybookConfigurationsClientAPI contains the set of methods on the PlaybookConfigurationsClient type. +type PlaybookConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration security.PlaybookConfiguration) (result security.PlaybookConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, playbookConfigurationName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, playbookConfigurationName string) (result security.PlaybookConfiguration, err error) + List(ctx context.Context) (result security.PlaybookConfigurationListPage, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result security.PlaybookConfigurationListPage, err error) + Patch(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration security.PlaybookConfiguration) (result security.PlaybookConfiguration, err error) + Validate(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration security.PlaybookConfiguration) (result security.PlaybookConfigurationValidationStatus, err error) } -var _ SubAssessmentsClientAPI = (*security.SubAssessmentsClient)(nil) +var _ PlaybookConfigurationsClientAPI = (*security.PlaybookConfigurationsClient)(nil) // RegulatoryComplianceStandardsClientAPI contains the set of methods on the RegulatoryComplianceStandardsClient type. type RegulatoryComplianceStandardsClientAPI interface { diff --git a/services/preview/security/mgmt/v1.0/security/subassessments.go b/services/preview/security/mgmt/v1.0/security/subassessments.go deleted file mode 100644 index 4fa19d8e398d..000000000000 --- a/services/preview/security/mgmt/v1.0/security/subassessments.go +++ /dev/null @@ -1,348 +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/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 69dfdeb2659e..83dfbcbb45ac 100644 --- a/services/preview/security/mgmt/v2.0/security/models.go +++ b/services/preview/security/mgmt/v2.0/security/models.go @@ -66,6 +66,23 @@ func PossibleActionValues() []Action { return []Action{Add, Recommended, Remove} } +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // ActionTypeEventHub ... + ActionTypeEventHub ActionType = "EventHub" + // ActionTypeLogicApp ... + ActionTypeLogicApp ActionType = "LogicApp" + // ActionTypePlaybookConfigurationAction ... + ActionTypePlaybookConfigurationAction ActionType = "PlaybookConfigurationAction" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ActionTypeEventHub, ActionTypeLogicApp, ActionTypePlaybookConfigurationAction} +} + // AlertNotifications enumerates the values for alert notifications. type AlertNotifications string @@ -96,25 +113,6 @@ 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 @@ -435,6 +433,39 @@ func PossibleMsiValues() []Msi { return []Msi{MsiAudit, MsiEnforce, MsiNone} } +// Operator enumerates the values for operator. +type Operator string + +const ( + // Contains ... + Contains Operator = "Contains" + // EndsWith ... + EndsWith Operator = "EndsWith" + // Equals ... + Equals Operator = "Equals" + // EqualsIgnoreCase ... + EqualsIgnoreCase Operator = "EqualsIgnoreCase" + // GreaterThan ... + GreaterThan Operator = "GreaterThan" + // GreaterThanOrEqualTo ... + GreaterThanOrEqualTo Operator = "GreaterThanOrEqualTo" + // LesserThan ... + LesserThan Operator = "LesserThan" + // LesserThanOrEqualTo ... + LesserThanOrEqualTo Operator = "LesserThanOrEqualTo" + // NotEquals ... + NotEquals Operator = "NotEquals" + // NotEqualsIgnoreCase ... + NotEqualsIgnoreCase Operator = "NotEqualsIgnoreCase" + // StartsWith ... + StartsWith Operator = "StartsWith" +) + +// PossibleOperatorValues returns an array of possible values for the Operator const type. +func PossibleOperatorValues() []Operator { + return []Operator{Contains, EndsWith, Equals, EqualsIgnoreCase, GreaterThan, GreaterThanOrEqualTo, LesserThan, LesserThanOrEqualTo, NotEquals, NotEqualsIgnoreCase, StartsWith} +} + // PricingTier enumerates the values for pricing tier. type PricingTier string @@ -450,6 +481,25 @@ func PossiblePricingTierValues() []PricingTier { return []PricingTier{Free, Standard} } +// PropertyType enumerates the values for property type. +type PropertyType string + +const ( + // Boolean ... + Boolean PropertyType = "boolean" + // Integer ... + Integer PropertyType = "integer" + // Number ... + Number PropertyType = "number" + // String ... + String PropertyType = "string" +) + +// PossiblePropertyTypeValues returns an array of possible values for the PropertyType const type. +func PossiblePropertyTypeValues() []PropertyType { + return []PropertyType{Boolean, Integer, Number, String} +} + // Protocol enumerates the values for protocol. type Protocol string @@ -641,23 +691,6 @@ 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 @@ -673,23 +706,6 @@ 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 @@ -763,23 +779,6 @@ 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 @@ -822,15 +821,15 @@ func PossibleTypeValues() []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" + // ValueTypeIPCidr An IP range in CIDR format (e.g. '192.168.0.1/8'). + ValueTypeIPCidr ValueType = "IpCidr" + // ValueTypeString Any string value. + ValueTypeString ValueType = "String" ) // PossibleValueTypeValues returns an array of possible values for the ValueType const type. func PossibleValueTypeValues() []ValueType { - return []ValueType{IPCidr, String} + return []ValueType{ValueTypeIPCidr, ValueTypeString} } // AadConnectivityState1 describes an Azure resource with kind @@ -1164,100 +1163,6 @@ 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. @@ -1920,7 +1825,7 @@ type AllowedConnectionsResourceProperties struct { 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 - READ-ONLY; The value type of the items in the list. Possible values include: 'ValueTypeIPCidr', 'ValueTypeString' ValueType ValueType `json:"valueType,omitempty"` // DisplayName - READ-ONLY; The display name of the custom alert. DisplayName *string `json:"displayName,omitempty"` @@ -2588,84 +2493,6 @@ 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"` @@ -3382,64 +3209,6 @@ 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. @@ -3452,20 +3221,6 @@ 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 @@ -3563,7 +3318,7 @@ type DataExportSettingProperties struct { 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 - READ-ONLY; The value type of the items in the list. Possible values include: 'ValueTypeIPCidr', 'ValueTypeString' ValueType ValueType `json:"valueType,omitempty"` // DisplayName - READ-ONLY; The display name of the custom alert. DisplayName *string `json:"displayName,omitempty"` @@ -4055,6 +3810,14 @@ type EffectiveNetworkSecurityGroups struct { NetworkSecurityGroups *[]string `json:"networkSecurityGroups,omitempty"` } +// ETag entity tag is used for comparing two or more entities from the same requested resource. ETags may +// be returned for individual resources, and then sent via If-Match / If-None-Match headers for concurrency +// control. +type ETag struct { + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. ETags may be returned for individual resources, and then sent via If-Match / If-None-Match headers for concurrency control. + Etag *string `json:"etag,omitempty"` +} + // BasicExternalSecuritySolution represents a security solution external to Azure Security Center which sends // information to an OMS workspace and whose data is displayed by Azure Security Center. type BasicExternalSecuritySolution interface { @@ -6013,7 +5776,7 @@ type Kind struct { // 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 - READ-ONLY; The value type of the items in the list. Possible values include: 'ValueTypeIPCidr', 'ValueTypeString' ValueType ValueType `json:"valueType,omitempty"` // DisplayName - READ-ONLY; The display name of the custom alert. DisplayName *string `json:"displayName,omitempty"` @@ -6217,32 +5980,47 @@ type PathRecommendation struct { ConfigurationStatus ConfigurationStatus1 `json:"configurationStatus,omitempty"` } -// Pricing azure Security Center is provided in two pricing tiers: free and standard, with the standard -// tier available with a trial period. The standard tier offers advanced security capabilities, while the -// free tier offers basic security features. -type Pricing struct { +// PlaybookConfiguration the playbook configuration resource. +type PlaybookConfiguration struct { autorest.Response `json:"-"` - // PricingProperties - Pricing data - *PricingProperties `json:"properties,omitempty"` + // PlaybookConfigurationProperties - Playbook configuration data + *PlaybookConfigurationProperties `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"` + // Kind - Kind of the resource + Kind *string `json:"kind,omitempty"` + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. ETags may be returned for individual resources, and then sent via If-Match / If-None-Match headers for concurrency control. + Etag *string `json:"etag,omitempty"` + // Tags - A list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` } -// MarshalJSON is the custom marshaler for Pricing. -func (p Pricing) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for PlaybookConfiguration. +func (pc PlaybookConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if p.PricingProperties != nil { - objectMap["properties"] = p.PricingProperties + if pc.PlaybookConfigurationProperties != nil { + objectMap["properties"] = pc.PlaybookConfigurationProperties + } + if pc.Kind != nil { + objectMap["kind"] = pc.Kind + } + if pc.Etag != nil { + objectMap["etag"] = pc.Etag + } + if pc.Tags != nil { + objectMap["tags"] = pc.Tags } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for Pricing struct. -func (p *Pricing) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for PlaybookConfiguration struct. +func (pc *PlaybookConfiguration) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -6252,12 +6030,12 @@ func (p *Pricing) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var pricingProperties PricingProperties - err = json.Unmarshal(*v, &pricingProperties) + var playbookConfigurationProperties PlaybookConfigurationProperties + err = json.Unmarshal(*v, &playbookConfigurationProperties) if err != nil { return err } - p.PricingProperties = &pricingProperties + pc.PlaybookConfigurationProperties = &playbookConfigurationProperties } case "id": if v != nil { @@ -6266,7 +6044,7 @@ func (p *Pricing) UnmarshalJSON(body []byte) error { if err != nil { return err } - p.ID = &ID + pc.ID = &ID } case "name": if v != nil { @@ -6275,7 +6053,7 @@ func (p *Pricing) UnmarshalJSON(body []byte) error { if err != nil { return err } - p.Name = &name + pc.Name = &name } case "type": if v != nil { @@ -6284,7 +6062,43 @@ func (p *Pricing) UnmarshalJSON(body []byte) error { if err != nil { return err } - p.Type = &typeVar + pc.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pc.Location = &location + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + pc.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pc.Etag = &etag + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pc.Tags = tags } } } @@ -6292,149 +6106,202 @@ func (p *Pricing) UnmarshalJSON(body []byte) error { return nil } -// PricingList list of pricing configurations response. -type PricingList struct { - autorest.Response `json:"-"` - // Value - List of pricing configurations - Value *[]Pricing `json:"value,omitempty"` +// BasicPlaybookConfigurationAction the action that should be triggered. +type BasicPlaybookConfigurationAction interface { + AsPlaybookConfigurationActionLogicApp() (*PlaybookConfigurationActionLogicApp, bool) + AsPlaybookConfigurationActionEventHub() (*PlaybookConfigurationActionEventHub, bool) + AsPlaybookConfigurationAction() (*PlaybookConfigurationAction, bool) } -// PricingProperties pricing properties for the relevant scope -type PricingProperties struct { - // PricingTier - The pricing tier value. Azure Security Center is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features. Possible values include: 'Free', 'Standard' - PricingTier PricingTier `json:"pricingTier,omitempty"` - // FreeTrialRemainingTime - READ-ONLY; The duration left for the subscriptions free trial period - in ISO 8601 format (e.g. P3Y6M4DT12H30M5S). - FreeTrialRemainingTime *string `json:"freeTrialRemainingTime,omitempty"` +// PlaybookConfigurationAction the action that should be triggered. +type PlaybookConfigurationAction struct { + // ActionType - Possible values include: 'ActionTypePlaybookConfigurationAction', 'ActionTypeLogicApp', 'ActionTypeEventHub' + ActionType ActionType `json:"actionType,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"` -} +func unmarshalBasicPlaybookConfigurationAction(body []byte) (BasicPlaybookConfigurationAction, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } -// 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 - PublisherName *string `json:"publisherName,omitempty"` - // ProductName - The product name taken from the file's version resource - ProductName *string `json:"productName,omitempty"` - // BinaryName - The "OriginalName" field taken from the file's version resource - BinaryName *string `json:"binaryName,omitempty"` - // Version - The binary file version taken from the file's version resource - Version *string `json:"version,omitempty"` + switch m["actionType"] { + case string(ActionTypeLogicApp): + var pcala PlaybookConfigurationActionLogicApp + err := json.Unmarshal(body, &pcala) + return pcala, err + case string(ActionTypeEventHub): + var pcaeh PlaybookConfigurationActionEventHub + err := json.Unmarshal(body, &pcaeh) + return pcaeh, err + default: + var pca PlaybookConfigurationAction + err := json.Unmarshal(body, &pca) + return pca, err + } } +func unmarshalBasicPlaybookConfigurationActionArray(body []byte) ([]BasicPlaybookConfigurationAction, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } -// RecommendationConfigurationProperties recommendation configuration -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 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 RecommendationConfigStatus `json:"status,omitempty"` -} + pcaArray := make([]BasicPlaybookConfigurationAction, len(rawMessages)) -// RegulatoryComplianceAssessment regulatory compliance assessment details and state -type RegulatoryComplianceAssessment struct { - autorest.Response `json:"-"` - // RegulatoryComplianceAssessmentProperties - Regulatory compliance assessment data - *RegulatoryComplianceAssessmentProperties `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"` + for index, rawMessage := range rawMessages { + pca, err := unmarshalBasicPlaybookConfigurationAction(*rawMessage) + if err != nil { + return nil, err + } + pcaArray[index] = pca + } + return pcaArray, nil } -// MarshalJSON is the custom marshaler for RegulatoryComplianceAssessment. -func (rca RegulatoryComplianceAssessment) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for PlaybookConfigurationAction. +func (pca PlaybookConfigurationAction) MarshalJSON() ([]byte, error) { + pca.ActionType = ActionTypePlaybookConfigurationAction objectMap := make(map[string]interface{}) - if rca.RegulatoryComplianceAssessmentProperties != nil { - objectMap["properties"] = rca.RegulatoryComplianceAssessmentProperties + if pca.ActionType != "" { + objectMap["actionType"] = pca.ActionType } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for RegulatoryComplianceAssessment struct. -func (rca *RegulatoryComplianceAssessment) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err +// AsPlaybookConfigurationActionLogicApp is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationAction. +func (pca PlaybookConfigurationAction) AsPlaybookConfigurationActionLogicApp() (*PlaybookConfigurationActionLogicApp, bool) { + return nil, false +} + +// AsPlaybookConfigurationActionEventHub is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationAction. +func (pca PlaybookConfigurationAction) AsPlaybookConfigurationActionEventHub() (*PlaybookConfigurationActionEventHub, bool) { + return nil, false +} + +// AsPlaybookConfigurationAction is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationAction. +func (pca PlaybookConfigurationAction) AsPlaybookConfigurationAction() (*PlaybookConfigurationAction, bool) { + return &pca, true +} + +// AsBasicPlaybookConfigurationAction is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationAction. +func (pca PlaybookConfigurationAction) AsBasicPlaybookConfigurationAction() (BasicPlaybookConfigurationAction, bool) { + return &pca, true +} + +// PlaybookConfigurationActionEventHub the event hub action that should be triggered. +type PlaybookConfigurationActionEventHub struct { + // EventHubResourceID - The event hub resource id. + EventHubResourceID *string `json:"eventHubResourceId,omitempty"` + // ConnectionString - The event hub connection string(the primary or secondary key). + ConnectionString *string `json:"connectionString,omitempty"` + // ActionType - Possible values include: 'ActionTypePlaybookConfigurationAction', 'ActionTypeLogicApp', 'ActionTypeEventHub' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for PlaybookConfigurationActionEventHub. +func (pcaeh PlaybookConfigurationActionEventHub) MarshalJSON() ([]byte, error) { + pcaeh.ActionType = ActionTypeEventHub + objectMap := make(map[string]interface{}) + if pcaeh.EventHubResourceID != nil { + objectMap["eventHubResourceId"] = pcaeh.EventHubResourceID } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var regulatoryComplianceAssessmentProperties RegulatoryComplianceAssessmentProperties - err = json.Unmarshal(*v, ®ulatoryComplianceAssessmentProperties) - if err != nil { - return err - } - rca.RegulatoryComplianceAssessmentProperties = ®ulatoryComplianceAssessmentProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rca.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rca.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rca.Type = &typeVar - } - } + if pcaeh.ConnectionString != nil { + objectMap["connectionString"] = pcaeh.ConnectionString } + if pcaeh.ActionType != "" { + objectMap["actionType"] = pcaeh.ActionType + } + return json.Marshal(objectMap) +} - return nil +// AsPlaybookConfigurationActionLogicApp is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationActionEventHub. +func (pcaeh PlaybookConfigurationActionEventHub) AsPlaybookConfigurationActionLogicApp() (*PlaybookConfigurationActionLogicApp, bool) { + return nil, false } -// RegulatoryComplianceAssessmentList list of regulatory compliance assessment response -type RegulatoryComplianceAssessmentList struct { +// AsPlaybookConfigurationActionEventHub is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationActionEventHub. +func (pcaeh PlaybookConfigurationActionEventHub) AsPlaybookConfigurationActionEventHub() (*PlaybookConfigurationActionEventHub, bool) { + return &pcaeh, true +} + +// AsPlaybookConfigurationAction is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationActionEventHub. +func (pcaeh PlaybookConfigurationActionEventHub) AsPlaybookConfigurationAction() (*PlaybookConfigurationAction, bool) { + return nil, false +} + +// AsBasicPlaybookConfigurationAction is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationActionEventHub. +func (pcaeh PlaybookConfigurationActionEventHub) AsBasicPlaybookConfigurationAction() (BasicPlaybookConfigurationAction, bool) { + return &pcaeh, true +} + +// PlaybookConfigurationActionLogicApp the logic app action that should be triggered. +type PlaybookConfigurationActionLogicApp struct { + // LogicAppResourceID - The triggered resource id. + LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` + // URI - The uri that should be triggered by an Http GET request. + URI *string `json:"uri,omitempty"` + // ActionType - Possible values include: 'ActionTypePlaybookConfigurationAction', 'ActionTypeLogicApp', 'ActionTypeEventHub' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for PlaybookConfigurationActionLogicApp. +func (pcala PlaybookConfigurationActionLogicApp) MarshalJSON() ([]byte, error) { + pcala.ActionType = ActionTypeLogicApp + objectMap := make(map[string]interface{}) + if pcala.LogicAppResourceID != nil { + objectMap["logicAppResourceId"] = pcala.LogicAppResourceID + } + if pcala.URI != nil { + objectMap["uri"] = pcala.URI + } + if pcala.ActionType != "" { + objectMap["actionType"] = pcala.ActionType + } + return json.Marshal(objectMap) +} + +// AsPlaybookConfigurationActionLogicApp is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationActionLogicApp. +func (pcala PlaybookConfigurationActionLogicApp) AsPlaybookConfigurationActionLogicApp() (*PlaybookConfigurationActionLogicApp, bool) { + return &pcala, true +} + +// AsPlaybookConfigurationActionEventHub is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationActionLogicApp. +func (pcala PlaybookConfigurationActionLogicApp) AsPlaybookConfigurationActionEventHub() (*PlaybookConfigurationActionEventHub, bool) { + return nil, false +} + +// AsPlaybookConfigurationAction is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationActionLogicApp. +func (pcala PlaybookConfigurationActionLogicApp) AsPlaybookConfigurationAction() (*PlaybookConfigurationAction, bool) { + return nil, false +} + +// AsBasicPlaybookConfigurationAction is the BasicPlaybookConfigurationAction implementation for PlaybookConfigurationActionLogicApp. +func (pcala PlaybookConfigurationActionLogicApp) AsBasicPlaybookConfigurationAction() (BasicPlaybookConfigurationAction, bool) { + return &pcala, true +} + +// PlaybookConfigurationList list of playbook configurations response. +type PlaybookConfigurationList struct { autorest.Response `json:"-"` - Value *[]RegulatoryComplianceAssessment `json:"value,omitempty"` + // Value - The list of playbook configurations under the given scope. + Value *[]PlaybookConfiguration `json:"value,omitempty"` // NextLink - READ-ONLY; The URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` } -// RegulatoryComplianceAssessmentListIterator provides access to a complete listing of -// RegulatoryComplianceAssessment values. -type RegulatoryComplianceAssessmentListIterator struct { +// PlaybookConfigurationListIterator provides access to a complete listing of PlaybookConfiguration values. +type PlaybookConfigurationListIterator struct { i int - page RegulatoryComplianceAssessmentListPage + page PlaybookConfigurationListPage } // 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 *RegulatoryComplianceAssessmentListIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *PlaybookConfigurationListIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegulatoryComplianceAssessmentListIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationListIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -6459,62 +6326,62 @@ func (iter *RegulatoryComplianceAssessmentListIterator) NextWithContext(ctx cont // 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 *RegulatoryComplianceAssessmentListIterator) Next() error { +func (iter *PlaybookConfigurationListIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RegulatoryComplianceAssessmentListIterator) NotDone() bool { +func (iter PlaybookConfigurationListIterator) 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 RegulatoryComplianceAssessmentListIterator) Response() RegulatoryComplianceAssessmentList { +func (iter PlaybookConfigurationListIterator) Response() PlaybookConfigurationList { 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 RegulatoryComplianceAssessmentListIterator) Value() RegulatoryComplianceAssessment { +func (iter PlaybookConfigurationListIterator) Value() PlaybookConfiguration { if !iter.page.NotDone() { - return RegulatoryComplianceAssessment{} + return PlaybookConfiguration{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the RegulatoryComplianceAssessmentListIterator type. -func NewRegulatoryComplianceAssessmentListIterator(page RegulatoryComplianceAssessmentListPage) RegulatoryComplianceAssessmentListIterator { - return RegulatoryComplianceAssessmentListIterator{page: page} +// Creates a new instance of the PlaybookConfigurationListIterator type. +func NewPlaybookConfigurationListIterator(page PlaybookConfigurationListPage) PlaybookConfigurationListIterator { + return PlaybookConfigurationListIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (rcal RegulatoryComplianceAssessmentList) IsEmpty() bool { - return rcal.Value == nil || len(*rcal.Value) == 0 +func (pcl PlaybookConfigurationList) IsEmpty() bool { + return pcl.Value == nil || len(*pcl.Value) == 0 } -// regulatoryComplianceAssessmentListPreparer prepares a request to retrieve the next set of results. +// playbookConfigurationListPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (rcal RegulatoryComplianceAssessmentList) regulatoryComplianceAssessmentListPreparer(ctx context.Context) (*http.Request, error) { - if rcal.NextLink == nil || len(to.String(rcal.NextLink)) < 1 { +func (pcl PlaybookConfigurationList) playbookConfigurationListPreparer(ctx context.Context) (*http.Request, error) { + if pcl.NextLink == nil || len(to.String(pcl.NextLink)) < 1 { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(rcal.NextLink))) + autorest.WithBaseURL(to.String(pcl.NextLink))) } -// RegulatoryComplianceAssessmentListPage contains a page of RegulatoryComplianceAssessment values. -type RegulatoryComplianceAssessmentListPage struct { - fn func(context.Context, RegulatoryComplianceAssessmentList) (RegulatoryComplianceAssessmentList, error) - rcal RegulatoryComplianceAssessmentList +// PlaybookConfigurationListPage contains a page of PlaybookConfiguration values. +type PlaybookConfigurationListPage struct { + fn func(context.Context, PlaybookConfigurationList) (PlaybookConfigurationList, error) + pcl PlaybookConfigurationList } // 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 *RegulatoryComplianceAssessmentListPage) NextWithContext(ctx context.Context) (err error) { +func (page *PlaybookConfigurationListPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegulatoryComplianceAssessmentListPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationListPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -6523,69 +6390,192 @@ func (page *RegulatoryComplianceAssessmentListPage) NextWithContext(ctx context. tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.rcal) + next, err := page.fn(ctx, page.pcl) if err != nil { return err } - page.rcal = next + page.pcl = 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 *RegulatoryComplianceAssessmentListPage) Next() error { +func (page *PlaybookConfigurationListPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RegulatoryComplianceAssessmentListPage) NotDone() bool { - return !page.rcal.IsEmpty() +func (page PlaybookConfigurationListPage) NotDone() bool { + return !page.pcl.IsEmpty() } // Response returns the raw server response from the last page request. -func (page RegulatoryComplianceAssessmentListPage) Response() RegulatoryComplianceAssessmentList { - return page.rcal +func (page PlaybookConfigurationListPage) Response() PlaybookConfigurationList { + return page.pcl } // Values returns the slice of values for the current page or nil if there are no values. -func (page RegulatoryComplianceAssessmentListPage) Values() []RegulatoryComplianceAssessment { - if page.rcal.IsEmpty() { +func (page PlaybookConfigurationListPage) Values() []PlaybookConfiguration { + if page.pcl.IsEmpty() { return nil } - return *page.rcal.Value + return *page.pcl.Value } -// Creates a new instance of the RegulatoryComplianceAssessmentListPage type. -func NewRegulatoryComplianceAssessmentListPage(getNextPage func(context.Context, RegulatoryComplianceAssessmentList) (RegulatoryComplianceAssessmentList, error)) RegulatoryComplianceAssessmentListPage { - return RegulatoryComplianceAssessmentListPage{fn: getNextPage} +// Creates a new instance of the PlaybookConfigurationListPage type. +func NewPlaybookConfigurationListPage(getNextPage func(context.Context, PlaybookConfigurationList) (PlaybookConfigurationList, error)) PlaybookConfigurationListPage { + return PlaybookConfigurationListPage{fn: getNextPage} } -// RegulatoryComplianceAssessmentProperties regulatory compliance assessment data -type RegulatoryComplianceAssessmentProperties struct { - // Description - READ-ONLY; The description of the regulatory compliance assessment +// PlaybookConfigurationMetadata the metadata of the playbook configuration resource. +type PlaybookConfigurationMetadata struct { + // CreatedDateTimeUtc - READ-ONLY; The playbook configuration creation date. + CreatedDateTimeUtc *date.Time `json:"createdDateTimeUtc,omitempty"` + // CreatedBy - READ-ONLY; The AAD object ID of the entity that created the playbook configuration. + CreatedBy *string `json:"createdBy,omitempty"` + // LastUpdatedDateTimeUtc - READ-ONLY; The playbook configuration last updated date. + LastUpdatedDateTimeUtc *date.Time `json:"lastUpdatedDateTimeUtc,omitempty"` + // LastUpdatedBy - READ-ONLY; The AAD object ID of the entity that last updated the playbook configuration. + LastUpdatedBy *string `json:"lastUpdatedBy,omitempty"` +} + +// PlaybookConfigurationProperties the playbook configuration data. +type PlaybookConfigurationProperties struct { + // Description - The playbook configuration description. Description *string `json:"description,omitempty"` - // AssessmentType - READ-ONLY; The expected type of assessment contained in the AssessmentDetailsLink - AssessmentType *string `json:"assessmentType,omitempty"` - // AssessmentDetailsLink - READ-ONLY; Link to more detailed assessment results data. The response type will be according to the assessmentType field - AssessmentDetailsLink *string `json:"assessmentDetailsLink,omitempty"` - // State - Aggregative state based on the assessment's scanned resources states. Possible values include: 'StatePassed', 'StateFailed', 'StateSkipped', 'StateUnsupported' - State State `json:"state,omitempty"` - // PassedResources - READ-ONLY; The given assessment's related resources count with passed state. - PassedResources *int32 `json:"passedResources,omitempty"` - // FailedResources - READ-ONLY; The given assessment's related resources count with failed state. - FailedResources *int32 `json:"failedResources,omitempty"` - // SkippedResources - READ-ONLY; The given assessment's related resources count with skipped state. - SkippedResources *int32 `json:"skippedResources,omitempty"` - // UnsupportedResources - READ-ONLY; The given assessment's related resources count with unsupported state. - UnsupportedResources *int32 `json:"unsupportedResources,omitempty"` + // IsEnabled - Indicates whether the playbook configuration is enabled. + IsEnabled *bool `json:"isEnabled,omitempty"` + // Metadata - The metadata of the playbook configuration resource. + Metadata *PlaybookConfigurationMetadata `json:"metadata,omitempty"` + // Scopes - A collection of the subscription's resources scopes on which the playbook configurations logic is applied. + Scopes *[]PlaybookConfigurationScope `json:"scopes,omitempty"` + // Sources - A collection of the source event types which evaluate the playbook configuration set of rules. + Sources *[]PlaybookConfigurationSource `json:"sources,omitempty"` + // Actions - A collection of the actions which are triggered if all the configured rule set evaluation is true. + Actions *[]BasicPlaybookConfigurationAction `json:"actions,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for PlaybookConfigurationProperties struct. +func (pcp *PlaybookConfigurationProperties) 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 "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + pcp.Description = &description + } + case "isEnabled": + if v != nil { + var isEnabled bool + err = json.Unmarshal(*v, &isEnabled) + if err != nil { + return err + } + pcp.IsEnabled = &isEnabled + } + case "metadata": + if v != nil { + var metadata PlaybookConfigurationMetadata + err = json.Unmarshal(*v, &metadata) + if err != nil { + return err + } + pcp.Metadata = &metadata + } + case "scopes": + if v != nil { + var scopes []PlaybookConfigurationScope + err = json.Unmarshal(*v, &scopes) + if err != nil { + return err + } + pcp.Scopes = &scopes + } + case "sources": + if v != nil { + var sources []PlaybookConfigurationSource + err = json.Unmarshal(*v, &sources) + if err != nil { + return err + } + pcp.Sources = &sources + } + case "actions": + if v != nil { + actions, err := unmarshalBasicPlaybookConfigurationActionArray(*v) + if err != nil { + return err + } + pcp.Actions = &actions + } + } + } + + return nil } -// RegulatoryComplianceControl regulatory compliance control details and state -type RegulatoryComplianceControl struct { +// PlaybookConfigurationRuleSet a rule set which evaluates all its rules upon an event interception. +type PlaybookConfigurationRuleSet struct { + Rules *[]PlaybookConfigurationTriggeringRule `json:"rules,omitempty"` +} + +// PlaybookConfigurationScope the subscription's resources scope +type PlaybookConfigurationScope struct { + // Description - The resources scope description. + Description *string `json:"description,omitempty"` + // ScopePath - The resources scope path. + ScopePath *string `json:"scopePath,omitempty"` +} + +// PlaybookConfigurationSource the source event types which evaluate the playbook configuration set of +// rules. For example - security alerts and recommended tasks. +type PlaybookConfigurationSource struct { + // EventSource - A valid event source type. + EventSource *string `json:"eventSource,omitempty"` + // RuleSets - A set of rules which evaluate upon event interception. + RuleSets *[]PlaybookConfigurationRuleSet `json:"ruleSets,omitempty"` +} + +// PlaybookConfigurationTriggeringRule a logic rule which evaluates upon event interception. The rule is +// configured by comparing the specified expected value, in an expected property within the event model, by +// the specified operator. +type PlaybookConfigurationTriggeringRule struct { + // PropertyJPath - The JPath of the entity model property that should be checked. + PropertyJPath *string `json:"propertyJPath,omitempty"` + // PropertyType - The data type of the compared operands. Possible values include: 'String', 'Integer', 'Number', 'Boolean' + PropertyType PropertyType `json:"propertyType,omitempty"` + // ExpectedValue - The expected value. + ExpectedValue *string `json:"expectedValue,omitempty"` + // Operator - A valid comparer operator to use. Possible values include: 'Equals', 'EqualsIgnoreCase', 'GreaterThan', 'GreaterThanOrEqualTo', 'LesserThan', 'LesserThanOrEqualTo', 'NotEquals', 'NotEqualsIgnoreCase', 'Contains', 'StartsWith', 'EndsWith' + Operator Operator `json:"operator,omitempty"` +} + +// PlaybookConfigurationValidationStatus the playbook configuration model state property bag. +type PlaybookConfigurationValidationStatus struct { autorest.Response `json:"-"` - // RegulatoryComplianceControlProperties - Regulatory compliance control data - *RegulatoryComplianceControlProperties `json:"properties,omitempty"` + // IsValid - Indicates whether the model is valid or not. + IsValid *bool `json:"isValid,omitempty"` + // Message - The validation message. + Message *string `json:"message,omitempty"` +} + +// Pricing azure Security Center is provided in two pricing tiers: free and standard, with the standard +// tier available with a trial period. The standard tier offers advanced security capabilities, while the +// free tier offers basic security features. +type Pricing struct { + autorest.Response `json:"-"` + // PricingProperties - Pricing data + *PricingProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name @@ -6594,17 +6584,17 @@ type RegulatoryComplianceControl struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for RegulatoryComplianceControl. -func (rcc RegulatoryComplianceControl) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for Pricing. +func (p Pricing) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if rcc.RegulatoryComplianceControlProperties != nil { - objectMap["properties"] = rcc.RegulatoryComplianceControlProperties + if p.PricingProperties != nil { + objectMap["properties"] = p.PricingProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for RegulatoryComplianceControl struct. -func (rcc *RegulatoryComplianceControl) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for Pricing struct. +func (p *Pricing) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -6614,12 +6604,12 @@ func (rcc *RegulatoryComplianceControl) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var regulatoryComplianceControlProperties RegulatoryComplianceControlProperties - err = json.Unmarshal(*v, ®ulatoryComplianceControlProperties) + var pricingProperties PricingProperties + err = json.Unmarshal(*v, &pricingProperties) if err != nil { return err } - rcc.RegulatoryComplianceControlProperties = ®ulatoryComplianceControlProperties + p.PricingProperties = &pricingProperties } case "id": if v != nil { @@ -6628,7 +6618,7 @@ func (rcc *RegulatoryComplianceControl) UnmarshalJSON(body []byte) error { if err != nil { return err } - rcc.ID = &ID + p.ID = &ID } case "name": if v != nil { @@ -6637,7 +6627,7 @@ func (rcc *RegulatoryComplianceControl) UnmarshalJSON(body []byte) error { if err != nil { return err } - rcc.Name = &name + p.Name = &name } case "type": if v != nil { @@ -6646,7 +6636,7 @@ func (rcc *RegulatoryComplianceControl) UnmarshalJSON(body []byte) error { if err != nil { return err } - rcc.Type = &typeVar + p.Type = &typeVar } } } @@ -6654,27 +6644,149 @@ func (rcc *RegulatoryComplianceControl) UnmarshalJSON(body []byte) error { return nil } -// RegulatoryComplianceControlList list of regulatory compliance controls response -type RegulatoryComplianceControlList struct { +// PricingList list of pricing configurations response. +type PricingList struct { autorest.Response `json:"-"` - // Value - List of regulatory compliance controls - Value *[]RegulatoryComplianceControl `json:"value,omitempty"` + // Value - List of pricing configurations + Value *[]Pricing `json:"value,omitempty"` +} + +// PricingProperties pricing properties for the relevant scope +type PricingProperties struct { + // PricingTier - The pricing tier value. Azure Security Center is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features. Possible values include: 'Free', 'Standard' + PricingTier PricingTier `json:"pricingTier,omitempty"` + // FreeTrialRemainingTime - READ-ONLY; The duration left for the subscriptions free trial period - in ISO 8601 format (e.g. P3Y6M4DT12H30M5S). + 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 + PublisherName *string `json:"publisherName,omitempty"` + // ProductName - The product name taken from the file's version resource + ProductName *string `json:"productName,omitempty"` + // BinaryName - The "OriginalName" field taken from the file's version resource + BinaryName *string `json:"binaryName,omitempty"` + // Version - The binary file version taken from the file's version resource + Version *string `json:"version,omitempty"` +} + +// RecommendationConfigurationProperties recommendation configuration +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 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 RecommendationConfigStatus `json:"status,omitempty"` +} + +// RegulatoryComplianceAssessment regulatory compliance assessment details and state +type RegulatoryComplianceAssessment struct { + autorest.Response `json:"-"` + // RegulatoryComplianceAssessmentProperties - Regulatory compliance assessment data + *RegulatoryComplianceAssessmentProperties `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 RegulatoryComplianceAssessment. +func (rca RegulatoryComplianceAssessment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rca.RegulatoryComplianceAssessmentProperties != nil { + objectMap["properties"] = rca.RegulatoryComplianceAssessmentProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RegulatoryComplianceAssessment struct. +func (rca *RegulatoryComplianceAssessment) 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 regulatoryComplianceAssessmentProperties RegulatoryComplianceAssessmentProperties + err = json.Unmarshal(*v, ®ulatoryComplianceAssessmentProperties) + if err != nil { + return err + } + rca.RegulatoryComplianceAssessmentProperties = ®ulatoryComplianceAssessmentProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rca.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rca.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rca.Type = &typeVar + } + } + } + + return nil +} + +// RegulatoryComplianceAssessmentList list of regulatory compliance assessment response +type RegulatoryComplianceAssessmentList struct { + autorest.Response `json:"-"` + Value *[]RegulatoryComplianceAssessment `json:"value,omitempty"` // NextLink - READ-ONLY; The URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` } -// RegulatoryComplianceControlListIterator provides access to a complete listing of -// RegulatoryComplianceControl values. -type RegulatoryComplianceControlListIterator struct { +// RegulatoryComplianceAssessmentListIterator provides access to a complete listing of +// RegulatoryComplianceAssessment values. +type RegulatoryComplianceAssessmentListIterator struct { i int - page RegulatoryComplianceControlListPage + page RegulatoryComplianceAssessmentListPage } // 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 *RegulatoryComplianceControlListIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *RegulatoryComplianceAssessmentListIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegulatoryComplianceControlListIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/RegulatoryComplianceAssessmentListIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -6699,62 +6811,62 @@ func (iter *RegulatoryComplianceControlListIterator) 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 *RegulatoryComplianceControlListIterator) Next() error { +func (iter *RegulatoryComplianceAssessmentListIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RegulatoryComplianceControlListIterator) NotDone() bool { +func (iter RegulatoryComplianceAssessmentListIterator) 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 RegulatoryComplianceControlListIterator) Response() RegulatoryComplianceControlList { +func (iter RegulatoryComplianceAssessmentListIterator) Response() RegulatoryComplianceAssessmentList { 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 RegulatoryComplianceControlListIterator) Value() RegulatoryComplianceControl { +func (iter RegulatoryComplianceAssessmentListIterator) Value() RegulatoryComplianceAssessment { if !iter.page.NotDone() { - return RegulatoryComplianceControl{} + return RegulatoryComplianceAssessment{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the RegulatoryComplianceControlListIterator type. -func NewRegulatoryComplianceControlListIterator(page RegulatoryComplianceControlListPage) RegulatoryComplianceControlListIterator { - return RegulatoryComplianceControlListIterator{page: page} +// Creates a new instance of the RegulatoryComplianceAssessmentListIterator type. +func NewRegulatoryComplianceAssessmentListIterator(page RegulatoryComplianceAssessmentListPage) RegulatoryComplianceAssessmentListIterator { + return RegulatoryComplianceAssessmentListIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (rccl RegulatoryComplianceControlList) IsEmpty() bool { - return rccl.Value == nil || len(*rccl.Value) == 0 +func (rcal RegulatoryComplianceAssessmentList) IsEmpty() bool { + return rcal.Value == nil || len(*rcal.Value) == 0 } -// regulatoryComplianceControlListPreparer prepares a request to retrieve the next set of results. +// regulatoryComplianceAssessmentListPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (rccl RegulatoryComplianceControlList) regulatoryComplianceControlListPreparer(ctx context.Context) (*http.Request, error) { - if rccl.NextLink == nil || len(to.String(rccl.NextLink)) < 1 { +func (rcal RegulatoryComplianceAssessmentList) regulatoryComplianceAssessmentListPreparer(ctx context.Context) (*http.Request, error) { + if rcal.NextLink == nil || len(to.String(rcal.NextLink)) < 1 { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(rccl.NextLink))) + autorest.WithBaseURL(to.String(rcal.NextLink))) } -// RegulatoryComplianceControlListPage contains a page of RegulatoryComplianceControl values. -type RegulatoryComplianceControlListPage struct { - fn func(context.Context, RegulatoryComplianceControlList) (RegulatoryComplianceControlList, error) - rccl RegulatoryComplianceControlList +// RegulatoryComplianceAssessmentListPage contains a page of RegulatoryComplianceAssessment values. +type RegulatoryComplianceAssessmentListPage struct { + fn func(context.Context, RegulatoryComplianceAssessmentList) (RegulatoryComplianceAssessmentList, error) + rcal RegulatoryComplianceAssessmentList } // 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 *RegulatoryComplianceControlListPage) NextWithContext(ctx context.Context) (err error) { +func (page *RegulatoryComplianceAssessmentListPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegulatoryComplianceControlListPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/RegulatoryComplianceAssessmentListPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -6763,63 +6875,69 @@ func (page *RegulatoryComplianceControlListPage) NextWithContext(ctx context.Con tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.rccl) + next, err := page.fn(ctx, page.rcal) if err != nil { return err } - page.rccl = next + page.rcal = 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 *RegulatoryComplianceControlListPage) Next() error { +func (page *RegulatoryComplianceAssessmentListPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RegulatoryComplianceControlListPage) NotDone() bool { - return !page.rccl.IsEmpty() +func (page RegulatoryComplianceAssessmentListPage) NotDone() bool { + return !page.rcal.IsEmpty() } // Response returns the raw server response from the last page request. -func (page RegulatoryComplianceControlListPage) Response() RegulatoryComplianceControlList { - return page.rccl +func (page RegulatoryComplianceAssessmentListPage) Response() RegulatoryComplianceAssessmentList { + return page.rcal } // Values returns the slice of values for the current page or nil if there are no values. -func (page RegulatoryComplianceControlListPage) Values() []RegulatoryComplianceControl { - if page.rccl.IsEmpty() { +func (page RegulatoryComplianceAssessmentListPage) Values() []RegulatoryComplianceAssessment { + if page.rcal.IsEmpty() { return nil } - return *page.rccl.Value + return *page.rcal.Value } -// Creates a new instance of the RegulatoryComplianceControlListPage type. -func NewRegulatoryComplianceControlListPage(getNextPage func(context.Context, RegulatoryComplianceControlList) (RegulatoryComplianceControlList, error)) RegulatoryComplianceControlListPage { - return RegulatoryComplianceControlListPage{fn: getNextPage} +// Creates a new instance of the RegulatoryComplianceAssessmentListPage type. +func NewRegulatoryComplianceAssessmentListPage(getNextPage func(context.Context, RegulatoryComplianceAssessmentList) (RegulatoryComplianceAssessmentList, error)) RegulatoryComplianceAssessmentListPage { + return RegulatoryComplianceAssessmentListPage{fn: getNextPage} } -// RegulatoryComplianceControlProperties regulatory compliance control data -type RegulatoryComplianceControlProperties struct { - // Description - READ-ONLY; The description of the regulatory compliance control +// RegulatoryComplianceAssessmentProperties regulatory compliance assessment data +type RegulatoryComplianceAssessmentProperties struct { + // Description - READ-ONLY; The description of the regulatory compliance assessment Description *string `json:"description,omitempty"` - // State - Aggregative state based on the control's supported assessments states. Possible values include: 'StatePassed', 'StateFailed', 'StateSkipped', 'StateUnsupported' + // AssessmentType - READ-ONLY; The expected type of assessment contained in the AssessmentDetailsLink + AssessmentType *string `json:"assessmentType,omitempty"` + // AssessmentDetailsLink - READ-ONLY; Link to more detailed assessment results data. The response type will be according to the assessmentType field + AssessmentDetailsLink *string `json:"assessmentDetailsLink,omitempty"` + // State - Aggregative state based on the assessment's scanned resources states. Possible values include: 'StatePassed', 'StateFailed', 'StateSkipped', 'StateUnsupported' State State `json:"state,omitempty"` - // PassedAssessments - READ-ONLY; The number of supported regulatory compliance assessments of the given control with a passed state - PassedAssessments *int32 `json:"passedAssessments,omitempty"` - // FailedAssessments - READ-ONLY; The number of supported regulatory compliance assessments of the given control with a failed state - FailedAssessments *int32 `json:"failedAssessments,omitempty"` - // SkippedAssessments - READ-ONLY; The number of supported regulatory compliance assessments of the given control with a skipped state - SkippedAssessments *int32 `json:"skippedAssessments,omitempty"` + // PassedResources - READ-ONLY; The given assessment's related resources count with passed state. + PassedResources *int32 `json:"passedResources,omitempty"` + // FailedResources - READ-ONLY; The given assessment's related resources count with failed state. + FailedResources *int32 `json:"failedResources,omitempty"` + // SkippedResources - READ-ONLY; The given assessment's related resources count with skipped state. + SkippedResources *int32 `json:"skippedResources,omitempty"` + // UnsupportedResources - READ-ONLY; The given assessment's related resources count with unsupported state. + UnsupportedResources *int32 `json:"unsupportedResources,omitempty"` } -// RegulatoryComplianceStandard regulatory compliance standard details and state -type RegulatoryComplianceStandard struct { +// RegulatoryComplianceControl regulatory compliance control details and state +type RegulatoryComplianceControl struct { autorest.Response `json:"-"` - // RegulatoryComplianceStandardProperties - Regulatory compliance standard data - *RegulatoryComplianceStandardProperties `json:"properties,omitempty"` + // RegulatoryComplianceControlProperties - Regulatory compliance control data + *RegulatoryComplianceControlProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name @@ -6828,17 +6946,17 @@ type RegulatoryComplianceStandard struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for RegulatoryComplianceStandard. -func (rcs RegulatoryComplianceStandard) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for RegulatoryComplianceControl. +func (rcc RegulatoryComplianceControl) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if rcs.RegulatoryComplianceStandardProperties != nil { - objectMap["properties"] = rcs.RegulatoryComplianceStandardProperties + if rcc.RegulatoryComplianceControlProperties != nil { + objectMap["properties"] = rcc.RegulatoryComplianceControlProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for RegulatoryComplianceStandard struct. -func (rcs *RegulatoryComplianceStandard) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for RegulatoryComplianceControl struct. +func (rcc *RegulatoryComplianceControl) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -6848,12 +6966,12 @@ func (rcs *RegulatoryComplianceStandard) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var regulatoryComplianceStandardProperties RegulatoryComplianceStandardProperties - err = json.Unmarshal(*v, ®ulatoryComplianceStandardProperties) + var regulatoryComplianceControlProperties RegulatoryComplianceControlProperties + err = json.Unmarshal(*v, ®ulatoryComplianceControlProperties) if err != nil { return err } - rcs.RegulatoryComplianceStandardProperties = ®ulatoryComplianceStandardProperties + rcc.RegulatoryComplianceControlProperties = ®ulatoryComplianceControlProperties } case "id": if v != nil { @@ -6862,7 +6980,7 @@ func (rcs *RegulatoryComplianceStandard) UnmarshalJSON(body []byte) error { if err != nil { return err } - rcs.ID = &ID + rcc.ID = &ID } case "name": if v != nil { @@ -6871,7 +6989,7 @@ func (rcs *RegulatoryComplianceStandard) UnmarshalJSON(body []byte) error { if err != nil { return err } - rcs.Name = &name + rcc.Name = &name } case "type": if v != nil { @@ -6880,7 +6998,7 @@ func (rcs *RegulatoryComplianceStandard) UnmarshalJSON(body []byte) error { if err != nil { return err } - rcs.Type = &typeVar + rcc.Type = &typeVar } } } @@ -6888,26 +7006,27 @@ func (rcs *RegulatoryComplianceStandard) UnmarshalJSON(body []byte) error { return nil } -// RegulatoryComplianceStandardList list of regulatory compliance standards response -type RegulatoryComplianceStandardList struct { +// RegulatoryComplianceControlList list of regulatory compliance controls response +type RegulatoryComplianceControlList struct { autorest.Response `json:"-"` - Value *[]RegulatoryComplianceStandard `json:"value,omitempty"` + // Value - List of regulatory compliance controls + Value *[]RegulatoryComplianceControl `json:"value,omitempty"` // NextLink - READ-ONLY; The URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` } -// RegulatoryComplianceStandardListIterator provides access to a complete listing of -// RegulatoryComplianceStandard values. -type RegulatoryComplianceStandardListIterator struct { +// RegulatoryComplianceControlListIterator provides access to a complete listing of +// RegulatoryComplianceControl values. +type RegulatoryComplianceControlListIterator struct { i int - page RegulatoryComplianceStandardListPage + page RegulatoryComplianceControlListPage } // 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 *RegulatoryComplianceStandardListIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *RegulatoryComplianceControlListIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegulatoryComplianceStandardListIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/RegulatoryComplianceControlListIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -6932,62 +7051,62 @@ func (iter *RegulatoryComplianceStandardListIterator) NextWithContext(ctx contex // 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 *RegulatoryComplianceStandardListIterator) Next() error { +func (iter *RegulatoryComplianceControlListIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter RegulatoryComplianceStandardListIterator) NotDone() bool { +func (iter RegulatoryComplianceControlListIterator) 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 RegulatoryComplianceStandardListIterator) Response() RegulatoryComplianceStandardList { +func (iter RegulatoryComplianceControlListIterator) Response() RegulatoryComplianceControlList { 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 RegulatoryComplianceStandardListIterator) Value() RegulatoryComplianceStandard { +func (iter RegulatoryComplianceControlListIterator) Value() RegulatoryComplianceControl { if !iter.page.NotDone() { - return RegulatoryComplianceStandard{} + return RegulatoryComplianceControl{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the RegulatoryComplianceStandardListIterator type. -func NewRegulatoryComplianceStandardListIterator(page RegulatoryComplianceStandardListPage) RegulatoryComplianceStandardListIterator { - return RegulatoryComplianceStandardListIterator{page: page} +// Creates a new instance of the RegulatoryComplianceControlListIterator type. +func NewRegulatoryComplianceControlListIterator(page RegulatoryComplianceControlListPage) RegulatoryComplianceControlListIterator { + return RegulatoryComplianceControlListIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (rcsl RegulatoryComplianceStandardList) IsEmpty() bool { - return rcsl.Value == nil || len(*rcsl.Value) == 0 +func (rccl RegulatoryComplianceControlList) IsEmpty() bool { + return rccl.Value == nil || len(*rccl.Value) == 0 } -// regulatoryComplianceStandardListPreparer prepares a request to retrieve the next set of results. +// regulatoryComplianceControlListPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (rcsl RegulatoryComplianceStandardList) regulatoryComplianceStandardListPreparer(ctx context.Context) (*http.Request, error) { - if rcsl.NextLink == nil || len(to.String(rcsl.NextLink)) < 1 { +func (rccl RegulatoryComplianceControlList) regulatoryComplianceControlListPreparer(ctx context.Context) (*http.Request, error) { + if rccl.NextLink == nil || len(to.String(rccl.NextLink)) < 1 { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(rcsl.NextLink))) + autorest.WithBaseURL(to.String(rccl.NextLink))) } -// RegulatoryComplianceStandardListPage contains a page of RegulatoryComplianceStandard values. -type RegulatoryComplianceStandardListPage struct { - fn func(context.Context, RegulatoryComplianceStandardList) (RegulatoryComplianceStandardList, error) - rcsl RegulatoryComplianceStandardList +// RegulatoryComplianceControlListPage contains a page of RegulatoryComplianceControl values. +type RegulatoryComplianceControlListPage struct { + fn func(context.Context, RegulatoryComplianceControlList) (RegulatoryComplianceControlList, error) + rccl RegulatoryComplianceControlList } // 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 *RegulatoryComplianceStandardListPage) NextWithContext(ctx context.Context) (err error) { +func (page *RegulatoryComplianceControlListPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/RegulatoryComplianceStandardListPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/RegulatoryComplianceControlListPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -6996,60 +7115,63 @@ func (page *RegulatoryComplianceStandardListPage) NextWithContext(ctx context.Co tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.rcsl) + next, err := page.fn(ctx, page.rccl) if err != nil { return err } - page.rcsl = next + page.rccl = 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 *RegulatoryComplianceStandardListPage) Next() error { +func (page *RegulatoryComplianceControlListPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page RegulatoryComplianceStandardListPage) NotDone() bool { - return !page.rcsl.IsEmpty() +func (page RegulatoryComplianceControlListPage) NotDone() bool { + return !page.rccl.IsEmpty() } // Response returns the raw server response from the last page request. -func (page RegulatoryComplianceStandardListPage) Response() RegulatoryComplianceStandardList { - return page.rcsl +func (page RegulatoryComplianceControlListPage) Response() RegulatoryComplianceControlList { + return page.rccl } // Values returns the slice of values for the current page or nil if there are no values. -func (page RegulatoryComplianceStandardListPage) Values() []RegulatoryComplianceStandard { - if page.rcsl.IsEmpty() { +func (page RegulatoryComplianceControlListPage) Values() []RegulatoryComplianceControl { + if page.rccl.IsEmpty() { return nil } - return *page.rcsl.Value + return *page.rccl.Value } -// Creates a new instance of the RegulatoryComplianceStandardListPage type. -func NewRegulatoryComplianceStandardListPage(getNextPage func(context.Context, RegulatoryComplianceStandardList) (RegulatoryComplianceStandardList, error)) RegulatoryComplianceStandardListPage { - return RegulatoryComplianceStandardListPage{fn: getNextPage} +// Creates a new instance of the RegulatoryComplianceControlListPage type. +func NewRegulatoryComplianceControlListPage(getNextPage func(context.Context, RegulatoryComplianceControlList) (RegulatoryComplianceControlList, error)) RegulatoryComplianceControlListPage { + return RegulatoryComplianceControlListPage{fn: getNextPage} } -// RegulatoryComplianceStandardProperties regulatory compliance standard data -type RegulatoryComplianceStandardProperties struct { - // State - Aggregative state based on the standard's supported controls states. Possible values include: 'StatePassed', 'StateFailed', 'StateSkipped', 'StateUnsupported' +// RegulatoryComplianceControlProperties regulatory compliance control data +type RegulatoryComplianceControlProperties struct { + // Description - READ-ONLY; The description of the regulatory compliance control + Description *string `json:"description,omitempty"` + // State - Aggregative state based on the control's supported assessments states. Possible values include: 'StatePassed', 'StateFailed', 'StateSkipped', 'StateUnsupported' State State `json:"state,omitempty"` - // PassedControls - READ-ONLY; The number of supported regulatory compliance controls of the given standard with a passed state - PassedControls *int32 `json:"passedControls,omitempty"` - // FailedControls - READ-ONLY; The number of supported regulatory compliance controls of the given standard with a failed state - FailedControls *int32 `json:"failedControls,omitempty"` - // SkippedControls - READ-ONLY; The number of supported regulatory compliance controls of the given standard with a skipped state - SkippedControls *int32 `json:"skippedControls,omitempty"` - // UnsupportedControls - READ-ONLY; The number of regulatory compliance controls of the given standard which are unsupported by automated assessments - UnsupportedControls *int32 `json:"unsupportedControls,omitempty"` + // PassedAssessments - READ-ONLY; The number of supported regulatory compliance assessments of the given control with a passed state + PassedAssessments *int32 `json:"passedAssessments,omitempty"` + // FailedAssessments - READ-ONLY; The number of supported regulatory compliance assessments of the given control with a failed state + FailedAssessments *int32 `json:"failedAssessments,omitempty"` + // SkippedAssessments - READ-ONLY; The number of supported regulatory compliance assessments of the given control with a skipped state + SkippedAssessments *int32 `json:"skippedAssessments,omitempty"` } -// Resource describes an Azure resource. -type Resource struct { +// RegulatoryComplianceStandard regulatory compliance standard details and state +type RegulatoryComplianceStandard struct { + autorest.Response `json:"-"` + // RegulatoryComplianceStandardProperties - Regulatory compliance standard data + *RegulatoryComplianceStandardProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name @@ -7058,215 +7180,86 @@ 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"` +// MarshalJSON is the custom marshaler for RegulatoryComplianceStandard. +func (rcs RegulatoryComplianceStandard) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rcs.RegulatoryComplianceStandardProperties != nil { + objectMap["properties"] = rcs.RegulatoryComplianceStandardProperties + } + return json.Marshal(objectMap) } -func unmarshalBasicResourceDetails(body []byte) (BasicResourceDetails, error) { - var m map[string]interface{} +// UnmarshalJSON is the custom unmarshaler for RegulatoryComplianceStandard struct. +func (rcs *RegulatoryComplianceStandard) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage 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 + return err } - - rdArray := make([]BasicResourceDetails, len(rawMessages)) - - for index, rawMessage := range rawMessages { - rd, err := unmarshalBasicResourceDetails(*rawMessage) - if err != nil { - return nil, err + for k, v := range m { + switch k { + case "properties": + if v != nil { + var regulatoryComplianceStandardProperties RegulatoryComplianceStandardProperties + err = json.Unmarshal(*v, ®ulatoryComplianceStandardProperties) + if err != nil { + return err + } + rcs.RegulatoryComplianceStandardProperties = ®ulatoryComplianceStandardProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rcs.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rcs.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rcs.Type = &typeVar + } } - 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 { - // Name - The name of the rule - Name *string `json:"name,omitempty"` - // Direction - The rule's direction. Possible values include: 'Inbound', 'Outbound' - Direction Direction `json:"direction,omitempty"` - // DestinationPort - The rule's destination port - DestinationPort *int32 `json:"destinationPort,omitempty"` - // Protocols - The rule's transport protocols - Protocols *[]TransportProtocol `json:"protocols,omitempty"` - // IPAddresses - The remote IP addresses that should be able to communicate with the Azure resource on the rule's destination port and protocol - IPAddresses *[]string `json:"ipAddresses,omitempty"` -} - -// SensitivityLabel the sensitivity label. -type SensitivityLabel struct { - // DisplayName - The name of the sensitivity label. - DisplayName *string `json:"displayName,omitempty"` - // Order - The order of the sensitivity label. - Order *float64 `json:"order,omitempty"` - // Enabled - Indicates whether the label is enabled or not. - 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:"-"` - // Kind - the kind of the settings string (DataExportSetting). Possible values include: 'SettingKindDataExportSetting', 'SettingKindAlertSuppressionSetting' - Kind SettingKind `json:"kind,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"` -} - -// SettingResource the kind of the security setting -type SettingResource struct { - // Kind - the kind of the settings string (DataExportSetting). Possible values include: 'SettingKindDataExportSetting', 'SettingKindAlertSuppressionSetting' - Kind SettingKind `json:"kind,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"` + return nil } -// SettingsList subscription settings list. -type SettingsList struct { +// RegulatoryComplianceStandardList list of regulatory compliance standards response +type RegulatoryComplianceStandardList struct { autorest.Response `json:"-"` - // Value - The settings list. - Value *[]Setting `json:"value,omitempty"` + Value *[]RegulatoryComplianceStandard `json:"value,omitempty"` // NextLink - READ-ONLY; The URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` } -// SettingsListIterator provides access to a complete listing of Setting values. -type SettingsListIterator struct { +// RegulatoryComplianceStandardListIterator provides access to a complete listing of +// RegulatoryComplianceStandard values. +type RegulatoryComplianceStandardListIterator struct { i int - page SettingsListPage + page RegulatoryComplianceStandardListPage } // 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 *SettingsListIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *RegulatoryComplianceStandardListIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SettingsListIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/RegulatoryComplianceStandardListIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -7291,62 +7284,62 @@ func (iter *SettingsListIterator) NextWithContext(ctx context.Context) (err erro // 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 *SettingsListIterator) Next() error { +func (iter *RegulatoryComplianceStandardListIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SettingsListIterator) NotDone() bool { +func (iter RegulatoryComplianceStandardListIterator) 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 SettingsListIterator) Response() SettingsList { +func (iter RegulatoryComplianceStandardListIterator) Response() RegulatoryComplianceStandardList { 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 SettingsListIterator) Value() Setting { +func (iter RegulatoryComplianceStandardListIterator) Value() RegulatoryComplianceStandard { if !iter.page.NotDone() { - return Setting{} + return RegulatoryComplianceStandard{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the SettingsListIterator type. -func NewSettingsListIterator(page SettingsListPage) SettingsListIterator { - return SettingsListIterator{page: page} +// Creates a new instance of the RegulatoryComplianceStandardListIterator type. +func NewRegulatoryComplianceStandardListIterator(page RegulatoryComplianceStandardListPage) RegulatoryComplianceStandardListIterator { + return RegulatoryComplianceStandardListIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (sl SettingsList) IsEmpty() bool { - return sl.Value == nil || len(*sl.Value) == 0 +func (rcsl RegulatoryComplianceStandardList) IsEmpty() bool { + return rcsl.Value == nil || len(*rcsl.Value) == 0 } -// settingsListPreparer prepares a request to retrieve the next set of results. +// regulatoryComplianceStandardListPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (sl SettingsList) settingsListPreparer(ctx context.Context) (*http.Request, error) { - if sl.NextLink == nil || len(to.String(sl.NextLink)) < 1 { +func (rcsl RegulatoryComplianceStandardList) regulatoryComplianceStandardListPreparer(ctx context.Context) (*http.Request, error) { + if rcsl.NextLink == nil || len(to.String(rcsl.NextLink)) < 1 { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(sl.NextLink))) + autorest.WithBaseURL(to.String(rcsl.NextLink))) } -// SettingsListPage contains a page of Setting values. -type SettingsListPage struct { - fn func(context.Context, SettingsList) (SettingsList, error) - sl SettingsList +// RegulatoryComplianceStandardListPage contains a page of RegulatoryComplianceStandard values. +type RegulatoryComplianceStandardListPage struct { + fn func(context.Context, RegulatoryComplianceStandardList) (RegulatoryComplianceStandardList, error) + rcsl RegulatoryComplianceStandardList } // 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 *SettingsListPage) NextWithContext(ctx context.Context) (err error) { +func (page *RegulatoryComplianceStandardListPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SettingsListPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/RegulatoryComplianceStandardListPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -7355,93 +7348,98 @@ func (page *SettingsListPage) NextWithContext(ctx context.Context) (err error) { tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.sl) + next, err := page.fn(ctx, page.rcsl) if err != nil { return err } - page.sl = next + page.rcsl = 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 *SettingsListPage) Next() error { +func (page *RegulatoryComplianceStandardListPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SettingsListPage) NotDone() bool { - return !page.sl.IsEmpty() +func (page RegulatoryComplianceStandardListPage) NotDone() bool { + return !page.rcsl.IsEmpty() } // Response returns the raw server response from the last page request. -func (page SettingsListPage) Response() SettingsList { - return page.sl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SettingsListPage) Values() []Setting { - if page.sl.IsEmpty() { - return nil - } - return *page.sl.Value -} - -// Creates a new instance of the SettingsListPage type. -func NewSettingsListPage(getNextPage func(context.Context, SettingsList) (SettingsList, error)) SettingsListPage { - 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"` +func (page RegulatoryComplianceStandardListPage) Response() RegulatoryComplianceStandardList { + return page.rcsl } -// 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 +// Values returns the slice of values for the current page or nil if there are no values. +func (page RegulatoryComplianceStandardListPage) Values() []RegulatoryComplianceStandard { + if page.rcsl.IsEmpty() { + return nil } - return json.Marshal(objectMap) + return *page.rcsl.Value } -// AsSQLServerVulnerabilityProperties is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. -func (ssvp SQLServerVulnerabilityProperties) AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) { - return &ssvp, true +// Creates a new instance of the RegulatoryComplianceStandardListPage type. +func NewRegulatoryComplianceStandardListPage(getNextPage func(context.Context, RegulatoryComplianceStandardList) (RegulatoryComplianceStandardList, error)) RegulatoryComplianceStandardListPage { + return RegulatoryComplianceStandardListPage{fn: getNextPage} } -// AsContainerRegistryVulnerabilityProperties is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. -func (ssvp SQLServerVulnerabilityProperties) AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) { - return nil, false +// RegulatoryComplianceStandardProperties regulatory compliance standard data +type RegulatoryComplianceStandardProperties struct { + // State - Aggregative state based on the standard's supported controls states. Possible values include: 'StatePassed', 'StateFailed', 'StateSkipped', 'StateUnsupported' + State State `json:"state,omitempty"` + // PassedControls - READ-ONLY; The number of supported regulatory compliance controls of the given standard with a passed state + PassedControls *int32 `json:"passedControls,omitempty"` + // FailedControls - READ-ONLY; The number of supported regulatory compliance controls of the given standard with a failed state + FailedControls *int32 `json:"failedControls,omitempty"` + // SkippedControls - READ-ONLY; The number of supported regulatory compliance controls of the given standard with a skipped state + SkippedControls *int32 `json:"skippedControls,omitempty"` + // UnsupportedControls - READ-ONLY; The number of regulatory compliance controls of the given standard which are unsupported by automated assessments + UnsupportedControls *int32 `json:"unsupportedControls,omitempty"` } -// AsServerVulnerabilityProperties is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. -func (ssvp SQLServerVulnerabilityProperties) AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) { - return nil, false +// Resource describes an Azure resource. +type Resource struct { + // 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"` } -// AsAdditionalData is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. -func (ssvp SQLServerVulnerabilityProperties) AsAdditionalData() (*AdditionalData, bool) { - return nil, false +// 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 { + // Name - The name of the rule + Name *string `json:"name,omitempty"` + // Direction - The rule's direction. Possible values include: 'Inbound', 'Outbound' + Direction Direction `json:"direction,omitempty"` + // DestinationPort - The rule's destination port + DestinationPort *int32 `json:"destinationPort,omitempty"` + // Protocols - The rule's transport protocols + Protocols *[]TransportProtocol `json:"protocols,omitempty"` + // IPAddresses - The remote IP addresses that should be able to communicate with the Azure resource on the rule's destination port and protocol + IPAddresses *[]string `json:"ipAddresses,omitempty"` } -// AsBasicAdditionalData is the BasicAdditionalData implementation for SQLServerVulnerabilityProperties. -func (ssvp SQLServerVulnerabilityProperties) AsBasicAdditionalData() (BasicAdditionalData, bool) { - return &ssvp, true +// SensitivityLabel the sensitivity label. +type SensitivityLabel struct { + // DisplayName - The name of the sensitivity label. + DisplayName *string `json:"displayName,omitempty"` + // Order - The order of the sensitivity label. + Order *float64 `json:"order,omitempty"` + // Enabled - Indicates whether the label is enabled or not. + Enabled *bool `json:"enabled,omitempty"` } -// SubAssessment security sub-assessment on a resource -type SubAssessment struct { - autorest.Response `json:"-"` - *SubAssessmentProperties `json:"properties,omitempty"` +// Setting represents a security setting in Azure Security Center. +type Setting struct { + autorest.Response `json:"-"` + // Kind - the kind of the settings string (DataExportSetting). Possible values include: 'SettingKindDataExportSetting', 'SettingKindAlertSuppressionSetting' + Kind SettingKind `json:"kind,omitempty"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name @@ -7450,86 +7448,38 @@ type SubAssessment struct { 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 +// SettingResource the kind of the security setting +type SettingResource struct { + // Kind - the kind of the settings string (DataExportSetting). Possible values include: 'SettingKindDataExportSetting', 'SettingKindAlertSuppressionSetting' + Kind SettingKind `json:"kind,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"` } -// SubAssessmentList list of security sub-assessments -type SubAssessmentList struct { +// SettingsList subscription settings list. +type SettingsList struct { autorest.Response `json:"-"` - // Value - READ-ONLY - Value *[]SubAssessment `json:"value,omitempty"` + // Value - The settings list. + Value *[]Setting `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 { +// SettingsListIterator provides access to a complete listing of Setting values. +type SettingsListIterator struct { i int - page SubAssessmentListPage + page SettingsListPage } // 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) { +func (iter *SettingsListIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentListIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/SettingsListIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -7554,62 +7504,62 @@ func (iter *SubAssessmentListIterator) NextWithContext(ctx context.Context) (err // 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 { +func (iter *SettingsListIterator) 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 { +func (iter SettingsListIterator) 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 { +func (iter SettingsListIterator) Response() SettingsList { 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 { +func (iter SettingsListIterator) Value() Setting { if !iter.page.NotDone() { - return SubAssessment{} + return Setting{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the SubAssessmentListIterator type. -func NewSubAssessmentListIterator(page SubAssessmentListPage) SubAssessmentListIterator { - return SubAssessmentListIterator{page: page} +// Creates a new instance of the SettingsListIterator type. +func NewSettingsListIterator(page SettingsListPage) SettingsListIterator { + return SettingsListIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (sal SubAssessmentList) IsEmpty() bool { - return sal.Value == nil || len(*sal.Value) == 0 +func (sl SettingsList) IsEmpty() bool { + return sl.Value == nil || len(*sl.Value) == 0 } -// subAssessmentListPreparer prepares a request to retrieve the next set of results. +// settingsListPreparer 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 { +func (sl SettingsList) settingsListPreparer(ctx context.Context) (*http.Request, error) { + if sl.NextLink == nil || len(to.String(sl.NextLink)) < 1 { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(sal.NextLink))) + autorest.WithBaseURL(to.String(sl.NextLink))) } -// SubAssessmentListPage contains a page of SubAssessment values. -type SubAssessmentListPage struct { - fn func(context.Context, SubAssessmentList) (SubAssessmentList, error) - sal SubAssessmentList +// SettingsListPage contains a page of Setting values. +type SettingsListPage struct { + fn func(context.Context, SettingsList) (SettingsList, error) + sl SettingsList } // 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) { +func (page *SettingsListPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubAssessmentListPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/SettingsListPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -7618,178 +7568,57 @@ func (page *SubAssessmentListPage) NextWithContext(ctx context.Context) (err err tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.sal) + next, err := page.fn(ctx, page.sl) if err != nil { return err } - page.sal = next + page.sl = 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 { +func (page *SettingsListPage) 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() +func (page SettingsListPage) NotDone() bool { + return !page.sl.IsEmpty() } // Response returns the raw server response from the last page request. -func (page SubAssessmentListPage) Response() SubAssessmentList { - return page.sal +func (page SettingsListPage) Response() SettingsList { + return page.sl } // 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() { +func (page SettingsListPage) Values() []Setting { + if page.sl.IsEmpty() { return nil } - return *page.sal.Value + return *page.sl.Value } -// Creates a new instance of the SubAssessmentListPage type. -func NewSubAssessmentListPage(getNextPage func(context.Context, SubAssessmentList) (SubAssessmentList, error)) SubAssessmentListPage { - return SubAssessmentListPage{fn: getNextPage} +// Creates a new instance of the SettingsListPage type. +func NewSettingsListPage(getNextPage func(context.Context, SettingsList) (SettingsList, error)) SettingsListPage { + return SettingsListPage{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"` +// Tags a list of key value pairs that describe the resource. +type Tags struct { + // Tags - A list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` } -// 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 - } - } +// MarshalJSON is the custom marshaler for Tags. +func (t Tags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.Tags != nil { + objectMap["tags"] = t.Tags } - - 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"` + return json.Marshal(objectMap) } // TagsResource a container holding only the Tags for a resource, allowing the user to update the tags. @@ -8395,6 +8224,39 @@ type TopologySingleResourceParent struct { ResourceID *string `json:"resourceId,omitempty"` } +// TrackedResource describes an Azure tracked resource. +type TrackedResource struct { + // 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"` + // Kind - Kind of the resource + Kind *string `json:"kind,omitempty"` + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. ETags may be returned for individual resources, and then sent via If-Match / If-None-Match headers for concurrency control. + Etag *string `json:"etag,omitempty"` + // Tags - A list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Kind != nil { + objectMap["kind"] = tr.Kind + } + if tr.Etag != nil { + objectMap["etag"] = tr.Etag + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + // UpdateIotSecuritySolutionData ... type UpdateIotSecuritySolutionData struct { UserDefinedResources *UserDefinedResourcesProperties `json:"userDefinedResources,omitempty"` @@ -8434,14 +8296,6 @@ 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/playbookconfigurations.go b/services/preview/security/mgmt/v2.0/security/playbookconfigurations.go new file mode 100644 index 000000000000..ba251d47dc38 --- /dev/null +++ b/services/preview/security/mgmt/v2.0/security/playbookconfigurations.go @@ -0,0 +1,733 @@ +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" +) + +// PlaybookConfigurationsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type PlaybookConfigurationsClient struct { + BaseClient +} + +// NewPlaybookConfigurationsClient creates an instance of the PlaybookConfigurationsClient client. +func NewPlaybookConfigurationsClient(subscriptionID string, ascLocation string) PlaybookConfigurationsClient { + return NewPlaybookConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewPlaybookConfigurationsClientWithBaseURI creates an instance of the PlaybookConfigurationsClient client. +func NewPlaybookConfigurationsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) PlaybookConfigurationsClient { + return PlaybookConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// CreateOrUpdate create or update a playbook configuration. If a playbook configuration is already created and a +// subsequent create request is issued with different properties, the playbook configuration properties will be +// updated. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// playbookConfigurationName - the playbook Configuration name. +// playbookConfiguration - the playbook configuration resource +func (client PlaybookConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration PlaybookConfiguration) (result PlaybookConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.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.PlaybookConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, playbookConfigurationName, playbookConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "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.PlaybookConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PlaybookConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration PlaybookConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "playbookConfigurationName": autorest.Encode("path", playbookConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + 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("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/playbookConfigurations/{playbookConfigurationName}", pathParameters), + autorest.WithJSON(playbookConfiguration), + 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 PlaybookConfigurationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PlaybookConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result PlaybookConfiguration, 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 delete a playbook configuration. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// playbookConfigurationName - the playbook Configuration name. +func (client PlaybookConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, playbookConfigurationName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.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.PlaybookConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, playbookConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PlaybookConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, playbookConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "playbookConfigurationName": autorest.Encode("path", playbookConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/playbookConfigurations/{playbookConfigurationName}", 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 PlaybookConfigurationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PlaybookConfigurationsClient) 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 get the details of a playbook configuration. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// playbookConfigurationName - the playbook Configuration name. +func (client PlaybookConfigurationsClient) Get(ctx context.Context, resourceGroupName string, playbookConfigurationName string) (result PlaybookConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.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.PlaybookConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, playbookConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "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.PlaybookConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client PlaybookConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, playbookConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "playbookConfigurationName": autorest.Encode("path", playbookConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/playbookConfigurations/{playbookConfigurationName}", 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 PlaybookConfigurationsClient) 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 PlaybookConfigurationsClient) GetResponder(resp *http.Response) (result PlaybookConfiguration, 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 all playbook configurations in a subscription. +func (client PlaybookConfigurationsClient) List(ctx context.Context) (result PlaybookConfigurationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.List") + defer func() { + sc := -1 + if result.pcl.Response.Response != nil { + sc = result.pcl.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.PlaybookConfigurationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.pcl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.pcl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client PlaybookConfigurationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/playbookConfigurations", 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 PlaybookConfigurationsClient) 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 PlaybookConfigurationsClient) ListResponder(resp *http.Response) (result PlaybookConfigurationList, 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 PlaybookConfigurationsClient) listNextResults(ctx context.Context, lastResults PlaybookConfigurationList) (result PlaybookConfigurationList, err error) { + req, err := lastResults.playbookConfigurationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "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.PlaybookConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PlaybookConfigurationsClient) ListComplete(ctx context.Context) (result PlaybookConfigurationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.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) + return +} + +// ListByResourceGroup get all playbook configurations in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +func (client PlaybookConfigurationsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result PlaybookConfigurationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.pcl.Response.Response != nil { + sc = result.pcl.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.PlaybookConfigurationsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.pcl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.pcl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client PlaybookConfigurationsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/playbookConfigurations", 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 PlaybookConfigurationsClient) 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 PlaybookConfigurationsClient) ListByResourceGroupResponder(resp *http.Response) (result PlaybookConfigurationList, 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 PlaybookConfigurationsClient) listByResourceGroupNextResults(ctx context.Context, lastResults PlaybookConfigurationList) (result PlaybookConfigurationList, err error) { + req, err := lastResults.playbookConfigurationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "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.PlaybookConfigurationsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client PlaybookConfigurationsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result PlaybookConfigurationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.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) + return +} + +// Patch patch an existing playbook configuration. Supports only Tags +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// playbookConfigurationName - the playbook Configuration name. +// playbookConfiguration - the playbook configuration resource +func (client PlaybookConfigurationsClient) Patch(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration PlaybookConfiguration) (result PlaybookConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.Patch") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.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.PlaybookConfigurationsClient", "Patch", err.Error()) + } + + req, err := client.PatchPreparer(ctx, resourceGroupName, playbookConfigurationName, playbookConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Patch", nil, "Failure preparing request") + return + } + + resp, err := client.PatchSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Patch", resp, "Failure sending request") + return + } + + result, err = client.PatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Patch", resp, "Failure responding to request") + } + + return +} + +// PatchPreparer prepares the Patch request. +func (client PlaybookConfigurationsClient) PatchPreparer(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration PlaybookConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "playbookConfigurationName": autorest.Encode("path", playbookConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/playbookConfigurations/{playbookConfigurationName}", pathParameters), + autorest.WithJSON(playbookConfiguration), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client PlaybookConfigurationsClient) PatchSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client PlaybookConfigurationsClient) PatchResponder(resp *http.Response) (result PlaybookConfiguration, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Validate validate the playbook configuration model before create or update. Any validation errors are returned to +// the client. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// playbookConfigurationName - the playbook Configuration name. +// playbookConfiguration - the playbook configuration resource +func (client PlaybookConfigurationsClient) Validate(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration PlaybookConfiguration) (result PlaybookConfigurationValidationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PlaybookConfigurationsClient.Validate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.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.PlaybookConfigurationsClient", "Validate", err.Error()) + } + + req, err := client.ValidatePreparer(ctx, resourceGroupName, playbookConfigurationName, playbookConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Validate", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Validate", resp, "Failure sending request") + return + } + + result, err = client.ValidateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.PlaybookConfigurationsClient", "Validate", resp, "Failure responding to request") + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client PlaybookConfigurationsClient) ValidatePreparer(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration PlaybookConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "playbookConfigurationName": autorest.Encode("path", playbookConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/playbookConfigurations/{playbookConfigurationName}/validate", pathParameters), + autorest.WithJSON(playbookConfiguration), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client PlaybookConfigurationsClient) ValidateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +func (client PlaybookConfigurationsClient) ValidateResponder(resp *http.Response) (result PlaybookConfigurationValidationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} 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 dec22bd03f50..20b634ef864a 100644 --- a/services/preview/security/mgmt/v2.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v2.0/security/securityapi/interfaces.go @@ -23,14 +23,18 @@ 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) +// PlaybookConfigurationsClientAPI contains the set of methods on the PlaybookConfigurationsClient type. +type PlaybookConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration security.PlaybookConfiguration) (result security.PlaybookConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, playbookConfigurationName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, playbookConfigurationName string) (result security.PlaybookConfiguration, err error) + List(ctx context.Context) (result security.PlaybookConfigurationListPage, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result security.PlaybookConfigurationListPage, err error) + Patch(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration security.PlaybookConfiguration) (result security.PlaybookConfiguration, err error) + Validate(ctx context.Context, resourceGroupName string, playbookConfigurationName string, playbookConfiguration security.PlaybookConfiguration) (result security.PlaybookConfigurationValidationStatus, err error) +} + +var _ PlaybookConfigurationsClientAPI = (*security.PlaybookConfigurationsClient)(nil) // RegulatoryComplianceStandardsClientAPI contains the set of methods on the RegulatoryComplianceStandardsClient type. type RegulatoryComplianceStandardsClientAPI interface { diff --git a/services/preview/security/mgmt/v2.0/security/subassessments.go b/services/preview/security/mgmt/v2.0/security/subassessments.go deleted file mode 100644 index 4fa19d8e398d..000000000000 --- a/services/preview/security/mgmt/v2.0/security/subassessments.go +++ /dev/null @@ -1,348 +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/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/models.go b/services/preview/security/mgmt/v3.0/security/models.go index d573fd085a9e..7b24be701fc8 100644 --- a/services/preview/security/mgmt/v3.0/security/models.go +++ b/services/preview/security/mgmt/v3.0/security/models.go @@ -95,25 +95,6 @@ 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 @@ -665,23 +646,6 @@ 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 @@ -697,23 +661,6 @@ 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 @@ -787,23 +734,6 @@ 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 @@ -911,100 +841,6 @@ 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. @@ -2335,84 +2171,6 @@ 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"` @@ -3354,64 +3112,6 @@ 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. @@ -3424,20 +3124,6 @@ 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 @@ -4019,6 +3705,14 @@ type DiscoveredSecuritySolutionProperties struct { Sku *string `json:"sku,omitempty"` } +// ETag entity tag is used for comparing two or more entities from the same requested resource. ETags may +// be returned for individual resources, and then sent via If-Match / If-None-Match headers for concurrency +// control. +type ETag struct { + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. ETags may be returned for individual resources, and then sent via If-Match / If-None-Match headers for concurrency control. + Etag *string `json:"etag,omitempty"` +} + // BasicExternalSecuritySolution represents a security solution external to Azure Security Center which sends // information to an OMS workspace and whose data is displayed by Azure Security Center. type BasicExternalSecuritySolution interface { @@ -6999,90 +6693,6 @@ 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. @@ -7177,61 +6787,6 @@ 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:"-"` @@ -7403,405 +6958,21 @@ 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"` +// Tags a list of key value pairs that describe the resource. +type Tags struct { + // Tags - A list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` } -// MarshalJSON is the custom marshaler for SubAssessment. -func (sa SubAssessment) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for Tags. +func (t Tags) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if sa.SubAssessmentProperties != nil { - objectMap["properties"] = sa.SubAssessmentProperties + if t.Tags != nil { + objectMap["tags"] = t.Tags } 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 @@ -8405,6 +7576,39 @@ type TopologySingleResourceParent struct { ResourceID *string `json:"resourceId,omitempty"` } +// TrackedResource describes an Azure tracked resource. +type TrackedResource struct { + // 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"` + // Kind - Kind of the resource + Kind *string `json:"kind,omitempty"` + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. ETags may be returned for individual resources, and then sent via If-Match / If-None-Match headers for concurrency control. + Etag *string `json:"etag,omitempty"` + // Tags - A list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Kind != nil { + objectMap["kind"] = tr.Kind + } + if tr.Etag != nil { + objectMap["etag"] = tr.Etag + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + // UpdateIotSecuritySolutionData ... type UpdateIotSecuritySolutionData struct { // UpdateIoTSecuritySolutionProperties - Security Solution data @@ -8480,14 +7684,6 @@ 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 3b70713dc7cb..279a2d80bcb1 100644 --- a/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go @@ -286,12 +286,3 @@ 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 deleted file mode 100644 index 4fa19d8e398d..000000000000 --- a/services/preview/security/mgmt/v3.0/security/subassessments.go +++ /dev/null @@ -1,348 +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/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 -}