From dc3fb068d454f6536c225eb2d4c5b880ce99d838 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 30 Jun 2021 05:23:18 +0000 Subject: [PATCH] CodeGen from PR 15023 in Azure/azure-rest-api-specs Added new onboarding modes and optinal-readonly evaluationEndTime property (#15023) Co-authored-by: Liran Chen --- .../security/mgmt/v1.0/security/CHANGELOG.md | 247 ++++++- .../security/mgmt/v1.0/security/_meta.json | 2 +- .../security/mgmt/v1.0/security/enums.go | 127 ++-- .../mgmt/v1.0/security/ingestionsettings.go | 555 ++++++++++++++ .../security/mgmt/v1.0/security/models.go | 683 +++++++++++++++++- .../v1.0/security/securityapi/interfaces.go | 28 +- .../security/mgmt/v1.0/security/settings.go | 10 +- .../mgmt/v1.0/security/softwareinventories.go | 378 ++++++++++ .../security/mgmt/v2.0/security/CHANGELOG.md | 251 ++++++- .../security/mgmt/v2.0/security/_meta.json | 2 +- .../security/mgmt/v2.0/security/enums.go | 127 ++-- .../mgmt/v2.0/security/ingestionsettings.go | 555 ++++++++++++++ .../security/mgmt/v2.0/security/models.go | 683 +++++++++++++++++- .../v2.0/security/securityapi/interfaces.go | 28 +- .../security/mgmt/v2.0/security/settings.go | 10 +- .../mgmt/v2.0/security/softwareinventories.go | 378 ++++++++++ .../security/mgmt/v3.0/security/CHANGELOG.md | 568 +-------------- .../security/mgmt/v3.0/security/_meta.json | 2 +- .../security/mgmt/v3.0/security/enums.go | 46 +- .../security/mgmt/v3.0/security/models.go | 175 ++++- .../v3.0/security/securityapi/interfaces.go | 20 +- .../security/mgmt/v3.0/security/settings.go | 10 +- 22 files changed, 4042 insertions(+), 843 deletions(-) create mode 100644 services/preview/security/mgmt/v1.0/security/ingestionsettings.go create mode 100644 services/preview/security/mgmt/v1.0/security/softwareinventories.go create mode 100644 services/preview/security/mgmt/v2.0/security/ingestionsettings.go create mode 100644 services/preview/security/mgmt/v2.0/security/softwareinventories.go diff --git a/services/preview/security/mgmt/v1.0/security/CHANGELOG.md b/services/preview/security/mgmt/v1.0/security/CHANGELOG.md index 43af44a736b2..2d1d9a161eb5 100644 --- a/services/preview/security/mgmt/v1.0/security/CHANGELOG.md +++ b/services/preview/security/mgmt/v1.0/security/CHANGELOG.md @@ -1,37 +1,220 @@ -# Change History +# Unreleased + +## Breaking Changes + +### Removed Constants + +1. EnforcementMode.Audit +1. EnforcementMode.Enforce +1. EventSource.Alerts +1. EventSource.Assessments +1. EventSource.SecureScoreControls +1. EventSource.SecureScores +1. EventSource.SubAssessments +1. SettingKind.SettingKindAlertSuppressionSetting +1. SettingKind.SettingKindDataExportSetting + +### Removed Funcs + +1. PossibleSettingKindValues() []SettingKind +1. SettingResource.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### Removed Structs + +1. SettingResource + +### Signature Changes + +#### Const Types + +1. KindAAD changed type from KindEnum to KindEnum1 +1. KindATA changed type from KindEnum to KindEnum1 +1. KindCEF changed type from KindEnum to KindEnum1 +1. KindExternalSecuritySolution changed type from KindEnum to KindEnum1 +1. None changed type from EnforcementMode to EndOfSupportStatus + +#### Funcs + +1. SettingsClient.Get + - Returns + - From: Setting, error + - To: SettingModel, error +1. SettingsClient.GetResponder + - Returns + - From: Setting, error + - To: SettingModel, error +1. SettingsClient.Update + - Params + - From: context.Context, string, Setting + - To: context.Context, string, BasicSetting + - Returns + - From: Setting, error + - To: SettingModel, error +1. SettingsClient.UpdatePreparer + - Params + - From: context.Context, string, Setting + - To: context.Context, string, BasicSetting +1. SettingsClient.UpdateResponder + - Returns + - From: Setting, error + - To: SettingModel, error +1. SettingsListIterator.Value + - Returns + - From: Setting + - To: BasicSetting +1. SettingsListPage.Values + - Returns + - From: []Setting + - To: []BasicSetting + +#### Struct Fields + +1. AadExternalSecuritySolution.Kind changed type from KindEnum to KindEnum1 +1. AtaExternalSecuritySolution.Kind changed type from KindEnum to KindEnum1 +1. CefExternalSecuritySolution.Kind changed type from KindEnum to KindEnum1 +1. DataExportSetting.Kind changed type from SettingKind to KindEnum +1. ExternalSecuritySolution.Kind changed type from KindEnum to KindEnum1 +1. Setting.Kind changed type from SettingKind to KindEnum +1. SettingsList.Value changed type from *[]Setting to *[]BasicSetting ## Additive Changes +### New Constants + +1. EndOfSupportStatus.NoLongerSupported +1. EndOfSupportStatus.UpcomingNoLongerSupported +1. EndOfSupportStatus.UpcomingVersionNoLongerSupported +1. EndOfSupportStatus.VersionNoLongerSupported +1. EnforcementMode.EnforcementModeAudit +1. EnforcementMode.EnforcementModeEnforce +1. EnforcementMode.EnforcementModeNone +1. EventSource.EventSourceAlerts +1. EventSource.EventSourceAssessments +1. EventSource.EventSourceRegulatoryComplianceAssessment +1. EventSource.EventSourceRegulatoryComplianceAssessmentSnapshot +1. EventSource.EventSourceSecureScoreControls +1. EventSource.EventSourceSecureScoreControlsSnapshot +1. EventSource.EventSourceSecureScores +1. EventSource.EventSourceSecureScoresSnapshot +1. EventSource.EventSourceSubAssessments +1. KindEnum.KindDataExportSetting +1. KindEnum.KindSetting + ### New Funcs -1. AlertConfidenceReason.MarshalJSON() ([]byte, error) -1. AllowedConnectionsList.MarshalJSON() ([]byte, error) -1. AllowedConnectionsResourceProperties.MarshalJSON() ([]byte, error) -1. AscLocationList.MarshalJSON() ([]byte, error) -1. AzureResourceLink.MarshalJSON() ([]byte, error) -1. CVE.MarshalJSON() ([]byte, error) -1. CVSS.MarshalJSON() ([]byte, error) -1. CloudErrorBody.MarshalJSON() ([]byte, error) -1. ComplianceProperties.MarshalJSON() ([]byte, error) -1. ComplianceSegment.MarshalJSON() ([]byte, error) -1. ConnectableResource.MarshalJSON() ([]byte, error) -1. ConnectedResource.MarshalJSON() ([]byte, error) -1. ContactList.MarshalJSON() ([]byte, error) -1. Location.MarshalJSON() ([]byte, error) -1. OperationDisplay.MarshalJSON() ([]byte, error) -1. Resource.MarshalJSON() ([]byte, error) -1. ScoreDetails.MarshalJSON() ([]byte, error) -1. SecureScoreControlDefinitionItemProperties.MarshalJSON() ([]byte, error) -1. SecureScoreControlDefinitionList.MarshalJSON() ([]byte, error) -1. SecureScoreControlList.MarshalJSON() ([]byte, error) -1. SecureScoreControlScore.MarshalJSON() ([]byte, error) -1. SecureScoresList.MarshalJSON() ([]byte, error) -1. SubAssessmentList.MarshalJSON() ([]byte, error) -1. SubAssessmentStatus.MarshalJSON() ([]byte, error) -1. TaskList.MarshalJSON() ([]byte, error) -1. TopologyList.MarshalJSON() ([]byte, error) -1. TopologyResourceProperties.MarshalJSON() ([]byte, error) -1. TopologySingleResource.MarshalJSON() ([]byte, error) -1. TopologySingleResourceChild.MarshalJSON() ([]byte, error) -1. TopologySingleResourceParent.MarshalJSON() ([]byte, error) -1. VendorReference.MarshalJSON() ([]byte, error) +1. *IngestionSettingListIterator.Next() error +1. *IngestionSettingListIterator.NextWithContext(context.Context) error +1. *IngestionSettingListPage.Next() error +1. *IngestionSettingListPage.NextWithContext(context.Context) error +1. *SettingModel.UnmarshalJSON([]byte) error +1. *SettingsList.UnmarshalJSON([]byte) error +1. *Software.UnmarshalJSON([]byte) error +1. *SoftwaresListIterator.Next() error +1. *SoftwaresListIterator.NextWithContext(context.Context) error +1. *SoftwaresListPage.Next() error +1. *SoftwaresListPage.NextWithContext(context.Context) error +1. DataExportSetting.AsBasicSetting() (BasicSetting, bool) +1. DataExportSetting.AsDataExportSetting() (*DataExportSetting, bool) +1. DataExportSetting.AsSetting() (*Setting, bool) +1. ErrorAdditionalInfo.MarshalJSON() ([]byte, error) +1. IngestionConnectionString.MarshalJSON() ([]byte, error) +1. IngestionSetting.MarshalJSON() ([]byte, error) +1. IngestionSettingList.IsEmpty() bool +1. IngestionSettingList.MarshalJSON() ([]byte, error) +1. IngestionSettingListIterator.NotDone() bool +1. IngestionSettingListIterator.Response() IngestionSettingList +1. IngestionSettingListIterator.Value() IngestionSetting +1. IngestionSettingListPage.NotDone() bool +1. IngestionSettingListPage.Response() IngestionSettingList +1. IngestionSettingListPage.Values() []IngestionSetting +1. IngestionSettingToken.MarshalJSON() ([]byte, error) +1. IngestionSettingsClient.Create(context.Context, string, IngestionSetting) (IngestionSetting, error) +1. IngestionSettingsClient.CreatePreparer(context.Context, string, IngestionSetting) (*http.Request, error) +1. IngestionSettingsClient.CreateResponder(*http.Response) (IngestionSetting, error) +1. IngestionSettingsClient.CreateSender(*http.Request) (*http.Response, error) +1. IngestionSettingsClient.Delete(context.Context, string) (autorest.Response, error) +1. IngestionSettingsClient.DeletePreparer(context.Context, string) (*http.Request, error) +1. IngestionSettingsClient.DeleteResponder(*http.Response) (autorest.Response, error) +1. IngestionSettingsClient.DeleteSender(*http.Request) (*http.Response, error) +1. IngestionSettingsClient.Get(context.Context, string) (IngestionSetting, error) +1. IngestionSettingsClient.GetPreparer(context.Context, string) (*http.Request, error) +1. IngestionSettingsClient.GetResponder(*http.Response) (IngestionSetting, error) +1. IngestionSettingsClient.GetSender(*http.Request) (*http.Response, error) +1. IngestionSettingsClient.List(context.Context) (IngestionSettingListPage, error) +1. IngestionSettingsClient.ListComplete(context.Context) (IngestionSettingListIterator, error) +1. IngestionSettingsClient.ListConnectionStrings(context.Context, string) (ConnectionStrings, error) +1. IngestionSettingsClient.ListConnectionStringsPreparer(context.Context, string) (*http.Request, error) +1. IngestionSettingsClient.ListConnectionStringsResponder(*http.Response) (ConnectionStrings, error) +1. IngestionSettingsClient.ListConnectionStringsSender(*http.Request) (*http.Response, error) +1. IngestionSettingsClient.ListPreparer(context.Context) (*http.Request, error) +1. IngestionSettingsClient.ListResponder(*http.Response) (IngestionSettingList, error) +1. IngestionSettingsClient.ListSender(*http.Request) (*http.Response, error) +1. IngestionSettingsClient.ListTokens(context.Context, string) (IngestionSettingToken, error) +1. IngestionSettingsClient.ListTokensPreparer(context.Context, string) (*http.Request, error) +1. IngestionSettingsClient.ListTokensResponder(*http.Response) (IngestionSettingToken, error) +1. IngestionSettingsClient.ListTokensSender(*http.Request) (*http.Response, error) +1. NewIngestionSettingListIterator(IngestionSettingListPage) IngestionSettingListIterator +1. NewIngestionSettingListPage(IngestionSettingList, func(context.Context, IngestionSettingList) (IngestionSettingList, error)) IngestionSettingListPage +1. NewIngestionSettingsClient(string, string) IngestionSettingsClient +1. NewIngestionSettingsClientWithBaseURI(string, string, string) IngestionSettingsClient +1. NewSoftwareInventoriesClient(string, string) SoftwareInventoriesClient +1. NewSoftwareInventoriesClientWithBaseURI(string, string, string) SoftwareInventoriesClient +1. NewSoftwaresListIterator(SoftwaresListPage) SoftwaresListIterator +1. NewSoftwaresListPage(SoftwaresList, func(context.Context, SoftwaresList) (SoftwaresList, error)) SoftwaresListPage +1. PossibleEndOfSupportStatusValues() []EndOfSupportStatus +1. PossibleKindEnum1Values() []KindEnum1 +1. Setting.AsBasicSetting() (BasicSetting, bool) +1. Setting.AsDataExportSetting() (*DataExportSetting, bool) +1. Setting.AsSetting() (*Setting, bool) +1. Software.MarshalJSON() ([]byte, error) +1. SoftwareInventoriesClient.Get(context.Context, string, string, string, string, string) (Software, error) +1. SoftwareInventoriesClient.GetPreparer(context.Context, string, string, string, string, string) (*http.Request, error) +1. SoftwareInventoriesClient.GetResponder(*http.Response) (Software, error) +1. SoftwareInventoriesClient.GetSender(*http.Request) (*http.Response, error) +1. SoftwareInventoriesClient.ListByExtendedResource(context.Context, string, string, string, string) (SoftwaresListPage, error) +1. SoftwareInventoriesClient.ListByExtendedResourceComplete(context.Context, string, string, string, string) (SoftwaresListIterator, error) +1. SoftwareInventoriesClient.ListByExtendedResourcePreparer(context.Context, string, string, string, string) (*http.Request, error) +1. SoftwareInventoriesClient.ListByExtendedResourceResponder(*http.Response) (SoftwaresList, error) +1. SoftwareInventoriesClient.ListByExtendedResourceSender(*http.Request) (*http.Response, error) +1. SoftwareInventoriesClient.ListBySubscription(context.Context) (SoftwaresListPage, error) +1. SoftwareInventoriesClient.ListBySubscriptionComplete(context.Context) (SoftwaresListIterator, error) +1. SoftwareInventoriesClient.ListBySubscriptionPreparer(context.Context) (*http.Request, error) +1. SoftwareInventoriesClient.ListBySubscriptionResponder(*http.Response) (SoftwaresList, error) +1. SoftwareInventoriesClient.ListBySubscriptionSender(*http.Request) (*http.Response, error) +1. SoftwaresList.IsEmpty() bool +1. SoftwaresList.MarshalJSON() ([]byte, error) +1. SoftwaresListIterator.NotDone() bool +1. SoftwaresListIterator.Response() SoftwaresList +1. SoftwaresListIterator.Value() Software +1. SoftwaresListPage.NotDone() bool +1. SoftwaresListPage.Response() SoftwaresList +1. SoftwaresListPage.Values() []Software + +### Struct Changes + +#### New Structs + +1. ConnectionStrings +1. ErrorAdditionalInfo +1. IngestionConnectionString +1. IngestionSetting +1. IngestionSettingList +1. IngestionSettingListIterator +1. IngestionSettingListPage +1. IngestionSettingToken +1. IngestionSettingsClient +1. SettingModel +1. Software +1. SoftwareInventoriesClient +1. SoftwareProperties +1. SoftwaresList +1. SoftwaresListIterator +1. SoftwaresListPage + +#### New Struct Fields + +1. CloudErrorBody.AdditionalInfo +1. CloudErrorBody.Details +1. CloudErrorBody.Target diff --git a/services/preview/security/mgmt/v1.0/security/_meta.json b/services/preview/security/mgmt/v1.0/security/_meta.json index bc78a287be13..2f427e0248bc 100644 --- a/services/preview/security/mgmt/v1.0/security/_meta.json +++ b/services/preview/security/mgmt/v1.0/security/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "34342af98a9330b5629dd4d034bd82d1d848e9c0", "readme": "/_/azure-rest-api-specs/specification/security/resource-manager/readme.md", "tag": "package-composite-v1", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/preview/security/mgmt/v1.0/security/enums.go b/services/preview/security/mgmt/v1.0/security/enums.go index ed5a06ace25a..df2ac4b29bae 100644 --- a/services/preview/security/mgmt/v1.0/security/enums.go +++ b/services/preview/security/mgmt/v1.0/security/enums.go @@ -269,21 +269,42 @@ func PossibleDirectionValues() []Direction { return []Direction{Inbound, Outbound} } +// EndOfSupportStatus enumerates the values for end of support status. +type EndOfSupportStatus string + +const ( + // NoLongerSupported ... + NoLongerSupported EndOfSupportStatus = "noLongerSupported" + // None ... + None EndOfSupportStatus = "None" + // UpcomingNoLongerSupported ... + UpcomingNoLongerSupported EndOfSupportStatus = "upcomingNoLongerSupported" + // UpcomingVersionNoLongerSupported ... + UpcomingVersionNoLongerSupported EndOfSupportStatus = "upcomingVersionNoLongerSupported" + // VersionNoLongerSupported ... + VersionNoLongerSupported EndOfSupportStatus = "versionNoLongerSupported" +) + +// PossibleEndOfSupportStatusValues returns an array of possible values for the EndOfSupportStatus const type. +func PossibleEndOfSupportStatusValues() []EndOfSupportStatus { + return []EndOfSupportStatus{NoLongerSupported, None, UpcomingNoLongerSupported, UpcomingVersionNoLongerSupported, VersionNoLongerSupported} +} + // EnforcementMode enumerates the values for enforcement mode. type EnforcementMode string const ( - // Audit ... - Audit EnforcementMode = "Audit" - // Enforce ... - Enforce EnforcementMode = "Enforce" - // None ... - None EnforcementMode = "None" + // EnforcementModeAudit ... + EnforcementModeAudit EnforcementMode = "Audit" + // EnforcementModeEnforce ... + EnforcementModeEnforce EnforcementMode = "Enforce" + // EnforcementModeNone ... + EnforcementModeNone EnforcementMode = "None" ) // PossibleEnforcementModeValues returns an array of possible values for the EnforcementMode const type. func PossibleEnforcementModeValues() []EnforcementMode { - return []EnforcementMode{Audit, Enforce, None} + return []EnforcementMode{EnforcementModeAudit, EnforcementModeEnforce, EnforcementModeNone} } // EnforcementMode1 enumerates the values for enforcement mode 1. @@ -324,21 +345,29 @@ func PossibleEnforcementSupportValues() []EnforcementSupport { type EventSource string const ( - // Alerts ... - Alerts EventSource = "Alerts" - // Assessments ... - Assessments EventSource = "Assessments" - // SecureScoreControls ... - SecureScoreControls EventSource = "SecureScoreControls" - // SecureScores ... - SecureScores EventSource = "SecureScores" - // SubAssessments ... - SubAssessments EventSource = "SubAssessments" + // EventSourceAlerts ... + EventSourceAlerts EventSource = "Alerts" + // EventSourceAssessments ... + EventSourceAssessments EventSource = "Assessments" + // EventSourceRegulatoryComplianceAssessment ... + EventSourceRegulatoryComplianceAssessment EventSource = "RegulatoryComplianceAssessment" + // EventSourceRegulatoryComplianceAssessmentSnapshot ... + EventSourceRegulatoryComplianceAssessmentSnapshot EventSource = "RegulatoryComplianceAssessmentSnapshot" + // EventSourceSecureScoreControls ... + EventSourceSecureScoreControls EventSource = "SecureScoreControls" + // EventSourceSecureScoreControlsSnapshot ... + EventSourceSecureScoreControlsSnapshot EventSource = "SecureScoreControlsSnapshot" + // EventSourceSecureScores ... + EventSourceSecureScores EventSource = "SecureScores" + // EventSourceSecureScoresSnapshot ... + EventSourceSecureScoresSnapshot EventSource = "SecureScoresSnapshot" + // EventSourceSubAssessments ... + EventSourceSubAssessments EventSource = "SubAssessments" ) // PossibleEventSourceValues returns an array of possible values for the EventSource const type. func PossibleEventSourceValues() []EventSource { - return []EventSource{Alerts, Assessments, SecureScoreControls, SecureScores, SubAssessments} + return []EventSource{EventSourceAlerts, EventSourceAssessments, EventSourceRegulatoryComplianceAssessment, EventSourceRegulatoryComplianceAssessmentSnapshot, EventSourceSecureScoreControls, EventSourceSecureScoreControlsSnapshot, EventSourceSecureScores, EventSourceSecureScoresSnapshot, EventSourceSubAssessments} } // Exe enumerates the values for exe. @@ -490,20 +519,35 @@ func PossibleIssueValues() []Issue { // KindEnum enumerates the values for kind enum. type KindEnum string +const ( + // KindDataExportSetting ... + KindDataExportSetting KindEnum = "DataExportSetting" + // KindSetting ... + KindSetting KindEnum = "Setting" +) + +// PossibleKindEnumValues returns an array of possible values for the KindEnum const type. +func PossibleKindEnumValues() []KindEnum { + return []KindEnum{KindDataExportSetting, KindSetting} +} + +// KindEnum1 enumerates the values for kind enum 1. +type KindEnum1 string + const ( // KindAAD ... - KindAAD KindEnum = "AAD" + KindAAD KindEnum1 = "AAD" // KindATA ... - KindATA KindEnum = "ATA" + KindATA KindEnum1 = "ATA" // KindCEF ... - KindCEF KindEnum = "CEF" + KindCEF KindEnum1 = "CEF" // KindExternalSecuritySolution ... - KindExternalSecuritySolution KindEnum = "ExternalSecuritySolution" + KindExternalSecuritySolution KindEnum1 = "ExternalSecuritySolution" ) -// PossibleKindEnumValues returns an array of possible values for the KindEnum const type. -func PossibleKindEnumValues() []KindEnum { - return []KindEnum{KindAAD, KindATA, KindCEF, KindExternalSecuritySolution} +// PossibleKindEnum1Values returns an array of possible values for the KindEnum1 const type. +func PossibleKindEnum1Values() []KindEnum1 { + return []KindEnum1{KindAAD, KindATA, KindCEF, KindExternalSecuritySolution} } // Msi enumerates the values for msi. @@ -527,23 +571,23 @@ func PossibleMsiValues() []Msi { type Operator string const ( - // Contains ... + // Contains Applies only for non-decimal operands Contains Operator = "Contains" - // EndsWith ... + // EndsWith Applies only for non-decimal operands EndsWith Operator = "EndsWith" - // Equals ... + // Equals Applies for decimal and non-decimal operands Equals Operator = "Equals" - // GreaterThan ... + // GreaterThan Applies only for decimal operands GreaterThan Operator = "GreaterThan" - // GreaterThanOrEqualTo ... + // GreaterThanOrEqualTo Applies only for decimal operands GreaterThanOrEqualTo Operator = "GreaterThanOrEqualTo" - // LesserThan ... + // LesserThan Applies only for decimal operands LesserThan Operator = "LesserThan" - // LesserThanOrEqualTo ... + // LesserThanOrEqualTo Applies only for decimal operands LesserThanOrEqualTo Operator = "LesserThanOrEqualTo" - // NotEquals ... + // NotEquals Applies for decimal and non-decimal operands NotEquals Operator = "NotEquals" - // StartsWith ... + // StartsWith Applies only for non-decimal operands StartsWith Operator = "StartsWith" ) @@ -902,21 +946,6 @@ func PossibleScriptValues() []Script { return []Script{ScriptAudit, ScriptEnforce, ScriptNone} } -// SettingKind enumerates the values for setting kind. -type SettingKind string - -const ( - // SettingKindAlertSuppressionSetting ... - SettingKindAlertSuppressionSetting SettingKind = "AlertSuppressionSetting" - // SettingKindDataExportSetting ... - SettingKindDataExportSetting SettingKind = "DataExportSetting" -) - -// PossibleSettingKindValues returns an array of possible values for the SettingKind const type. -func PossibleSettingKindValues() []SettingKind { - return []SettingKind{SettingKindAlertSuppressionSetting, SettingKindDataExportSetting} -} - // Severity enumerates the values for severity. type Severity string diff --git a/services/preview/security/mgmt/v1.0/security/ingestionsettings.go b/services/preview/security/mgmt/v1.0/security/ingestionsettings.go new file mode 100644 index 000000000000..b5f7ce03a686 --- /dev/null +++ b/services/preview/security/mgmt/v1.0/security/ingestionsettings.go @@ -0,0 +1,555 @@ +package security + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "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" +) + +// IngestionSettingsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type IngestionSettingsClient struct { + BaseClient +} + +// NewIngestionSettingsClient creates an instance of the IngestionSettingsClient client. +func NewIngestionSettingsClient(subscriptionID string, ascLocation string) IngestionSettingsClient { + return NewIngestionSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewIngestionSettingsClientWithBaseURI creates an instance of the IngestionSettingsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewIngestionSettingsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IngestionSettingsClient { + return IngestionSettingsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// Create create setting for ingesting security data and logs to correlate with resources associated with the +// subscription. +// Parameters: +// ingestionSettingName - name of the ingestion setting +// ingestionSetting - ingestion setting object +func (client IngestionSettingsClient) Create(ctx context.Context, ingestionSettingName string, ingestionSetting IngestionSetting) (result IngestionSetting, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.Create") + 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}}}}); err != nil { + return result, validation.NewError("security.IngestionSettingsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, ingestionSettingName, ingestionSetting) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client IngestionSettingsClient) CreatePreparer(ctx context.Context, ingestionSettingName string, ingestionSetting IngestionSetting) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ingestionSettingName": autorest.Encode("path", ingestionSettingName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-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}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}", pathParameters), + autorest.WithJSON(ingestionSetting), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client IngestionSettingsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client IngestionSettingsClient) CreateResponder(resp *http.Response) (result IngestionSetting, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the ingestion settings for this subscription. +// Parameters: +// ingestionSettingName - name of the ingestion setting +func (client IngestionSettingsClient) Delete(ctx context.Context, ingestionSettingName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.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}}}}); err != nil { + return result, validation.NewError("security.IngestionSettingsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, ingestionSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client IngestionSettingsClient) DeletePreparer(ctx context.Context, ingestionSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ingestionSettingName": autorest.Encode("path", ingestionSettingName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}", 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 IngestionSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client IngestionSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get settings for ingesting security data and logs to correlate with resources associated with the subscription. +// Parameters: +// ingestionSettingName - name of the ingestion setting +func (client IngestionSettingsClient) Get(ctx context.Context, ingestionSettingName string) (result IngestionSetting, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.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}}}}); err != nil { + return result, validation.NewError("security.IngestionSettingsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, ingestionSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "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.IngestionSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client IngestionSettingsClient) GetPreparer(ctx context.Context, ingestionSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ingestionSettingName": autorest.Encode("path", ingestionSettingName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}", 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 IngestionSettingsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client IngestionSettingsClient) GetResponder(resp *http.Response) (result IngestionSetting, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List settings for ingesting security data and logs to correlate with resources associated with the subscription. +func (client IngestionSettingsClient) List(ctx context.Context) (result IngestionSettingListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.List") + defer func() { + sc := -1 + if result.isl.Response.Response != nil { + sc = result.isl.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.IngestionSettingsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.isl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "List", resp, "Failure sending request") + return + } + + result.isl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "List", resp, "Failure responding to request") + return + } + if result.isl.hasNextLink() && result.isl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client IngestionSettingsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings", 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 IngestionSettingsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client IngestionSettingsClient) ListResponder(resp *http.Response) (result IngestionSettingList, err error) { + err = autorest.Respond( + resp, + 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 IngestionSettingsClient) listNextResults(ctx context.Context, lastResults IngestionSettingList) (result IngestionSettingList, err error) { + req, err := lastResults.ingestionSettingListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "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.IngestionSettingsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client IngestionSettingsClient) ListComplete(ctx context.Context) (result IngestionSettingListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.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 +} + +// ListConnectionStrings connection strings for ingesting security scan logs and data. +// Parameters: +// ingestionSettingName - name of the ingestion setting +func (client IngestionSettingsClient) ListConnectionStrings(ctx context.Context, ingestionSettingName string) (result ConnectionStrings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.ListConnectionStrings") + 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}}}}); err != nil { + return result, validation.NewError("security.IngestionSettingsClient", "ListConnectionStrings", err.Error()) + } + + req, err := client.ListConnectionStringsPreparer(ctx, ingestionSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListConnectionStrings", nil, "Failure preparing request") + return + } + + resp, err := client.ListConnectionStringsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListConnectionStrings", resp, "Failure sending request") + return + } + + result, err = client.ListConnectionStringsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListConnectionStrings", resp, "Failure responding to request") + return + } + + return +} + +// ListConnectionStringsPreparer prepares the ListConnectionStrings request. +func (client IngestionSettingsClient) ListConnectionStringsPreparer(ctx context.Context, ingestionSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ingestionSettingName": autorest.Encode("path", ingestionSettingName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListConnectionStringsSender sends the ListConnectionStrings request. The method will close the +// http.Response Body if it receives an error. +func (client IngestionSettingsClient) ListConnectionStringsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListConnectionStringsResponder handles the response to the ListConnectionStrings request. The method always +// closes the http.Response Body. +func (client IngestionSettingsClient) ListConnectionStringsResponder(resp *http.Response) (result ConnectionStrings, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListTokens returns the token that is used for correlating ingested telemetry with the resources in the subscription. +// Parameters: +// ingestionSettingName - name of the ingestion setting +func (client IngestionSettingsClient) ListTokens(ctx context.Context, ingestionSettingName string) (result IngestionSettingToken, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.ListTokens") + 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}}}}); err != nil { + return result, validation.NewError("security.IngestionSettingsClient", "ListTokens", err.Error()) + } + + req, err := client.ListTokensPreparer(ctx, ingestionSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListTokens", nil, "Failure preparing request") + return + } + + resp, err := client.ListTokensSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListTokens", resp, "Failure sending request") + return + } + + result, err = client.ListTokensResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListTokens", resp, "Failure responding to request") + return + } + + return +} + +// ListTokensPreparer prepares the ListTokens request. +func (client IngestionSettingsClient) ListTokensPreparer(ctx context.Context, ingestionSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ingestionSettingName": autorest.Encode("path", ingestionSettingName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListTokensSender sends the ListTokens request. The method will close the +// http.Response Body if it receives an error. +func (client IngestionSettingsClient) ListTokensSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListTokensResponder handles the response to the ListTokens request. The method always +// closes the http.Response Body. +func (client IngestionSettingsClient) ListTokensResponder(resp *http.Response) (result IngestionSettingToken, err error) { + err = autorest.Respond( + resp, + 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/models.go b/services/preview/security/mgmt/v1.0/security/models.go index ddd586e71223..30744224f6ab 100644 --- a/services/preview/security/mgmt/v1.0/security/models.go +++ b/services/preview/security/mgmt/v1.0/security/models.go @@ -40,7 +40,7 @@ type AadExternalSecuritySolution struct { // Location - READ-ONLY; Location where the resource is stored Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' - Kind KindEnum `json:"kind,omitempty"` + Kind KindEnum1 `json:"kind,omitempty"` } // MarshalJSON is the custom marshaler for AadExternalSecuritySolution. @@ -2551,7 +2551,7 @@ func (awg *AppWhitelistingGroup) UnmarshalJSON(body []byte) error { // AppWhitelistingGroupData represents a VM/server group and set of rules that are Recommended by Azure // Security Center to be allowed type AppWhitelistingGroupData struct { - // EnforcementMode - Possible values include: 'Audit', 'Enforce', 'None' + // EnforcementMode - Possible values include: 'EnforcementModeAudit', 'EnforcementModeEnforce', 'EnforcementModeNone' EnforcementMode EnforcementMode `json:"enforcementMode,omitempty"` ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` // ConfigurationStatus - Possible values include: 'ConfigurationStatus2Configured', 'ConfigurationStatus2NotConfigured', 'ConfigurationStatus2InProgress', 'ConfigurationStatus2Failed', 'ConfigurationStatus2NoStatus' @@ -2788,7 +2788,7 @@ type AtaExternalSecuritySolution struct { // Location - READ-ONLY; Location where the resource is stored Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' - Kind KindEnum `json:"kind,omitempty"` + Kind KindEnum1 `json:"kind,omitempty"` } // MarshalJSON is the custom marshaler for AtaExternalSecuritySolution. @@ -3662,7 +3662,7 @@ type AutomationScope struct { // - security alerts and security assessments. To learn more about the supported security events data // models schemas - please visit https://aka.ms/ASCAutomationSchemas. type AutomationSource struct { - // EventSource - A valid event source type. Possible values include: 'Assessments', 'SubAssessments', 'Alerts', 'SecureScores', 'SecureScoreControls' + // EventSource - A valid event source type. Possible values include: 'EventSourceAssessments', 'EventSourceSubAssessments', 'EventSourceAlerts', 'EventSourceSecureScores', 'EventSourceSecureScoresSnapshot', 'EventSourceSecureScoreControls', 'EventSourceSecureScoreControlsSnapshot', 'EventSourceRegulatoryComplianceAssessment', 'EventSourceRegulatoryComplianceAssessmentSnapshot' EventSource EventSource `json:"eventSource,omitempty"` // RuleSets - A set of rules which evaluate upon event interception. A logical disjunction is applied between defined rule sets (logical 'or'). RuleSets *[]AutomationRuleSet `json:"ruleSets,omitempty"` @@ -4165,7 +4165,7 @@ type CefExternalSecuritySolution struct { // Location - READ-ONLY; Location where the resource is stored Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' - Kind KindEnum `json:"kind,omitempty"` + Kind KindEnum1 `json:"kind,omitempty"` } // MarshalJSON is the custom marshaler for CefExternalSecuritySolution. @@ -4326,9 +4326,10 @@ func (csp *CefSolutionProperties) UnmarshalJSON(body []byte) error { return nil } -// CloudError error response structure. +// CloudError common error response for all Azure Resource Manager APIs to return error details for failed +// operations. (This also follows the OData error response format.). type CloudError struct { - // CloudErrorBody - Error data + // CloudErrorBody - The error object. *CloudErrorBody `json:"error,omitempty"` } @@ -4365,12 +4366,18 @@ func (ce *CloudError) UnmarshalJSON(body []byte) error { return nil } -// CloudErrorBody error details. +// CloudErrorBody the error detail. type CloudErrorBody struct { - // Code - READ-ONLY; An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + // Code - READ-ONLY; The error code. Code *string `json:"code,omitempty"` - // Message - READ-ONLY; A message describing the error, intended to be suitable for display in a user interface. + // Message - READ-ONLY; The error message. Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]CloudErrorBody `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` } // MarshalJSON is the custom marshaler for CloudErrorBody. @@ -4690,6 +4697,13 @@ type ConnectedWorkspace struct { ID *string `json:"id,omitempty"` } +// ConnectionStrings connection string for ingesting security data and logs +type ConnectionStrings struct { + autorest.Response `json:"-"` + // Value - Connection strings + Value *[]IngestionConnectionString `json:"value,omitempty"` +} + // ConnectionToIPNotAllowed outbound connection to an ip that isn't allowed. Allow list consists of ipv4 or // ipv6 range in CIDR notation. type ConnectionToIPNotAllowed struct { @@ -5829,18 +5843,19 @@ func (c CVSS) MarshalJSON() ([]byte, error) { type DataExportSetting struct { // DataExportSettingProperties - Data export setting data *DataExportSettingProperties `json:"properties,omitempty"` - // 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"` + // Kind - Possible values include: 'KindSetting', 'KindDataExportSetting' + Kind KindEnum `json:"kind,omitempty"` } // MarshalJSON is the custom marshaler for DataExportSetting. func (desVar DataExportSetting) MarshalJSON() ([]byte, error) { + desVar.Kind = KindDataExportSetting objectMap := make(map[string]interface{}) if desVar.DataExportSettingProperties != nil { objectMap["properties"] = desVar.DataExportSettingProperties @@ -5851,6 +5866,21 @@ func (desVar DataExportSetting) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// AsDataExportSetting is the BasicSetting implementation for DataExportSetting. +func (desVar DataExportSetting) AsDataExportSetting() (*DataExportSetting, bool) { + return &desVar, true +} + +// AsSetting is the BasicSetting implementation for DataExportSetting. +func (desVar DataExportSetting) AsSetting() (*Setting, bool) { + return nil, false +} + +// AsBasicSetting is the BasicSetting implementation for DataExportSetting. +func (desVar DataExportSetting) AsBasicSetting() (BasicSetting, bool) { + return &desVar, true +} + // UnmarshalJSON is the custom unmarshaler for DataExportSetting struct. func (desVar *DataExportSetting) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -5871,7 +5901,7 @@ func (desVar *DataExportSetting) UnmarshalJSON(body []byte) error { } case "kind": if v != nil { - var kind SettingKind + var kind KindEnum err = json.Unmarshal(*v, &kind) if err != nil { return err @@ -6862,6 +6892,20 @@ type EffectiveNetworkSecurityGroups struct { NetworkSecurityGroups *[]string `json:"networkSecurityGroups,omitempty"` } +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // ETag entity tag is used for comparing two or more entities from the same requested resource. type ETag struct { // Etag - Entity tag is used for comparing two or more entities from the same requested resource. @@ -6890,7 +6934,7 @@ type ExternalSecuritySolution struct { // Location - READ-ONLY; Location where the resource is stored Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' - Kind KindEnum `json:"kind,omitempty"` + Kind KindEnum1 `json:"kind,omitempty"` } func unmarshalBasicExternalSecuritySolution(body []byte) (BasicExternalSecuritySolution, error) { @@ -8664,6 +8708,222 @@ type InformationType struct { Keywords *[]InformationProtectionKeyword `json:"keywords,omitempty"` } +// IngestionConnectionString connection string for ingesting security data and logs +type IngestionConnectionString struct { + // Location - READ-ONLY; The region where ingested logs and data resides + Location *string `json:"location,omitempty"` + // Value - READ-ONLY; Connection string value + Value *string `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for IngestionConnectionString. +func (ics IngestionConnectionString) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// IngestionSetting configures how to correlate scan data and logs with resources associated with the +// subscription. +type IngestionSetting struct { + autorest.Response `json:"-"` + // Properties - Ingestion setting data + Properties interface{} `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 IngestionSetting. +func (is IngestionSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if is.Properties != nil { + objectMap["properties"] = is.Properties + } + return json.Marshal(objectMap) +} + +// IngestionSettingList list of ingestion settings +type IngestionSettingList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of ingestion settings + Value *[]IngestionSetting `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for IngestionSettingList. +func (isl IngestionSettingList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// IngestionSettingListIterator provides access to a complete listing of IngestionSetting values. +type IngestionSettingListIterator struct { + i int + page IngestionSettingListPage +} + +// 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 *IngestionSettingListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingListIterator.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 *IngestionSettingListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter IngestionSettingListIterator) 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 IngestionSettingListIterator) Response() IngestionSettingList { + 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 IngestionSettingListIterator) Value() IngestionSetting { + if !iter.page.NotDone() { + return IngestionSetting{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the IngestionSettingListIterator type. +func NewIngestionSettingListIterator(page IngestionSettingListPage) IngestionSettingListIterator { + return IngestionSettingListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (isl IngestionSettingList) IsEmpty() bool { + return isl.Value == nil || len(*isl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (isl IngestionSettingList) hasNextLink() bool { + return isl.NextLink != nil && len(*isl.NextLink) != 0 +} + +// ingestionSettingListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (isl IngestionSettingList) ingestionSettingListPreparer(ctx context.Context) (*http.Request, error) { + if !isl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(isl.NextLink))) +} + +// IngestionSettingListPage contains a page of IngestionSetting values. +type IngestionSettingListPage struct { + fn func(context.Context, IngestionSettingList) (IngestionSettingList, error) + isl IngestionSettingList +} + +// 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 *IngestionSettingListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.isl) + if err != nil { + return err + } + page.isl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + 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 *IngestionSettingListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page IngestionSettingListPage) NotDone() bool { + return !page.isl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page IngestionSettingListPage) Response() IngestionSettingList { + return page.isl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page IngestionSettingListPage) Values() []IngestionSetting { + if page.isl.IsEmpty() { + return nil + } + return *page.isl.Value +} + +// Creates a new instance of the IngestionSettingListPage type. +func NewIngestionSettingListPage(cur IngestionSettingList, getNextPage func(context.Context, IngestionSettingList) (IngestionSettingList, error)) IngestionSettingListPage { + return IngestionSettingListPage{ + fn: getNextPage, + isl: cur, + } +} + +// IngestionSettingToken configures how to correlate scan data and logs with resources associated with the +// subscription. +type IngestionSettingToken struct { + autorest.Response `json:"-"` + // Token - READ-ONLY; The token is used for correlating security data and logs with the resources in the subscription. + Token *string `json:"token,omitempty"` +} + +// MarshalJSON is the custom marshaler for IngestionSettingToken. +func (ist IngestionSettingToken) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // JitNetworkAccessPoliciesList ... type JitNetworkAccessPoliciesList struct { autorest.Response `json:"-"` @@ -13297,11 +13557,17 @@ type ServicePrincipalProperties struct { Secret *string `json:"secret,omitempty"` } -// Setting represents a security setting in Azure Security Center. +// BasicSetting the kind of the security setting +type BasicSetting interface { + AsDataExportSetting() (*DataExportSetting, bool) + AsSetting() (*Setting, bool) +} + +// Setting the kind of the security setting type Setting struct { autorest.Response `json:"-"` - // Kind - the kind of the settings string (DataExportSetting). Possible values include: 'SettingKindDataExportSetting', 'SettingKindAlertSuppressionSetting' - Kind SettingKind `json:"kind,omitempty"` + // Kind - Possible values include: 'KindSetting', 'KindDataExportSetting' + Kind KindEnum `json:"kind,omitempty"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name @@ -13310,8 +13576,46 @@ type Setting struct { Type *string `json:"type,omitempty"` } +func unmarshalBasicSetting(body []byte) (BasicSetting, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindDataExportSetting): + var desVar DataExportSetting + err := json.Unmarshal(body, &desVar) + return desVar, err + default: + var s Setting + err := json.Unmarshal(body, &s) + return s, err + } +} +func unmarshalBasicSettingArray(body []byte) ([]BasicSetting, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + sArray := make([]BasicSetting, len(rawMessages)) + + for index, rawMessage := range rawMessages { + s, err := unmarshalBasicSetting(*rawMessage) + if err != nil { + return nil, err + } + sArray[index] = s + } + return sArray, nil +} + // MarshalJSON is the custom marshaler for Setting. func (s Setting) MarshalJSON() ([]byte, error) { + s.Kind = KindSetting objectMap := make(map[string]interface{}) if s.Kind != "" { objectMap["kind"] = s.Kind @@ -13319,32 +13623,43 @@ func (s Setting) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// 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"` +// AsDataExportSetting is the BasicSetting implementation for Setting. +func (s Setting) AsDataExportSetting() (*DataExportSetting, bool) { + return nil, false } -// MarshalJSON is the custom marshaler for SettingResource. -func (sr SettingResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Kind != "" { - objectMap["kind"] = sr.Kind +// AsSetting is the BasicSetting implementation for Setting. +func (s Setting) AsSetting() (*Setting, bool) { + return &s, true +} + +// AsBasicSetting is the BasicSetting implementation for Setting. +func (s Setting) AsBasicSetting() (BasicSetting, bool) { + return &s, true +} + +// SettingModel ... +type SettingModel struct { + autorest.Response `json:"-"` + Value BasicSetting `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for SettingModel struct. +func (sm *SettingModel) UnmarshalJSON(body []byte) error { + s, err := unmarshalBasicSetting(body) + if err != nil { + return err } - return json.Marshal(objectMap) + sm.Value = s + + return nil } // SettingsList subscription settings list. type SettingsList struct { autorest.Response `json:"-"` // Value - The settings list. - Value *[]Setting `json:"value,omitempty"` + Value *[]BasicSetting `json:"value,omitempty"` // NextLink - READ-ONLY; The URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` } @@ -13358,6 +13673,38 @@ func (sl SettingsList) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// UnmarshalJSON is the custom unmarshaler for SettingsList struct. +func (sl *SettingsList) 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 "value": + if v != nil { + value, err := unmarshalBasicSettingArray(*v) + if err != nil { + return err + } + sl.Value = &value + } + case "nextLink": + if v != nil { + var nextLink string + err = json.Unmarshal(*v, &nextLink) + if err != nil { + return err + } + sl.NextLink = &nextLink + } + } + } + + return nil +} + // SettingsListIterator provides access to a complete listing of Setting values. type SettingsListIterator struct { i int @@ -13409,7 +13756,7 @@ func (iter SettingsListIterator) Response() SettingsList { // 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 SettingsListIterator) Value() BasicSetting { if !iter.page.NotDone() { return Setting{} } @@ -13443,7 +13790,7 @@ func (sl SettingsList) settingsListPreparer(ctx context.Context) (*http.Request, autorest.WithBaseURL(to.String(sl.NextLink))) } -// SettingsListPage contains a page of Setting values. +// SettingsListPage contains a page of BasicSetting values. type SettingsListPage struct { fn func(context.Context, SettingsList) (SettingsList, error) sl SettingsList @@ -13493,7 +13840,7 @@ func (page SettingsListPage) Response() SettingsList { } // Values returns the slice of values for the current page or nil if there are no values. -func (page SettingsListPage) Values() []Setting { +func (page SettingsListPage) Values() []BasicSetting { if page.sl.IsEmpty() { return nil } @@ -13508,6 +13855,268 @@ func NewSettingsListPage(cur SettingsList, getNextPage func(context.Context, Set } } +// Software represents a software data +type Software struct { + autorest.Response `json:"-"` + // SoftwareProperties - Properties of the Software Inventory resource + *SoftwareProperties `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 Software. +func (s Software) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.SoftwareProperties != nil { + objectMap["properties"] = s.SoftwareProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Software struct. +func (s *Software) 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 softwareProperties SoftwareProperties + err = json.Unmarshal(*v, &softwareProperties) + if err != nil { + return err + } + s.SoftwareProperties = &softwareProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + } + } + + return nil +} + +// SoftwareProperties software Inventory resource properties +type SoftwareProperties struct { + // DeviceID - Unique identifier for the virtual machine in the service. + DeviceID *string `json:"deviceId,omitempty"` + // OsPlatform - Platform of the operating system running on the device. + OsPlatform *string `json:"osPlatform,omitempty"` + // Vendor - Name of the software vendor. + Vendor *string `json:"vendor,omitempty"` + // SoftwareName - Name of the software product. + SoftwareName *string `json:"softwareName,omitempty"` + // Version - Version number of the software product. + Version *string `json:"version,omitempty"` + // EndOfSupportStatus - End of support status. Possible values include: 'None', 'NoLongerSupported', 'VersionNoLongerSupported', 'UpcomingNoLongerSupported', 'UpcomingVersionNoLongerSupported' + EndOfSupportStatus EndOfSupportStatus `json:"endOfSupportStatus,omitempty"` + // EndOfSupportDate - The end of support date in case the product is upcoming end of support. + EndOfSupportDate *string `json:"endOfSupportDate,omitempty"` + // NumberOfKnownVulnerabilities - Number of weaknesses. + NumberOfKnownVulnerabilities *int32 `json:"numberOfKnownVulnerabilities,omitempty"` + // FirstSeenAt - First time that the software was seen in the device. + FirstSeenAt *string `json:"firstSeenAt,omitempty"` +} + +// SoftwaresList represents the software inventory of the virtual machine. +type SoftwaresList struct { + autorest.Response `json:"-"` + Value *[]Software `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SoftwaresList. +func (sl SoftwaresList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sl.Value != nil { + objectMap["value"] = sl.Value + } + return json.Marshal(objectMap) +} + +// SoftwaresListIterator provides access to a complete listing of Software values. +type SoftwaresListIterator struct { + i int + page SoftwaresListPage +} + +// 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 *SoftwaresListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwaresListIterator.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 *SoftwaresListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SoftwaresListIterator) 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 SoftwaresListIterator) Response() SoftwaresList { + 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 SoftwaresListIterator) Value() Software { + if !iter.page.NotDone() { + return Software{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SoftwaresListIterator type. +func NewSoftwaresListIterator(page SoftwaresListPage) SoftwaresListIterator { + return SoftwaresListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sl SoftwaresList) IsEmpty() bool { + return sl.Value == nil || len(*sl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sl SoftwaresList) hasNextLink() bool { + return sl.NextLink != nil && len(*sl.NextLink) != 0 +} + +// softwaresListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sl SoftwaresList) softwaresListPreparer(ctx context.Context) (*http.Request, error) { + if !sl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sl.NextLink))) +} + +// SoftwaresListPage contains a page of Software values. +type SoftwaresListPage struct { + fn func(context.Context, SoftwaresList) (SoftwaresList, error) + sl SoftwaresList +} + +// 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 *SoftwaresListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwaresListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sl) + if err != nil { + return err + } + page.sl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + 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 *SoftwaresListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SoftwaresListPage) NotDone() bool { + return !page.sl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SoftwaresListPage) Response() SoftwaresList { + return page.sl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SoftwaresListPage) Values() []Software { + if page.sl.IsEmpty() { + return nil + } + return *page.sl.Value +} + +// Creates a new instance of the SoftwaresListPage type. +func NewSoftwaresListPage(cur SoftwaresList, getNextPage func(context.Context, SoftwaresList) (SoftwaresList, error)) SoftwaresListPage { + return SoftwaresListPage{ + fn: getNextPage, + sl: cur, + } +} + // 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 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 0088922aaf64..0f7b0824c728 100644 --- a/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go @@ -12,6 +12,17 @@ import ( "github.com/Azure/go-autorest/autorest" ) +// SoftwareInventoriesClientAPI contains the set of methods on the SoftwareInventoriesClient type. +type SoftwareInventoriesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, softwareName string) (result security.Software, err error) + ListByExtendedResource(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result security.SoftwaresListPage, err error) + ListByExtendedResourceComplete(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result security.SoftwaresListIterator, err error) + ListBySubscription(ctx context.Context) (result security.SoftwaresListPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result security.SoftwaresListIterator, err error) +} + +var _ SoftwareInventoriesClientAPI = (*security.SoftwareInventoriesClient)(nil) + // SQLVulnerabilityAssessmentScansClientAPI contains the set of methods on the SQLVulnerabilityAssessmentScansClient type. type SQLVulnerabilityAssessmentScansClientAPI interface { Get(ctx context.Context, scanID string, workspaceID string, APIVersion string, resourceID string) (result security.Scan, err error) @@ -209,10 +220,10 @@ var _ DeviceSecurityGroupsClientAPI = (*security.DeviceSecurityGroupsClient)(nil // SettingsClientAPI contains the set of methods on the SettingsClient type. type SettingsClientAPI interface { - Get(ctx context.Context, settingName string) (result security.Setting, err error) + Get(ctx context.Context, settingName string) (result security.SettingModel, err error) List(ctx context.Context) (result security.SettingsListPage, err error) ListComplete(ctx context.Context) (result security.SettingsListIterator, err error) - Update(ctx context.Context, settingName string, setting security.Setting) (result security.Setting, err error) + Update(ctx context.Context, settingName string, setting security.BasicSetting) (result security.SettingModel, err error) } var _ SettingsClientAPI = (*security.SettingsClient)(nil) @@ -372,3 +383,16 @@ type AlertsSuppressionRulesClientAPI interface { } var _ AlertsSuppressionRulesClientAPI = (*security.AlertsSuppressionRulesClient)(nil) + +// IngestionSettingsClientAPI contains the set of methods on the IngestionSettingsClient type. +type IngestionSettingsClientAPI interface { + Create(ctx context.Context, ingestionSettingName string, ingestionSetting security.IngestionSetting) (result security.IngestionSetting, err error) + Delete(ctx context.Context, ingestionSettingName string) (result autorest.Response, err error) + Get(ctx context.Context, ingestionSettingName string) (result security.IngestionSetting, err error) + List(ctx context.Context) (result security.IngestionSettingListPage, err error) + ListComplete(ctx context.Context) (result security.IngestionSettingListIterator, err error) + ListConnectionStrings(ctx context.Context, ingestionSettingName string) (result security.ConnectionStrings, err error) + ListTokens(ctx context.Context, ingestionSettingName string) (result security.IngestionSettingToken, err error) +} + +var _ IngestionSettingsClientAPI = (*security.IngestionSettingsClient)(nil) diff --git a/services/preview/security/mgmt/v1.0/security/settings.go b/services/preview/security/mgmt/v1.0/security/settings.go index 5d87a8857e37..224ec473bbcf 100644 --- a/services/preview/security/mgmt/v1.0/security/settings.go +++ b/services/preview/security/mgmt/v1.0/security/settings.go @@ -34,7 +34,7 @@ func NewSettingsClientWithBaseURI(baseURI string, subscriptionID string, ascLoca // Get settings of different configurations in security center // Parameters: // settingName - name of setting: (MCAS/WDATP) -func (client SettingsClient) Get(ctx context.Context, settingName string) (result Setting, err error) { +func (client SettingsClient) Get(ctx context.Context, settingName string) (result SettingModel, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/SettingsClient.Get") defer func() { @@ -101,7 +101,7 @@ func (client SettingsClient) GetSender(req *http.Request) (*http.Response, error // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client SettingsClient) GetResponder(resp *http.Response) (result Setting, err error) { +func (client SettingsClient) GetResponder(resp *http.Response) (result SettingModel, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -234,7 +234,7 @@ func (client SettingsClient) ListComplete(ctx context.Context) (result SettingsL // Parameters: // settingName - name of setting: (MCAS/WDATP) // setting - setting object -func (client SettingsClient) Update(ctx context.Context, settingName string, setting Setting) (result Setting, err error) { +func (client SettingsClient) Update(ctx context.Context, settingName string, setting BasicSetting) (result SettingModel, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/SettingsClient.Update") defer func() { @@ -274,7 +274,7 @@ func (client SettingsClient) Update(ctx context.Context, settingName string, set } // UpdatePreparer prepares the Update request. -func (client SettingsClient) UpdatePreparer(ctx context.Context, settingName string, setting Setting) (*http.Request, error) { +func (client SettingsClient) UpdatePreparer(ctx context.Context, settingName string, setting BasicSetting) (*http.Request, error) { pathParameters := map[string]interface{}{ "settingName": autorest.Encode("path", settingName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), @@ -303,7 +303,7 @@ func (client SettingsClient) UpdateSender(req *http.Request) (*http.Response, er // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. -func (client SettingsClient) UpdateResponder(resp *http.Response) (result Setting, err error) { +func (client SettingsClient) UpdateResponder(resp *http.Response) (result SettingModel, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), diff --git a/services/preview/security/mgmt/v1.0/security/softwareinventories.go b/services/preview/security/mgmt/v1.0/security/softwareinventories.go new file mode 100644 index 000000000000..d7e3b70fd39a --- /dev/null +++ b/services/preview/security/mgmt/v1.0/security/softwareinventories.go @@ -0,0 +1,378 @@ +package security + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "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" +) + +// SoftwareInventoriesClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type SoftwareInventoriesClient struct { + BaseClient +} + +// NewSoftwareInventoriesClient creates an instance of the SoftwareInventoriesClient client. +func NewSoftwareInventoriesClient(subscriptionID string, ascLocation string) SoftwareInventoriesClient { + return NewSoftwareInventoriesClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewSoftwareInventoriesClientWithBaseURI creates an instance of the SoftwareInventoriesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewSoftwareInventoriesClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) SoftwareInventoriesClient { + return SoftwareInventoriesClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// Get gets a single software data of the virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// resourceNamespace - the namespace of the resource. +// resourceType - the type of the resource. +// resourceName - name of the resource. +// softwareName - name of the installed software. +func (client SoftwareInventoriesClient) Get(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, softwareName string) (result Software, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareInventoriesClient.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.SoftwareInventoriesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceNamespace, resourceType, resourceName, softwareName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "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.SoftwareInventoriesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SoftwareInventoriesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, softwareName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceNamespace": autorest.Encode("path", resourceNamespace), + "resourceType": autorest.Encode("path", resourceType), + "softwareName": autorest.Encode("path", softwareName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-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/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName}", 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 SoftwareInventoriesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SoftwareInventoriesClient) GetResponder(resp *http.Response) (result Software, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByExtendedResource gets the software inventory of the virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// resourceNamespace - the namespace of the resource. +// resourceType - the type of the resource. +// resourceName - name of the resource. +func (client SoftwareInventoriesClient) ListByExtendedResource(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result SoftwaresListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareInventoriesClient.ListByExtendedResource") + defer func() { + sc := -1 + if result.sl.Response.Response != nil { + sc = result.sl.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.SoftwareInventoriesClient", "ListByExtendedResource", err.Error()) + } + + result.fn = client.listByExtendedResourceNextResults + req, err := client.ListByExtendedResourcePreparer(ctx, resourceGroupName, resourceNamespace, resourceType, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListByExtendedResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListByExtendedResourceSender(req) + if err != nil { + result.sl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListByExtendedResource", resp, "Failure sending request") + return + } + + result.sl, err = client.ListByExtendedResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListByExtendedResource", resp, "Failure responding to request") + return + } + if result.sl.hasNextLink() && result.sl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByExtendedResourcePreparer prepares the ListByExtendedResource request. +func (client SoftwareInventoriesClient) ListByExtendedResourcePreparer(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceNamespace": autorest.Encode("path", resourceNamespace), + "resourceType": autorest.Encode("path", resourceType), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-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/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByExtendedResourceSender sends the ListByExtendedResource request. The method will close the +// http.Response Body if it receives an error. +func (client SoftwareInventoriesClient) ListByExtendedResourceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByExtendedResourceResponder handles the response to the ListByExtendedResource request. The method always +// closes the http.Response Body. +func (client SoftwareInventoriesClient) ListByExtendedResourceResponder(resp *http.Response) (result SoftwaresList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByExtendedResourceNextResults retrieves the next set of results, if any. +func (client SoftwareInventoriesClient) listByExtendedResourceNextResults(ctx context.Context, lastResults SoftwaresList) (result SoftwaresList, err error) { + req, err := lastResults.softwaresListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "listByExtendedResourceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByExtendedResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "listByExtendedResourceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByExtendedResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "listByExtendedResourceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByExtendedResourceComplete enumerates all values, automatically crossing page boundaries as required. +func (client SoftwareInventoriesClient) ListByExtendedResourceComplete(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result SoftwaresListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareInventoriesClient.ListByExtendedResource") + 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.ListByExtendedResource(ctx, resourceGroupName, resourceNamespace, resourceType, resourceName) + return +} + +// ListBySubscription gets the software inventory of all virtual machines in the subscriptions. +func (client SoftwareInventoriesClient) ListBySubscription(ctx context.Context) (result SoftwaresListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareInventoriesClient.ListBySubscription") + defer func() { + sc := -1 + if result.sl.Response.Response != nil { + sc = result.sl.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.SoftwareInventoriesClient", "ListBySubscription", err.Error()) + } + + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.sl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.sl, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.sl.hasNextLink() && result.sl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client SoftwareInventoriesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-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/softwareInventories", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client SoftwareInventoriesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client SoftwareInventoriesClient) ListBySubscriptionResponder(resp *http.Response) (result SoftwaresList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client SoftwareInventoriesClient) listBySubscriptionNextResults(ctx context.Context, lastResults SoftwaresList) (result SoftwaresList, err error) { + req, err := lastResults.softwaresListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client SoftwareInventoriesClient) ListBySubscriptionComplete(ctx context.Context) (result SoftwaresListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareInventoriesClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} diff --git a/services/preview/security/mgmt/v2.0/security/CHANGELOG.md b/services/preview/security/mgmt/v2.0/security/CHANGELOG.md index 0ddd0317ce49..2d1d9a161eb5 100644 --- a/services/preview/security/mgmt/v2.0/security/CHANGELOG.md +++ b/services/preview/security/mgmt/v2.0/security/CHANGELOG.md @@ -1,41 +1,220 @@ -# Change History +# Unreleased + +## Breaking Changes + +### Removed Constants + +1. EnforcementMode.Audit +1. EnforcementMode.Enforce +1. EventSource.Alerts +1. EventSource.Assessments +1. EventSource.SecureScoreControls +1. EventSource.SecureScores +1. EventSource.SubAssessments +1. SettingKind.SettingKindAlertSuppressionSetting +1. SettingKind.SettingKindDataExportSetting + +### Removed Funcs + +1. PossibleSettingKindValues() []SettingKind +1. SettingResource.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### Removed Structs + +1. SettingResource + +### Signature Changes + +#### Const Types + +1. KindAAD changed type from KindEnum to KindEnum1 +1. KindATA changed type from KindEnum to KindEnum1 +1. KindCEF changed type from KindEnum to KindEnum1 +1. KindExternalSecuritySolution changed type from KindEnum to KindEnum1 +1. None changed type from EnforcementMode to EndOfSupportStatus + +#### Funcs + +1. SettingsClient.Get + - Returns + - From: Setting, error + - To: SettingModel, error +1. SettingsClient.GetResponder + - Returns + - From: Setting, error + - To: SettingModel, error +1. SettingsClient.Update + - Params + - From: context.Context, string, Setting + - To: context.Context, string, BasicSetting + - Returns + - From: Setting, error + - To: SettingModel, error +1. SettingsClient.UpdatePreparer + - Params + - From: context.Context, string, Setting + - To: context.Context, string, BasicSetting +1. SettingsClient.UpdateResponder + - Returns + - From: Setting, error + - To: SettingModel, error +1. SettingsListIterator.Value + - Returns + - From: Setting + - To: BasicSetting +1. SettingsListPage.Values + - Returns + - From: []Setting + - To: []BasicSetting + +#### Struct Fields + +1. AadExternalSecuritySolution.Kind changed type from KindEnum to KindEnum1 +1. AtaExternalSecuritySolution.Kind changed type from KindEnum to KindEnum1 +1. CefExternalSecuritySolution.Kind changed type from KindEnum to KindEnum1 +1. DataExportSetting.Kind changed type from SettingKind to KindEnum +1. ExternalSecuritySolution.Kind changed type from KindEnum to KindEnum1 +1. Setting.Kind changed type from SettingKind to KindEnum +1. SettingsList.Value changed type from *[]Setting to *[]BasicSetting ## Additive Changes +### New Constants + +1. EndOfSupportStatus.NoLongerSupported +1. EndOfSupportStatus.UpcomingNoLongerSupported +1. EndOfSupportStatus.UpcomingVersionNoLongerSupported +1. EndOfSupportStatus.VersionNoLongerSupported +1. EnforcementMode.EnforcementModeAudit +1. EnforcementMode.EnforcementModeEnforce +1. EnforcementMode.EnforcementModeNone +1. EventSource.EventSourceAlerts +1. EventSource.EventSourceAssessments +1. EventSource.EventSourceRegulatoryComplianceAssessment +1. EventSource.EventSourceRegulatoryComplianceAssessmentSnapshot +1. EventSource.EventSourceSecureScoreControls +1. EventSource.EventSourceSecureScoreControlsSnapshot +1. EventSource.EventSourceSecureScores +1. EventSource.EventSourceSecureScoresSnapshot +1. EventSource.EventSourceSubAssessments +1. KindEnum.KindDataExportSetting +1. KindEnum.KindSetting + ### New Funcs -1. AlertConfidenceReason.MarshalJSON() ([]byte, error) -1. AllowedConnectionsList.MarshalJSON() ([]byte, error) -1. AllowedConnectionsResourceProperties.MarshalJSON() ([]byte, error) -1. AscLocationList.MarshalJSON() ([]byte, error) -1. AzureResourceLink.MarshalJSON() ([]byte, error) -1. CVE.MarshalJSON() ([]byte, error) -1. CVSS.MarshalJSON() ([]byte, error) -1. CloudErrorBody.MarshalJSON() ([]byte, error) -1. ComplianceProperties.MarshalJSON() ([]byte, error) -1. ComplianceSegment.MarshalJSON() ([]byte, error) -1. ConnectableResource.MarshalJSON() ([]byte, error) -1. ConnectedResource.MarshalJSON() ([]byte, error) -1. ContactList.MarshalJSON() ([]byte, error) -1. IoTSecurityAggregatedAlertProperties.MarshalJSON() ([]byte, error) -1. IoTSecurityAlertedDevice.MarshalJSON() ([]byte, error) -1. IoTSecurityDeviceAlert.MarshalJSON() ([]byte, error) -1. IoTSecurityDeviceRecommendation.MarshalJSON() ([]byte, error) -1. Location.MarshalJSON() ([]byte, error) -1. OperationDisplay.MarshalJSON() ([]byte, error) -1. Resource.MarshalJSON() ([]byte, error) -1. ScoreDetails.MarshalJSON() ([]byte, error) -1. SecureScoreControlDefinitionItemProperties.MarshalJSON() ([]byte, error) -1. SecureScoreControlDefinitionList.MarshalJSON() ([]byte, error) -1. SecureScoreControlList.MarshalJSON() ([]byte, error) -1. SecureScoreControlScore.MarshalJSON() ([]byte, error) -1. SecureScoresList.MarshalJSON() ([]byte, error) -1. SubAssessmentList.MarshalJSON() ([]byte, error) -1. SubAssessmentStatus.MarshalJSON() ([]byte, error) -1. TaskList.MarshalJSON() ([]byte, error) -1. TopologyList.MarshalJSON() ([]byte, error) -1. TopologyResourceProperties.MarshalJSON() ([]byte, error) -1. TopologySingleResource.MarshalJSON() ([]byte, error) -1. TopologySingleResourceChild.MarshalJSON() ([]byte, error) -1. TopologySingleResourceParent.MarshalJSON() ([]byte, error) -1. VendorReference.MarshalJSON() ([]byte, error) +1. *IngestionSettingListIterator.Next() error +1. *IngestionSettingListIterator.NextWithContext(context.Context) error +1. *IngestionSettingListPage.Next() error +1. *IngestionSettingListPage.NextWithContext(context.Context) error +1. *SettingModel.UnmarshalJSON([]byte) error +1. *SettingsList.UnmarshalJSON([]byte) error +1. *Software.UnmarshalJSON([]byte) error +1. *SoftwaresListIterator.Next() error +1. *SoftwaresListIterator.NextWithContext(context.Context) error +1. *SoftwaresListPage.Next() error +1. *SoftwaresListPage.NextWithContext(context.Context) error +1. DataExportSetting.AsBasicSetting() (BasicSetting, bool) +1. DataExportSetting.AsDataExportSetting() (*DataExportSetting, bool) +1. DataExportSetting.AsSetting() (*Setting, bool) +1. ErrorAdditionalInfo.MarshalJSON() ([]byte, error) +1. IngestionConnectionString.MarshalJSON() ([]byte, error) +1. IngestionSetting.MarshalJSON() ([]byte, error) +1. IngestionSettingList.IsEmpty() bool +1. IngestionSettingList.MarshalJSON() ([]byte, error) +1. IngestionSettingListIterator.NotDone() bool +1. IngestionSettingListIterator.Response() IngestionSettingList +1. IngestionSettingListIterator.Value() IngestionSetting +1. IngestionSettingListPage.NotDone() bool +1. IngestionSettingListPage.Response() IngestionSettingList +1. IngestionSettingListPage.Values() []IngestionSetting +1. IngestionSettingToken.MarshalJSON() ([]byte, error) +1. IngestionSettingsClient.Create(context.Context, string, IngestionSetting) (IngestionSetting, error) +1. IngestionSettingsClient.CreatePreparer(context.Context, string, IngestionSetting) (*http.Request, error) +1. IngestionSettingsClient.CreateResponder(*http.Response) (IngestionSetting, error) +1. IngestionSettingsClient.CreateSender(*http.Request) (*http.Response, error) +1. IngestionSettingsClient.Delete(context.Context, string) (autorest.Response, error) +1. IngestionSettingsClient.DeletePreparer(context.Context, string) (*http.Request, error) +1. IngestionSettingsClient.DeleteResponder(*http.Response) (autorest.Response, error) +1. IngestionSettingsClient.DeleteSender(*http.Request) (*http.Response, error) +1. IngestionSettingsClient.Get(context.Context, string) (IngestionSetting, error) +1. IngestionSettingsClient.GetPreparer(context.Context, string) (*http.Request, error) +1. IngestionSettingsClient.GetResponder(*http.Response) (IngestionSetting, error) +1. IngestionSettingsClient.GetSender(*http.Request) (*http.Response, error) +1. IngestionSettingsClient.List(context.Context) (IngestionSettingListPage, error) +1. IngestionSettingsClient.ListComplete(context.Context) (IngestionSettingListIterator, error) +1. IngestionSettingsClient.ListConnectionStrings(context.Context, string) (ConnectionStrings, error) +1. IngestionSettingsClient.ListConnectionStringsPreparer(context.Context, string) (*http.Request, error) +1. IngestionSettingsClient.ListConnectionStringsResponder(*http.Response) (ConnectionStrings, error) +1. IngestionSettingsClient.ListConnectionStringsSender(*http.Request) (*http.Response, error) +1. IngestionSettingsClient.ListPreparer(context.Context) (*http.Request, error) +1. IngestionSettingsClient.ListResponder(*http.Response) (IngestionSettingList, error) +1. IngestionSettingsClient.ListSender(*http.Request) (*http.Response, error) +1. IngestionSettingsClient.ListTokens(context.Context, string) (IngestionSettingToken, error) +1. IngestionSettingsClient.ListTokensPreparer(context.Context, string) (*http.Request, error) +1. IngestionSettingsClient.ListTokensResponder(*http.Response) (IngestionSettingToken, error) +1. IngestionSettingsClient.ListTokensSender(*http.Request) (*http.Response, error) +1. NewIngestionSettingListIterator(IngestionSettingListPage) IngestionSettingListIterator +1. NewIngestionSettingListPage(IngestionSettingList, func(context.Context, IngestionSettingList) (IngestionSettingList, error)) IngestionSettingListPage +1. NewIngestionSettingsClient(string, string) IngestionSettingsClient +1. NewIngestionSettingsClientWithBaseURI(string, string, string) IngestionSettingsClient +1. NewSoftwareInventoriesClient(string, string) SoftwareInventoriesClient +1. NewSoftwareInventoriesClientWithBaseURI(string, string, string) SoftwareInventoriesClient +1. NewSoftwaresListIterator(SoftwaresListPage) SoftwaresListIterator +1. NewSoftwaresListPage(SoftwaresList, func(context.Context, SoftwaresList) (SoftwaresList, error)) SoftwaresListPage +1. PossibleEndOfSupportStatusValues() []EndOfSupportStatus +1. PossibleKindEnum1Values() []KindEnum1 +1. Setting.AsBasicSetting() (BasicSetting, bool) +1. Setting.AsDataExportSetting() (*DataExportSetting, bool) +1. Setting.AsSetting() (*Setting, bool) +1. Software.MarshalJSON() ([]byte, error) +1. SoftwareInventoriesClient.Get(context.Context, string, string, string, string, string) (Software, error) +1. SoftwareInventoriesClient.GetPreparer(context.Context, string, string, string, string, string) (*http.Request, error) +1. SoftwareInventoriesClient.GetResponder(*http.Response) (Software, error) +1. SoftwareInventoriesClient.GetSender(*http.Request) (*http.Response, error) +1. SoftwareInventoriesClient.ListByExtendedResource(context.Context, string, string, string, string) (SoftwaresListPage, error) +1. SoftwareInventoriesClient.ListByExtendedResourceComplete(context.Context, string, string, string, string) (SoftwaresListIterator, error) +1. SoftwareInventoriesClient.ListByExtendedResourcePreparer(context.Context, string, string, string, string) (*http.Request, error) +1. SoftwareInventoriesClient.ListByExtendedResourceResponder(*http.Response) (SoftwaresList, error) +1. SoftwareInventoriesClient.ListByExtendedResourceSender(*http.Request) (*http.Response, error) +1. SoftwareInventoriesClient.ListBySubscription(context.Context) (SoftwaresListPage, error) +1. SoftwareInventoriesClient.ListBySubscriptionComplete(context.Context) (SoftwaresListIterator, error) +1. SoftwareInventoriesClient.ListBySubscriptionPreparer(context.Context) (*http.Request, error) +1. SoftwareInventoriesClient.ListBySubscriptionResponder(*http.Response) (SoftwaresList, error) +1. SoftwareInventoriesClient.ListBySubscriptionSender(*http.Request) (*http.Response, error) +1. SoftwaresList.IsEmpty() bool +1. SoftwaresList.MarshalJSON() ([]byte, error) +1. SoftwaresListIterator.NotDone() bool +1. SoftwaresListIterator.Response() SoftwaresList +1. SoftwaresListIterator.Value() Software +1. SoftwaresListPage.NotDone() bool +1. SoftwaresListPage.Response() SoftwaresList +1. SoftwaresListPage.Values() []Software + +### Struct Changes + +#### New Structs + +1. ConnectionStrings +1. ErrorAdditionalInfo +1. IngestionConnectionString +1. IngestionSetting +1. IngestionSettingList +1. IngestionSettingListIterator +1. IngestionSettingListPage +1. IngestionSettingToken +1. IngestionSettingsClient +1. SettingModel +1. Software +1. SoftwareInventoriesClient +1. SoftwareProperties +1. SoftwaresList +1. SoftwaresListIterator +1. SoftwaresListPage + +#### New Struct Fields + +1. CloudErrorBody.AdditionalInfo +1. CloudErrorBody.Details +1. CloudErrorBody.Target diff --git a/services/preview/security/mgmt/v2.0/security/_meta.json b/services/preview/security/mgmt/v2.0/security/_meta.json index ea159a9416c6..aa799886fcb6 100644 --- a/services/preview/security/mgmt/v2.0/security/_meta.json +++ b/services/preview/security/mgmt/v2.0/security/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "34342af98a9330b5629dd4d034bd82d1d848e9c0", "readme": "/_/azure-rest-api-specs/specification/security/resource-manager/readme.md", "tag": "package-composite-v2", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/preview/security/mgmt/v2.0/security/enums.go b/services/preview/security/mgmt/v2.0/security/enums.go index 8d0b7725faa7..ce4fc1b88c3a 100644 --- a/services/preview/security/mgmt/v2.0/security/enums.go +++ b/services/preview/security/mgmt/v2.0/security/enums.go @@ -282,21 +282,42 @@ func PossibleDirectionValues() []Direction { return []Direction{Inbound, Outbound} } +// EndOfSupportStatus enumerates the values for end of support status. +type EndOfSupportStatus string + +const ( + // NoLongerSupported ... + NoLongerSupported EndOfSupportStatus = "noLongerSupported" + // None ... + None EndOfSupportStatus = "None" + // UpcomingNoLongerSupported ... + UpcomingNoLongerSupported EndOfSupportStatus = "upcomingNoLongerSupported" + // UpcomingVersionNoLongerSupported ... + UpcomingVersionNoLongerSupported EndOfSupportStatus = "upcomingVersionNoLongerSupported" + // VersionNoLongerSupported ... + VersionNoLongerSupported EndOfSupportStatus = "versionNoLongerSupported" +) + +// PossibleEndOfSupportStatusValues returns an array of possible values for the EndOfSupportStatus const type. +func PossibleEndOfSupportStatusValues() []EndOfSupportStatus { + return []EndOfSupportStatus{NoLongerSupported, None, UpcomingNoLongerSupported, UpcomingVersionNoLongerSupported, VersionNoLongerSupported} +} + // EnforcementMode enumerates the values for enforcement mode. type EnforcementMode string const ( - // Audit ... - Audit EnforcementMode = "Audit" - // Enforce ... - Enforce EnforcementMode = "Enforce" - // None ... - None EnforcementMode = "None" + // EnforcementModeAudit ... + EnforcementModeAudit EnforcementMode = "Audit" + // EnforcementModeEnforce ... + EnforcementModeEnforce EnforcementMode = "Enforce" + // EnforcementModeNone ... + EnforcementModeNone EnforcementMode = "None" ) // PossibleEnforcementModeValues returns an array of possible values for the EnforcementMode const type. func PossibleEnforcementModeValues() []EnforcementMode { - return []EnforcementMode{Audit, Enforce, None} + return []EnforcementMode{EnforcementModeAudit, EnforcementModeEnforce, EnforcementModeNone} } // EnforcementMode1 enumerates the values for enforcement mode 1. @@ -337,21 +358,29 @@ func PossibleEnforcementSupportValues() []EnforcementSupport { type EventSource string const ( - // Alerts ... - Alerts EventSource = "Alerts" - // Assessments ... - Assessments EventSource = "Assessments" - // SecureScoreControls ... - SecureScoreControls EventSource = "SecureScoreControls" - // SecureScores ... - SecureScores EventSource = "SecureScores" - // SubAssessments ... - SubAssessments EventSource = "SubAssessments" + // EventSourceAlerts ... + EventSourceAlerts EventSource = "Alerts" + // EventSourceAssessments ... + EventSourceAssessments EventSource = "Assessments" + // EventSourceRegulatoryComplianceAssessment ... + EventSourceRegulatoryComplianceAssessment EventSource = "RegulatoryComplianceAssessment" + // EventSourceRegulatoryComplianceAssessmentSnapshot ... + EventSourceRegulatoryComplianceAssessmentSnapshot EventSource = "RegulatoryComplianceAssessmentSnapshot" + // EventSourceSecureScoreControls ... + EventSourceSecureScoreControls EventSource = "SecureScoreControls" + // EventSourceSecureScoreControlsSnapshot ... + EventSourceSecureScoreControlsSnapshot EventSource = "SecureScoreControlsSnapshot" + // EventSourceSecureScores ... + EventSourceSecureScores EventSource = "SecureScores" + // EventSourceSecureScoresSnapshot ... + EventSourceSecureScoresSnapshot EventSource = "SecureScoresSnapshot" + // EventSourceSubAssessments ... + EventSourceSubAssessments EventSource = "SubAssessments" ) // PossibleEventSourceValues returns an array of possible values for the EventSource const type. func PossibleEventSourceValues() []EventSource { - return []EventSource{Alerts, Assessments, SecureScoreControls, SecureScores, SubAssessments} + return []EventSource{EventSourceAlerts, EventSourceAssessments, EventSourceRegulatoryComplianceAssessment, EventSourceRegulatoryComplianceAssessmentSnapshot, EventSourceSecureScoreControls, EventSourceSecureScoreControlsSnapshot, EventSourceSecureScores, EventSourceSecureScoresSnapshot, EventSourceSubAssessments} } // Exe enumerates the values for exe. @@ -516,20 +545,35 @@ func PossibleIssueValues() []Issue { // KindEnum enumerates the values for kind enum. type KindEnum string +const ( + // KindDataExportSetting ... + KindDataExportSetting KindEnum = "DataExportSetting" + // KindSetting ... + KindSetting KindEnum = "Setting" +) + +// PossibleKindEnumValues returns an array of possible values for the KindEnum const type. +func PossibleKindEnumValues() []KindEnum { + return []KindEnum{KindDataExportSetting, KindSetting} +} + +// KindEnum1 enumerates the values for kind enum 1. +type KindEnum1 string + const ( // KindAAD ... - KindAAD KindEnum = "AAD" + KindAAD KindEnum1 = "AAD" // KindATA ... - KindATA KindEnum = "ATA" + KindATA KindEnum1 = "ATA" // KindCEF ... - KindCEF KindEnum = "CEF" + KindCEF KindEnum1 = "CEF" // KindExternalSecuritySolution ... - KindExternalSecuritySolution KindEnum = "ExternalSecuritySolution" + KindExternalSecuritySolution KindEnum1 = "ExternalSecuritySolution" ) -// PossibleKindEnumValues returns an array of possible values for the KindEnum const type. -func PossibleKindEnumValues() []KindEnum { - return []KindEnum{KindAAD, KindATA, KindCEF, KindExternalSecuritySolution} +// PossibleKindEnum1Values returns an array of possible values for the KindEnum1 const type. +func PossibleKindEnum1Values() []KindEnum1 { + return []KindEnum1{KindAAD, KindATA, KindCEF, KindExternalSecuritySolution} } // Msi enumerates the values for msi. @@ -553,23 +597,23 @@ func PossibleMsiValues() []Msi { type Operator string const ( - // Contains ... + // Contains Applies only for non-decimal operands Contains Operator = "Contains" - // EndsWith ... + // EndsWith Applies only for non-decimal operands EndsWith Operator = "EndsWith" - // Equals ... + // Equals Applies for decimal and non-decimal operands Equals Operator = "Equals" - // GreaterThan ... + // GreaterThan Applies only for decimal operands GreaterThan Operator = "GreaterThan" - // GreaterThanOrEqualTo ... + // GreaterThanOrEqualTo Applies only for decimal operands GreaterThanOrEqualTo Operator = "GreaterThanOrEqualTo" - // LesserThan ... + // LesserThan Applies only for decimal operands LesserThan Operator = "LesserThan" - // LesserThanOrEqualTo ... + // LesserThanOrEqualTo Applies only for decimal operands LesserThanOrEqualTo Operator = "LesserThanOrEqualTo" - // NotEquals ... + // NotEquals Applies for decimal and non-decimal operands NotEquals Operator = "NotEquals" - // StartsWith ... + // StartsWith Applies only for non-decimal operands StartsWith Operator = "StartsWith" ) @@ -998,21 +1042,6 @@ func PossibleScriptValues() []Script { return []Script{ScriptAudit, ScriptEnforce, ScriptNone} } -// SettingKind enumerates the values for setting kind. -type SettingKind string - -const ( - // SettingKindAlertSuppressionSetting ... - SettingKindAlertSuppressionSetting SettingKind = "AlertSuppressionSetting" - // SettingKindDataExportSetting ... - SettingKindDataExportSetting SettingKind = "DataExportSetting" -) - -// PossibleSettingKindValues returns an array of possible values for the SettingKind const type. -func PossibleSettingKindValues() []SettingKind { - return []SettingKind{SettingKindAlertSuppressionSetting, SettingKindDataExportSetting} -} - // Severity enumerates the values for severity. type Severity string diff --git a/services/preview/security/mgmt/v2.0/security/ingestionsettings.go b/services/preview/security/mgmt/v2.0/security/ingestionsettings.go new file mode 100644 index 000000000000..b5f7ce03a686 --- /dev/null +++ b/services/preview/security/mgmt/v2.0/security/ingestionsettings.go @@ -0,0 +1,555 @@ +package security + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "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" +) + +// IngestionSettingsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type IngestionSettingsClient struct { + BaseClient +} + +// NewIngestionSettingsClient creates an instance of the IngestionSettingsClient client. +func NewIngestionSettingsClient(subscriptionID string, ascLocation string) IngestionSettingsClient { + return NewIngestionSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewIngestionSettingsClientWithBaseURI creates an instance of the IngestionSettingsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewIngestionSettingsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IngestionSettingsClient { + return IngestionSettingsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// Create create setting for ingesting security data and logs to correlate with resources associated with the +// subscription. +// Parameters: +// ingestionSettingName - name of the ingestion setting +// ingestionSetting - ingestion setting object +func (client IngestionSettingsClient) Create(ctx context.Context, ingestionSettingName string, ingestionSetting IngestionSetting) (result IngestionSetting, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.Create") + 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}}}}); err != nil { + return result, validation.NewError("security.IngestionSettingsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, ingestionSettingName, ingestionSetting) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client IngestionSettingsClient) CreatePreparer(ctx context.Context, ingestionSettingName string, ingestionSetting IngestionSetting) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ingestionSettingName": autorest.Encode("path", ingestionSettingName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-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}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}", pathParameters), + autorest.WithJSON(ingestionSetting), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client IngestionSettingsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client IngestionSettingsClient) CreateResponder(resp *http.Response) (result IngestionSetting, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the ingestion settings for this subscription. +// Parameters: +// ingestionSettingName - name of the ingestion setting +func (client IngestionSettingsClient) Delete(ctx context.Context, ingestionSettingName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.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}}}}); err != nil { + return result, validation.NewError("security.IngestionSettingsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, ingestionSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client IngestionSettingsClient) DeletePreparer(ctx context.Context, ingestionSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ingestionSettingName": autorest.Encode("path", ingestionSettingName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}", 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 IngestionSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client IngestionSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get settings for ingesting security data and logs to correlate with resources associated with the subscription. +// Parameters: +// ingestionSettingName - name of the ingestion setting +func (client IngestionSettingsClient) Get(ctx context.Context, ingestionSettingName string) (result IngestionSetting, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.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}}}}); err != nil { + return result, validation.NewError("security.IngestionSettingsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, ingestionSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "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.IngestionSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client IngestionSettingsClient) GetPreparer(ctx context.Context, ingestionSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ingestionSettingName": autorest.Encode("path", ingestionSettingName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}", 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 IngestionSettingsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client IngestionSettingsClient) GetResponder(resp *http.Response) (result IngestionSetting, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List settings for ingesting security data and logs to correlate with resources associated with the subscription. +func (client IngestionSettingsClient) List(ctx context.Context) (result IngestionSettingListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.List") + defer func() { + sc := -1 + if result.isl.Response.Response != nil { + sc = result.isl.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.IngestionSettingsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.isl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "List", resp, "Failure sending request") + return + } + + result.isl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "List", resp, "Failure responding to request") + return + } + if result.isl.hasNextLink() && result.isl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client IngestionSettingsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings", 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 IngestionSettingsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client IngestionSettingsClient) ListResponder(resp *http.Response) (result IngestionSettingList, err error) { + err = autorest.Respond( + resp, + 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 IngestionSettingsClient) listNextResults(ctx context.Context, lastResults IngestionSettingList) (result IngestionSettingList, err error) { + req, err := lastResults.ingestionSettingListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "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.IngestionSettingsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client IngestionSettingsClient) ListComplete(ctx context.Context) (result IngestionSettingListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.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 +} + +// ListConnectionStrings connection strings for ingesting security scan logs and data. +// Parameters: +// ingestionSettingName - name of the ingestion setting +func (client IngestionSettingsClient) ListConnectionStrings(ctx context.Context, ingestionSettingName string) (result ConnectionStrings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.ListConnectionStrings") + 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}}}}); err != nil { + return result, validation.NewError("security.IngestionSettingsClient", "ListConnectionStrings", err.Error()) + } + + req, err := client.ListConnectionStringsPreparer(ctx, ingestionSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListConnectionStrings", nil, "Failure preparing request") + return + } + + resp, err := client.ListConnectionStringsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListConnectionStrings", resp, "Failure sending request") + return + } + + result, err = client.ListConnectionStringsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListConnectionStrings", resp, "Failure responding to request") + return + } + + return +} + +// ListConnectionStringsPreparer prepares the ListConnectionStrings request. +func (client IngestionSettingsClient) ListConnectionStringsPreparer(ctx context.Context, ingestionSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ingestionSettingName": autorest.Encode("path", ingestionSettingName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListConnectionStringsSender sends the ListConnectionStrings request. The method will close the +// http.Response Body if it receives an error. +func (client IngestionSettingsClient) ListConnectionStringsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListConnectionStringsResponder handles the response to the ListConnectionStrings request. The method always +// closes the http.Response Body. +func (client IngestionSettingsClient) ListConnectionStringsResponder(resp *http.Response) (result ConnectionStrings, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListTokens returns the token that is used for correlating ingested telemetry with the resources in the subscription. +// Parameters: +// ingestionSettingName - name of the ingestion setting +func (client IngestionSettingsClient) ListTokens(ctx context.Context, ingestionSettingName string) (result IngestionSettingToken, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.ListTokens") + 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}}}}); err != nil { + return result, validation.NewError("security.IngestionSettingsClient", "ListTokens", err.Error()) + } + + req, err := client.ListTokensPreparer(ctx, ingestionSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListTokens", nil, "Failure preparing request") + return + } + + resp, err := client.ListTokensSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListTokens", resp, "Failure sending request") + return + } + + result, err = client.ListTokensResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListTokens", resp, "Failure responding to request") + return + } + + return +} + +// ListTokensPreparer prepares the ListTokens request. +func (client IngestionSettingsClient) ListTokensPreparer(ctx context.Context, ingestionSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ingestionSettingName": autorest.Encode("path", ingestionSettingName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListTokensSender sends the ListTokens request. The method will close the +// http.Response Body if it receives an error. +func (client IngestionSettingsClient) ListTokensSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListTokensResponder handles the response to the ListTokens request. The method always +// closes the http.Response Body. +func (client IngestionSettingsClient) ListTokensResponder(resp *http.Response) (result IngestionSettingToken, err error) { + err = autorest.Respond( + resp, + 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/models.go b/services/preview/security/mgmt/v2.0/security/models.go index 3e3bc607845d..d26d34f7f797 100644 --- a/services/preview/security/mgmt/v2.0/security/models.go +++ b/services/preview/security/mgmt/v2.0/security/models.go @@ -40,7 +40,7 @@ type AadExternalSecuritySolution struct { // Location - READ-ONLY; Location where the resource is stored Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' - Kind KindEnum `json:"kind,omitempty"` + Kind KindEnum1 `json:"kind,omitempty"` } // MarshalJSON is the custom marshaler for AadExternalSecuritySolution. @@ -2551,7 +2551,7 @@ func (awg *AppWhitelistingGroup) UnmarshalJSON(body []byte) error { // AppWhitelistingGroupData represents a VM/server group and set of rules that are Recommended by Azure // Security Center to be allowed type AppWhitelistingGroupData struct { - // EnforcementMode - Possible values include: 'Audit', 'Enforce', 'None' + // EnforcementMode - Possible values include: 'EnforcementModeAudit', 'EnforcementModeEnforce', 'EnforcementModeNone' EnforcementMode EnforcementMode `json:"enforcementMode,omitempty"` ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` // ConfigurationStatus - Possible values include: 'ConfigurationStatus2Configured', 'ConfigurationStatus2NotConfigured', 'ConfigurationStatus2InProgress', 'ConfigurationStatus2Failed', 'ConfigurationStatus2NoStatus' @@ -2788,7 +2788,7 @@ type AtaExternalSecuritySolution struct { // Location - READ-ONLY; Location where the resource is stored Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' - Kind KindEnum `json:"kind,omitempty"` + Kind KindEnum1 `json:"kind,omitempty"` } // MarshalJSON is the custom marshaler for AtaExternalSecuritySolution. @@ -3662,7 +3662,7 @@ type AutomationScope struct { // - security alerts and security assessments. To learn more about the supported security events data // models schemas - please visit https://aka.ms/ASCAutomationSchemas. type AutomationSource struct { - // EventSource - A valid event source type. Possible values include: 'Assessments', 'SubAssessments', 'Alerts', 'SecureScores', 'SecureScoreControls' + // EventSource - A valid event source type. Possible values include: 'EventSourceAssessments', 'EventSourceSubAssessments', 'EventSourceAlerts', 'EventSourceSecureScores', 'EventSourceSecureScoresSnapshot', 'EventSourceSecureScoreControls', 'EventSourceSecureScoreControlsSnapshot', 'EventSourceRegulatoryComplianceAssessment', 'EventSourceRegulatoryComplianceAssessmentSnapshot' EventSource EventSource `json:"eventSource,omitempty"` // RuleSets - A set of rules which evaluate upon event interception. A logical disjunction is applied between defined rule sets (logical 'or'). RuleSets *[]AutomationRuleSet `json:"ruleSets,omitempty"` @@ -4165,7 +4165,7 @@ type CefExternalSecuritySolution struct { // Location - READ-ONLY; Location where the resource is stored Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' - Kind KindEnum `json:"kind,omitempty"` + Kind KindEnum1 `json:"kind,omitempty"` } // MarshalJSON is the custom marshaler for CefExternalSecuritySolution. @@ -4326,9 +4326,10 @@ func (csp *CefSolutionProperties) UnmarshalJSON(body []byte) error { return nil } -// CloudError error response structure. +// CloudError common error response for all Azure Resource Manager APIs to return error details for failed +// operations. (This also follows the OData error response format.). type CloudError struct { - // CloudErrorBody - Error data + // CloudErrorBody - The error object. *CloudErrorBody `json:"error,omitempty"` } @@ -4365,12 +4366,18 @@ func (ce *CloudError) UnmarshalJSON(body []byte) error { return nil } -// CloudErrorBody error details. +// CloudErrorBody the error detail. type CloudErrorBody struct { - // Code - READ-ONLY; An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + // Code - READ-ONLY; The error code. Code *string `json:"code,omitempty"` - // Message - READ-ONLY; A message describing the error, intended to be suitable for display in a user interface. + // Message - READ-ONLY; The error message. Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]CloudErrorBody `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` } // MarshalJSON is the custom marshaler for CloudErrorBody. @@ -4690,6 +4697,13 @@ type ConnectedWorkspace struct { ID *string `json:"id,omitempty"` } +// ConnectionStrings connection string for ingesting security data and logs +type ConnectionStrings struct { + autorest.Response `json:"-"` + // Value - Connection strings + Value *[]IngestionConnectionString `json:"value,omitempty"` +} + // ConnectionToIPNotAllowed outbound connection to an ip that isn't allowed. Allow list consists of ipv4 or // ipv6 range in CIDR notation. type ConnectionToIPNotAllowed struct { @@ -5829,18 +5843,19 @@ func (c CVSS) MarshalJSON() ([]byte, error) { type DataExportSetting struct { // DataExportSettingProperties - Data export setting data *DataExportSettingProperties `json:"properties,omitempty"` - // 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"` + // Kind - Possible values include: 'KindSetting', 'KindDataExportSetting' + Kind KindEnum `json:"kind,omitempty"` } // MarshalJSON is the custom marshaler for DataExportSetting. func (desVar DataExportSetting) MarshalJSON() ([]byte, error) { + desVar.Kind = KindDataExportSetting objectMap := make(map[string]interface{}) if desVar.DataExportSettingProperties != nil { objectMap["properties"] = desVar.DataExportSettingProperties @@ -5851,6 +5866,21 @@ func (desVar DataExportSetting) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// AsDataExportSetting is the BasicSetting implementation for DataExportSetting. +func (desVar DataExportSetting) AsDataExportSetting() (*DataExportSetting, bool) { + return &desVar, true +} + +// AsSetting is the BasicSetting implementation for DataExportSetting. +func (desVar DataExportSetting) AsSetting() (*Setting, bool) { + return nil, false +} + +// AsBasicSetting is the BasicSetting implementation for DataExportSetting. +func (desVar DataExportSetting) AsBasicSetting() (BasicSetting, bool) { + return &desVar, true +} + // UnmarshalJSON is the custom unmarshaler for DataExportSetting struct. func (desVar *DataExportSetting) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage @@ -5871,7 +5901,7 @@ func (desVar *DataExportSetting) UnmarshalJSON(body []byte) error { } case "kind": if v != nil { - var kind SettingKind + var kind KindEnum err = json.Unmarshal(*v, &kind) if err != nil { return err @@ -6862,6 +6892,20 @@ type EffectiveNetworkSecurityGroups struct { NetworkSecurityGroups *[]string `json:"networkSecurityGroups,omitempty"` } +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // ETag entity tag is used for comparing two or more entities from the same requested resource. type ETag struct { // Etag - Entity tag is used for comparing two or more entities from the same requested resource. @@ -6890,7 +6934,7 @@ type ExternalSecuritySolution struct { // Location - READ-ONLY; Location where the resource is stored Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' - Kind KindEnum `json:"kind,omitempty"` + Kind KindEnum1 `json:"kind,omitempty"` } func unmarshalBasicExternalSecuritySolution(body []byte) (BasicExternalSecuritySolution, error) { @@ -8664,6 +8708,222 @@ type InformationType struct { Keywords *[]InformationProtectionKeyword `json:"keywords,omitempty"` } +// IngestionConnectionString connection string for ingesting security data and logs +type IngestionConnectionString struct { + // Location - READ-ONLY; The region where ingested logs and data resides + Location *string `json:"location,omitempty"` + // Value - READ-ONLY; Connection string value + Value *string `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for IngestionConnectionString. +func (ics IngestionConnectionString) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// IngestionSetting configures how to correlate scan data and logs with resources associated with the +// subscription. +type IngestionSetting struct { + autorest.Response `json:"-"` + // Properties - Ingestion setting data + Properties interface{} `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 IngestionSetting. +func (is IngestionSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if is.Properties != nil { + objectMap["properties"] = is.Properties + } + return json.Marshal(objectMap) +} + +// IngestionSettingList list of ingestion settings +type IngestionSettingList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of ingestion settings + Value *[]IngestionSetting `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for IngestionSettingList. +func (isl IngestionSettingList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// IngestionSettingListIterator provides access to a complete listing of IngestionSetting values. +type IngestionSettingListIterator struct { + i int + page IngestionSettingListPage +} + +// 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 *IngestionSettingListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingListIterator.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 *IngestionSettingListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter IngestionSettingListIterator) 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 IngestionSettingListIterator) Response() IngestionSettingList { + 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 IngestionSettingListIterator) Value() IngestionSetting { + if !iter.page.NotDone() { + return IngestionSetting{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the IngestionSettingListIterator type. +func NewIngestionSettingListIterator(page IngestionSettingListPage) IngestionSettingListIterator { + return IngestionSettingListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (isl IngestionSettingList) IsEmpty() bool { + return isl.Value == nil || len(*isl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (isl IngestionSettingList) hasNextLink() bool { + return isl.NextLink != nil && len(*isl.NextLink) != 0 +} + +// ingestionSettingListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (isl IngestionSettingList) ingestionSettingListPreparer(ctx context.Context) (*http.Request, error) { + if !isl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(isl.NextLink))) +} + +// IngestionSettingListPage contains a page of IngestionSetting values. +type IngestionSettingListPage struct { + fn func(context.Context, IngestionSettingList) (IngestionSettingList, error) + isl IngestionSettingList +} + +// 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 *IngestionSettingListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.isl) + if err != nil { + return err + } + page.isl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + 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 *IngestionSettingListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page IngestionSettingListPage) NotDone() bool { + return !page.isl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page IngestionSettingListPage) Response() IngestionSettingList { + return page.isl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page IngestionSettingListPage) Values() []IngestionSetting { + if page.isl.IsEmpty() { + return nil + } + return *page.isl.Value +} + +// Creates a new instance of the IngestionSettingListPage type. +func NewIngestionSettingListPage(cur IngestionSettingList, getNextPage func(context.Context, IngestionSettingList) (IngestionSettingList, error)) IngestionSettingListPage { + return IngestionSettingListPage{ + fn: getNextPage, + isl: cur, + } +} + +// IngestionSettingToken configures how to correlate scan data and logs with resources associated with the +// subscription. +type IngestionSettingToken struct { + autorest.Response `json:"-"` + // Token - READ-ONLY; The token is used for correlating security data and logs with the resources in the subscription. + Token *string `json:"token,omitempty"` +} + +// MarshalJSON is the custom marshaler for IngestionSettingToken. +func (ist IngestionSettingToken) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // IoTSecurityAggregatedAlert security Solution Aggregated Alert information type IoTSecurityAggregatedAlert struct { autorest.Response `json:"-"` @@ -14311,11 +14571,17 @@ type ServicePrincipalProperties struct { Secret *string `json:"secret,omitempty"` } -// Setting represents a security setting in Azure Security Center. +// BasicSetting the kind of the security setting +type BasicSetting interface { + AsDataExportSetting() (*DataExportSetting, bool) + AsSetting() (*Setting, bool) +} + +// Setting the kind of the security setting type Setting struct { autorest.Response `json:"-"` - // Kind - the kind of the settings string (DataExportSetting). Possible values include: 'SettingKindDataExportSetting', 'SettingKindAlertSuppressionSetting' - Kind SettingKind `json:"kind,omitempty"` + // Kind - Possible values include: 'KindSetting', 'KindDataExportSetting' + Kind KindEnum `json:"kind,omitempty"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name @@ -14324,8 +14590,46 @@ type Setting struct { Type *string `json:"type,omitempty"` } +func unmarshalBasicSetting(body []byte) (BasicSetting, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindDataExportSetting): + var desVar DataExportSetting + err := json.Unmarshal(body, &desVar) + return desVar, err + default: + var s Setting + err := json.Unmarshal(body, &s) + return s, err + } +} +func unmarshalBasicSettingArray(body []byte) ([]BasicSetting, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + sArray := make([]BasicSetting, len(rawMessages)) + + for index, rawMessage := range rawMessages { + s, err := unmarshalBasicSetting(*rawMessage) + if err != nil { + return nil, err + } + sArray[index] = s + } + return sArray, nil +} + // MarshalJSON is the custom marshaler for Setting. func (s Setting) MarshalJSON() ([]byte, error) { + s.Kind = KindSetting objectMap := make(map[string]interface{}) if s.Kind != "" { objectMap["kind"] = s.Kind @@ -14333,32 +14637,43 @@ func (s Setting) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// 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"` +// AsDataExportSetting is the BasicSetting implementation for Setting. +func (s Setting) AsDataExportSetting() (*DataExportSetting, bool) { + return nil, false } -// MarshalJSON is the custom marshaler for SettingResource. -func (sr SettingResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sr.Kind != "" { - objectMap["kind"] = sr.Kind +// AsSetting is the BasicSetting implementation for Setting. +func (s Setting) AsSetting() (*Setting, bool) { + return &s, true +} + +// AsBasicSetting is the BasicSetting implementation for Setting. +func (s Setting) AsBasicSetting() (BasicSetting, bool) { + return &s, true +} + +// SettingModel ... +type SettingModel struct { + autorest.Response `json:"-"` + Value BasicSetting `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for SettingModel struct. +func (sm *SettingModel) UnmarshalJSON(body []byte) error { + s, err := unmarshalBasicSetting(body) + if err != nil { + return err } - return json.Marshal(objectMap) + sm.Value = s + + return nil } // SettingsList subscription settings list. type SettingsList struct { autorest.Response `json:"-"` // Value - The settings list. - Value *[]Setting `json:"value,omitempty"` + Value *[]BasicSetting `json:"value,omitempty"` // NextLink - READ-ONLY; The URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` } @@ -14372,6 +14687,38 @@ func (sl SettingsList) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// UnmarshalJSON is the custom unmarshaler for SettingsList struct. +func (sl *SettingsList) 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 "value": + if v != nil { + value, err := unmarshalBasicSettingArray(*v) + if err != nil { + return err + } + sl.Value = &value + } + case "nextLink": + if v != nil { + var nextLink string + err = json.Unmarshal(*v, &nextLink) + if err != nil { + return err + } + sl.NextLink = &nextLink + } + } + } + + return nil +} + // SettingsListIterator provides access to a complete listing of Setting values. type SettingsListIterator struct { i int @@ -14423,7 +14770,7 @@ func (iter SettingsListIterator) Response() SettingsList { // 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 SettingsListIterator) Value() BasicSetting { if !iter.page.NotDone() { return Setting{} } @@ -14457,7 +14804,7 @@ func (sl SettingsList) settingsListPreparer(ctx context.Context) (*http.Request, autorest.WithBaseURL(to.String(sl.NextLink))) } -// SettingsListPage contains a page of Setting values. +// SettingsListPage contains a page of BasicSetting values. type SettingsListPage struct { fn func(context.Context, SettingsList) (SettingsList, error) sl SettingsList @@ -14507,7 +14854,7 @@ func (page SettingsListPage) Response() SettingsList { } // Values returns the slice of values for the current page or nil if there are no values. -func (page SettingsListPage) Values() []Setting { +func (page SettingsListPage) Values() []BasicSetting { if page.sl.IsEmpty() { return nil } @@ -14522,6 +14869,268 @@ func NewSettingsListPage(cur SettingsList, getNextPage func(context.Context, Set } } +// Software represents a software data +type Software struct { + autorest.Response `json:"-"` + // SoftwareProperties - Properties of the Software Inventory resource + *SoftwareProperties `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 Software. +func (s Software) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.SoftwareProperties != nil { + objectMap["properties"] = s.SoftwareProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Software struct. +func (s *Software) 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 softwareProperties SoftwareProperties + err = json.Unmarshal(*v, &softwareProperties) + if err != nil { + return err + } + s.SoftwareProperties = &softwareProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + } + } + + return nil +} + +// SoftwareProperties software Inventory resource properties +type SoftwareProperties struct { + // DeviceID - Unique identifier for the virtual machine in the service. + DeviceID *string `json:"deviceId,omitempty"` + // OsPlatform - Platform of the operating system running on the device. + OsPlatform *string `json:"osPlatform,omitempty"` + // Vendor - Name of the software vendor. + Vendor *string `json:"vendor,omitempty"` + // SoftwareName - Name of the software product. + SoftwareName *string `json:"softwareName,omitempty"` + // Version - Version number of the software product. + Version *string `json:"version,omitempty"` + // EndOfSupportStatus - End of support status. Possible values include: 'None', 'NoLongerSupported', 'VersionNoLongerSupported', 'UpcomingNoLongerSupported', 'UpcomingVersionNoLongerSupported' + EndOfSupportStatus EndOfSupportStatus `json:"endOfSupportStatus,omitempty"` + // EndOfSupportDate - The end of support date in case the product is upcoming end of support. + EndOfSupportDate *string `json:"endOfSupportDate,omitempty"` + // NumberOfKnownVulnerabilities - Number of weaknesses. + NumberOfKnownVulnerabilities *int32 `json:"numberOfKnownVulnerabilities,omitempty"` + // FirstSeenAt - First time that the software was seen in the device. + FirstSeenAt *string `json:"firstSeenAt,omitempty"` +} + +// SoftwaresList represents the software inventory of the virtual machine. +type SoftwaresList struct { + autorest.Response `json:"-"` + Value *[]Software `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SoftwaresList. +func (sl SoftwaresList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sl.Value != nil { + objectMap["value"] = sl.Value + } + return json.Marshal(objectMap) +} + +// SoftwaresListIterator provides access to a complete listing of Software values. +type SoftwaresListIterator struct { + i int + page SoftwaresListPage +} + +// 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 *SoftwaresListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwaresListIterator.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 *SoftwaresListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SoftwaresListIterator) 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 SoftwaresListIterator) Response() SoftwaresList { + 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 SoftwaresListIterator) Value() Software { + if !iter.page.NotDone() { + return Software{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SoftwaresListIterator type. +func NewSoftwaresListIterator(page SoftwaresListPage) SoftwaresListIterator { + return SoftwaresListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sl SoftwaresList) IsEmpty() bool { + return sl.Value == nil || len(*sl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sl SoftwaresList) hasNextLink() bool { + return sl.NextLink != nil && len(*sl.NextLink) != 0 +} + +// softwaresListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sl SoftwaresList) softwaresListPreparer(ctx context.Context) (*http.Request, error) { + if !sl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sl.NextLink))) +} + +// SoftwaresListPage contains a page of Software values. +type SoftwaresListPage struct { + fn func(context.Context, SoftwaresList) (SoftwaresList, error) + sl SoftwaresList +} + +// 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 *SoftwaresListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwaresListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sl) + if err != nil { + return err + } + page.sl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + 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 *SoftwaresListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SoftwaresListPage) NotDone() bool { + return !page.sl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SoftwaresListPage) Response() SoftwaresList { + return page.sl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SoftwaresListPage) Values() []Software { + if page.sl.IsEmpty() { + return nil + } + return *page.sl.Value +} + +// Creates a new instance of the SoftwaresListPage type. +func NewSoftwaresListPage(cur SoftwaresList, getNextPage func(context.Context, SoftwaresList) (SoftwaresList, error)) SoftwaresListPage { + return SoftwaresListPage{ + fn: getNextPage, + sl: cur, + } +} + // 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 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 5f0989fa73eb..05c14309cea9 100644 --- a/services/preview/security/mgmt/v2.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v2.0/security/securityapi/interfaces.go @@ -12,6 +12,17 @@ import ( "github.com/Azure/go-autorest/autorest" ) +// SoftwareInventoriesClientAPI contains the set of methods on the SoftwareInventoriesClient type. +type SoftwareInventoriesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, softwareName string) (result security.Software, err error) + ListByExtendedResource(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result security.SoftwaresListPage, err error) + ListByExtendedResourceComplete(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result security.SoftwaresListIterator, err error) + ListBySubscription(ctx context.Context) (result security.SoftwaresListPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result security.SoftwaresListIterator, err error) +} + +var _ SoftwareInventoriesClientAPI = (*security.SoftwareInventoriesClient)(nil) + // SQLVulnerabilityAssessmentScansClientAPI contains the set of methods on the SQLVulnerabilityAssessmentScansClient type. type SQLVulnerabilityAssessmentScansClientAPI interface { Get(ctx context.Context, scanID string, workspaceID string, APIVersion string, resourceID string) (result security.Scan, err error) @@ -204,10 +215,10 @@ var _ DeviceSecurityGroupsClientAPI = (*security.DeviceSecurityGroupsClient)(nil // SettingsClientAPI contains the set of methods on the SettingsClient type. type SettingsClientAPI interface { - Get(ctx context.Context, settingName string) (result security.Setting, err error) + Get(ctx context.Context, settingName string) (result security.SettingModel, err error) List(ctx context.Context) (result security.SettingsListPage, err error) ListComplete(ctx context.Context) (result security.SettingsListIterator, err error) - Update(ctx context.Context, settingName string, setting security.Setting) (result security.Setting, err error) + Update(ctx context.Context, settingName string, setting security.BasicSetting) (result security.SettingModel, err error) } var _ SettingsClientAPI = (*security.SettingsClient)(nil) @@ -432,3 +443,16 @@ type AlertsSuppressionRulesClientAPI interface { } var _ AlertsSuppressionRulesClientAPI = (*security.AlertsSuppressionRulesClient)(nil) + +// IngestionSettingsClientAPI contains the set of methods on the IngestionSettingsClient type. +type IngestionSettingsClientAPI interface { + Create(ctx context.Context, ingestionSettingName string, ingestionSetting security.IngestionSetting) (result security.IngestionSetting, err error) + Delete(ctx context.Context, ingestionSettingName string) (result autorest.Response, err error) + Get(ctx context.Context, ingestionSettingName string) (result security.IngestionSetting, err error) + List(ctx context.Context) (result security.IngestionSettingListPage, err error) + ListComplete(ctx context.Context) (result security.IngestionSettingListIterator, err error) + ListConnectionStrings(ctx context.Context, ingestionSettingName string) (result security.ConnectionStrings, err error) + ListTokens(ctx context.Context, ingestionSettingName string) (result security.IngestionSettingToken, err error) +} + +var _ IngestionSettingsClientAPI = (*security.IngestionSettingsClient)(nil) diff --git a/services/preview/security/mgmt/v2.0/security/settings.go b/services/preview/security/mgmt/v2.0/security/settings.go index 5d87a8857e37..224ec473bbcf 100644 --- a/services/preview/security/mgmt/v2.0/security/settings.go +++ b/services/preview/security/mgmt/v2.0/security/settings.go @@ -34,7 +34,7 @@ func NewSettingsClientWithBaseURI(baseURI string, subscriptionID string, ascLoca // Get settings of different configurations in security center // Parameters: // settingName - name of setting: (MCAS/WDATP) -func (client SettingsClient) Get(ctx context.Context, settingName string) (result Setting, err error) { +func (client SettingsClient) Get(ctx context.Context, settingName string) (result SettingModel, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/SettingsClient.Get") defer func() { @@ -101,7 +101,7 @@ func (client SettingsClient) GetSender(req *http.Request) (*http.Response, error // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client SettingsClient) GetResponder(resp *http.Response) (result Setting, err error) { +func (client SettingsClient) GetResponder(resp *http.Response) (result SettingModel, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -234,7 +234,7 @@ func (client SettingsClient) ListComplete(ctx context.Context) (result SettingsL // Parameters: // settingName - name of setting: (MCAS/WDATP) // setting - setting object -func (client SettingsClient) Update(ctx context.Context, settingName string, setting Setting) (result Setting, err error) { +func (client SettingsClient) Update(ctx context.Context, settingName string, setting BasicSetting) (result SettingModel, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/SettingsClient.Update") defer func() { @@ -274,7 +274,7 @@ func (client SettingsClient) Update(ctx context.Context, settingName string, set } // UpdatePreparer prepares the Update request. -func (client SettingsClient) UpdatePreparer(ctx context.Context, settingName string, setting Setting) (*http.Request, error) { +func (client SettingsClient) UpdatePreparer(ctx context.Context, settingName string, setting BasicSetting) (*http.Request, error) { pathParameters := map[string]interface{}{ "settingName": autorest.Encode("path", settingName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), @@ -303,7 +303,7 @@ func (client SettingsClient) UpdateSender(req *http.Request) (*http.Response, er // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. -func (client SettingsClient) UpdateResponder(resp *http.Response) (result Setting, err error) { +func (client SettingsClient) UpdateResponder(resp *http.Response) (result SettingModel, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), diff --git a/services/preview/security/mgmt/v2.0/security/softwareinventories.go b/services/preview/security/mgmt/v2.0/security/softwareinventories.go new file mode 100644 index 000000000000..d7e3b70fd39a --- /dev/null +++ b/services/preview/security/mgmt/v2.0/security/softwareinventories.go @@ -0,0 +1,378 @@ +package security + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "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" +) + +// SoftwareInventoriesClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type SoftwareInventoriesClient struct { + BaseClient +} + +// NewSoftwareInventoriesClient creates an instance of the SoftwareInventoriesClient client. +func NewSoftwareInventoriesClient(subscriptionID string, ascLocation string) SoftwareInventoriesClient { + return NewSoftwareInventoriesClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewSoftwareInventoriesClientWithBaseURI creates an instance of the SoftwareInventoriesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewSoftwareInventoriesClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) SoftwareInventoriesClient { + return SoftwareInventoriesClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// Get gets a single software data of the virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// resourceNamespace - the namespace of the resource. +// resourceType - the type of the resource. +// resourceName - name of the resource. +// softwareName - name of the installed software. +func (client SoftwareInventoriesClient) Get(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, softwareName string) (result Software, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareInventoriesClient.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.SoftwareInventoriesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceNamespace, resourceType, resourceName, softwareName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "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.SoftwareInventoriesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SoftwareInventoriesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, softwareName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceNamespace": autorest.Encode("path", resourceNamespace), + "resourceType": autorest.Encode("path", resourceType), + "softwareName": autorest.Encode("path", softwareName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-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/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName}", 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 SoftwareInventoriesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SoftwareInventoriesClient) GetResponder(resp *http.Response) (result Software, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByExtendedResource gets the software inventory of the virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// resourceNamespace - the namespace of the resource. +// resourceType - the type of the resource. +// resourceName - name of the resource. +func (client SoftwareInventoriesClient) ListByExtendedResource(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result SoftwaresListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareInventoriesClient.ListByExtendedResource") + defer func() { + sc := -1 + if result.sl.Response.Response != nil { + sc = result.sl.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.SoftwareInventoriesClient", "ListByExtendedResource", err.Error()) + } + + result.fn = client.listByExtendedResourceNextResults + req, err := client.ListByExtendedResourcePreparer(ctx, resourceGroupName, resourceNamespace, resourceType, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListByExtendedResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListByExtendedResourceSender(req) + if err != nil { + result.sl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListByExtendedResource", resp, "Failure sending request") + return + } + + result.sl, err = client.ListByExtendedResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListByExtendedResource", resp, "Failure responding to request") + return + } + if result.sl.hasNextLink() && result.sl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByExtendedResourcePreparer prepares the ListByExtendedResource request. +func (client SoftwareInventoriesClient) ListByExtendedResourcePreparer(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceNamespace": autorest.Encode("path", resourceNamespace), + "resourceType": autorest.Encode("path", resourceType), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-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/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByExtendedResourceSender sends the ListByExtendedResource request. The method will close the +// http.Response Body if it receives an error. +func (client SoftwareInventoriesClient) ListByExtendedResourceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByExtendedResourceResponder handles the response to the ListByExtendedResource request. The method always +// closes the http.Response Body. +func (client SoftwareInventoriesClient) ListByExtendedResourceResponder(resp *http.Response) (result SoftwaresList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByExtendedResourceNextResults retrieves the next set of results, if any. +func (client SoftwareInventoriesClient) listByExtendedResourceNextResults(ctx context.Context, lastResults SoftwaresList) (result SoftwaresList, err error) { + req, err := lastResults.softwaresListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "listByExtendedResourceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByExtendedResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "listByExtendedResourceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByExtendedResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "listByExtendedResourceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByExtendedResourceComplete enumerates all values, automatically crossing page boundaries as required. +func (client SoftwareInventoriesClient) ListByExtendedResourceComplete(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result SoftwaresListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareInventoriesClient.ListByExtendedResource") + 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.ListByExtendedResource(ctx, resourceGroupName, resourceNamespace, resourceType, resourceName) + return +} + +// ListBySubscription gets the software inventory of all virtual machines in the subscriptions. +func (client SoftwareInventoriesClient) ListBySubscription(ctx context.Context) (result SoftwaresListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareInventoriesClient.ListBySubscription") + defer func() { + sc := -1 + if result.sl.Response.Response != nil { + sc = result.sl.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.SoftwareInventoriesClient", "ListBySubscription", err.Error()) + } + + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.sl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.sl, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.sl.hasNextLink() && result.sl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client SoftwareInventoriesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-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/softwareInventories", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client SoftwareInventoriesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client SoftwareInventoriesClient) ListBySubscriptionResponder(resp *http.Response) (result SoftwaresList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client SoftwareInventoriesClient) listBySubscriptionNextResults(ctx context.Context, lastResults SoftwaresList) (result SoftwaresList, err error) { + req, err := lastResults.softwaresListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client SoftwareInventoriesClient) ListBySubscriptionComplete(ctx context.Context) (result SoftwaresListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareInventoriesClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} diff --git a/services/preview/security/mgmt/v3.0/security/CHANGELOG.md b/services/preview/security/mgmt/v3.0/security/CHANGELOG.md index aa3fea66c4aa..c374e893ae28 100644 --- a/services/preview/security/mgmt/v3.0/security/CHANGELOG.md +++ b/services/preview/security/mgmt/v3.0/security/CHANGELOG.md @@ -1,562 +1,58 @@ -# Change History +# Unreleased ## Breaking Changes -### Removed Constants - -1. EnforcementMode.Audit -1. EnforcementMode.Enforce -1. EventSource.Assessments -1. EventSource.SecureScoreControls -1. EventSource.SecureScores -1. EventSource.SubAssessments - -### Removed Funcs - -1. *IotAlert.UnmarshalJSON([]byte) error -1. *IotAlertListIterator.Next() error -1. *IotAlertListIterator.NextWithContext(context.Context) error -1. *IotAlertListPage.Next() error -1. *IotAlertListPage.NextWithContext(context.Context) error -1. *IotRecommendation.UnmarshalJSON([]byte) error -1. *IotRecommendationListIterator.Next() error -1. *IotRecommendationListIterator.NextWithContext(context.Context) error -1. *IotRecommendationListPage.Next() error -1. *IotRecommendationListPage.NextWithContext(context.Context) error -1. AlertsClient.GetResourceGroupLevelAlerts(context.Context, string, string) (Alert, error) -1. AlertsClient.GetResourceGroupLevelAlertsPreparer(context.Context, string, string) (*http.Request, error) -1. AlertsClient.GetResourceGroupLevelAlertsResponder(*http.Response) (Alert, error) -1. AlertsClient.GetResourceGroupLevelAlertsSender(*http.Request) (*http.Response, error) -1. AlertsClient.GetSubscriptionLevelAlert(context.Context, string) (Alert, error) -1. AlertsClient.GetSubscriptionLevelAlertPreparer(context.Context, string) (*http.Request, error) -1. AlertsClient.GetSubscriptionLevelAlertResponder(*http.Response) (Alert, error) -1. AlertsClient.GetSubscriptionLevelAlertSender(*http.Request) (*http.Response, error) -1. AlertsClient.ListResourceGroupLevelAlertsByRegion(context.Context, string) (AlertListPage, error) -1. AlertsClient.ListResourceGroupLevelAlertsByRegionComplete(context.Context, string) (AlertListIterator, error) -1. AlertsClient.ListResourceGroupLevelAlertsByRegionPreparer(context.Context, string) (*http.Request, error) -1. AlertsClient.ListResourceGroupLevelAlertsByRegionResponder(*http.Response) (AlertList, error) -1. AlertsClient.ListResourceGroupLevelAlertsByRegionSender(*http.Request) (*http.Response, error) -1. AlertsClient.ListSubscriptionLevelAlertsByRegion(context.Context) (AlertListPage, error) -1. AlertsClient.ListSubscriptionLevelAlertsByRegionComplete(context.Context) (AlertListIterator, error) -1. AlertsClient.ListSubscriptionLevelAlertsByRegionPreparer(context.Context) (*http.Request, error) -1. AlertsClient.ListSubscriptionLevelAlertsByRegionResponder(*http.Response) (AlertList, error) -1. AlertsClient.ListSubscriptionLevelAlertsByRegionSender(*http.Request) (*http.Response, error) -1. AlertsClient.UpdateResourceGroupLevelAlertStateToDismiss(context.Context, string, string) (autorest.Response, error) -1. AlertsClient.UpdateResourceGroupLevelAlertStateToDismissPreparer(context.Context, string, string) (*http.Request, error) -1. AlertsClient.UpdateResourceGroupLevelAlertStateToDismissResponder(*http.Response) (autorest.Response, error) -1. AlertsClient.UpdateResourceGroupLevelAlertStateToDismissSender(*http.Request) (*http.Response, error) -1. AlertsClient.UpdateResourceGroupLevelAlertStateToReactivate(context.Context, string, string) (autorest.Response, error) -1. AlertsClient.UpdateResourceGroupLevelAlertStateToReactivatePreparer(context.Context, string, string) (*http.Request, error) -1. AlertsClient.UpdateResourceGroupLevelAlertStateToReactivateResponder(*http.Response) (autorest.Response, error) -1. AlertsClient.UpdateResourceGroupLevelAlertStateToReactivateSender(*http.Request) (*http.Response, error) -1. AlertsClient.UpdateSubscriptionLevelAlertStateToDismiss(context.Context, string) (autorest.Response, error) -1. AlertsClient.UpdateSubscriptionLevelAlertStateToDismissPreparer(context.Context, string) (*http.Request, error) -1. AlertsClient.UpdateSubscriptionLevelAlertStateToDismissResponder(*http.Response) (autorest.Response, error) -1. AlertsClient.UpdateSubscriptionLevelAlertStateToDismissSender(*http.Request) (*http.Response, error) -1. AlertsClient.UpdateSubscriptionLevelAlertStateToReactivate(context.Context, string) (autorest.Response, error) -1. AlertsClient.UpdateSubscriptionLevelAlertStateToReactivatePreparer(context.Context, string) (*http.Request, error) -1. AlertsClient.UpdateSubscriptionLevelAlertStateToReactivateResponder(*http.Response) (autorest.Response, error) -1. AlertsClient.UpdateSubscriptionLevelAlertStateToReactivateSender(*http.Request) (*http.Response, error) -1. IotAlert.MarshalJSON() ([]byte, error) -1. IotAlertList.IsEmpty() bool -1. IotAlertList.MarshalJSON() ([]byte, error) -1. IotAlertListIterator.NotDone() bool -1. IotAlertListIterator.Response() IotAlertList -1. IotAlertListIterator.Value() IotAlert -1. IotAlertListPage.NotDone() bool -1. IotAlertListPage.Response() IotAlertList -1. IotAlertListPage.Values() []IotAlert -1. IotAlertProperties.MarshalJSON() ([]byte, error) -1. IotAlertTypesClient.Get1(context.Context, string) (IotAlertType, error) -1. IotAlertTypesClient.Get1Preparer(context.Context, string) (*http.Request, error) -1. IotAlertTypesClient.Get1Responder(*http.Response) (IotAlertType, error) -1. IotAlertTypesClient.Get1Sender(*http.Request) (*http.Response, error) -1. IotAlertTypesClient.List1(context.Context) (IotAlertTypeList, error) -1. IotAlertTypesClient.List1Preparer(context.Context) (*http.Request, error) -1. IotAlertTypesClient.List1Responder(*http.Response) (IotAlertTypeList, error) -1. IotAlertTypesClient.List1Sender(*http.Request) (*http.Response, error) -1. IotAlertsClient.Get1(context.Context, string, string) (IotAlertModel, error) -1. IotAlertsClient.Get1Preparer(context.Context, string, string) (*http.Request, error) -1. IotAlertsClient.Get1Responder(*http.Response) (IotAlertModel, error) -1. IotAlertsClient.Get1Sender(*http.Request) (*http.Response, error) -1. IotAlertsClient.List1(context.Context, string, string, string, string, ManagementState, string, *int32, string) (IotAlertListModelPage, error) -1. IotAlertsClient.List1Complete(context.Context, string, string, string, string, ManagementState, string, *int32, string) (IotAlertListModelIterator, error) -1. IotAlertsClient.List1Preparer(context.Context, string, string, string, string, ManagementState, string, *int32, string) (*http.Request, error) -1. IotAlertsClient.List1Responder(*http.Response) (IotAlertListModel, error) -1. IotAlertsClient.List1Sender(*http.Request) (*http.Response, error) -1. IotRecommendation.MarshalJSON() ([]byte, error) -1. IotRecommendationList.IsEmpty() bool -1. IotRecommendationList.MarshalJSON() ([]byte, error) -1. IotRecommendationListIterator.NotDone() bool -1. IotRecommendationListIterator.Response() IotRecommendationList -1. IotRecommendationListIterator.Value() IotRecommendation -1. IotRecommendationListPage.NotDone() bool -1. IotRecommendationListPage.Response() IotRecommendationList -1. IotRecommendationListPage.Values() []IotRecommendation -1. IotRecommendationProperties.MarshalJSON() ([]byte, error) -1. IotRecommendationTypesClient.Get1(context.Context, string) (IotRecommendationType, error) -1. IotRecommendationTypesClient.Get1Preparer(context.Context, string) (*http.Request, error) -1. IotRecommendationTypesClient.Get1Responder(*http.Response) (IotRecommendationType, error) -1. IotRecommendationTypesClient.Get1Sender(*http.Request) (*http.Response, error) -1. IotRecommendationTypesClient.List1(context.Context) (IotRecommendationTypeList, error) -1. IotRecommendationTypesClient.List1Preparer(context.Context) (*http.Request, error) -1. IotRecommendationTypesClient.List1Responder(*http.Response) (IotRecommendationTypeList, error) -1. IotRecommendationTypesClient.List1Sender(*http.Request) (*http.Response, error) -1. IotRecommendationsClient.Get1(context.Context, string, string) (IotRecommendationModel, error) -1. IotRecommendationsClient.Get1Preparer(context.Context, string, string) (*http.Request, error) -1. IotRecommendationsClient.Get1Responder(*http.Response) (IotRecommendationModel, error) -1. IotRecommendationsClient.Get1Sender(*http.Request) (*http.Response, error) -1. IotRecommendationsClient.List1(context.Context, string, string, string, *int32, string) (IotRecommendationListModelPage, error) -1. IotRecommendationsClient.List1Complete(context.Context, string, string, string, *int32, string) (IotRecommendationListModelIterator, error) -1. IotRecommendationsClient.List1Preparer(context.Context, string, string, string, *int32, string) (*http.Request, error) -1. IotRecommendationsClient.List1Responder(*http.Response) (IotRecommendationListModel, error) -1. IotRecommendationsClient.List1Sender(*http.Request) (*http.Response, error) -1. NewIotAlertListIterator(IotAlertListPage) IotAlertListIterator -1. NewIotAlertListPage(IotAlertList, func(context.Context, IotAlertList) (IotAlertList, error)) IotAlertListPage -1. NewIotRecommendationListIterator(IotRecommendationListPage) IotRecommendationListIterator -1. NewIotRecommendationListPage(IotRecommendationList, func(context.Context, IotRecommendationList) (IotRecommendationList, error)) IotRecommendationListPage -1. PossibleCategoryValues() []Category - -### Struct Changes - -#### Removed Structs - -1. IotAlert -1. IotAlertList -1. IotAlertListIterator -1. IotAlertListPage -1. IotAlertProperties -1. IotRecommendation -1. IotRecommendationList -1. IotRecommendationListIterator -1. IotRecommendationListPage -1. IotRecommendationProperties - -#### Removed Struct Fields - -1. AssessmentMetadataProperties.Category - ### Signature Changes #### Const Types -1. Alerts changed type from EventSource to AdditionalWorkspaceDataType -1. Compute changed type from Category to Categories -1. Data changed type from Category to Categories -1. IdentityAndAccess changed type from Category to Categories -1. IoT changed type from Category to Categories -1. Networking changed type from Category to Categories -1. None changed type from EnforcementMode to EndOfSupportStatus -1. RawEvents changed type from ExportData to AdditionalWorkspaceDataType - -#### Funcs - -1. IotAlertTypesClient.Get - - Params - - From: context.Context, string, string, string - - To: context.Context, string -1. IotAlertTypesClient.GetPreparer - - Params - - From: context.Context, string, string, string - - To: context.Context, string -1. IotAlertTypesClient.List - - Params - - From: context.Context, string, string - - To: context.Context -1. IotAlertTypesClient.ListPreparer - - Params - - From: context.Context, string, string - - To: context.Context -1. IotAlertsClient.Get - - Params - - From: context.Context, string, string, string - - To: context.Context, string, string - - Returns - - From: IotAlert, error - - To: IotAlertModel, error -1. IotAlertsClient.GetPreparer - - Params - - From: context.Context, string, string, string - - To: context.Context, string, string -1. IotAlertsClient.GetResponder - - Returns - - From: IotAlert, error - - To: IotAlertModel, error -1. IotAlertsClient.List - - Params - - From: context.Context, string, string, string, string, string, string, *int32, string - - To: context.Context, string, string, string, string, ManagementState, string, *int32, string - - Returns - - From: IotAlertListPage, error - - To: IotAlertListModelPage, error -1. IotAlertsClient.ListComplete - - Params - - From: context.Context, string, string, string, string, string, string, *int32, string - - To: context.Context, string, string, string, string, ManagementState, string, *int32, string - - Returns - - From: IotAlertListIterator, error - - To: IotAlertListModelIterator, error -1. IotAlertsClient.ListPreparer - - Params - - From: context.Context, string, string, string, string, string, string, *int32, string - - To: context.Context, string, string, string, string, ManagementState, string, *int32, string -1. IotAlertsClient.ListResponder - - Returns - - From: IotAlertList, error - - To: IotAlertListModel, error -1. IotRecommendationTypesClient.Get - - Params - - From: context.Context, string, string, string - - To: context.Context, string -1. IotRecommendationTypesClient.GetPreparer - - Params - - From: context.Context, string, string, string - - To: context.Context, string -1. IotRecommendationTypesClient.List - - Params - - From: context.Context, string, string - - To: context.Context -1. IotRecommendationTypesClient.ListPreparer - - Params - - From: context.Context, string, string - - To: context.Context -1. IotRecommendationsClient.Get - - Params - - From: context.Context, string, string, string - - To: context.Context, string, string - - Returns - - From: IotRecommendation, error - - To: IotRecommendationModel, error -1. IotRecommendationsClient.GetPreparer - - Params - - From: context.Context, string, string, string - - To: context.Context, string, string -1. IotRecommendationsClient.GetResponder - - Returns - - From: IotRecommendation, error - - To: IotRecommendationModel, error -1. IotRecommendationsClient.List - - Params - - From: context.Context, string, string, string, string, *int32, string - - To: context.Context, string, string, string, *int32, string - - Returns - - From: IotRecommendationListPage, error - - To: IotRecommendationListModelPage, error -1. IotRecommendationsClient.ListComplete - - Params - - From: context.Context, string, string, string, string, *int32, string - - To: context.Context, string, string, string, *int32, string - - Returns - - From: IotRecommendationListIterator, error - - To: IotRecommendationListModelIterator, error -1. IotRecommendationsClient.ListPreparer - - Params - - From: context.Context, string, string, string, string, *int32, string - - To: context.Context, string, string, string, *int32, string -1. IotRecommendationsClient.ListResponder - - Returns - - From: IotRecommendationList, error - - To: IotRecommendationListModel, error -1. ServerVulnerabilityAssessmentClient.Delete - - Returns - - From: autorest.Response, error - - To: ServerVulnerabilityAssessmentDeleteFuture, error -1. ServerVulnerabilityAssessmentClient.DeleteSender - - Returns - - From: *http.Response, error - - To: ServerVulnerabilityAssessmentDeleteFuture, error +1. KindAAD changed type from KindEnum1 to KindEnum +1. KindATA changed type from KindEnum1 to KindEnum +1. KindAlertSimulatorRequestProperties changed type from KindEnum2 to KindEnum1 +1. KindBundles changed type from KindEnum2 to KindEnum1 +1. KindCEF changed type from KindEnum1 to KindEnum +1. KindDataExportSettings changed type from KindEnum to KindEnum2 +1. KindExternalSecuritySolution changed type from KindEnum1 to KindEnum +1. KindSetting changed type from KindEnum to KindEnum2 #### Struct Fields -1. IoTSecurityAggregatedAlertProperties.Count changed type from *int32 to *int64 -1. IoTSecurityAggregatedAlertPropertiesTopDevicesListItem.AlertsCount changed type from *int32 to *int64 -1. IoTSecurityAggregatedRecommendationProperties.HealthyDevices changed type from *int32 to *int64 -1. IoTSecurityAggregatedRecommendationProperties.UnhealthyDeviceCount changed type from *int32 to *int64 -1. IoTSecurityAlertedDevice.AlertsCount changed type from *int32 to *int64 -1. IoTSecurityDeviceAlert.AlertsCount changed type from *int32 to *int64 -1. IoTSecurityDeviceRecommendation.DevicesCount changed type from *int32 to *int64 -1. IoTSecuritySolutionAnalyticsModelProperties.UnhealthyDeviceCount changed type from *int32 to *int64 -1. IoTSeverityMetrics.High changed type from *int32 to *int64 -1. IoTSeverityMetrics.Low changed type from *int32 to *int64 -1. IoTSeverityMetrics.Medium changed type from *int32 to *int64 +1. AadExternalSecuritySolution.Kind changed type from KindEnum1 to KindEnum +1. AlertSimulatorBundlesRequestProperties.Kind changed type from KindEnum2 to KindEnum1 +1. AlertSimulatorRequestProperties.Kind changed type from KindEnum2 to KindEnum1 +1. AtaExternalSecuritySolution.Kind changed type from KindEnum1 to KindEnum +1. CefExternalSecuritySolution.Kind changed type from KindEnum1 to KindEnum +1. DataExportSettings.Kind changed type from KindEnum to KindEnum2 +1. ExternalSecuritySolution.Kind changed type from KindEnum1 to KindEnum +1. Setting.Kind changed type from KindEnum to KindEnum2 ## Additive Changes ### New Constants -1. AdditionalWorkspaceType.Sentinel -1. BundleType.AppServices -1. BundleType.DNS -1. BundleType.KeyVaults -1. BundleType.KubernetesService -1. BundleType.ResourceManager -1. BundleType.SQLServers -1. BundleType.StorageAccounts -1. BundleType.VirtualMachines -1. CreatedByType.Application -1. CreatedByType.Key -1. CreatedByType.ManagedIdentity -1. CreatedByType.User -1. EndOfSupportStatus.NoLongerSupported -1. EndOfSupportStatus.UpcomingNoLongerSupported -1. EndOfSupportStatus.UpcomingVersionNoLongerSupported -1. EndOfSupportStatus.VersionNoLongerSupported -1. EnforcementMode.EnforcementModeAudit -1. EnforcementMode.EnforcementModeEnforce -1. EnforcementMode.EnforcementModeNone -1. EventSource.EventSourceAlerts -1. EventSource.EventSourceAssessments -1. EventSource.EventSourceRegulatoryComplianceAssessment -1. EventSource.EventSourceRegulatoryComplianceAssessmentSnapshot -1. EventSource.EventSourceSecureScoreControls -1. EventSource.EventSourceSecureScoreControlsSnapshot -1. EventSource.EventSourceSecureScores -1. EventSource.EventSourceSecureScoresSnapshot -1. EventSource.EventSourceSubAssessments -1. ExportData.ExportDataRawEvents -1. KindEnum2.KindAlertSimulatorRequestProperties -1. KindEnum2.KindBundles -1. OnboardingKind.Default -1. OnboardingKind.MigratedToAzure -1. RuleTypeBasicCustomAlertRule.RuleTypeConnectionFromIPNotAllowed -1. SensorType.SensorTypeEnterprise -1. SensorType.SensorTypeOt +1. KindEnum2.KindAlertSyncSettings +1. OnboardingKind.Evaluation +1. OnboardingKind.Purchased ### New Funcs -1. *AlertSimulatorBundlesRequestProperties.UnmarshalJSON([]byte) error -1. *AlertSimulatorRequestBody.UnmarshalJSON([]byte) error -1. *AlertSimulatorRequestProperties.UnmarshalJSON([]byte) error -1. *AlertsSimulateFuture.UnmarshalJSON([]byte) error -1. *IngestionSettingListIterator.Next() error -1. *IngestionSettingListIterator.NextWithContext(context.Context) error -1. *IngestionSettingListPage.Next() error -1. *IngestionSettingListPage.NextWithContext(context.Context) error -1. *ServerVulnerabilityAssessmentDeleteFuture.UnmarshalJSON([]byte) error -1. *Software.UnmarshalJSON([]byte) error -1. *SoftwaresListIterator.Next() error -1. *SoftwaresListIterator.NextWithContext(context.Context) error -1. *SoftwaresListPage.Next() error -1. *SoftwaresListPage.NextWithContext(context.Context) error -1. ActiveConnectionsNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. AlertSimulatorBundlesRequestProperties.AsAlertSimulatorBundlesRequestProperties() (*AlertSimulatorBundlesRequestProperties, bool) -1. AlertSimulatorBundlesRequestProperties.AsAlertSimulatorRequestProperties() (*AlertSimulatorRequestProperties, bool) -1. AlertSimulatorBundlesRequestProperties.AsBasicAlertSimulatorRequestProperties() (BasicAlertSimulatorRequestProperties, bool) -1. AlertSimulatorBundlesRequestProperties.MarshalJSON() ([]byte, error) -1. AlertSimulatorRequestProperties.AsAlertSimulatorBundlesRequestProperties() (*AlertSimulatorBundlesRequestProperties, bool) -1. AlertSimulatorRequestProperties.AsAlertSimulatorRequestProperties() (*AlertSimulatorRequestProperties, bool) -1. AlertSimulatorRequestProperties.AsBasicAlertSimulatorRequestProperties() (BasicAlertSimulatorRequestProperties, bool) -1. AlertSimulatorRequestProperties.MarshalJSON() ([]byte, error) -1. AlertsClient.GetResourceGroupLevel(context.Context, string, string) (Alert, error) -1. AlertsClient.GetResourceGroupLevelPreparer(context.Context, string, string) (*http.Request, error) -1. AlertsClient.GetResourceGroupLevelResponder(*http.Response) (Alert, error) -1. AlertsClient.GetResourceGroupLevelSender(*http.Request) (*http.Response, error) -1. AlertsClient.GetSubscriptionLevel(context.Context, string) (Alert, error) -1. AlertsClient.GetSubscriptionLevelPreparer(context.Context, string) (*http.Request, error) -1. AlertsClient.GetSubscriptionLevelResponder(*http.Response) (Alert, error) -1. AlertsClient.GetSubscriptionLevelSender(*http.Request) (*http.Response, error) -1. AlertsClient.ListResourceGroupLevelByRegion(context.Context, string) (AlertListPage, error) -1. AlertsClient.ListResourceGroupLevelByRegionComplete(context.Context, string) (AlertListIterator, error) -1. AlertsClient.ListResourceGroupLevelByRegionPreparer(context.Context, string) (*http.Request, error) -1. AlertsClient.ListResourceGroupLevelByRegionResponder(*http.Response) (AlertList, error) -1. AlertsClient.ListResourceGroupLevelByRegionSender(*http.Request) (*http.Response, error) -1. AlertsClient.ListSubscriptionLevelByRegion(context.Context) (AlertListPage, error) -1. AlertsClient.ListSubscriptionLevelByRegionComplete(context.Context) (AlertListIterator, error) -1. AlertsClient.ListSubscriptionLevelByRegionPreparer(context.Context) (*http.Request, error) -1. AlertsClient.ListSubscriptionLevelByRegionResponder(*http.Response) (AlertList, error) -1. AlertsClient.ListSubscriptionLevelByRegionSender(*http.Request) (*http.Response, error) -1. AlertsClient.Simulate(context.Context, AlertSimulatorRequestBody) (AlertsSimulateFuture, error) -1. AlertsClient.SimulatePreparer(context.Context, AlertSimulatorRequestBody) (*http.Request, error) -1. AlertsClient.SimulateResponder(*http.Response) (autorest.Response, error) -1. AlertsClient.SimulateSender(*http.Request) (AlertsSimulateFuture, error) -1. AlertsClient.UpdateResourceGroupLevelStateToActivate(context.Context, string, string) (autorest.Response, error) -1. AlertsClient.UpdateResourceGroupLevelStateToActivatePreparer(context.Context, string, string) (*http.Request, error) -1. AlertsClient.UpdateResourceGroupLevelStateToActivateResponder(*http.Response) (autorest.Response, error) -1. AlertsClient.UpdateResourceGroupLevelStateToActivateSender(*http.Request) (*http.Response, error) -1. AlertsClient.UpdateResourceGroupLevelStateToDismiss(context.Context, string, string) (autorest.Response, error) -1. AlertsClient.UpdateResourceGroupLevelStateToDismissPreparer(context.Context, string, string) (*http.Request, error) -1. AlertsClient.UpdateResourceGroupLevelStateToDismissResponder(*http.Response) (autorest.Response, error) -1. AlertsClient.UpdateResourceGroupLevelStateToDismissSender(*http.Request) (*http.Response, error) -1. AlertsClient.UpdateSubscriptionLevelStateToActivate(context.Context, string) (autorest.Response, error) -1. AlertsClient.UpdateSubscriptionLevelStateToActivatePreparer(context.Context, string) (*http.Request, error) -1. AlertsClient.UpdateSubscriptionLevelStateToActivateResponder(*http.Response) (autorest.Response, error) -1. AlertsClient.UpdateSubscriptionLevelStateToActivateSender(*http.Request) (*http.Response, error) -1. AlertsClient.UpdateSubscriptionLevelStateToDismiss(context.Context, string) (autorest.Response, error) -1. AlertsClient.UpdateSubscriptionLevelStateToDismissPreparer(context.Context, string) (*http.Request, error) -1. AlertsClient.UpdateSubscriptionLevelStateToDismissResponder(*http.Response) (autorest.Response, error) -1. AlertsClient.UpdateSubscriptionLevelStateToDismissSender(*http.Request) (*http.Response, error) -1. AllowlistCustomAlertRule.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. AmqpC2DMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. AmqpC2DRejectedMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. AmqpD2CMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. ConnectionFromIPNotAllowed.AsActiveConnectionsNotInAllowedRange() (*ActiveConnectionsNotInAllowedRange, bool) -1. ConnectionFromIPNotAllowed.AsAllowlistCustomAlertRule() (*AllowlistCustomAlertRule, bool) -1. ConnectionFromIPNotAllowed.AsAmqpC2DMessagesNotInAllowedRange() (*AmqpC2DMessagesNotInAllowedRange, bool) -1. ConnectionFromIPNotAllowed.AsAmqpC2DRejectedMessagesNotInAllowedRange() (*AmqpC2DRejectedMessagesNotInAllowedRange, bool) -1. ConnectionFromIPNotAllowed.AsAmqpD2CMessagesNotInAllowedRange() (*AmqpD2CMessagesNotInAllowedRange, bool) -1. ConnectionFromIPNotAllowed.AsBasicAllowlistCustomAlertRule() (BasicAllowlistCustomAlertRule, bool) -1. ConnectionFromIPNotAllowed.AsBasicCustomAlertRule() (BasicCustomAlertRule, bool) -1. ConnectionFromIPNotAllowed.AsBasicListCustomAlertRule() (BasicListCustomAlertRule, bool) -1. ConnectionFromIPNotAllowed.AsBasicThresholdCustomAlertRule() (BasicThresholdCustomAlertRule, bool) -1. ConnectionFromIPNotAllowed.AsBasicTimeWindowCustomAlertRule() (BasicTimeWindowCustomAlertRule, bool) -1. ConnectionFromIPNotAllowed.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. ConnectionFromIPNotAllowed.AsConnectionToIPNotAllowed() (*ConnectionToIPNotAllowed, bool) -1. ConnectionFromIPNotAllowed.AsCustomAlertRule() (*CustomAlertRule, bool) -1. ConnectionFromIPNotAllowed.AsDenylistCustomAlertRule() (*DenylistCustomAlertRule, bool) -1. ConnectionFromIPNotAllowed.AsDirectMethodInvokesNotInAllowedRange() (*DirectMethodInvokesNotInAllowedRange, bool) -1. ConnectionFromIPNotAllowed.AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) -1. ConnectionFromIPNotAllowed.AsFileUploadsNotInAllowedRange() (*FileUploadsNotInAllowedRange, bool) -1. ConnectionFromIPNotAllowed.AsHTTPC2DMessagesNotInAllowedRange() (*HTTPC2DMessagesNotInAllowedRange, bool) -1. ConnectionFromIPNotAllowed.AsHTTPC2DRejectedMessagesNotInAllowedRange() (*HTTPC2DRejectedMessagesNotInAllowedRange, bool) -1. ConnectionFromIPNotAllowed.AsHTTPD2CMessagesNotInAllowedRange() (*HTTPD2CMessagesNotInAllowedRange, bool) -1. ConnectionFromIPNotAllowed.AsListCustomAlertRule() (*ListCustomAlertRule, bool) -1. ConnectionFromIPNotAllowed.AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) -1. ConnectionFromIPNotAllowed.AsMqttC2DMessagesNotInAllowedRange() (*MqttC2DMessagesNotInAllowedRange, bool) -1. ConnectionFromIPNotAllowed.AsMqttC2DRejectedMessagesNotInAllowedRange() (*MqttC2DRejectedMessagesNotInAllowedRange, bool) -1. ConnectionFromIPNotAllowed.AsMqttD2CMessagesNotInAllowedRange() (*MqttD2CMessagesNotInAllowedRange, bool) -1. ConnectionFromIPNotAllowed.AsProcessNotAllowed() (*ProcessNotAllowed, bool) -1. ConnectionFromIPNotAllowed.AsQueuePurgesNotInAllowedRange() (*QueuePurgesNotInAllowedRange, bool) -1. ConnectionFromIPNotAllowed.AsThresholdCustomAlertRule() (*ThresholdCustomAlertRule, bool) -1. ConnectionFromIPNotAllowed.AsTimeWindowCustomAlertRule() (*TimeWindowCustomAlertRule, bool) -1. ConnectionFromIPNotAllowed.AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) -1. ConnectionFromIPNotAllowed.AsUnauthorizedOperationsNotInAllowedRange() (*UnauthorizedOperationsNotInAllowedRange, bool) -1. ConnectionFromIPNotAllowed.MarshalJSON() ([]byte, error) -1. ConnectionToIPNotAllowed.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. CustomAlertRule.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. DenylistCustomAlertRule.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. DirectMethodInvokesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. ErrorAdditionalInfo.MarshalJSON() ([]byte, error) -1. FailedLocalLoginsNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. FileUploadsNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. HTTPC2DMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. HTTPC2DRejectedMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. HTTPD2CMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. IngestionConnectionString.MarshalJSON() ([]byte, error) -1. IngestionSetting.MarshalJSON() ([]byte, error) -1. IngestionSettingList.IsEmpty() bool -1. IngestionSettingList.MarshalJSON() ([]byte, error) -1. IngestionSettingListIterator.NotDone() bool -1. IngestionSettingListIterator.Response() IngestionSettingList -1. IngestionSettingListIterator.Value() IngestionSetting -1. IngestionSettingListPage.NotDone() bool -1. IngestionSettingListPage.Response() IngestionSettingList -1. IngestionSettingListPage.Values() []IngestionSetting -1. IngestionSettingToken.MarshalJSON() ([]byte, error) -1. IngestionSettingsClient.Create(context.Context, string, IngestionSetting) (IngestionSetting, error) -1. IngestionSettingsClient.CreatePreparer(context.Context, string, IngestionSetting) (*http.Request, error) -1. IngestionSettingsClient.CreateResponder(*http.Response) (IngestionSetting, error) -1. IngestionSettingsClient.CreateSender(*http.Request) (*http.Response, error) -1. IngestionSettingsClient.Delete(context.Context, string) (autorest.Response, error) -1. IngestionSettingsClient.DeletePreparer(context.Context, string) (*http.Request, error) -1. IngestionSettingsClient.DeleteResponder(*http.Response) (autorest.Response, error) -1. IngestionSettingsClient.DeleteSender(*http.Request) (*http.Response, error) -1. IngestionSettingsClient.Get(context.Context, string) (IngestionSetting, error) -1. IngestionSettingsClient.GetPreparer(context.Context, string) (*http.Request, error) -1. IngestionSettingsClient.GetResponder(*http.Response) (IngestionSetting, error) -1. IngestionSettingsClient.GetSender(*http.Request) (*http.Response, error) -1. IngestionSettingsClient.List(context.Context) (IngestionSettingListPage, error) -1. IngestionSettingsClient.ListComplete(context.Context) (IngestionSettingListIterator, error) -1. IngestionSettingsClient.ListConnectionStrings(context.Context, string) (ConnectionStrings, error) -1. IngestionSettingsClient.ListConnectionStringsPreparer(context.Context, string) (*http.Request, error) -1. IngestionSettingsClient.ListConnectionStringsResponder(*http.Response) (ConnectionStrings, error) -1. IngestionSettingsClient.ListConnectionStringsSender(*http.Request) (*http.Response, error) -1. IngestionSettingsClient.ListPreparer(context.Context) (*http.Request, error) -1. IngestionSettingsClient.ListResponder(*http.Response) (IngestionSettingList, error) -1. IngestionSettingsClient.ListSender(*http.Request) (*http.Response, error) -1. IngestionSettingsClient.ListTokens(context.Context, string) (IngestionSettingToken, error) -1. IngestionSettingsClient.ListTokensPreparer(context.Context, string) (*http.Request, error) -1. IngestionSettingsClient.ListTokensResponder(*http.Response) (IngestionSettingToken, error) -1. IngestionSettingsClient.ListTokensSender(*http.Request) (*http.Response, error) -1. ListCustomAlertRule.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. LocalUserNotAllowed.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. MqttC2DMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. MqttC2DRejectedMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. MqttD2CMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. NewIngestionSettingListIterator(IngestionSettingListPage) IngestionSettingListIterator -1. NewIngestionSettingListPage(IngestionSettingList, func(context.Context, IngestionSettingList) (IngestionSettingList, error)) IngestionSettingListPage -1. NewIngestionSettingsClient(string, string) IngestionSettingsClient -1. NewIngestionSettingsClientWithBaseURI(string, string, string) IngestionSettingsClient -1. NewSoftwareInventoriesClient(string, string) SoftwareInventoriesClient -1. NewSoftwareInventoriesClientWithBaseURI(string, string, string) SoftwareInventoriesClient -1. NewSoftwaresListIterator(SoftwaresListPage) SoftwaresListIterator -1. NewSoftwaresListPage(SoftwaresList, func(context.Context, SoftwaresList) (SoftwaresList, error)) SoftwaresListPage -1. PossibleAdditionalWorkspaceDataTypeValues() []AdditionalWorkspaceDataType -1. PossibleAdditionalWorkspaceTypeValues() []AdditionalWorkspaceType -1. PossibleBundleTypeValues() []BundleType -1. PossibleCategoriesValues() []Categories -1. PossibleCreatedByTypeValues() []CreatedByType -1. PossibleEndOfSupportStatusValues() []EndOfSupportStatus -1. PossibleKindEnum2Values() []KindEnum2 -1. PossibleOnboardingKindValues() []OnboardingKind -1. PossibleSensorTypeValues() []SensorType -1. ProcessNotAllowed.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. QueuePurgesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. Software.MarshalJSON() ([]byte, error) -1. SoftwareInventoriesClient.Get(context.Context, string, string, string, string, string) (Software, error) -1. SoftwareInventoriesClient.GetPreparer(context.Context, string, string, string, string, string) (*http.Request, error) -1. SoftwareInventoriesClient.GetResponder(*http.Response) (Software, error) -1. SoftwareInventoriesClient.GetSender(*http.Request) (*http.Response, error) -1. SoftwareInventoriesClient.ListByExtendedResource(context.Context, string, string, string, string) (SoftwaresListPage, error) -1. SoftwareInventoriesClient.ListByExtendedResourceComplete(context.Context, string, string, string, string) (SoftwaresListIterator, error) -1. SoftwareInventoriesClient.ListByExtendedResourcePreparer(context.Context, string, string, string, string) (*http.Request, error) -1. SoftwareInventoriesClient.ListByExtendedResourceResponder(*http.Response) (SoftwaresList, error) -1. SoftwareInventoriesClient.ListByExtendedResourceSender(*http.Request) (*http.Response, error) -1. SoftwareInventoriesClient.ListBySubscription(context.Context) (SoftwaresListPage, error) -1. SoftwareInventoriesClient.ListBySubscriptionComplete(context.Context) (SoftwaresListIterator, error) -1. SoftwareInventoriesClient.ListBySubscriptionPreparer(context.Context) (*http.Request, error) -1. SoftwareInventoriesClient.ListBySubscriptionResponder(*http.Response) (SoftwaresList, error) -1. SoftwareInventoriesClient.ListBySubscriptionSender(*http.Request) (*http.Response, error) -1. SoftwaresList.IsEmpty() bool -1. SoftwaresList.MarshalJSON() ([]byte, error) -1. SoftwaresListIterator.NotDone() bool -1. SoftwaresListIterator.Response() SoftwaresList -1. SoftwaresListIterator.Value() Software -1. SoftwaresListPage.NotDone() bool -1. SoftwaresListPage.Response() SoftwaresList -1. SoftwaresListPage.Values() []Software -1. ThresholdCustomAlertRule.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. TimeWindowCustomAlertRule.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. TwinUpdatesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) -1. UnauthorizedOperationsNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. *AlertSyncSettings.UnmarshalJSON([]byte) error +1. AlertSyncSettings.AsAlertSyncSettings() (*AlertSyncSettings, bool) +1. AlertSyncSettings.AsBasicSetting() (BasicSetting, bool) +1. AlertSyncSettings.AsDataExportSettings() (*DataExportSettings, bool) +1. AlertSyncSettings.AsSetting() (*Setting, bool) +1. AlertSyncSettings.MarshalJSON() ([]byte, error) +1. DataExportSettings.AsAlertSyncSettings() (*AlertSyncSettings, bool) +1. IotDefenderSettingsProperties.MarshalJSON() ([]byte, error) +1. Setting.AsAlertSyncSettings() (*AlertSyncSettings, bool) ### Struct Changes #### New Structs -1. AdditionalWorkspacesProperties -1. AlertSimulatorBundlesRequestProperties -1. AlertSimulatorRequestBody -1. AlertSimulatorRequestProperties -1. AlertsSimulateFuture -1. ConnectionFromIPNotAllowed -1. ConnectionStrings -1. ErrorAdditionalInfo -1. IngestionConnectionString -1. IngestionSetting -1. IngestionSettingList -1. IngestionSettingListIterator -1. IngestionSettingListPage -1. IngestionSettingToken -1. IngestionSettingsClient -1. ServerVulnerabilityAssessmentDeleteFuture -1. Software -1. SoftwareInventoriesClient -1. SoftwareProperties -1. SoftwaresList -1. SoftwaresListIterator -1. SoftwaresListPage -1. SystemData +1. AlertSyncSettingProperties +1. AlertSyncSettings #### New Struct Fields -1. AssessmentMetadataProperties.Categories -1. CloudErrorBody.AdditionalInfo -1. CloudErrorBody.Details -1. CloudErrorBody.Target -1. IoTSecuritySolutionModel.SystemData -1. IoTSecuritySolutionProperties.AdditionalWorkspaces -1. IotAlertModel.ID -1. IotAlertModel.Name -1. IotAlertModel.Type -1. IotDefenderSettingsProperties.OnboardingKind -1. IotSensorProperties.SensorType +1. IotDefenderSettingsProperties.EvaluationEndTime diff --git a/services/preview/security/mgmt/v3.0/security/_meta.json b/services/preview/security/mgmt/v3.0/security/_meta.json index 5f95c7bcb6c4..b3d4fbe59b98 100644 --- a/services/preview/security/mgmt/v3.0/security/_meta.json +++ b/services/preview/security/mgmt/v3.0/security/_meta.json @@ -1,5 +1,5 @@ { - "commit": "2b0b50e3e5bd467aa039a51cafa2a071593eca28", + "commit": "34342af98a9330b5629dd4d034bd82d1d848e9c0", "readme": "/_/azure-rest-api-specs/specification/security/resource-manager/readme.md", "tag": "package-composite-v3", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/preview/security/mgmt/v3.0/security/enums.go b/services/preview/security/mgmt/v3.0/security/enums.go index 25b9c2e5e721..4cc6ec11eb72 100644 --- a/services/preview/security/mgmt/v3.0/security/enums.go +++ b/services/preview/security/mgmt/v3.0/security/enums.go @@ -882,49 +882,51 @@ func PossibleIssueValues() []Issue { type KindEnum string const ( - // KindDataExportSettings ... - KindDataExportSettings KindEnum = "DataExportSettings" - // KindSetting ... - KindSetting KindEnum = "Setting" + // KindAAD ... + KindAAD KindEnum = "AAD" + // KindATA ... + KindATA KindEnum = "ATA" + // KindCEF ... + KindCEF KindEnum = "CEF" + // KindExternalSecuritySolution ... + KindExternalSecuritySolution KindEnum = "ExternalSecuritySolution" ) // PossibleKindEnumValues returns an array of possible values for the KindEnum const type. func PossibleKindEnumValues() []KindEnum { - return []KindEnum{KindDataExportSettings, KindSetting} + return []KindEnum{KindAAD, KindATA, KindCEF, KindExternalSecuritySolution} } // KindEnum1 enumerates the values for kind enum 1. type KindEnum1 string const ( - // KindAAD ... - KindAAD KindEnum1 = "AAD" - // KindATA ... - KindATA KindEnum1 = "ATA" - // KindCEF ... - KindCEF KindEnum1 = "CEF" - // KindExternalSecuritySolution ... - KindExternalSecuritySolution KindEnum1 = "ExternalSecuritySolution" + // KindAlertSimulatorRequestProperties ... + KindAlertSimulatorRequestProperties KindEnum1 = "AlertSimulatorRequestProperties" + // KindBundles ... + KindBundles KindEnum1 = "Bundles" ) // PossibleKindEnum1Values returns an array of possible values for the KindEnum1 const type. func PossibleKindEnum1Values() []KindEnum1 { - return []KindEnum1{KindAAD, KindATA, KindCEF, KindExternalSecuritySolution} + return []KindEnum1{KindAlertSimulatorRequestProperties, KindBundles} } // KindEnum2 enumerates the values for kind enum 2. type KindEnum2 string const ( - // KindAlertSimulatorRequestProperties ... - KindAlertSimulatorRequestProperties KindEnum2 = "AlertSimulatorRequestProperties" - // KindBundles ... - KindBundles KindEnum2 = "Bundles" + // KindAlertSyncSettings ... + KindAlertSyncSettings KindEnum2 = "AlertSyncSettings" + // KindDataExportSettings ... + KindDataExportSettings KindEnum2 = "DataExportSettings" + // KindSetting ... + KindSetting KindEnum2 = "Setting" ) // PossibleKindEnum2Values returns an array of possible values for the KindEnum2 const type. func PossibleKindEnum2Values() []KindEnum2 { - return []KindEnum2{KindAlertSimulatorRequestProperties, KindBundles} + return []KindEnum2{KindAlertSyncSettings, KindDataExportSettings, KindSetting} } // MacSignificance enumerates the values for mac significance. @@ -980,13 +982,17 @@ type OnboardingKind string const ( // Default ... Default OnboardingKind = "Default" + // Evaluation ... + Evaluation OnboardingKind = "Evaluation" // MigratedToAzure ... MigratedToAzure OnboardingKind = "MigratedToAzure" + // Purchased ... + Purchased OnboardingKind = "Purchased" ) // PossibleOnboardingKindValues returns an array of possible values for the OnboardingKind const type. func PossibleOnboardingKindValues() []OnboardingKind { - return []OnboardingKind{Default, MigratedToAzure} + return []OnboardingKind{Default, Evaluation, MigratedToAzure, Purchased} } // Operator enumerates the values for operator. diff --git a/services/preview/security/mgmt/v3.0/security/models.go b/services/preview/security/mgmt/v3.0/security/models.go index 0d33397018d3..03a13201a108 100644 --- a/services/preview/security/mgmt/v3.0/security/models.go +++ b/services/preview/security/mgmt/v3.0/security/models.go @@ -41,7 +41,7 @@ type AadExternalSecuritySolution struct { // Location - READ-ONLY; Location where the resource is stored Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' - Kind KindEnum1 `json:"kind,omitempty"` + Kind KindEnum `json:"kind,omitempty"` } // MarshalJSON is the custom marshaler for AadExternalSecuritySolution. @@ -1472,7 +1472,7 @@ type AlertSimulatorBundlesRequestProperties struct { // AdditionalProperties - Unmatched properties from the message are deserialized this collection AdditionalProperties map[string]interface{} `json:""` // Kind - Possible values include: 'KindAlertSimulatorRequestProperties', 'KindBundles' - Kind KindEnum2 `json:"kind,omitempty"` + Kind KindEnum1 `json:"kind,omitempty"` } // MarshalJSON is the custom marshaler for AlertSimulatorBundlesRequestProperties. @@ -1538,7 +1538,7 @@ func (asbrp *AlertSimulatorBundlesRequestProperties) UnmarshalJSON(body []byte) } case "kind": if v != nil { - var kind KindEnum2 + var kind KindEnum1 err = json.Unmarshal(*v, &kind) if err != nil { return err @@ -1591,7 +1591,7 @@ type AlertSimulatorRequestProperties struct { // AdditionalProperties - Unmatched properties from the message are deserialized this collection AdditionalProperties map[string]interface{} `json:""` // Kind - Possible values include: 'KindAlertSimulatorRequestProperties', 'KindBundles' - Kind KindEnum2 `json:"kind,omitempty"` + Kind KindEnum1 `json:"kind,omitempty"` } func unmarshalBasicAlertSimulatorRequestProperties(body []byte) (BasicAlertSimulatorRequestProperties, error) { @@ -1682,7 +1682,7 @@ func (asrp *AlertSimulatorRequestProperties) UnmarshalJSON(body []byte) error { } case "kind": if v != nil { - var kind KindEnum2 + var kind KindEnum1 err = json.Unmarshal(*v, &kind) if err != nil { return err @@ -2014,6 +2014,119 @@ func NewAlertsSuppressionRulesListPage(cur AlertsSuppressionRulesList, getNextPa } } +// AlertSyncSettingProperties the alert sync setting properties +type AlertSyncSettingProperties struct { + // Enabled - Is the alert sync setting enabled + Enabled *bool `json:"enabled,omitempty"` +} + +// AlertSyncSettings represents an alert sync setting +type AlertSyncSettings struct { + // AlertSyncSettingProperties - Alert sync setting data + *AlertSyncSettingProperties `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"` + // Kind - Possible values include: 'KindSetting', 'KindDataExportSettings', 'KindAlertSyncSettings' + Kind KindEnum2 `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertSyncSettings. +func (ass AlertSyncSettings) MarshalJSON() ([]byte, error) { + ass.Kind = KindAlertSyncSettings + objectMap := make(map[string]interface{}) + if ass.AlertSyncSettingProperties != nil { + objectMap["properties"] = ass.AlertSyncSettingProperties + } + if ass.Kind != "" { + objectMap["kind"] = ass.Kind + } + return json.Marshal(objectMap) +} + +// AsDataExportSettings is the BasicSetting implementation for AlertSyncSettings. +func (ass AlertSyncSettings) AsDataExportSettings() (*DataExportSettings, bool) { + return nil, false +} + +// AsAlertSyncSettings is the BasicSetting implementation for AlertSyncSettings. +func (ass AlertSyncSettings) AsAlertSyncSettings() (*AlertSyncSettings, bool) { + return &ass, true +} + +// AsSetting is the BasicSetting implementation for AlertSyncSettings. +func (ass AlertSyncSettings) AsSetting() (*Setting, bool) { + return nil, false +} + +// AsBasicSetting is the BasicSetting implementation for AlertSyncSettings. +func (ass AlertSyncSettings) AsBasicSetting() (BasicSetting, bool) { + return &ass, true +} + +// UnmarshalJSON is the custom unmarshaler for AlertSyncSettings struct. +func (ass *AlertSyncSettings) 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 alertSyncSettingProperties AlertSyncSettingProperties + err = json.Unmarshal(*v, &alertSyncSettingProperties) + if err != nil { + return err + } + ass.AlertSyncSettingProperties = &alertSyncSettingProperties + } + case "kind": + if v != nil { + var kind KindEnum2 + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ass.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ass.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ass.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ass.Type = &typeVar + } + } + } + + return nil +} + // AllowedConnectionsList list of all possible traffic between Azure resources type AllowedConnectionsList struct { autorest.Response `json:"-"` @@ -3999,7 +4112,7 @@ type AtaExternalSecuritySolution struct { // Location - READ-ONLY; Location where the resource is stored Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' - Kind KindEnum1 `json:"kind,omitempty"` + Kind KindEnum `json:"kind,omitempty"` } // MarshalJSON is the custom marshaler for AtaExternalSecuritySolution. @@ -5414,7 +5527,7 @@ type CefExternalSecuritySolution struct { // Location - READ-ONLY; Location where the resource is stored Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' - Kind KindEnum1 `json:"kind,omitempty"` + Kind KindEnum `json:"kind,omitempty"` } // MarshalJSON is the custom marshaler for CefExternalSecuritySolution. @@ -7546,7 +7659,7 @@ func (c CVSS) MarshalJSON() ([]byte, error) { // DataExportSettingProperties the data export setting properties type DataExportSettingProperties struct { - // Enabled - Is the data export setting is enabled + // Enabled - Is the data export setting enabled Enabled *bool `json:"enabled,omitempty"` } @@ -7554,14 +7667,14 @@ type DataExportSettingProperties struct { type DataExportSettings struct { // DataExportSettingProperties - Data export setting data *DataExportSettingProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindSetting', 'KindDataExportSettings', 'KindAlertSyncSettings' + Kind KindEnum2 `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"` - // Kind - Possible values include: 'KindSetting', 'KindDataExportSettings' - Kind KindEnum `json:"kind,omitempty"` } // MarshalJSON is the custom marshaler for DataExportSettings. @@ -7582,6 +7695,11 @@ func (desVar DataExportSettings) AsDataExportSettings() (*DataExportSettings, bo return &desVar, true } +// AsAlertSyncSettings is the BasicSetting implementation for DataExportSettings. +func (desVar DataExportSettings) AsAlertSyncSettings() (*AlertSyncSettings, bool) { + return nil, false +} + // AsSetting is the BasicSetting implementation for DataExportSettings. func (desVar DataExportSettings) AsSetting() (*Setting, bool) { return nil, false @@ -7612,7 +7730,7 @@ func (desVar *DataExportSettings) UnmarshalJSON(body []byte) error { } case "kind": if v != nil { - var kind KindEnum + var kind KindEnum2 err = json.Unmarshal(*v, &kind) if err != nil { return err @@ -8969,7 +9087,7 @@ type ExternalSecuritySolution struct { // Location - READ-ONLY; Location where the resource is stored Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' - Kind KindEnum1 `json:"kind,omitempty"` + Kind KindEnum `json:"kind,omitempty"` } func unmarshalBasicExternalSecuritySolution(body []byte) (BasicExternalSecuritySolution, error) { @@ -11476,8 +11594,25 @@ type IotDefenderSettingsProperties struct { DeviceQuota *int32 `json:"deviceQuota,omitempty"` // SentinelWorkspaceResourceIds - Sentinel Workspace Resource Ids SentinelWorkspaceResourceIds *[]string `json:"sentinelWorkspaceResourceIds,omitempty"` - // OnboardingKind - The kind of onboarding for the subscription. Possible values include: 'Default', 'MigratedToAzure' + // OnboardingKind - The kind of onboarding for the subscription. Possible values include: 'Default', 'MigratedToAzure', 'Evaluation', 'Purchased' OnboardingKind OnboardingKind `json:"onboardingKind,omitempty"` + // EvaluationEndTime - READ-ONLY; End time of the evaluation period, if such exist + EvaluationEndTime *date.Time `json:"evaluationEndTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for IotDefenderSettingsProperties. +func (idsp IotDefenderSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if idsp.DeviceQuota != nil { + objectMap["deviceQuota"] = idsp.DeviceQuota + } + if idsp.SentinelWorkspaceResourceIds != nil { + objectMap["sentinelWorkspaceResourceIds"] = idsp.SentinelWorkspaceResourceIds + } + if idsp.OnboardingKind != "" { + objectMap["onboardingKind"] = idsp.OnboardingKind + } + return json.Marshal(objectMap) } // IotRecommendationListModel list of IoT recommendations @@ -18294,14 +18429,15 @@ type ServicePrincipalProperties struct { // BasicSetting the kind of the security setting type BasicSetting interface { AsDataExportSettings() (*DataExportSettings, bool) + AsAlertSyncSettings() (*AlertSyncSettings, bool) AsSetting() (*Setting, bool) } // Setting the kind of the security setting type Setting struct { autorest.Response `json:"-"` - // Kind - Possible values include: 'KindSetting', 'KindDataExportSettings' - Kind KindEnum `json:"kind,omitempty"` + // Kind - Possible values include: 'KindSetting', 'KindDataExportSettings', 'KindAlertSyncSettings' + Kind KindEnum2 `json:"kind,omitempty"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name @@ -18322,6 +18458,10 @@ func unmarshalBasicSetting(body []byte) (BasicSetting, error) { var desVar DataExportSettings err := json.Unmarshal(body, &desVar) return desVar, err + case string(KindAlertSyncSettings): + var ass AlertSyncSettings + err := json.Unmarshal(body, &ass) + return ass, err default: var s Setting err := json.Unmarshal(body, &s) @@ -18362,6 +18502,11 @@ func (s Setting) AsDataExportSettings() (*DataExportSettings, bool) { return nil, false } +// AsAlertSyncSettings is the BasicSetting implementation for Setting. +func (s Setting) AsAlertSyncSettings() (*AlertSyncSettings, bool) { + return nil, false +} + // AsSetting is the BasicSetting implementation for Setting. func (s Setting) AsSetting() (*Setting, bool) { return &s, true 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 cea80c9c6b1c..9e2da968bde0 100644 --- a/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go @@ -30,16 +30,6 @@ type PricingsClientAPI interface { var _ PricingsClientAPI = (*security.PricingsClient)(nil) -// SettingsClientAPI contains the set of methods on the SettingsClient type. -type SettingsClientAPI interface { - Get(ctx context.Context, settingName string) (result security.SettingModel, err error) - List(ctx context.Context) (result security.SettingsListPage, err error) - ListComplete(ctx context.Context) (result security.SettingsListIterator, err error) - Update(ctx context.Context, settingName string, setting security.BasicSetting) (result security.SettingModel, err error) -} - -var _ SettingsClientAPI = (*security.SettingsClient)(nil) - // AdvancedThreatProtectionClientAPI contains the set of methods on the AdvancedThreatProtectionClient type. type AdvancedThreatProtectionClientAPI interface { Create(ctx context.Context, resourceID string, advancedThreatProtectionSetting security.AdvancedThreatProtectionSetting) (result security.AdvancedThreatProtectionSetting, err error) @@ -577,6 +567,16 @@ type AlertsClientAPI interface { var _ AlertsClientAPI = (*security.AlertsClient)(nil) +// SettingsClientAPI contains the set of methods on the SettingsClient type. +type SettingsClientAPI interface { + Get(ctx context.Context, settingName string) (result security.SettingModel, err error) + List(ctx context.Context) (result security.SettingsListPage, err error) + ListComplete(ctx context.Context) (result security.SettingsListIterator, err error) + Update(ctx context.Context, settingName string, setting security.BasicSetting) (result security.SettingModel, err error) +} + +var _ SettingsClientAPI = (*security.SettingsClient)(nil) + // IngestionSettingsClientAPI contains the set of methods on the IngestionSettingsClient type. type IngestionSettingsClientAPI interface { Create(ctx context.Context, ingestionSettingName string, ingestionSetting security.IngestionSetting) (result security.IngestionSetting, err error) diff --git a/services/preview/security/mgmt/v3.0/security/settings.go b/services/preview/security/mgmt/v3.0/security/settings.go index df451b6e747f..6ff57dc8da26 100644 --- a/services/preview/security/mgmt/v3.0/security/settings.go +++ b/services/preview/security/mgmt/v3.0/security/settings.go @@ -33,7 +33,7 @@ func NewSettingsClientWithBaseURI(baseURI string, subscriptionID string, ascLoca // Get settings of different configurations in security center // Parameters: -// settingName - name of setting: (MCAS/WDATP) +// settingName - the name of the setting func (client SettingsClient) Get(ctx context.Context, settingName string) (result SettingModel, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/SettingsClient.Get") @@ -80,7 +80,7 @@ func (client SettingsClient) GetPreparer(ctx context.Context, settingName string "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-01-01" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -162,7 +162,7 @@ func (client SettingsClient) ListPreparer(ctx context.Context) (*http.Request, e "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-01-01" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -232,7 +232,7 @@ func (client SettingsClient) ListComplete(ctx context.Context) (result SettingsL // Update updating settings about different configurations in security center // Parameters: -// settingName - name of setting: (MCAS/WDATP) +// settingName - the name of the setting // setting - setting object func (client SettingsClient) Update(ctx context.Context, settingName string, setting BasicSetting) (result SettingModel, err error) { if tracing.IsEnabled() { @@ -280,7 +280,7 @@ func (client SettingsClient) UpdatePreparer(ctx context.Context, settingName str "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-01-01" + const APIVersion = "2021-06-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, }