From 3ed5a6deb24f80ccb546b7c3d15a245b376ee8a8 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 9 Jul 2019 08:47:13 +0000 Subject: [PATCH 1/3] Generated from 0bc0b6465c2c93267a29e4eb0c39e2b12a8b623e add operation ID's --- .../preview/security/mgmt/security/models.go | 184 +++++++- .../mgmt/security/securityapi/models.go | 1 + .../security/adaptiveapplicationcontrols.go | 296 ++++++++++++ .../security/mgmt/v1.0/security/models.go | 446 +++++++++++++++++- .../v1.0/security/securityapi/interfaces.go | 9 + .../security/adaptiveapplicationcontrols.go | 296 ++++++++++++ .../security/mgmt/v2.0/security/models.go | 446 +++++++++++++++++- .../v2.0/security/securityapi/interfaces.go | 9 + .../security/adaptiveapplicationcontrols.go | 296 ++++++++++++ .../security/mgmt/v3.0/security/models.go | 445 ++++++++++++++++- .../v3.0/security/securityapi/interfaces.go | 9 + 11 files changed, 2396 insertions(+), 41 deletions(-) create mode 100644 services/preview/security/mgmt/v1.0/security/adaptiveapplicationcontrols.go create mode 100644 services/preview/security/mgmt/v2.0/security/adaptiveapplicationcontrols.go create mode 100644 services/preview/security/mgmt/v3.0/security/adaptiveapplicationcontrols.go diff --git a/profiles/preview/preview/security/mgmt/security/models.go b/profiles/preview/preview/security/mgmt/security/models.go index cfbee9f1de94..0ca39a909189 100644 --- a/profiles/preview/preview/security/mgmt/security/models.go +++ b/profiles/preview/preview/security/mgmt/security/models.go @@ -37,6 +37,14 @@ const ( NotLicensed AadConnectivityState = original.NotLicensed ) +type Action = original.Action + +const ( + Add Action = original.Add + Recommended Action = original.Recommended + Remove Action = original.Remove +) + type AlertNotifications = original.AlertNotifications const ( @@ -58,6 +66,36 @@ const ( AutoProvisionOn AutoProvision = original.AutoProvisionOn ) +type ConfigurationStatus = original.ConfigurationStatus + +const ( + Configured ConfigurationStatus = original.Configured + Failed ConfigurationStatus = original.Failed + InProgress ConfigurationStatus = original.InProgress + NoStatus ConfigurationStatus = original.NoStatus + NotConfigured ConfigurationStatus = original.NotConfigured +) + +type ConfigurationStatus1 = original.ConfigurationStatus1 + +const ( + ConfigurationStatus1Configured ConfigurationStatus1 = original.ConfigurationStatus1Configured + ConfigurationStatus1Failed ConfigurationStatus1 = original.ConfigurationStatus1Failed + ConfigurationStatus1InProgress ConfigurationStatus1 = original.ConfigurationStatus1InProgress + ConfigurationStatus1NoStatus ConfigurationStatus1 = original.ConfigurationStatus1NoStatus + ConfigurationStatus1NotConfigured ConfigurationStatus1 = original.ConfigurationStatus1NotConfigured +) + +type ConfigurationStatus2 = original.ConfigurationStatus2 + +const ( + ConfigurationStatus2Configured ConfigurationStatus2 = original.ConfigurationStatus2Configured + ConfigurationStatus2Failed ConfigurationStatus2 = original.ConfigurationStatus2Failed + ConfigurationStatus2InProgress ConfigurationStatus2 = original.ConfigurationStatus2InProgress + ConfigurationStatus2NoStatus ConfigurationStatus2 = original.ConfigurationStatus2NoStatus + ConfigurationStatus2NotConfigured ConfigurationStatus2 = original.ConfigurationStatus2NotConfigured +) + type ConnectionType = original.ConnectionType const ( @@ -65,6 +103,20 @@ const ( Internal ConnectionType = original.Internal ) +type EnforcementMode = original.EnforcementMode + +const ( + Audit EnforcementMode = original.Audit + Enforce EnforcementMode = original.Enforce +) + +type EnforcementMode1 = original.EnforcementMode1 + +const ( + EnforcementMode1Audit EnforcementMode1 = original.EnforcementMode1Audit + EnforcementMode1Enforce EnforcementMode1 = original.EnforcementMode1Enforce +) + type ExternalSecuritySolutionKind = original.ExternalSecuritySolutionKind const ( @@ -82,6 +134,27 @@ const ( Waf Family = original.Waf ) +type FileType = original.FileType + +const ( + Dll FileType = original.Dll + Exe FileType = original.Exe + Msi FileType = original.Msi + Script FileType = original.Script + Unknown FileType = original.Unknown +) + +type Issue = original.Issue + +const ( + ExecutableViolationsAudited Issue = original.ExecutableViolationsAudited + MsiAndScriptViolationsAudited Issue = original.MsiAndScriptViolationsAudited + MsiAndScriptViolationsBlocked Issue = original.MsiAndScriptViolationsBlocked + RulesViolatedManually Issue = original.RulesViolatedManually + ViolationsAudited Issue = original.ViolationsAudited + ViolationsBlocked Issue = original.ViolationsBlocked +) + type KindEnum = original.KindEnum const ( @@ -109,11 +182,36 @@ const ( type ProvisioningState = original.ProvisioningState const ( - Canceled ProvisioningState = original.Canceled - Deprovisioning ProvisioningState = original.Deprovisioning - Failed ProvisioningState = original.Failed - Provisioning ProvisioningState = original.Provisioning - Succeeded ProvisioningState = original.Succeeded + ProvisioningStateCanceled ProvisioningState = original.ProvisioningStateCanceled + ProvisioningStateDeprovisioning ProvisioningState = original.ProvisioningStateDeprovisioning + ProvisioningStateFailed ProvisioningState = original.ProvisioningStateFailed + ProvisioningStateProvisioning ProvisioningState = original.ProvisioningStateProvisioning + ProvisioningStateSucceeded ProvisioningState = original.ProvisioningStateSucceeded +) + +type RecommendationAction = original.RecommendationAction + +const ( + RecommendationActionAdd RecommendationAction = original.RecommendationActionAdd + RecommendationActionRecommended RecommendationAction = original.RecommendationActionRecommended + RecommendationActionRemove RecommendationAction = original.RecommendationActionRemove +) + +type RecommendationAction1 = original.RecommendationAction1 + +const ( + RecommendationAction1Add RecommendationAction1 = original.RecommendationAction1Add + RecommendationAction1Recommended RecommendationAction1 = original.RecommendationAction1Recommended + RecommendationAction1Remove RecommendationAction1 = original.RecommendationAction1Remove +) + +type RecommendationStatus = original.RecommendationStatus + +const ( + RecommendationStatusNoStatus RecommendationStatus = original.RecommendationStatusNoStatus + RecommendationStatusNotAvailable RecommendationStatus = original.RecommendationStatusNotAvailable + RecommendationStatusNotRecommended RecommendationStatus = original.RecommendationStatusNotRecommended + RecommendationStatusRecommended RecommendationStatus = original.RecommendationStatusRecommended ) type ReportedSeverity = original.ReportedSeverity @@ -141,6 +239,16 @@ const ( SettingKindDataExportSetting SettingKind = original.SettingKindDataExportSetting ) +type SourceSystem = original.SourceSystem + +const ( + AzureAppLocker SourceSystem = original.AzureAppLocker + AzureAuditD SourceSystem = original.AzureAuditD + NonAzureAppLocker SourceSystem = original.NonAzureAppLocker + NonAzureAuditD SourceSystem = original.NonAzureAuditD + None SourceSystem = original.None +) + type State = original.State const ( @@ -165,9 +273,21 @@ const ( UserRequested StatusReason = original.UserRequested ) +type Type = original.Type + +const ( + BinarySignature Type = original.BinarySignature + File Type = original.File + FileHash Type = original.FileHash + ProductSignature Type = original.ProductSignature + PublisherSignature Type = original.PublisherSignature + VersionAndAboveSignature Type = original.VersionAndAboveSignature +) + type AadConnectivityState1 = original.AadConnectivityState1 type AadExternalSecuritySolution = original.AadExternalSecuritySolution type AadSolutionProperties = original.AadSolutionProperties +type AdaptiveApplicationControlsClient = original.AdaptiveApplicationControlsClient type AdvancedThreatProtectionClient = original.AdvancedThreatProtectionClient type AdvancedThreatProtectionProperties = original.AdvancedThreatProtectionProperties type AdvancedThreatProtectionSetting = original.AdvancedThreatProtectionSetting @@ -185,6 +305,11 @@ type AllowedConnectionsListIterator = original.AllowedConnectionsListIterator type AllowedConnectionsListPage = original.AllowedConnectionsListPage type AllowedConnectionsResource = original.AllowedConnectionsResource type AllowedConnectionsResourceProperties = original.AllowedConnectionsResourceProperties +type AppWhitelistingGroup = original.AppWhitelistingGroup +type AppWhitelistingGroupData = original.AppWhitelistingGroupData +type AppWhitelistingGroups = original.AppWhitelistingGroups +type AppWhitelistingIssueSummary = original.AppWhitelistingIssueSummary +type AppWhitelistingPutGroupData = original.AppWhitelistingPutGroupData type AscLocation = original.AscLocation type AscLocationList = original.AscLocationList type AscLocationListIterator = original.AscLocationListIterator @@ -272,10 +397,12 @@ type OperationList = original.OperationList type OperationListIterator = original.OperationListIterator type OperationListPage = original.OperationListPage type OperationsClient = original.OperationsClient +type PathRecommendation = original.PathRecommendation type Pricing = original.Pricing type PricingList = original.PricingList type PricingProperties = original.PricingProperties type PricingsClient = original.PricingsClient +type PublisherInfo = original.PublisherInfo type RegulatoryComplianceAssessment = original.RegulatoryComplianceAssessment type RegulatoryComplianceAssessmentList = original.RegulatoryComplianceAssessmentList type RegulatoryComplianceAssessmentListIterator = original.RegulatoryComplianceAssessmentListIterator @@ -322,6 +449,8 @@ type TopologyResourceProperties = original.TopologyResourceProperties type TopologySingleResource = original.TopologySingleResource type TopologySingleResourceChild = original.TopologySingleResourceChild type TopologySingleResourceParent = original.TopologySingleResourceParent +type UserRecommendation = original.UserRecommendation +type VMRecommendation = original.VMRecommendation type WorkspaceSetting = original.WorkspaceSetting type WorkspaceSettingList = original.WorkspaceSettingList type WorkspaceSettingListIterator = original.WorkspaceSettingListIterator @@ -332,6 +461,12 @@ type WorkspaceSettingsClient = original.WorkspaceSettingsClient func New(subscriptionID string, ascLocation string) BaseClient { return original.New(subscriptionID, ascLocation) } +func NewAdaptiveApplicationControlsClient(subscriptionID string, ascLocation string) AdaptiveApplicationControlsClient { + return original.NewAdaptiveApplicationControlsClient(subscriptionID, ascLocation) +} +func NewAdaptiveApplicationControlsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) AdaptiveApplicationControlsClient { + return original.NewAdaptiveApplicationControlsClientWithBaseURI(baseURI, subscriptionID, ascLocation) +} func NewAdvancedThreatProtectionClient(subscriptionID string, ascLocation string) AdvancedThreatProtectionClient { return original.NewAdvancedThreatProtectionClient(subscriptionID, ascLocation) } @@ -584,6 +719,9 @@ func NewWorkspaceSettingsClientWithBaseURI(baseURI string, subscriptionID string func PossibleAadConnectivityStateValues() []AadConnectivityState { return original.PossibleAadConnectivityStateValues() } +func PossibleActionValues() []Action { + return original.PossibleActionValues() +} func PossibleAlertNotificationsValues() []AlertNotifications { return original.PossibleAlertNotificationsValues() } @@ -593,15 +731,36 @@ func PossibleAlertsToAdminsValues() []AlertsToAdmins { func PossibleAutoProvisionValues() []AutoProvision { return original.PossibleAutoProvisionValues() } +func PossibleConfigurationStatus1Values() []ConfigurationStatus1 { + return original.PossibleConfigurationStatus1Values() +} +func PossibleConfigurationStatus2Values() []ConfigurationStatus2 { + return original.PossibleConfigurationStatus2Values() +} +func PossibleConfigurationStatusValues() []ConfigurationStatus { + return original.PossibleConfigurationStatusValues() +} func PossibleConnectionTypeValues() []ConnectionType { return original.PossibleConnectionTypeValues() } +func PossibleEnforcementMode1Values() []EnforcementMode1 { + return original.PossibleEnforcementMode1Values() +} +func PossibleEnforcementModeValues() []EnforcementMode { + return original.PossibleEnforcementModeValues() +} func PossibleExternalSecuritySolutionKindValues() []ExternalSecuritySolutionKind { return original.PossibleExternalSecuritySolutionKindValues() } func PossibleFamilyValues() []Family { return original.PossibleFamilyValues() } +func PossibleFileTypeValues() []FileType { + return original.PossibleFileTypeValues() +} +func PossibleIssueValues() []Issue { + return original.PossibleIssueValues() +} func PossibleKindEnumValues() []KindEnum { return original.PossibleKindEnumValues() } @@ -614,6 +773,15 @@ func PossibleProtocolValues() []Protocol { func PossibleProvisioningStateValues() []ProvisioningState { return original.PossibleProvisioningStateValues() } +func PossibleRecommendationAction1Values() []RecommendationAction1 { + return original.PossibleRecommendationAction1Values() +} +func PossibleRecommendationActionValues() []RecommendationAction { + return original.PossibleRecommendationActionValues() +} +func PossibleRecommendationStatusValues() []RecommendationStatus { + return original.PossibleRecommendationStatusValues() +} func PossibleReportedSeverityValues() []ReportedSeverity { return original.PossibleReportedSeverityValues() } @@ -623,6 +791,9 @@ func PossibleResourceStatusValues() []ResourceStatus { func PossibleSettingKindValues() []SettingKind { return original.PossibleSettingKindValues() } +func PossibleSourceSystemValues() []SourceSystem { + return original.PossibleSourceSystemValues() +} func PossibleStateValues() []State { return original.PossibleStateValues() } @@ -632,6 +803,9 @@ func PossibleStatusReasonValues() []StatusReason { func PossibleStatusValues() []Status { return original.PossibleStatusValues() } +func PossibleTypeValues() []Type { + return original.PossibleTypeValues() +} func UserAgent() string { return original.UserAgent() + " profiles/preview" } diff --git a/profiles/preview/preview/security/mgmt/security/securityapi/models.go b/profiles/preview/preview/security/mgmt/security/securityapi/models.go index 87d60a743168..f7833e384019 100644 --- a/profiles/preview/preview/security/mgmt/security/securityapi/models.go +++ b/profiles/preview/preview/security/mgmt/security/securityapi/models.go @@ -21,6 +21,7 @@ package securityapi import original "github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v3.0/security/securityapi" +type AdaptiveApplicationControlsClientAPI = original.AdaptiveApplicationControlsClientAPI type AdvancedThreatProtectionClientAPI = original.AdvancedThreatProtectionClientAPI type AlertsClientAPI = original.AlertsClientAPI type AllowedConnectionsClientAPI = original.AllowedConnectionsClientAPI diff --git a/services/preview/security/mgmt/v1.0/security/adaptiveapplicationcontrols.go b/services/preview/security/mgmt/v1.0/security/adaptiveapplicationcontrols.go new file mode 100644 index 000000000000..8fe79f24b6d0 --- /dev/null +++ b/services/preview/security/mgmt/v1.0/security/adaptiveapplicationcontrols.go @@ -0,0 +1,296 @@ +package security + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AdaptiveApplicationControlsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type AdaptiveApplicationControlsClient struct { + BaseClient +} + +// NewAdaptiveApplicationControlsClient creates an instance of the AdaptiveApplicationControlsClient client. +func NewAdaptiveApplicationControlsClient(subscriptionID string, ascLocation string) AdaptiveApplicationControlsClient { + return NewAdaptiveApplicationControlsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewAdaptiveApplicationControlsClientWithBaseURI creates an instance of the AdaptiveApplicationControlsClient client. +func NewAdaptiveApplicationControlsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) AdaptiveApplicationControlsClient { + return AdaptiveApplicationControlsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// Get gets an application control VM/server group. +// Parameters: +// groupName - name of an application control VM/server group +func (client AdaptiveApplicationControlsClient) Get(ctx context.Context, groupName string) (result AppWhitelistingGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AdaptiveApplicationControlsClient.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.AdaptiveApplicationControlsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, groupName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "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.AdaptiveApplicationControlsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AdaptiveApplicationControlsClient) GetPreparer(ctx context.Context, groupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ascLocation": autorest.Encode("path", client.AscLocation), + "groupName": autorest.Encode("path", groupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-06-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/locations/{ascLocation}/applicationWhitelistings/{groupName}", 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 AdaptiveApplicationControlsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AdaptiveApplicationControlsClient) GetResponder(resp *http.Response) (result AppWhitelistingGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of application control VM/server groups for the subscription. +// Parameters: +// includePathRecommendations - include the policy rules +// summary - return output in a summarized form +func (client AdaptiveApplicationControlsClient) List(ctx context.Context, includePathRecommendations *bool, summary *bool) (result AppWhitelistingGroups, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AdaptiveApplicationControlsClient.List") + 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.AdaptiveApplicationControlsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, includePathRecommendations, summary) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AdaptiveApplicationControlsClient) ListPreparer(ctx context.Context, includePathRecommendations *bool, summary *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if includePathRecommendations != nil { + queryParameters["includePathRecommendations"] = autorest.Encode("query", *includePathRecommendations) + } + if summary != nil { + queryParameters["summary"] = autorest.Encode("query", *summary) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings", 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 AdaptiveApplicationControlsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AdaptiveApplicationControlsClient) ListResponder(resp *http.Response) (result AppWhitelistingGroups, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Put update an application control VM/server group +// Parameters: +// groupName - name of an application control VM/server group +// body - the updated VM/server group data +func (client AdaptiveApplicationControlsClient) Put(ctx context.Context, groupName string, body AppWhitelistingPutGroupData) (result AppWhitelistingGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AdaptiveApplicationControlsClient.Put") + 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.AdaptiveApplicationControlsClient", "Put", err.Error()) + } + + req, err := client.PutPreparer(ctx, groupName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Put", nil, "Failure preparing request") + return + } + + resp, err := client.PutSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Put", resp, "Failure sending request") + return + } + + result, err = client.PutResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Put", resp, "Failure responding to request") + } + + return +} + +// PutPreparer prepares the Put request. +func (client AdaptiveApplicationControlsClient) PutPreparer(ctx context.Context, groupName string, body AppWhitelistingPutGroupData) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ascLocation": autorest.Encode("path", client.AscLocation), + "groupName": autorest.Encode("path", groupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PutSender sends the Put request. The method will close the +// http.Response Body if it receives an error. +func (client AdaptiveApplicationControlsClient) PutSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// PutResponder handles the response to the Put request. The method always +// closes the http.Response Body. +func (client AdaptiveApplicationControlsClient) PutResponder(resp *http.Response) (result AppWhitelistingGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/security/mgmt/v1.0/security/models.go b/services/preview/security/mgmt/v1.0/security/models.go index a3517580ed06..686c939c82bf 100644 --- a/services/preview/security/mgmt/v1.0/security/models.go +++ b/services/preview/security/mgmt/v1.0/security/models.go @@ -49,6 +49,23 @@ func PossibleAadConnectivityStateValues() []AadConnectivityState { return []AadConnectivityState{Connected, Discovered, NotLicensed} } +// Action enumerates the values for action. +type Action string + +const ( + // Add ... + Add Action = "Add" + // Recommended ... + Recommended Action = "Recommended" + // Remove ... + Remove Action = "Remove" +) + +// PossibleActionValues returns an array of possible values for the Action const type. +func PossibleActionValues() []Action { + return []Action{Add, Recommended, Remove} +} + // AlertNotifications enumerates the values for alert notifications. type AlertNotifications string @@ -94,6 +111,69 @@ func PossibleAutoProvisionValues() []AutoProvision { return []AutoProvision{AutoProvisionOff, AutoProvisionOn} } +// ConfigurationStatus enumerates the values for configuration status. +type ConfigurationStatus string + +const ( + // Configured ... + Configured ConfigurationStatus = "Configured" + // Failed ... + Failed ConfigurationStatus = "Failed" + // InProgress ... + InProgress ConfigurationStatus = "InProgress" + // NoStatus ... + NoStatus ConfigurationStatus = "NoStatus" + // NotConfigured ... + NotConfigured ConfigurationStatus = "NotConfigured" +) + +// PossibleConfigurationStatusValues returns an array of possible values for the ConfigurationStatus const type. +func PossibleConfigurationStatusValues() []ConfigurationStatus { + return []ConfigurationStatus{Configured, Failed, InProgress, NoStatus, NotConfigured} +} + +// ConfigurationStatus1 enumerates the values for configuration status 1. +type ConfigurationStatus1 string + +const ( + // ConfigurationStatus1Configured ... + ConfigurationStatus1Configured ConfigurationStatus1 = "Configured" + // ConfigurationStatus1Failed ... + ConfigurationStatus1Failed ConfigurationStatus1 = "Failed" + // ConfigurationStatus1InProgress ... + ConfigurationStatus1InProgress ConfigurationStatus1 = "InProgress" + // ConfigurationStatus1NoStatus ... + ConfigurationStatus1NoStatus ConfigurationStatus1 = "NoStatus" + // ConfigurationStatus1NotConfigured ... + ConfigurationStatus1NotConfigured ConfigurationStatus1 = "NotConfigured" +) + +// PossibleConfigurationStatus1Values returns an array of possible values for the ConfigurationStatus1 const type. +func PossibleConfigurationStatus1Values() []ConfigurationStatus1 { + return []ConfigurationStatus1{ConfigurationStatus1Configured, ConfigurationStatus1Failed, ConfigurationStatus1InProgress, ConfigurationStatus1NoStatus, ConfigurationStatus1NotConfigured} +} + +// ConfigurationStatus2 enumerates the values for configuration status 2. +type ConfigurationStatus2 string + +const ( + // ConfigurationStatus2Configured ... + ConfigurationStatus2Configured ConfigurationStatus2 = "Configured" + // ConfigurationStatus2Failed ... + ConfigurationStatus2Failed ConfigurationStatus2 = "Failed" + // ConfigurationStatus2InProgress ... + ConfigurationStatus2InProgress ConfigurationStatus2 = "InProgress" + // ConfigurationStatus2NoStatus ... + ConfigurationStatus2NoStatus ConfigurationStatus2 = "NoStatus" + // ConfigurationStatus2NotConfigured ... + ConfigurationStatus2NotConfigured ConfigurationStatus2 = "NotConfigured" +) + +// PossibleConfigurationStatus2Values returns an array of possible values for the ConfigurationStatus2 const type. +func PossibleConfigurationStatus2Values() []ConfigurationStatus2 { + return []ConfigurationStatus2{ConfigurationStatus2Configured, ConfigurationStatus2Failed, ConfigurationStatus2InProgress, ConfigurationStatus2NoStatus, ConfigurationStatus2NotConfigured} +} + // ConnectionType enumerates the values for connection type. type ConnectionType string @@ -124,6 +204,36 @@ func PossibleDirectionValues() []Direction { return []Direction{Inbound, Outbound} } +// EnforcementMode enumerates the values for enforcement mode. +type EnforcementMode string + +const ( + // Audit ... + Audit EnforcementMode = "Audit" + // Enforce ... + Enforce EnforcementMode = "Enforce" +) + +// PossibleEnforcementModeValues returns an array of possible values for the EnforcementMode const type. +func PossibleEnforcementModeValues() []EnforcementMode { + return []EnforcementMode{Audit, Enforce} +} + +// EnforcementMode1 enumerates the values for enforcement mode 1. +type EnforcementMode1 string + +const ( + // EnforcementMode1Audit ... + EnforcementMode1Audit EnforcementMode1 = "Audit" + // EnforcementMode1Enforce ... + EnforcementMode1Enforce EnforcementMode1 = "Enforce" +) + +// PossibleEnforcementMode1Values returns an array of possible values for the EnforcementMode1 const type. +func PossibleEnforcementMode1Values() []EnforcementMode1 { + return []EnforcementMode1{EnforcementMode1Audit, EnforcementMode1Enforce} +} + // ExternalSecuritySolutionKind enumerates the values for external security solution kind. type ExternalSecuritySolutionKind string @@ -160,6 +270,50 @@ func PossibleFamilyValues() []Family { return []Family{Ngfw, SaasWaf, Va, Waf} } +// FileType enumerates the values for file type. +type FileType string + +const ( + // Dll ... + Dll FileType = "Dll" + // Exe ... + Exe FileType = "Exe" + // Msi ... + Msi FileType = "Msi" + // Script ... + Script FileType = "Script" + // Unknown ... + Unknown FileType = "Unknown" +) + +// PossibleFileTypeValues returns an array of possible values for the FileType const type. +func PossibleFileTypeValues() []FileType { + return []FileType{Dll, Exe, Msi, Script, Unknown} +} + +// Issue enumerates the values for issue. +type Issue string + +const ( + // ExecutableViolationsAudited ... + ExecutableViolationsAudited Issue = "ExecutableViolationsAudited" + // MsiAndScriptViolationsAudited ... + MsiAndScriptViolationsAudited Issue = "MsiAndScriptViolationsAudited" + // MsiAndScriptViolationsBlocked ... + MsiAndScriptViolationsBlocked Issue = "MsiAndScriptViolationsBlocked" + // RulesViolatedManually ... + RulesViolatedManually Issue = "RulesViolatedManually" + // ViolationsAudited ... + ViolationsAudited Issue = "ViolationsAudited" + // ViolationsBlocked ... + ViolationsBlocked Issue = "ViolationsBlocked" +) + +// PossibleIssueValues returns an array of possible values for the Issue const type. +func PossibleIssueValues() []Issue { + return []Issue{ExecutableViolationsAudited, MsiAndScriptViolationsAudited, MsiAndScriptViolationsBlocked, RulesViolatedManually, ViolationsAudited, ViolationsBlocked} +} + // KindEnum enumerates the values for kind enum. type KindEnum string @@ -211,6 +365,59 @@ func PossibleProtocolValues() []Protocol { return []Protocol{All, TCP, UDP} } +// RecommendationAction enumerates the values for recommendation action. +type RecommendationAction string + +const ( + // RecommendationActionAdd ... + RecommendationActionAdd RecommendationAction = "Add" + // RecommendationActionRecommended ... + RecommendationActionRecommended RecommendationAction = "Recommended" + // RecommendationActionRemove ... + RecommendationActionRemove RecommendationAction = "Remove" +) + +// PossibleRecommendationActionValues returns an array of possible values for the RecommendationAction const type. +func PossibleRecommendationActionValues() []RecommendationAction { + return []RecommendationAction{RecommendationActionAdd, RecommendationActionRecommended, RecommendationActionRemove} +} + +// RecommendationAction1 enumerates the values for recommendation action 1. +type RecommendationAction1 string + +const ( + // RecommendationAction1Add ... + RecommendationAction1Add RecommendationAction1 = "Add" + // RecommendationAction1Recommended ... + RecommendationAction1Recommended RecommendationAction1 = "Recommended" + // RecommendationAction1Remove ... + RecommendationAction1Remove RecommendationAction1 = "Remove" +) + +// PossibleRecommendationAction1Values returns an array of possible values for the RecommendationAction1 const type. +func PossibleRecommendationAction1Values() []RecommendationAction1 { + return []RecommendationAction1{RecommendationAction1Add, RecommendationAction1Recommended, RecommendationAction1Remove} +} + +// RecommendationStatus enumerates the values for recommendation status. +type RecommendationStatus string + +const ( + // RecommendationStatusNoStatus ... + RecommendationStatusNoStatus RecommendationStatus = "NoStatus" + // RecommendationStatusNotAvailable ... + RecommendationStatusNotAvailable RecommendationStatus = "NotAvailable" + // RecommendationStatusNotRecommended ... + RecommendationStatusNotRecommended RecommendationStatus = "NotRecommended" + // RecommendationStatusRecommended ... + RecommendationStatusRecommended RecommendationStatus = "Recommended" +) + +// PossibleRecommendationStatusValues returns an array of possible values for the RecommendationStatus const type. +func PossibleRecommendationStatusValues() []RecommendationStatus { + return []RecommendationStatus{RecommendationStatusNoStatus, RecommendationStatusNotAvailable, RecommendationStatusNotRecommended, RecommendationStatusRecommended} +} + // ReportedSeverity enumerates the values for reported severity. type ReportedSeverity string @@ -245,23 +452,45 @@ func PossibleSettingKindValues() []SettingKind { return []SettingKind{SettingKindAlertSuppressionSetting, SettingKindDataExportSetting} } +// SourceSystem enumerates the values for source system. +type SourceSystem string + +const ( + // AzureAppLocker ... + AzureAppLocker SourceSystem = "Azure_AppLocker" + // AzureAuditD ... + AzureAuditD SourceSystem = "Azure_AuditD" + // NonAzureAppLocker ... + NonAzureAppLocker SourceSystem = "NonAzure_AppLocker" + // NonAzureAuditD ... + NonAzureAuditD SourceSystem = "NonAzure_AuditD" + // None ... + None SourceSystem = "None" +) + +// PossibleSourceSystemValues returns an array of possible values for the SourceSystem const type. +func PossibleSourceSystemValues() []SourceSystem { + return []SourceSystem{AzureAppLocker, AzureAuditD, NonAzureAppLocker, NonAzureAuditD, None} +} + // State enumerates the values for state. type State string const ( - // Failed At least one supported regulatory compliance control in the given standard has a state of failed - Failed State = "Failed" - // Passed All supported regulatory compliance controls in the given standard have a passed state - Passed State = "Passed" - // Skipped All supported regulatory compliance controls in the given standard have a state of skipped - Skipped State = "Skipped" - // Unsupported No supported regulatory compliance data for the given standard - Unsupported State = "Unsupported" + // StateFailed At least one supported regulatory compliance control in the given standard has a state of + // failed + StateFailed State = "Failed" + // StatePassed All supported regulatory compliance controls in the given standard have a passed state + StatePassed State = "Passed" + // StateSkipped All supported regulatory compliance controls in the given standard have a state of skipped + StateSkipped State = "Skipped" + // StateUnsupported No supported regulatory compliance data for the given standard + StateUnsupported State = "Unsupported" ) // PossibleStateValues returns an array of possible values for the State const type. func PossibleStateValues() []State { - return []State{Failed, Passed, Skipped, Unsupported} + return []State{StateFailed, StatePassed, StateSkipped, StateUnsupported} } // Status enumerates the values for status. @@ -311,6 +540,29 @@ func PossibleTransportProtocolValues() []TransportProtocol { return []TransportProtocol{TransportProtocolTCP, TransportProtocolUDP} } +// Type enumerates the values for type. +type Type string + +const ( + // BinarySignature ... + BinarySignature Type = "BinarySignature" + // File ... + File Type = "File" + // FileHash ... + FileHash Type = "FileHash" + // ProductSignature ... + ProductSignature Type = "ProductSignature" + // PublisherSignature ... + PublisherSignature Type = "PublisherSignature" + // VersionAndAboveSignature ... + VersionAndAboveSignature Type = "VersionAndAboveSignature" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{BinarySignature, File, FileHash, ProductSignature, PublisherSignature, VersionAndAboveSignature} +} + // ValueType enumerates the values for value type. type ValueType string @@ -1331,6 +1583,128 @@ type AllowlistCustomAlertRule struct { RuleType *string `json:"ruleType,omitempty"` } +// AppWhitelistingGroup ... +type AppWhitelistingGroup struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Location where the resource is stored + Location *string `json:"location,omitempty"` + *AppWhitelistingGroupData `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppWhitelistingGroup. +func (awg AppWhitelistingGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if awg.AppWhitelistingGroupData != nil { + objectMap["properties"] = awg.AppWhitelistingGroupData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AppWhitelistingGroup struct. +func (awg *AppWhitelistingGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + awg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + awg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + awg.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + awg.Location = &location + } + case "properties": + if v != nil { + var appWhitelistingGroupData AppWhitelistingGroupData + err = json.Unmarshal(*v, &appWhitelistingGroupData) + if err != nil { + return err + } + awg.AppWhitelistingGroupData = &appWhitelistingGroupData + } + } + } + + return nil +} + +// AppWhitelistingGroupData represents a VM/server group and set of rules that are Recommended by Azure +// Security Center to be allowed +type AppWhitelistingGroupData struct { + // EnforcementMode - Possible values include: 'Audit', 'Enforce' + EnforcementMode EnforcementMode `json:"enforcementMode,omitempty"` + // ConfigurationStatus - Possible values include: 'ConfigurationStatus2Configured', 'ConfigurationStatus2NotConfigured', 'ConfigurationStatus2InProgress', 'ConfigurationStatus2Failed', 'ConfigurationStatus2NoStatus' + ConfigurationStatus ConfigurationStatus2 `json:"configurationStatus,omitempty"` + // RecommendationStatus - Possible values include: 'RecommendationStatusRecommended', 'RecommendationStatusNotRecommended', 'RecommendationStatusNotAvailable', 'RecommendationStatusNoStatus' + RecommendationStatus RecommendationStatus `json:"recommendationStatus,omitempty"` + Issues *[]AppWhitelistingIssueSummary `json:"issues,omitempty"` + // SourceSystem - Possible values include: 'AzureAppLocker', 'AzureAuditD', 'NonAzureAppLocker', 'NonAzureAuditD', 'None' + SourceSystem SourceSystem `json:"sourceSystem,omitempty"` + VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` + PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +} + +// AppWhitelistingGroups represents a list of VM/server groups and set of rules that are Recommended by +// Azure Security Center to be allowed +type AppWhitelistingGroups struct { + autorest.Response `json:"-"` + Value *[]AppWhitelistingGroup `json:"value,omitempty"` +} + +// AppWhitelistingIssueSummary represents a summary of the alerts of the VM/server group +type AppWhitelistingIssueSummary struct { + // Issue - Possible values include: 'ViolationsAudited', 'ViolationsBlocked', 'MsiAndScriptViolationsAudited', 'MsiAndScriptViolationsBlocked', 'ExecutableViolationsAudited', 'RulesViolatedManually' + Issue Issue `json:"issue,omitempty"` + // NumberOfVms - The number of machines in the VM/server group that have this alert + NumberOfVms *float64 `json:"numberOfVms,omitempty"` +} + +// AppWhitelistingPutGroupData the altered data of the recommended VM/server group policy +type AppWhitelistingPutGroupData struct { + // EnforcementMode - Possible values include: 'EnforcementMode1Audit', 'EnforcementMode1Enforce' + EnforcementMode EnforcementMode1 `json:"enforcementMode,omitempty"` + VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` + PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +} + // AscLocation the ASC location of the subscription is in the "name" field type AscLocation struct { autorest.Response `json:"-"` @@ -4362,6 +4736,25 @@ func NewOperationListPage(getNextPage func(context.Context, OperationList) (Oper return OperationListPage{fn: getNextPage} } +// PathRecommendation represents a path that is recommended to be allowed and its properties +type PathRecommendation struct { + // Path - The full path to whitelist + Path *string `json:"path,omitempty"` + // Action - Possible values include: 'Recommended', 'Add', 'Remove' + Action Action `json:"action,omitempty"` + // Type - Possible values include: 'File', 'FileHash', 'PublisherSignature', 'ProductSignature', 'BinarySignature', 'VersionAndAboveSignature' + Type Type `json:"type,omitempty"` + PublisherInfo *PublisherInfo `json:"publisherInfo,omitempty"` + // Common - Whether the path is commonly run on the machine + Common *bool `json:"common,omitempty"` + UserSids *[]string `json:"userSids,omitempty"` + Usernames *[]UserRecommendation `json:"usernames,omitempty"` + // FileType - Possible values include: 'Exe', 'Dll', 'Msi', 'Script', 'Unknown' + FileType FileType `json:"fileType,omitempty"` + // ConfigurationStatus - Possible values include: 'ConfigurationStatus1Configured', 'ConfigurationStatus1NotConfigured', 'ConfigurationStatus1InProgress', 'ConfigurationStatus1Failed', 'ConfigurationStatus1NoStatus' + ConfigurationStatus ConfigurationStatus1 `json:"configurationStatus,omitempty"` +} + // Pricing pricing tier will be applied for the scope based on the resource ID type Pricing struct { autorest.Response `json:"-"` @@ -4587,6 +4980,18 @@ type PricingProperties struct { PricingTier PricingTier `json:"pricingTier,omitempty"` } +// PublisherInfo represents the publisher information of a process/rule +type PublisherInfo struct { + // PublisherName - The Subject field of the x.509 certificate used to sign the code, using the following fields - O = Organization, L = Locality, S = State or Province, and C = Country + PublisherName *string `json:"publisherName,omitempty"` + // ProductName - The product name taken from the file's version resource + ProductName *string `json:"productName,omitempty"` + // BinaryName - The "OriginalName" field taken from the file's version resource + BinaryName *string `json:"binaryName,omitempty"` + // Version - The binary file version taken from the file's version resource + Version *string `json:"version,omitempty"` +} + // RegulatoryComplianceAssessment regulatory compliance assessment details and state type RegulatoryComplianceAssessment struct { autorest.Response `json:"-"` @@ -4814,7 +5219,7 @@ type RegulatoryComplianceAssessmentProperties struct { AssessmentType *string `json:"assessmentType,omitempty"` // AssessmentDetailsLink - READ-ONLY; Link to more detailed assessment results data. The response type will be according to the assessmentType field AssessmentDetailsLink *string `json:"assessmentDetailsLink,omitempty"` - // State - Aggregative state based on the assessment's scanned resources states. Possible values include: 'Passed', 'Failed', 'Skipped', 'Unsupported' + // State - Aggregative state based on the assessment's scanned resources states. Possible values include: 'StatePassed', 'StateFailed', 'StateSkipped', 'StateUnsupported' State State `json:"state,omitempty"` // PassedResources - READ-ONLY; The given assessment's related resources count with passed state. PassedResources *int32 `json:"passedResources,omitempty"` @@ -5050,7 +5455,7 @@ func NewRegulatoryComplianceControlListPage(getNextPage func(context.Context, Re type RegulatoryComplianceControlProperties struct { // Description - READ-ONLY; The description of the regulatory compliance control Description *string `json:"description,omitempty"` - // State - Aggregative state based on the control's supported assessments states. Possible values include: 'Passed', 'Failed', 'Skipped', 'Unsupported' + // State - Aggregative state based on the control's supported assessments states. Possible values include: 'StatePassed', 'StateFailed', 'StateSkipped', 'StateUnsupported' State State `json:"state,omitempty"` // PassedAssessments - READ-ONLY; The number of supported regulatory compliance assessments of the given control with a passed state PassedAssessments *int32 `json:"passedAssessments,omitempty"` @@ -5281,7 +5686,7 @@ func NewRegulatoryComplianceStandardListPage(getNextPage func(context.Context, R // RegulatoryComplianceStandardProperties regulatory compliance standard data type RegulatoryComplianceStandardProperties struct { - // State - Aggregative state based on the standard's supported controls states. Possible values include: 'Passed', 'Failed', 'Skipped', 'Unsupported' + // State - Aggregative state based on the standard's supported controls states. Possible values include: 'StatePassed', 'StateFailed', 'StateSkipped', 'StateUnsupported' State State `json:"state,omitempty"` // PassedControls - READ-ONLY; The number of supported regulatory compliance controls of the given standard with a passed state PassedControls *int32 `json:"passedControls,omitempty"` @@ -6087,6 +6492,23 @@ type TopologySingleResourceParent struct { ResourceID *string `json:"resourceId,omitempty"` } +// UserRecommendation represents a user that is recommended to be allowed for a certain rule +type UserRecommendation struct { + // Username - Represents a user that is recommended to be allowed for a certain rule + Username *string `json:"username,omitempty"` + // RecommendationAction - Possible values include: 'RecommendationAction1Recommended', 'RecommendationAction1Add', 'RecommendationAction1Remove' + RecommendationAction RecommendationAction1 `json:"recommendationAction,omitempty"` +} + +// VMRecommendation represents a machine that is part of a VM/server group +type VMRecommendation struct { + // ConfigurationStatus - Possible values include: 'Configured', 'NotConfigured', 'InProgress', 'Failed', 'NoStatus' + ConfigurationStatus ConfigurationStatus `json:"configurationStatus,omitempty"` + // RecommendationAction - Possible values include: 'RecommendationActionRecommended', 'RecommendationActionAdd', 'RecommendationActionRemove' + RecommendationAction RecommendationAction `json:"recommendationAction,omitempty"` + ResourceID *string `json:"resourceId,omitempty"` +} + // WorkspaceSetting configures where to store the OMS agent data for workspaces under a scope type WorkspaceSetting struct { autorest.Response `json:"-"` 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 8d8207b0e5f5..06c5df144765 100644 --- a/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go @@ -199,6 +199,15 @@ type JitNetworkAccessPoliciesClientAPI interface { var _ JitNetworkAccessPoliciesClientAPI = (*security.JitNetworkAccessPoliciesClient)(nil) +// AdaptiveApplicationControlsClientAPI contains the set of methods on the AdaptiveApplicationControlsClient type. +type AdaptiveApplicationControlsClientAPI interface { + Get(ctx context.Context, groupName string) (result security.AppWhitelistingGroup, err error) + List(ctx context.Context, includePathRecommendations *bool, summary *bool) (result security.AppWhitelistingGroups, err error) + Put(ctx context.Context, groupName string, body security.AppWhitelistingPutGroupData) (result security.AppWhitelistingGroup, err error) +} + +var _ AdaptiveApplicationControlsClientAPI = (*security.AdaptiveApplicationControlsClient)(nil) + // ExternalSecuritySolutionsClientAPI contains the set of methods on the ExternalSecuritySolutionsClient type. type ExternalSecuritySolutionsClientAPI interface { Get(ctx context.Context, resourceGroupName string, externalSecuritySolutionsName string) (result security.ExternalSecuritySolutionModel, err error) diff --git a/services/preview/security/mgmt/v2.0/security/adaptiveapplicationcontrols.go b/services/preview/security/mgmt/v2.0/security/adaptiveapplicationcontrols.go new file mode 100644 index 000000000000..8fe79f24b6d0 --- /dev/null +++ b/services/preview/security/mgmt/v2.0/security/adaptiveapplicationcontrols.go @@ -0,0 +1,296 @@ +package security + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AdaptiveApplicationControlsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type AdaptiveApplicationControlsClient struct { + BaseClient +} + +// NewAdaptiveApplicationControlsClient creates an instance of the AdaptiveApplicationControlsClient client. +func NewAdaptiveApplicationControlsClient(subscriptionID string, ascLocation string) AdaptiveApplicationControlsClient { + return NewAdaptiveApplicationControlsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewAdaptiveApplicationControlsClientWithBaseURI creates an instance of the AdaptiveApplicationControlsClient client. +func NewAdaptiveApplicationControlsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) AdaptiveApplicationControlsClient { + return AdaptiveApplicationControlsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// Get gets an application control VM/server group. +// Parameters: +// groupName - name of an application control VM/server group +func (client AdaptiveApplicationControlsClient) Get(ctx context.Context, groupName string) (result AppWhitelistingGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AdaptiveApplicationControlsClient.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.AdaptiveApplicationControlsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, groupName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "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.AdaptiveApplicationControlsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AdaptiveApplicationControlsClient) GetPreparer(ctx context.Context, groupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ascLocation": autorest.Encode("path", client.AscLocation), + "groupName": autorest.Encode("path", groupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-06-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/locations/{ascLocation}/applicationWhitelistings/{groupName}", 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 AdaptiveApplicationControlsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AdaptiveApplicationControlsClient) GetResponder(resp *http.Response) (result AppWhitelistingGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of application control VM/server groups for the subscription. +// Parameters: +// includePathRecommendations - include the policy rules +// summary - return output in a summarized form +func (client AdaptiveApplicationControlsClient) List(ctx context.Context, includePathRecommendations *bool, summary *bool) (result AppWhitelistingGroups, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AdaptiveApplicationControlsClient.List") + 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.AdaptiveApplicationControlsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, includePathRecommendations, summary) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AdaptiveApplicationControlsClient) ListPreparer(ctx context.Context, includePathRecommendations *bool, summary *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if includePathRecommendations != nil { + queryParameters["includePathRecommendations"] = autorest.Encode("query", *includePathRecommendations) + } + if summary != nil { + queryParameters["summary"] = autorest.Encode("query", *summary) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings", 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 AdaptiveApplicationControlsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AdaptiveApplicationControlsClient) ListResponder(resp *http.Response) (result AppWhitelistingGroups, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Put update an application control VM/server group +// Parameters: +// groupName - name of an application control VM/server group +// body - the updated VM/server group data +func (client AdaptiveApplicationControlsClient) Put(ctx context.Context, groupName string, body AppWhitelistingPutGroupData) (result AppWhitelistingGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AdaptiveApplicationControlsClient.Put") + 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.AdaptiveApplicationControlsClient", "Put", err.Error()) + } + + req, err := client.PutPreparer(ctx, groupName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Put", nil, "Failure preparing request") + return + } + + resp, err := client.PutSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Put", resp, "Failure sending request") + return + } + + result, err = client.PutResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Put", resp, "Failure responding to request") + } + + return +} + +// PutPreparer prepares the Put request. +func (client AdaptiveApplicationControlsClient) PutPreparer(ctx context.Context, groupName string, body AppWhitelistingPutGroupData) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ascLocation": autorest.Encode("path", client.AscLocation), + "groupName": autorest.Encode("path", groupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PutSender sends the Put request. The method will close the +// http.Response Body if it receives an error. +func (client AdaptiveApplicationControlsClient) PutSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// PutResponder handles the response to the Put request. The method always +// closes the http.Response Body. +func (client AdaptiveApplicationControlsClient) PutResponder(resp *http.Response) (result AppWhitelistingGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/security/mgmt/v2.0/security/models.go b/services/preview/security/mgmt/v2.0/security/models.go index 88c0d9fc630b..eac3ff8bd496 100644 --- a/services/preview/security/mgmt/v2.0/security/models.go +++ b/services/preview/security/mgmt/v2.0/security/models.go @@ -49,6 +49,23 @@ func PossibleAadConnectivityStateValues() []AadConnectivityState { return []AadConnectivityState{Connected, Discovered, NotLicensed} } +// Action enumerates the values for action. +type Action string + +const ( + // Add ... + Add Action = "Add" + // Recommended ... + Recommended Action = "Recommended" + // Remove ... + Remove Action = "Remove" +) + +// PossibleActionValues returns an array of possible values for the Action const type. +func PossibleActionValues() []Action { + return []Action{Add, Recommended, Remove} +} + // AlertNotifications enumerates the values for alert notifications. type AlertNotifications string @@ -94,6 +111,69 @@ func PossibleAutoProvisionValues() []AutoProvision { return []AutoProvision{AutoProvisionOff, AutoProvisionOn} } +// ConfigurationStatus enumerates the values for configuration status. +type ConfigurationStatus string + +const ( + // Configured ... + Configured ConfigurationStatus = "Configured" + // Failed ... + Failed ConfigurationStatus = "Failed" + // InProgress ... + InProgress ConfigurationStatus = "InProgress" + // NoStatus ... + NoStatus ConfigurationStatus = "NoStatus" + // NotConfigured ... + NotConfigured ConfigurationStatus = "NotConfigured" +) + +// PossibleConfigurationStatusValues returns an array of possible values for the ConfigurationStatus const type. +func PossibleConfigurationStatusValues() []ConfigurationStatus { + return []ConfigurationStatus{Configured, Failed, InProgress, NoStatus, NotConfigured} +} + +// ConfigurationStatus1 enumerates the values for configuration status 1. +type ConfigurationStatus1 string + +const ( + // ConfigurationStatus1Configured ... + ConfigurationStatus1Configured ConfigurationStatus1 = "Configured" + // ConfigurationStatus1Failed ... + ConfigurationStatus1Failed ConfigurationStatus1 = "Failed" + // ConfigurationStatus1InProgress ... + ConfigurationStatus1InProgress ConfigurationStatus1 = "InProgress" + // ConfigurationStatus1NoStatus ... + ConfigurationStatus1NoStatus ConfigurationStatus1 = "NoStatus" + // ConfigurationStatus1NotConfigured ... + ConfigurationStatus1NotConfigured ConfigurationStatus1 = "NotConfigured" +) + +// PossibleConfigurationStatus1Values returns an array of possible values for the ConfigurationStatus1 const type. +func PossibleConfigurationStatus1Values() []ConfigurationStatus1 { + return []ConfigurationStatus1{ConfigurationStatus1Configured, ConfigurationStatus1Failed, ConfigurationStatus1InProgress, ConfigurationStatus1NoStatus, ConfigurationStatus1NotConfigured} +} + +// ConfigurationStatus2 enumerates the values for configuration status 2. +type ConfigurationStatus2 string + +const ( + // ConfigurationStatus2Configured ... + ConfigurationStatus2Configured ConfigurationStatus2 = "Configured" + // ConfigurationStatus2Failed ... + ConfigurationStatus2Failed ConfigurationStatus2 = "Failed" + // ConfigurationStatus2InProgress ... + ConfigurationStatus2InProgress ConfigurationStatus2 = "InProgress" + // ConfigurationStatus2NoStatus ... + ConfigurationStatus2NoStatus ConfigurationStatus2 = "NoStatus" + // ConfigurationStatus2NotConfigured ... + ConfigurationStatus2NotConfigured ConfigurationStatus2 = "NotConfigured" +) + +// PossibleConfigurationStatus2Values returns an array of possible values for the ConfigurationStatus2 const type. +func PossibleConfigurationStatus2Values() []ConfigurationStatus2 { + return []ConfigurationStatus2{ConfigurationStatus2Configured, ConfigurationStatus2Failed, ConfigurationStatus2InProgress, ConfigurationStatus2NoStatus, ConfigurationStatus2NotConfigured} +} + // ConnectionType enumerates the values for connection type. type ConnectionType string @@ -124,6 +204,36 @@ func PossibleDirectionValues() []Direction { return []Direction{Inbound, Outbound} } +// EnforcementMode enumerates the values for enforcement mode. +type EnforcementMode string + +const ( + // Audit ... + Audit EnforcementMode = "Audit" + // Enforce ... + Enforce EnforcementMode = "Enforce" +) + +// PossibleEnforcementModeValues returns an array of possible values for the EnforcementMode const type. +func PossibleEnforcementModeValues() []EnforcementMode { + return []EnforcementMode{Audit, Enforce} +} + +// EnforcementMode1 enumerates the values for enforcement mode 1. +type EnforcementMode1 string + +const ( + // EnforcementMode1Audit ... + EnforcementMode1Audit EnforcementMode1 = "Audit" + // EnforcementMode1Enforce ... + EnforcementMode1Enforce EnforcementMode1 = "Enforce" +) + +// PossibleEnforcementMode1Values returns an array of possible values for the EnforcementMode1 const type. +func PossibleEnforcementMode1Values() []EnforcementMode1 { + return []EnforcementMode1{EnforcementMode1Audit, EnforcementMode1Enforce} +} + // ExternalSecuritySolutionKind enumerates the values for external security solution kind. type ExternalSecuritySolutionKind string @@ -160,6 +270,50 @@ func PossibleFamilyValues() []Family { return []Family{Ngfw, SaasWaf, Va, Waf} } +// FileType enumerates the values for file type. +type FileType string + +const ( + // Dll ... + Dll FileType = "Dll" + // Exe ... + Exe FileType = "Exe" + // Msi ... + Msi FileType = "Msi" + // Script ... + Script FileType = "Script" + // Unknown ... + Unknown FileType = "Unknown" +) + +// PossibleFileTypeValues returns an array of possible values for the FileType const type. +func PossibleFileTypeValues() []FileType { + return []FileType{Dll, Exe, Msi, Script, Unknown} +} + +// Issue enumerates the values for issue. +type Issue string + +const ( + // ExecutableViolationsAudited ... + ExecutableViolationsAudited Issue = "ExecutableViolationsAudited" + // MsiAndScriptViolationsAudited ... + MsiAndScriptViolationsAudited Issue = "MsiAndScriptViolationsAudited" + // MsiAndScriptViolationsBlocked ... + MsiAndScriptViolationsBlocked Issue = "MsiAndScriptViolationsBlocked" + // RulesViolatedManually ... + RulesViolatedManually Issue = "RulesViolatedManually" + // ViolationsAudited ... + ViolationsAudited Issue = "ViolationsAudited" + // ViolationsBlocked ... + ViolationsBlocked Issue = "ViolationsBlocked" +) + +// PossibleIssueValues returns an array of possible values for the Issue const type. +func PossibleIssueValues() []Issue { + return []Issue{ExecutableViolationsAudited, MsiAndScriptViolationsAudited, MsiAndScriptViolationsBlocked, RulesViolatedManually, ViolationsAudited, ViolationsBlocked} +} + // KindEnum enumerates the values for kind enum. type KindEnum string @@ -211,6 +365,59 @@ func PossibleProtocolValues() []Protocol { return []Protocol{All, TCP, UDP} } +// RecommendationAction enumerates the values for recommendation action. +type RecommendationAction string + +const ( + // RecommendationActionAdd ... + RecommendationActionAdd RecommendationAction = "Add" + // RecommendationActionRecommended ... + RecommendationActionRecommended RecommendationAction = "Recommended" + // RecommendationActionRemove ... + RecommendationActionRemove RecommendationAction = "Remove" +) + +// PossibleRecommendationActionValues returns an array of possible values for the RecommendationAction const type. +func PossibleRecommendationActionValues() []RecommendationAction { + return []RecommendationAction{RecommendationActionAdd, RecommendationActionRecommended, RecommendationActionRemove} +} + +// RecommendationAction1 enumerates the values for recommendation action 1. +type RecommendationAction1 string + +const ( + // RecommendationAction1Add ... + RecommendationAction1Add RecommendationAction1 = "Add" + // RecommendationAction1Recommended ... + RecommendationAction1Recommended RecommendationAction1 = "Recommended" + // RecommendationAction1Remove ... + RecommendationAction1Remove RecommendationAction1 = "Remove" +) + +// PossibleRecommendationAction1Values returns an array of possible values for the RecommendationAction1 const type. +func PossibleRecommendationAction1Values() []RecommendationAction1 { + return []RecommendationAction1{RecommendationAction1Add, RecommendationAction1Recommended, RecommendationAction1Remove} +} + +// RecommendationStatus enumerates the values for recommendation status. +type RecommendationStatus string + +const ( + // RecommendationStatusNoStatus ... + RecommendationStatusNoStatus RecommendationStatus = "NoStatus" + // RecommendationStatusNotAvailable ... + RecommendationStatusNotAvailable RecommendationStatus = "NotAvailable" + // RecommendationStatusNotRecommended ... + RecommendationStatusNotRecommended RecommendationStatus = "NotRecommended" + // RecommendationStatusRecommended ... + RecommendationStatusRecommended RecommendationStatus = "Recommended" +) + +// PossibleRecommendationStatusValues returns an array of possible values for the RecommendationStatus const type. +func PossibleRecommendationStatusValues() []RecommendationStatus { + return []RecommendationStatus{RecommendationStatusNoStatus, RecommendationStatusNotAvailable, RecommendationStatusNotRecommended, RecommendationStatusRecommended} +} + // ReportedSeverity enumerates the values for reported severity. type ReportedSeverity string @@ -245,23 +452,45 @@ func PossibleSettingKindValues() []SettingKind { return []SettingKind{SettingKindAlertSuppressionSetting, SettingKindDataExportSetting} } +// SourceSystem enumerates the values for source system. +type SourceSystem string + +const ( + // AzureAppLocker ... + AzureAppLocker SourceSystem = "Azure_AppLocker" + // AzureAuditD ... + AzureAuditD SourceSystem = "Azure_AuditD" + // NonAzureAppLocker ... + NonAzureAppLocker SourceSystem = "NonAzure_AppLocker" + // NonAzureAuditD ... + NonAzureAuditD SourceSystem = "NonAzure_AuditD" + // None ... + None SourceSystem = "None" +) + +// PossibleSourceSystemValues returns an array of possible values for the SourceSystem const type. +func PossibleSourceSystemValues() []SourceSystem { + return []SourceSystem{AzureAppLocker, AzureAuditD, NonAzureAppLocker, NonAzureAuditD, None} +} + // State enumerates the values for state. type State string const ( - // Failed At least one supported regulatory compliance control in the given standard has a state of failed - Failed State = "Failed" - // Passed All supported regulatory compliance controls in the given standard have a passed state - Passed State = "Passed" - // Skipped All supported regulatory compliance controls in the given standard have a state of skipped - Skipped State = "Skipped" - // Unsupported No supported regulatory compliance data for the given standard - Unsupported State = "Unsupported" + // StateFailed At least one supported regulatory compliance control in the given standard has a state of + // failed + StateFailed State = "Failed" + // StatePassed All supported regulatory compliance controls in the given standard have a passed state + StatePassed State = "Passed" + // StateSkipped All supported regulatory compliance controls in the given standard have a state of skipped + StateSkipped State = "Skipped" + // StateUnsupported No supported regulatory compliance data for the given standard + StateUnsupported State = "Unsupported" ) // PossibleStateValues returns an array of possible values for the State const type. func PossibleStateValues() []State { - return []State{Failed, Passed, Skipped, Unsupported} + return []State{StateFailed, StatePassed, StateSkipped, StateUnsupported} } // Status enumerates the values for status. @@ -311,6 +540,29 @@ func PossibleTransportProtocolValues() []TransportProtocol { return []TransportProtocol{TransportProtocolTCP, TransportProtocolUDP} } +// Type enumerates the values for type. +type Type string + +const ( + // BinarySignature ... + BinarySignature Type = "BinarySignature" + // File ... + File Type = "File" + // FileHash ... + FileHash Type = "FileHash" + // ProductSignature ... + ProductSignature Type = "ProductSignature" + // PublisherSignature ... + PublisherSignature Type = "PublisherSignature" + // VersionAndAboveSignature ... + VersionAndAboveSignature Type = "VersionAndAboveSignature" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{BinarySignature, File, FileHash, ProductSignature, PublisherSignature, VersionAndAboveSignature} +} + // ValueType enumerates the values for value type. type ValueType string @@ -1331,6 +1583,128 @@ type AllowlistCustomAlertRule struct { RuleType *string `json:"ruleType,omitempty"` } +// AppWhitelistingGroup ... +type AppWhitelistingGroup struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Location where the resource is stored + Location *string `json:"location,omitempty"` + *AppWhitelistingGroupData `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppWhitelistingGroup. +func (awg AppWhitelistingGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if awg.AppWhitelistingGroupData != nil { + objectMap["properties"] = awg.AppWhitelistingGroupData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AppWhitelistingGroup struct. +func (awg *AppWhitelistingGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + awg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + awg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + awg.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + awg.Location = &location + } + case "properties": + if v != nil { + var appWhitelistingGroupData AppWhitelistingGroupData + err = json.Unmarshal(*v, &appWhitelistingGroupData) + if err != nil { + return err + } + awg.AppWhitelistingGroupData = &appWhitelistingGroupData + } + } + } + + return nil +} + +// AppWhitelistingGroupData represents a VM/server group and set of rules that are Recommended by Azure +// Security Center to be allowed +type AppWhitelistingGroupData struct { + // EnforcementMode - Possible values include: 'Audit', 'Enforce' + EnforcementMode EnforcementMode `json:"enforcementMode,omitempty"` + // ConfigurationStatus - Possible values include: 'ConfigurationStatus2Configured', 'ConfigurationStatus2NotConfigured', 'ConfigurationStatus2InProgress', 'ConfigurationStatus2Failed', 'ConfigurationStatus2NoStatus' + ConfigurationStatus ConfigurationStatus2 `json:"configurationStatus,omitempty"` + // RecommendationStatus - Possible values include: 'RecommendationStatusRecommended', 'RecommendationStatusNotRecommended', 'RecommendationStatusNotAvailable', 'RecommendationStatusNoStatus' + RecommendationStatus RecommendationStatus `json:"recommendationStatus,omitempty"` + Issues *[]AppWhitelistingIssueSummary `json:"issues,omitempty"` + // SourceSystem - Possible values include: 'AzureAppLocker', 'AzureAuditD', 'NonAzureAppLocker', 'NonAzureAuditD', 'None' + SourceSystem SourceSystem `json:"sourceSystem,omitempty"` + VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` + PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +} + +// AppWhitelistingGroups represents a list of VM/server groups and set of rules that are Recommended by +// Azure Security Center to be allowed +type AppWhitelistingGroups struct { + autorest.Response `json:"-"` + Value *[]AppWhitelistingGroup `json:"value,omitempty"` +} + +// AppWhitelistingIssueSummary represents a summary of the alerts of the VM/server group +type AppWhitelistingIssueSummary struct { + // Issue - Possible values include: 'ViolationsAudited', 'ViolationsBlocked', 'MsiAndScriptViolationsAudited', 'MsiAndScriptViolationsBlocked', 'ExecutableViolationsAudited', 'RulesViolatedManually' + Issue Issue `json:"issue,omitempty"` + // NumberOfVms - The number of machines in the VM/server group that have this alert + NumberOfVms *float64 `json:"numberOfVms,omitempty"` +} + +// AppWhitelistingPutGroupData the altered data of the recommended VM/server group policy +type AppWhitelistingPutGroupData struct { + // EnforcementMode - Possible values include: 'EnforcementMode1Audit', 'EnforcementMode1Enforce' + EnforcementMode EnforcementMode1 `json:"enforcementMode,omitempty"` + VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` + PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +} + // AscLocation the ASC location of the subscription is in the "name" field type AscLocation struct { autorest.Response `json:"-"` @@ -4362,6 +4736,25 @@ func NewOperationListPage(getNextPage func(context.Context, OperationList) (Oper return OperationListPage{fn: getNextPage} } +// PathRecommendation represents a path that is recommended to be allowed and its properties +type PathRecommendation struct { + // Path - The full path to whitelist + Path *string `json:"path,omitempty"` + // Action - Possible values include: 'Recommended', 'Add', 'Remove' + Action Action `json:"action,omitempty"` + // Type - Possible values include: 'File', 'FileHash', 'PublisherSignature', 'ProductSignature', 'BinarySignature', 'VersionAndAboveSignature' + Type Type `json:"type,omitempty"` + PublisherInfo *PublisherInfo `json:"publisherInfo,omitempty"` + // Common - Whether the path is commonly run on the machine + Common *bool `json:"common,omitempty"` + UserSids *[]string `json:"userSids,omitempty"` + Usernames *[]UserRecommendation `json:"usernames,omitempty"` + // FileType - Possible values include: 'Exe', 'Dll', 'Msi', 'Script', 'Unknown' + FileType FileType `json:"fileType,omitempty"` + // ConfigurationStatus - Possible values include: 'ConfigurationStatus1Configured', 'ConfigurationStatus1NotConfigured', 'ConfigurationStatus1InProgress', 'ConfigurationStatus1Failed', 'ConfigurationStatus1NoStatus' + ConfigurationStatus ConfigurationStatus1 `json:"configurationStatus,omitempty"` +} + // Pricing pricing tier will be applied for the scope based on the resource ID type Pricing struct { autorest.Response `json:"-"` @@ -4450,6 +4843,18 @@ type PricingProperties struct { FreeTrialRemainingTime *string `json:"freeTrialRemainingTime,omitempty"` } +// PublisherInfo represents the publisher information of a process/rule +type PublisherInfo struct { + // PublisherName - The Subject field of the x.509 certificate used to sign the code, using the following fields - O = Organization, L = Locality, S = State or Province, and C = Country + PublisherName *string `json:"publisherName,omitempty"` + // ProductName - The product name taken from the file's version resource + ProductName *string `json:"productName,omitempty"` + // BinaryName - The "OriginalName" field taken from the file's version resource + BinaryName *string `json:"binaryName,omitempty"` + // Version - The binary file version taken from the file's version resource + Version *string `json:"version,omitempty"` +} + // RegulatoryComplianceAssessment regulatory compliance assessment details and state type RegulatoryComplianceAssessment struct { autorest.Response `json:"-"` @@ -4677,7 +5082,7 @@ type RegulatoryComplianceAssessmentProperties struct { AssessmentType *string `json:"assessmentType,omitempty"` // AssessmentDetailsLink - READ-ONLY; Link to more detailed assessment results data. The response type will be according to the assessmentType field AssessmentDetailsLink *string `json:"assessmentDetailsLink,omitempty"` - // State - Aggregative state based on the assessment's scanned resources states. Possible values include: 'Passed', 'Failed', 'Skipped', 'Unsupported' + // State - Aggregative state based on the assessment's scanned resources states. Possible values include: 'StatePassed', 'StateFailed', 'StateSkipped', 'StateUnsupported' State State `json:"state,omitempty"` // PassedResources - READ-ONLY; The given assessment's related resources count with passed state. PassedResources *int32 `json:"passedResources,omitempty"` @@ -4913,7 +5318,7 @@ func NewRegulatoryComplianceControlListPage(getNextPage func(context.Context, Re type RegulatoryComplianceControlProperties struct { // Description - READ-ONLY; The description of the regulatory compliance control Description *string `json:"description,omitempty"` - // State - Aggregative state based on the control's supported assessments states. Possible values include: 'Passed', 'Failed', 'Skipped', 'Unsupported' + // State - Aggregative state based on the control's supported assessments states. Possible values include: 'StatePassed', 'StateFailed', 'StateSkipped', 'StateUnsupported' State State `json:"state,omitempty"` // PassedAssessments - READ-ONLY; The number of supported regulatory compliance assessments of the given control with a passed state PassedAssessments *int32 `json:"passedAssessments,omitempty"` @@ -5144,7 +5549,7 @@ func NewRegulatoryComplianceStandardListPage(getNextPage func(context.Context, R // RegulatoryComplianceStandardProperties regulatory compliance standard data type RegulatoryComplianceStandardProperties struct { - // State - Aggregative state based on the standard's supported controls states. Possible values include: 'Passed', 'Failed', 'Skipped', 'Unsupported' + // State - Aggregative state based on the standard's supported controls states. Possible values include: 'StatePassed', 'StateFailed', 'StateSkipped', 'StateUnsupported' State State `json:"state,omitempty"` // PassedControls - READ-ONLY; The number of supported regulatory compliance controls of the given standard with a passed state PassedControls *int32 `json:"passedControls,omitempty"` @@ -5950,6 +6355,23 @@ type TopologySingleResourceParent struct { ResourceID *string `json:"resourceId,omitempty"` } +// UserRecommendation represents a user that is recommended to be allowed for a certain rule +type UserRecommendation struct { + // Username - Represents a user that is recommended to be allowed for a certain rule + Username *string `json:"username,omitempty"` + // RecommendationAction - Possible values include: 'RecommendationAction1Recommended', 'RecommendationAction1Add', 'RecommendationAction1Remove' + RecommendationAction RecommendationAction1 `json:"recommendationAction,omitempty"` +} + +// VMRecommendation represents a machine that is part of a VM/server group +type VMRecommendation struct { + // ConfigurationStatus - Possible values include: 'Configured', 'NotConfigured', 'InProgress', 'Failed', 'NoStatus' + ConfigurationStatus ConfigurationStatus `json:"configurationStatus,omitempty"` + // RecommendationAction - Possible values include: 'RecommendationActionRecommended', 'RecommendationActionAdd', 'RecommendationActionRemove' + RecommendationAction RecommendationAction `json:"recommendationAction,omitempty"` + ResourceID *string `json:"resourceId,omitempty"` +} + // WorkspaceSetting configures where to store the OMS agent data for workspaces under a scope type WorkspaceSetting struct { autorest.Response `json:"-"` 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 333b51d906f9..357335dd3a70 100644 --- a/services/preview/security/mgmt/v2.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v2.0/security/securityapi/interfaces.go @@ -196,6 +196,15 @@ type JitNetworkAccessPoliciesClientAPI interface { var _ JitNetworkAccessPoliciesClientAPI = (*security.JitNetworkAccessPoliciesClient)(nil) +// AdaptiveApplicationControlsClientAPI contains the set of methods on the AdaptiveApplicationControlsClient type. +type AdaptiveApplicationControlsClientAPI interface { + Get(ctx context.Context, groupName string) (result security.AppWhitelistingGroup, err error) + List(ctx context.Context, includePathRecommendations *bool, summary *bool) (result security.AppWhitelistingGroups, err error) + Put(ctx context.Context, groupName string, body security.AppWhitelistingPutGroupData) (result security.AppWhitelistingGroup, err error) +} + +var _ AdaptiveApplicationControlsClientAPI = (*security.AdaptiveApplicationControlsClient)(nil) + // ExternalSecuritySolutionsClientAPI contains the set of methods on the ExternalSecuritySolutionsClient type. type ExternalSecuritySolutionsClientAPI interface { Get(ctx context.Context, resourceGroupName string, externalSecuritySolutionsName string) (result security.ExternalSecuritySolutionModel, err error) diff --git a/services/preview/security/mgmt/v3.0/security/adaptiveapplicationcontrols.go b/services/preview/security/mgmt/v3.0/security/adaptiveapplicationcontrols.go new file mode 100644 index 000000000000..8fe79f24b6d0 --- /dev/null +++ b/services/preview/security/mgmt/v3.0/security/adaptiveapplicationcontrols.go @@ -0,0 +1,296 @@ +package security + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AdaptiveApplicationControlsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type AdaptiveApplicationControlsClient struct { + BaseClient +} + +// NewAdaptiveApplicationControlsClient creates an instance of the AdaptiveApplicationControlsClient client. +func NewAdaptiveApplicationControlsClient(subscriptionID string, ascLocation string) AdaptiveApplicationControlsClient { + return NewAdaptiveApplicationControlsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewAdaptiveApplicationControlsClientWithBaseURI creates an instance of the AdaptiveApplicationControlsClient client. +func NewAdaptiveApplicationControlsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) AdaptiveApplicationControlsClient { + return AdaptiveApplicationControlsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// Get gets an application control VM/server group. +// Parameters: +// groupName - name of an application control VM/server group +func (client AdaptiveApplicationControlsClient) Get(ctx context.Context, groupName string) (result AppWhitelistingGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AdaptiveApplicationControlsClient.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.AdaptiveApplicationControlsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, groupName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "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.AdaptiveApplicationControlsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AdaptiveApplicationControlsClient) GetPreparer(ctx context.Context, groupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ascLocation": autorest.Encode("path", client.AscLocation), + "groupName": autorest.Encode("path", groupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-06-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/locations/{ascLocation}/applicationWhitelistings/{groupName}", 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 AdaptiveApplicationControlsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AdaptiveApplicationControlsClient) GetResponder(resp *http.Response) (result AppWhitelistingGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of application control VM/server groups for the subscription. +// Parameters: +// includePathRecommendations - include the policy rules +// summary - return output in a summarized form +func (client AdaptiveApplicationControlsClient) List(ctx context.Context, includePathRecommendations *bool, summary *bool) (result AppWhitelistingGroups, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AdaptiveApplicationControlsClient.List") + 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.AdaptiveApplicationControlsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, includePathRecommendations, summary) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AdaptiveApplicationControlsClient) ListPreparer(ctx context.Context, includePathRecommendations *bool, summary *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if includePathRecommendations != nil { + queryParameters["includePathRecommendations"] = autorest.Encode("query", *includePathRecommendations) + } + if summary != nil { + queryParameters["summary"] = autorest.Encode("query", *summary) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings", 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 AdaptiveApplicationControlsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AdaptiveApplicationControlsClient) ListResponder(resp *http.Response) (result AppWhitelistingGroups, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Put update an application control VM/server group +// Parameters: +// groupName - name of an application control VM/server group +// body - the updated VM/server group data +func (client AdaptiveApplicationControlsClient) Put(ctx context.Context, groupName string, body AppWhitelistingPutGroupData) (result AppWhitelistingGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AdaptiveApplicationControlsClient.Put") + 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.AdaptiveApplicationControlsClient", "Put", err.Error()) + } + + req, err := client.PutPreparer(ctx, groupName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Put", nil, "Failure preparing request") + return + } + + resp, err := client.PutSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Put", resp, "Failure sending request") + return + } + + result, err = client.PutResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Put", resp, "Failure responding to request") + } + + return +} + +// PutPreparer prepares the Put request. +func (client AdaptiveApplicationControlsClient) PutPreparer(ctx context.Context, groupName string, body AppWhitelistingPutGroupData) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ascLocation": autorest.Encode("path", client.AscLocation), + "groupName": autorest.Encode("path", groupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PutSender sends the Put request. The method will close the +// http.Response Body if it receives an error. +func (client AdaptiveApplicationControlsClient) PutSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// PutResponder handles the response to the Put request. The method always +// closes the http.Response Body. +func (client AdaptiveApplicationControlsClient) PutResponder(resp *http.Response) (result AppWhitelistingGroup, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/security/mgmt/v3.0/security/models.go b/services/preview/security/mgmt/v3.0/security/models.go index 8187d3f8cf07..b70b97541921 100644 --- a/services/preview/security/mgmt/v3.0/security/models.go +++ b/services/preview/security/mgmt/v3.0/security/models.go @@ -48,6 +48,23 @@ func PossibleAadConnectivityStateValues() []AadConnectivityState { return []AadConnectivityState{Connected, Discovered, NotLicensed} } +// Action enumerates the values for action. +type Action string + +const ( + // Add ... + Add Action = "Add" + // Recommended ... + Recommended Action = "Recommended" + // Remove ... + Remove Action = "Remove" +) + +// PossibleActionValues returns an array of possible values for the Action const type. +func PossibleActionValues() []Action { + return []Action{Add, Recommended, Remove} +} + // AlertNotifications enumerates the values for alert notifications. type AlertNotifications string @@ -93,6 +110,69 @@ func PossibleAutoProvisionValues() []AutoProvision { return []AutoProvision{AutoProvisionOff, AutoProvisionOn} } +// ConfigurationStatus enumerates the values for configuration status. +type ConfigurationStatus string + +const ( + // Configured ... + Configured ConfigurationStatus = "Configured" + // Failed ... + Failed ConfigurationStatus = "Failed" + // InProgress ... + InProgress ConfigurationStatus = "InProgress" + // NoStatus ... + NoStatus ConfigurationStatus = "NoStatus" + // NotConfigured ... + NotConfigured ConfigurationStatus = "NotConfigured" +) + +// PossibleConfigurationStatusValues returns an array of possible values for the ConfigurationStatus const type. +func PossibleConfigurationStatusValues() []ConfigurationStatus { + return []ConfigurationStatus{Configured, Failed, InProgress, NoStatus, NotConfigured} +} + +// ConfigurationStatus1 enumerates the values for configuration status 1. +type ConfigurationStatus1 string + +const ( + // ConfigurationStatus1Configured ... + ConfigurationStatus1Configured ConfigurationStatus1 = "Configured" + // ConfigurationStatus1Failed ... + ConfigurationStatus1Failed ConfigurationStatus1 = "Failed" + // ConfigurationStatus1InProgress ... + ConfigurationStatus1InProgress ConfigurationStatus1 = "InProgress" + // ConfigurationStatus1NoStatus ... + ConfigurationStatus1NoStatus ConfigurationStatus1 = "NoStatus" + // ConfigurationStatus1NotConfigured ... + ConfigurationStatus1NotConfigured ConfigurationStatus1 = "NotConfigured" +) + +// PossibleConfigurationStatus1Values returns an array of possible values for the ConfigurationStatus1 const type. +func PossibleConfigurationStatus1Values() []ConfigurationStatus1 { + return []ConfigurationStatus1{ConfigurationStatus1Configured, ConfigurationStatus1Failed, ConfigurationStatus1InProgress, ConfigurationStatus1NoStatus, ConfigurationStatus1NotConfigured} +} + +// ConfigurationStatus2 enumerates the values for configuration status 2. +type ConfigurationStatus2 string + +const ( + // ConfigurationStatus2Configured ... + ConfigurationStatus2Configured ConfigurationStatus2 = "Configured" + // ConfigurationStatus2Failed ... + ConfigurationStatus2Failed ConfigurationStatus2 = "Failed" + // ConfigurationStatus2InProgress ... + ConfigurationStatus2InProgress ConfigurationStatus2 = "InProgress" + // ConfigurationStatus2NoStatus ... + ConfigurationStatus2NoStatus ConfigurationStatus2 = "NoStatus" + // ConfigurationStatus2NotConfigured ... + ConfigurationStatus2NotConfigured ConfigurationStatus2 = "NotConfigured" +) + +// PossibleConfigurationStatus2Values returns an array of possible values for the ConfigurationStatus2 const type. +func PossibleConfigurationStatus2Values() []ConfigurationStatus2 { + return []ConfigurationStatus2{ConfigurationStatus2Configured, ConfigurationStatus2Failed, ConfigurationStatus2InProgress, ConfigurationStatus2NoStatus, ConfigurationStatus2NotConfigured} +} + // ConnectionType enumerates the values for connection type. type ConnectionType string @@ -108,6 +188,36 @@ func PossibleConnectionTypeValues() []ConnectionType { return []ConnectionType{External, Internal} } +// EnforcementMode enumerates the values for enforcement mode. +type EnforcementMode string + +const ( + // Audit ... + Audit EnforcementMode = "Audit" + // Enforce ... + Enforce EnforcementMode = "Enforce" +) + +// PossibleEnforcementModeValues returns an array of possible values for the EnforcementMode const type. +func PossibleEnforcementModeValues() []EnforcementMode { + return []EnforcementMode{Audit, Enforce} +} + +// EnforcementMode1 enumerates the values for enforcement mode 1. +type EnforcementMode1 string + +const ( + // EnforcementMode1Audit ... + EnforcementMode1Audit EnforcementMode1 = "Audit" + // EnforcementMode1Enforce ... + EnforcementMode1Enforce EnforcementMode1 = "Enforce" +) + +// PossibleEnforcementMode1Values returns an array of possible values for the EnforcementMode1 const type. +func PossibleEnforcementMode1Values() []EnforcementMode1 { + return []EnforcementMode1{EnforcementMode1Audit, EnforcementMode1Enforce} +} + // ExternalSecuritySolutionKind enumerates the values for external security solution kind. type ExternalSecuritySolutionKind string @@ -144,6 +254,50 @@ func PossibleFamilyValues() []Family { return []Family{Ngfw, SaasWaf, Va, Waf} } +// FileType enumerates the values for file type. +type FileType string + +const ( + // Dll ... + Dll FileType = "Dll" + // Exe ... + Exe FileType = "Exe" + // Msi ... + Msi FileType = "Msi" + // Script ... + Script FileType = "Script" + // Unknown ... + Unknown FileType = "Unknown" +) + +// PossibleFileTypeValues returns an array of possible values for the FileType const type. +func PossibleFileTypeValues() []FileType { + return []FileType{Dll, Exe, Msi, Script, Unknown} +} + +// Issue enumerates the values for issue. +type Issue string + +const ( + // ExecutableViolationsAudited ... + ExecutableViolationsAudited Issue = "ExecutableViolationsAudited" + // MsiAndScriptViolationsAudited ... + MsiAndScriptViolationsAudited Issue = "MsiAndScriptViolationsAudited" + // MsiAndScriptViolationsBlocked ... + MsiAndScriptViolationsBlocked Issue = "MsiAndScriptViolationsBlocked" + // RulesViolatedManually ... + RulesViolatedManually Issue = "RulesViolatedManually" + // ViolationsAudited ... + ViolationsAudited Issue = "ViolationsAudited" + // ViolationsBlocked ... + ViolationsBlocked Issue = "ViolationsBlocked" +) + +// PossibleIssueValues returns an array of possible values for the Issue const type. +func PossibleIssueValues() []Issue { + return []Issue{ExecutableViolationsAudited, MsiAndScriptViolationsAudited, MsiAndScriptViolationsBlocked, RulesViolatedManually, ViolationsAudited, ViolationsBlocked} +} + // KindEnum enumerates the values for kind enum. type KindEnum string @@ -199,21 +353,74 @@ func PossibleProtocolValues() []Protocol { type ProvisioningState string const ( - // Canceled ... - Canceled ProvisioningState = "Canceled" - // Deprovisioning ... - Deprovisioning ProvisioningState = "Deprovisioning" - // Failed ... - Failed ProvisioningState = "Failed" - // Provisioning ... - Provisioning ProvisioningState = "Provisioning" - // Succeeded ... - Succeeded ProvisioningState = "Succeeded" + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeprovisioning ... + ProvisioningStateDeprovisioning ProvisioningState = "Deprovisioning" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning ... + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" ) // PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Canceled, Deprovisioning, Failed, Provisioning, Succeeded} + return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateDeprovisioning, ProvisioningStateFailed, ProvisioningStateProvisioning, ProvisioningStateSucceeded} +} + +// RecommendationAction enumerates the values for recommendation action. +type RecommendationAction string + +const ( + // RecommendationActionAdd ... + RecommendationActionAdd RecommendationAction = "Add" + // RecommendationActionRecommended ... + RecommendationActionRecommended RecommendationAction = "Recommended" + // RecommendationActionRemove ... + RecommendationActionRemove RecommendationAction = "Remove" +) + +// PossibleRecommendationActionValues returns an array of possible values for the RecommendationAction const type. +func PossibleRecommendationActionValues() []RecommendationAction { + return []RecommendationAction{RecommendationActionAdd, RecommendationActionRecommended, RecommendationActionRemove} +} + +// RecommendationAction1 enumerates the values for recommendation action 1. +type RecommendationAction1 string + +const ( + // RecommendationAction1Add ... + RecommendationAction1Add RecommendationAction1 = "Add" + // RecommendationAction1Recommended ... + RecommendationAction1Recommended RecommendationAction1 = "Recommended" + // RecommendationAction1Remove ... + RecommendationAction1Remove RecommendationAction1 = "Remove" +) + +// PossibleRecommendationAction1Values returns an array of possible values for the RecommendationAction1 const type. +func PossibleRecommendationAction1Values() []RecommendationAction1 { + return []RecommendationAction1{RecommendationAction1Add, RecommendationAction1Recommended, RecommendationAction1Remove} +} + +// RecommendationStatus enumerates the values for recommendation status. +type RecommendationStatus string + +const ( + // RecommendationStatusNoStatus ... + RecommendationStatusNoStatus RecommendationStatus = "NoStatus" + // RecommendationStatusNotAvailable ... + RecommendationStatusNotAvailable RecommendationStatus = "NotAvailable" + // RecommendationStatusNotRecommended ... + RecommendationStatusNotRecommended RecommendationStatus = "NotRecommended" + // RecommendationStatusRecommended ... + RecommendationStatusRecommended RecommendationStatus = "Recommended" +) + +// PossibleRecommendationStatusValues returns an array of possible values for the RecommendationStatus const type. +func PossibleRecommendationStatusValues() []RecommendationStatus { + return []RecommendationStatus{RecommendationStatusNoStatus, RecommendationStatusNotAvailable, RecommendationStatusNotRecommended, RecommendationStatusRecommended} } // ReportedSeverity enumerates the values for reported severity. @@ -269,6 +476,27 @@ func PossibleSettingKindValues() []SettingKind { return []SettingKind{SettingKindAlertSuppressionSetting, SettingKindDataExportSetting} } +// SourceSystem enumerates the values for source system. +type SourceSystem string + +const ( + // AzureAppLocker ... + AzureAppLocker SourceSystem = "Azure_AppLocker" + // AzureAuditD ... + AzureAuditD SourceSystem = "Azure_AuditD" + // NonAzureAppLocker ... + NonAzureAppLocker SourceSystem = "NonAzure_AppLocker" + // NonAzureAuditD ... + NonAzureAuditD SourceSystem = "NonAzure_AuditD" + // None ... + None SourceSystem = "None" +) + +// PossibleSourceSystemValues returns an array of possible values for the SourceSystem const type. +func PossibleSourceSystemValues() []SourceSystem { + return []SourceSystem{AzureAppLocker, AzureAuditD, NonAzureAppLocker, NonAzureAuditD, None} +} + // State enumerates the values for state. type State string @@ -321,6 +549,29 @@ func PossibleStatusReasonValues() []StatusReason { return []StatusReason{Expired, NewerRequestInitiated, UserRequested} } +// Type enumerates the values for type. +type Type string + +const ( + // BinarySignature ... + BinarySignature Type = "BinarySignature" + // File ... + File Type = "File" + // FileHash ... + FileHash Type = "FileHash" + // ProductSignature ... + ProductSignature Type = "ProductSignature" + // PublisherSignature ... + PublisherSignature Type = "PublisherSignature" + // VersionAndAboveSignature ... + VersionAndAboveSignature Type = "VersionAndAboveSignature" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{BinarySignature, File, FileHash, ProductSignature, PublisherSignature, VersionAndAboveSignature} +} + // AadConnectivityState1 describes an Azure resource with kind type AadConnectivityState1 struct { // ConnectivityState - Possible values include: 'Discovered', 'NotLicensed', 'Connected' @@ -1047,6 +1298,128 @@ type AllowedConnectionsResourceProperties struct { ConnectableResources *[]ConnectableResource `json:"connectableResources,omitempty"` } +// AppWhitelistingGroup ... +type AppWhitelistingGroup struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Location where the resource is stored + Location *string `json:"location,omitempty"` + *AppWhitelistingGroupData `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppWhitelistingGroup. +func (awg AppWhitelistingGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if awg.AppWhitelistingGroupData != nil { + objectMap["properties"] = awg.AppWhitelistingGroupData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AppWhitelistingGroup struct. +func (awg *AppWhitelistingGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + awg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + awg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + awg.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + awg.Location = &location + } + case "properties": + if v != nil { + var appWhitelistingGroupData AppWhitelistingGroupData + err = json.Unmarshal(*v, &appWhitelistingGroupData) + if err != nil { + return err + } + awg.AppWhitelistingGroupData = &appWhitelistingGroupData + } + } + } + + return nil +} + +// AppWhitelistingGroupData represents a VM/server group and set of rules that are Recommended by Azure +// Security Center to be allowed +type AppWhitelistingGroupData struct { + // EnforcementMode - Possible values include: 'Audit', 'Enforce' + EnforcementMode EnforcementMode `json:"enforcementMode,omitempty"` + // ConfigurationStatus - Possible values include: 'ConfigurationStatus2Configured', 'ConfigurationStatus2NotConfigured', 'ConfigurationStatus2InProgress', 'ConfigurationStatus2Failed', 'ConfigurationStatus2NoStatus' + ConfigurationStatus ConfigurationStatus2 `json:"configurationStatus,omitempty"` + // RecommendationStatus - Possible values include: 'RecommendationStatusRecommended', 'RecommendationStatusNotRecommended', 'RecommendationStatusNotAvailable', 'RecommendationStatusNoStatus' + RecommendationStatus RecommendationStatus `json:"recommendationStatus,omitempty"` + Issues *[]AppWhitelistingIssueSummary `json:"issues,omitempty"` + // SourceSystem - Possible values include: 'AzureAppLocker', 'AzureAuditD', 'NonAzureAppLocker', 'NonAzureAuditD', 'None' + SourceSystem SourceSystem `json:"sourceSystem,omitempty"` + VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` + PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +} + +// AppWhitelistingGroups represents a list of VM/server groups and set of rules that are Recommended by +// Azure Security Center to be allowed +type AppWhitelistingGroups struct { + autorest.Response `json:"-"` + Value *[]AppWhitelistingGroup `json:"value,omitempty"` +} + +// AppWhitelistingIssueSummary represents a summary of the alerts of the VM/server group +type AppWhitelistingIssueSummary struct { + // Issue - Possible values include: 'ViolationsAudited', 'ViolationsBlocked', 'MsiAndScriptViolationsAudited', 'MsiAndScriptViolationsBlocked', 'ExecutableViolationsAudited', 'RulesViolatedManually' + Issue Issue `json:"issue,omitempty"` + // NumberOfVms - The number of machines in the VM/server group that have this alert + NumberOfVms *float64 `json:"numberOfVms,omitempty"` +} + +// AppWhitelistingPutGroupData the altered data of the recommended VM/server group policy +type AppWhitelistingPutGroupData struct { + // EnforcementMode - Possible values include: 'EnforcementMode1Audit', 'EnforcementMode1Enforce' + EnforcementMode EnforcementMode1 `json:"enforcementMode,omitempty"` + VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` + PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +} + // AscLocation the ASC location of the subscription is in the "name" field type AscLocation struct { autorest.Response `json:"-"` @@ -4021,6 +4394,25 @@ func NewOperationListPage(getNextPage func(context.Context, OperationList) (Oper return OperationListPage{fn: getNextPage} } +// PathRecommendation represents a path that is recommended to be allowed and its properties +type PathRecommendation struct { + // Path - The full path to whitelist + Path *string `json:"path,omitempty"` + // Action - Possible values include: 'Recommended', 'Add', 'Remove' + Action Action `json:"action,omitempty"` + // Type - Possible values include: 'File', 'FileHash', 'PublisherSignature', 'ProductSignature', 'BinarySignature', 'VersionAndAboveSignature' + Type Type `json:"type,omitempty"` + PublisherInfo *PublisherInfo `json:"publisherInfo,omitempty"` + // Common - Whether the path is commonly run on the machine + Common *bool `json:"common,omitempty"` + UserSids *[]string `json:"userSids,omitempty"` + Usernames *[]UserRecommendation `json:"usernames,omitempty"` + // FileType - Possible values include: 'Exe', 'Dll', 'Msi', 'Script', 'Unknown' + FileType FileType `json:"fileType,omitempty"` + // ConfigurationStatus - Possible values include: 'ConfigurationStatus1Configured', 'ConfigurationStatus1NotConfigured', 'ConfigurationStatus1InProgress', 'ConfigurationStatus1Failed', 'ConfigurationStatus1NoStatus' + ConfigurationStatus ConfigurationStatus1 `json:"configurationStatus,omitempty"` +} + // Pricing pricing tier will be applied for the scope based on the resource ID type Pricing struct { autorest.Response `json:"-"` @@ -4109,6 +4501,18 @@ type PricingProperties struct { FreeTrialRemainingTime *string `json:"freeTrialRemainingTime,omitempty"` } +// PublisherInfo represents the publisher information of a process/rule +type PublisherInfo struct { + // PublisherName - The Subject field of the x.509 certificate used to sign the code, using the following fields - O = Organization, L = Locality, S = State or Province, and C = Country + PublisherName *string `json:"publisherName,omitempty"` + // ProductName - The product name taken from the file's version resource + ProductName *string `json:"productName,omitempty"` + // BinaryName - The "OriginalName" field taken from the file's version resource + BinaryName *string `json:"binaryName,omitempty"` + // Version - The binary file version taken from the file's version resource + Version *string `json:"version,omitempty"` +} + // RegulatoryComplianceAssessment regulatory compliance assessment details and state type RegulatoryComplianceAssessment struct { autorest.Response `json:"-"` @@ -4909,7 +5313,7 @@ func (sva *ServerVulnerabilityAssessment) UnmarshalJSON(body []byte) error { // ServerVulnerabilityAssessmentProperties describes ServerVulnerabilityAssessment properties. type ServerVulnerabilityAssessmentProperties struct { - // ProvisioningState - READ-ONLY; The provisioningState of the vulnerability assessment capability on the VM. Possible values include: 'Succeeded', 'Failed', 'Canceled', 'Provisioning', 'Deprovisioning' + // ProvisioningState - READ-ONLY; The provisioningState of the vulnerability assessment capability on the VM. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateProvisioning', 'ProvisioningStateDeprovisioning' ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` } @@ -5642,6 +6046,23 @@ type TopologySingleResourceParent struct { ResourceID *string `json:"resourceId,omitempty"` } +// UserRecommendation represents a user that is recommended to be allowed for a certain rule +type UserRecommendation struct { + // Username - Represents a user that is recommended to be allowed for a certain rule + Username *string `json:"username,omitempty"` + // RecommendationAction - Possible values include: 'RecommendationAction1Recommended', 'RecommendationAction1Add', 'RecommendationAction1Remove' + RecommendationAction RecommendationAction1 `json:"recommendationAction,omitempty"` +} + +// VMRecommendation represents a machine that is part of a VM/server group +type VMRecommendation struct { + // ConfigurationStatus - Possible values include: 'Configured', 'NotConfigured', 'InProgress', 'Failed', 'NoStatus' + ConfigurationStatus ConfigurationStatus `json:"configurationStatus,omitempty"` + // RecommendationAction - Possible values include: 'RecommendationActionRecommended', 'RecommendationActionAdd', 'RecommendationActionRemove' + RecommendationAction RecommendationAction `json:"recommendationAction,omitempty"` + ResourceID *string `json:"resourceId,omitempty"` +} + // WorkspaceSetting configures where to store the OMS agent data for workspaces under a scope type WorkspaceSetting struct { autorest.Response `json:"-"` 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 cf6808518f0e..e1ae813ee59c 100644 --- a/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go @@ -104,6 +104,15 @@ type JitNetworkAccessPoliciesClientAPI interface { var _ JitNetworkAccessPoliciesClientAPI = (*security.JitNetworkAccessPoliciesClient)(nil) +// AdaptiveApplicationControlsClientAPI contains the set of methods on the AdaptiveApplicationControlsClient type. +type AdaptiveApplicationControlsClientAPI interface { + Get(ctx context.Context, groupName string) (result security.AppWhitelistingGroup, err error) + List(ctx context.Context, includePathRecommendations *bool, summary *bool) (result security.AppWhitelistingGroups, err error) + Put(ctx context.Context, groupName string, body security.AppWhitelistingPutGroupData) (result security.AppWhitelistingGroup, err error) +} + +var _ AdaptiveApplicationControlsClientAPI = (*security.AdaptiveApplicationControlsClient)(nil) + // LocationsClientAPI contains the set of methods on the LocationsClient type. type LocationsClientAPI interface { Get(ctx context.Context) (result security.AscLocation, err error) From e902f375ea1266105771548826a05460944e5825 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 9 Jul 2019 08:57:46 +0000 Subject: [PATCH 2/3] Generated from 56fe4277e879002f98abc961fc5fb3abf80cf32a remove location from example, add Executable to fileType --- .../preview/preview/security/mgmt/security/models.go | 11 ++++++----- .../preview/security/mgmt/v1.0/security/models.go | 6 ++++-- .../preview/security/mgmt/v2.0/security/models.go | 6 ++++-- .../preview/security/mgmt/v3.0/security/models.go | 6 ++++-- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/profiles/preview/preview/security/mgmt/security/models.go b/profiles/preview/preview/security/mgmt/security/models.go index 0ca39a909189..34ffb776019a 100644 --- a/profiles/preview/preview/security/mgmt/security/models.go +++ b/profiles/preview/preview/security/mgmt/security/models.go @@ -137,11 +137,12 @@ const ( type FileType = original.FileType const ( - Dll FileType = original.Dll - Exe FileType = original.Exe - Msi FileType = original.Msi - Script FileType = original.Script - Unknown FileType = original.Unknown + Dll FileType = original.Dll + Exe FileType = original.Exe + Executable FileType = original.Executable + Msi FileType = original.Msi + Script FileType = original.Script + Unknown FileType = original.Unknown ) type Issue = original.Issue diff --git a/services/preview/security/mgmt/v1.0/security/models.go b/services/preview/security/mgmt/v1.0/security/models.go index 686c939c82bf..6b41a0671d75 100644 --- a/services/preview/security/mgmt/v1.0/security/models.go +++ b/services/preview/security/mgmt/v1.0/security/models.go @@ -278,6 +278,8 @@ const ( Dll FileType = "Dll" // Exe ... Exe FileType = "Exe" + // Executable ... + Executable FileType = "Executable" // Msi ... Msi FileType = "Msi" // Script ... @@ -288,7 +290,7 @@ const ( // PossibleFileTypeValues returns an array of possible values for the FileType const type. func PossibleFileTypeValues() []FileType { - return []FileType{Dll, Exe, Msi, Script, Unknown} + return []FileType{Dll, Exe, Executable, Msi, Script, Unknown} } // Issue enumerates the values for issue. @@ -4749,7 +4751,7 @@ type PathRecommendation struct { Common *bool `json:"common,omitempty"` UserSids *[]string `json:"userSids,omitempty"` Usernames *[]UserRecommendation `json:"usernames,omitempty"` - // FileType - Possible values include: 'Exe', 'Dll', 'Msi', 'Script', 'Unknown' + // FileType - Possible values include: 'Exe', 'Dll', 'Msi', 'Script', 'Executable', 'Unknown' FileType FileType `json:"fileType,omitempty"` // ConfigurationStatus - Possible values include: 'ConfigurationStatus1Configured', 'ConfigurationStatus1NotConfigured', 'ConfigurationStatus1InProgress', 'ConfigurationStatus1Failed', 'ConfigurationStatus1NoStatus' ConfigurationStatus ConfigurationStatus1 `json:"configurationStatus,omitempty"` diff --git a/services/preview/security/mgmt/v2.0/security/models.go b/services/preview/security/mgmt/v2.0/security/models.go index eac3ff8bd496..923ea5cecfed 100644 --- a/services/preview/security/mgmt/v2.0/security/models.go +++ b/services/preview/security/mgmt/v2.0/security/models.go @@ -278,6 +278,8 @@ const ( Dll FileType = "Dll" // Exe ... Exe FileType = "Exe" + // Executable ... + Executable FileType = "Executable" // Msi ... Msi FileType = "Msi" // Script ... @@ -288,7 +290,7 @@ const ( // PossibleFileTypeValues returns an array of possible values for the FileType const type. func PossibleFileTypeValues() []FileType { - return []FileType{Dll, Exe, Msi, Script, Unknown} + return []FileType{Dll, Exe, Executable, Msi, Script, Unknown} } // Issue enumerates the values for issue. @@ -4749,7 +4751,7 @@ type PathRecommendation struct { Common *bool `json:"common,omitempty"` UserSids *[]string `json:"userSids,omitempty"` Usernames *[]UserRecommendation `json:"usernames,omitempty"` - // FileType - Possible values include: 'Exe', 'Dll', 'Msi', 'Script', 'Unknown' + // FileType - Possible values include: 'Exe', 'Dll', 'Msi', 'Script', 'Executable', 'Unknown' FileType FileType `json:"fileType,omitempty"` // ConfigurationStatus - Possible values include: 'ConfigurationStatus1Configured', 'ConfigurationStatus1NotConfigured', 'ConfigurationStatus1InProgress', 'ConfigurationStatus1Failed', 'ConfigurationStatus1NoStatus' ConfigurationStatus ConfigurationStatus1 `json:"configurationStatus,omitempty"` diff --git a/services/preview/security/mgmt/v3.0/security/models.go b/services/preview/security/mgmt/v3.0/security/models.go index b70b97541921..e33c7168eecb 100644 --- a/services/preview/security/mgmt/v3.0/security/models.go +++ b/services/preview/security/mgmt/v3.0/security/models.go @@ -262,6 +262,8 @@ const ( Dll FileType = "Dll" // Exe ... Exe FileType = "Exe" + // Executable ... + Executable FileType = "Executable" // Msi ... Msi FileType = "Msi" // Script ... @@ -272,7 +274,7 @@ const ( // PossibleFileTypeValues returns an array of possible values for the FileType const type. func PossibleFileTypeValues() []FileType { - return []FileType{Dll, Exe, Msi, Script, Unknown} + return []FileType{Dll, Exe, Executable, Msi, Script, Unknown} } // Issue enumerates the values for issue. @@ -4407,7 +4409,7 @@ type PathRecommendation struct { Common *bool `json:"common,omitempty"` UserSids *[]string `json:"userSids,omitempty"` Usernames *[]UserRecommendation `json:"usernames,omitempty"` - // FileType - Possible values include: 'Exe', 'Dll', 'Msi', 'Script', 'Unknown' + // FileType - Possible values include: 'Exe', 'Dll', 'Msi', 'Script', 'Executable', 'Unknown' FileType FileType `json:"fileType,omitempty"` // ConfigurationStatus - Possible values include: 'ConfigurationStatus1Configured', 'ConfigurationStatus1NotConfigured', 'ConfigurationStatus1InProgress', 'ConfigurationStatus1Failed', 'ConfigurationStatus1NoStatus' ConfigurationStatus ConfigurationStatus1 `json:"configurationStatus,omitempty"` From ec48b29a840e8c931bbdb25513ed44cb10c093a2 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 16 Jul 2019 05:10:20 +0000 Subject: [PATCH 3/3] Generated from 6307743902cd21e4a200cca1cddc2383121ae216 add Whitelistings to custom-words --- .../preview/security/mgmt/security/models.go | 162 ++ .../mgmt/security/securityapi/models.go | 8 + .../security/mgmt/v2.0/security/models.go | 2 +- .../security/mgmt/v2.0/security/pricings.go | 12 +- .../mgmt/v3.0/security/iotsecuritysolution.go | 413 +++++ .../v3.0/security/iotsecuritysolutions.go | 163 ++ .../security/iotsecuritysolutionsanalytics.go | 219 +++ ...curitysolutionsanalyticsaggregatedalert.go | 224 +++ ...uritysolutionsanalyticsaggregatedalerts.go | 175 +++ ...ecuritysolutionsanalyticsrecommendation.go | 135 ++ ...curitysolutionsanalyticsrecommendations.go | 175 +++ .../iotsecuritysolutionsresourcegroup.go | 173 +++ .../security/mgmt/v3.0/security/models.go | 1351 +++++++++++++++-- .../security/mgmt/v3.0/security/pricings.go | 12 +- .../v3.0/security/securityapi/interfaces.go | 61 + 15 files changed, 3161 insertions(+), 124 deletions(-) create mode 100644 services/preview/security/mgmt/v3.0/security/iotsecuritysolution.go create mode 100644 services/preview/security/mgmt/v3.0/security/iotsecuritysolutions.go create mode 100644 services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalytics.go create mode 100644 services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsaggregatedalert.go create mode 100644 services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsaggregatedalerts.go create mode 100644 services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsrecommendation.go create mode 100644 services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsrecommendations.go create mode 100644 services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsresourcegroup.go diff --git a/profiles/preview/preview/security/mgmt/security/models.go b/profiles/preview/preview/security/mgmt/security/models.go index 34ffb776019a..d17999ae6fe7 100644 --- a/profiles/preview/preview/security/mgmt/security/models.go +++ b/profiles/preview/preview/security/mgmt/security/models.go @@ -103,6 +103,12 @@ const ( Internal ConnectionType = original.Internal ) +type DataSource = original.DataSource + +const ( + TwinData DataSource = original.TwinData +) + type EnforcementMode = original.EnforcementMode const ( @@ -117,6 +123,12 @@ const ( EnforcementMode1Enforce EnforcementMode1 = original.EnforcementMode1Enforce ) +type ExportData = original.ExportData + +const ( + RawEvents ExportData = original.RawEvents +) + type ExternalSecuritySolutionKind = original.ExternalSecuritySolutionKind const ( @@ -206,6 +218,13 @@ const ( RecommendationAction1Remove RecommendationAction1 = original.RecommendationAction1Remove ) +type RecommendationConfigStatus = original.RecommendationConfigStatus + +const ( + TurnedOff RecommendationConfigStatus = original.TurnedOff + TurnedOn RecommendationConfigStatus = original.TurnedOn +) + type RecommendationStatus = original.RecommendationStatus const ( @@ -215,6 +234,23 @@ const ( RecommendationStatusRecommended RecommendationStatus = original.RecommendationStatusRecommended ) +type RecommendationType = original.RecommendationType + +const ( + DenyDefaultIPPolicy RecommendationType = original.DenyDefaultIPPolicy + EnableDiagnosticsLog RecommendationType = original.EnableDiagnosticsLog + IdenticalAuthenticationCredentials RecommendationType = original.IdenticalAuthenticationCredentials + OpenPortsOnDevice RecommendationType = original.OpenPortsOnDevice + OperationSystemNotValid RecommendationType = original.OperationSystemNotValid + PermissiveFirewallPolicy RecommendationType = original.PermissiveFirewallPolicy + PermissiveFirewallRuleInput RecommendationType = original.PermissiveFirewallRuleInput + PermissiveFirewallRuleOut RecommendationType = original.PermissiveFirewallRuleOut + SecurityTwinConfigurationConflict RecommendationType = original.SecurityTwinConfigurationConflict + SecurityTwinConfigurationNotOptimal RecommendationType = original.SecurityTwinConfigurationNotOptimal + TooLargeIPRange RecommendationType = original.TooLargeIPRange + UnutilizedMessagesFromAgent RecommendationType = original.UnutilizedMessagesFromAgent +) + type ReportedSeverity = original.ReportedSeverity const ( @@ -240,6 +276,13 @@ const ( SettingKindDataExportSetting SettingKind = original.SettingKindDataExportSetting ) +type SolutionStatus = original.SolutionStatus + +const ( + Disabled SolutionStatus = original.Disabled + Enabled SolutionStatus = original.Enabled +) + type SourceSystem = original.SourceSystem const ( @@ -375,6 +418,40 @@ type InformationProtectionPolicyListIterator = original.InformationProtectionPol type InformationProtectionPolicyListPage = original.InformationProtectionPolicyListPage type InformationProtectionPolicyProperties = original.InformationProtectionPolicyProperties type InformationType = original.InformationType +type IoTSecurityAggregatedAlert = original.IoTSecurityAggregatedAlert +type IoTSecurityAggregatedAlertList = original.IoTSecurityAggregatedAlertList +type IoTSecurityAggregatedAlertListIterator = original.IoTSecurityAggregatedAlertListIterator +type IoTSecurityAggregatedAlertListPage = original.IoTSecurityAggregatedAlertListPage +type IoTSecurityAggregatedAlertProperties = original.IoTSecurityAggregatedAlertProperties +type IoTSecurityAggregatedRecommendation = original.IoTSecurityAggregatedRecommendation +type IoTSecurityAggregatedRecommendationList = original.IoTSecurityAggregatedRecommendationList +type IoTSecurityAggregatedRecommendationListIterator = original.IoTSecurityAggregatedRecommendationListIterator +type IoTSecurityAggregatedRecommendationListPage = original.IoTSecurityAggregatedRecommendationListPage +type IoTSecurityAggregatedRecommendationProperties = original.IoTSecurityAggregatedRecommendationProperties +type IoTSecurityAlertedDevice = original.IoTSecurityAlertedDevice +type IoTSecurityAlertedDevicesList = original.IoTSecurityAlertedDevicesList +type IoTSecurityDeviceAlert = original.IoTSecurityDeviceAlert +type IoTSecurityDeviceAlertsList = original.IoTSecurityDeviceAlertsList +type IoTSecurityDeviceRecommendation = original.IoTSecurityDeviceRecommendation +type IoTSecurityDeviceRecommendationsList = original.IoTSecurityDeviceRecommendationsList +type IoTSecuritySolutionAnalyticsModel = original.IoTSecuritySolutionAnalyticsModel +type IoTSecuritySolutionAnalyticsModelList = original.IoTSecuritySolutionAnalyticsModelList +type IoTSecuritySolutionAnalyticsModelProperties = original.IoTSecuritySolutionAnalyticsModelProperties +type IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem = original.IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem +type IoTSecuritySolutionModel = original.IoTSecuritySolutionModel +type IoTSecuritySolutionProperties = original.IoTSecuritySolutionProperties +type IoTSecuritySolutionsAnalyticsAggregatedAlertClient = original.IoTSecuritySolutionsAnalyticsAggregatedAlertClient +type IoTSecuritySolutionsAnalyticsAggregatedAlertsClient = original.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient +type IoTSecuritySolutionsAnalyticsClient = original.IoTSecuritySolutionsAnalyticsClient +type IoTSecuritySolutionsAnalyticsRecommendationClient = original.IoTSecuritySolutionsAnalyticsRecommendationClient +type IoTSecuritySolutionsAnalyticsRecommendationsClient = original.IoTSecuritySolutionsAnalyticsRecommendationsClient +type IoTSecuritySolutionsClient = original.IoTSecuritySolutionsClient +type IoTSecuritySolutionsList = original.IoTSecuritySolutionsList +type IoTSecuritySolutionsListIterator = original.IoTSecuritySolutionsListIterator +type IoTSecuritySolutionsListPage = original.IoTSecuritySolutionsListPage +type IoTSecuritySolutionsResourceGroupClient = original.IoTSecuritySolutionsResourceGroupClient +type IoTSeverityMetrics = original.IoTSeverityMetrics +type IotSecuritySolutionClient = original.IotSecuritySolutionClient type JitNetworkAccessPoliciesClient = original.JitNetworkAccessPoliciesClient type JitNetworkAccessPoliciesList = original.JitNetworkAccessPoliciesList type JitNetworkAccessPoliciesListIterator = original.JitNetworkAccessPoliciesListIterator @@ -404,6 +481,7 @@ type PricingList = original.PricingList type PricingProperties = original.PricingProperties type PricingsClient = original.PricingsClient type PublisherInfo = original.PublisherInfo +type RecommendationConfigurationProperties = original.RecommendationConfigurationProperties type RegulatoryComplianceAssessment = original.RegulatoryComplianceAssessment type RegulatoryComplianceAssessmentList = original.RegulatoryComplianceAssessmentList type RegulatoryComplianceAssessmentListIterator = original.RegulatoryComplianceAssessmentListIterator @@ -434,6 +512,7 @@ type SettingsClient = original.SettingsClient type SettingsList = original.SettingsList type SettingsListIterator = original.SettingsListIterator type SettingsListPage = original.SettingsListPage +type TagsResource = original.TagsResource type Task = original.Task type TaskList = original.TaskList type TaskListIterator = original.TaskListIterator @@ -450,6 +529,8 @@ type TopologyResourceProperties = original.TopologyResourceProperties type TopologySingleResource = original.TopologySingleResource type TopologySingleResourceChild = original.TopologySingleResourceChild type TopologySingleResourceParent = original.TopologySingleResourceParent +type UpdateIotSecuritySolutionData = original.UpdateIotSecuritySolutionData +type UserDefinedResourcesProperties = original.UserDefinedResourcesProperties type UserRecommendation = original.UserRecommendation type VMRecommendation = original.VMRecommendation type WorkspaceSetting = original.WorkspaceSetting @@ -588,6 +669,72 @@ func NewInformationProtectionPolicyListIterator(page InformationProtectionPolicy func NewInformationProtectionPolicyListPage(getNextPage func(context.Context, InformationProtectionPolicyList) (InformationProtectionPolicyList, error)) InformationProtectionPolicyListPage { return original.NewInformationProtectionPolicyListPage(getNextPage) } +func NewIoTSecurityAggregatedAlertListIterator(page IoTSecurityAggregatedAlertListPage) IoTSecurityAggregatedAlertListIterator { + return original.NewIoTSecurityAggregatedAlertListIterator(page) +} +func NewIoTSecurityAggregatedAlertListPage(getNextPage func(context.Context, IoTSecurityAggregatedAlertList) (IoTSecurityAggregatedAlertList, error)) IoTSecurityAggregatedAlertListPage { + return original.NewIoTSecurityAggregatedAlertListPage(getNextPage) +} +func NewIoTSecurityAggregatedRecommendationListIterator(page IoTSecurityAggregatedRecommendationListPage) IoTSecurityAggregatedRecommendationListIterator { + return original.NewIoTSecurityAggregatedRecommendationListIterator(page) +} +func NewIoTSecurityAggregatedRecommendationListPage(getNextPage func(context.Context, IoTSecurityAggregatedRecommendationList) (IoTSecurityAggregatedRecommendationList, error)) IoTSecurityAggregatedRecommendationListPage { + return original.NewIoTSecurityAggregatedRecommendationListPage(getNextPage) +} +func NewIoTSecuritySolutionsAnalyticsAggregatedAlertClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsAggregatedAlertClient { + return original.NewIoTSecuritySolutionsAnalyticsAggregatedAlertClient(subscriptionID, ascLocation) +} +func NewIoTSecuritySolutionsAnalyticsAggregatedAlertClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsAggregatedAlertClient { + return original.NewIoTSecuritySolutionsAnalyticsAggregatedAlertClientWithBaseURI(baseURI, subscriptionID, ascLocation) +} +func NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsAggregatedAlertsClient { + return original.NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClient(subscriptionID, ascLocation) +} +func NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsAggregatedAlertsClient { + return original.NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClientWithBaseURI(baseURI, subscriptionID, ascLocation) +} +func NewIoTSecuritySolutionsAnalyticsClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsClient { + return original.NewIoTSecuritySolutionsAnalyticsClient(subscriptionID, ascLocation) +} +func NewIoTSecuritySolutionsAnalyticsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsClient { + return original.NewIoTSecuritySolutionsAnalyticsClientWithBaseURI(baseURI, subscriptionID, ascLocation) +} +func NewIoTSecuritySolutionsAnalyticsRecommendationClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsRecommendationClient { + return original.NewIoTSecuritySolutionsAnalyticsRecommendationClient(subscriptionID, ascLocation) +} +func NewIoTSecuritySolutionsAnalyticsRecommendationClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsRecommendationClient { + return original.NewIoTSecuritySolutionsAnalyticsRecommendationClientWithBaseURI(baseURI, subscriptionID, ascLocation) +} +func NewIoTSecuritySolutionsAnalyticsRecommendationsClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsRecommendationsClient { + return original.NewIoTSecuritySolutionsAnalyticsRecommendationsClient(subscriptionID, ascLocation) +} +func NewIoTSecuritySolutionsAnalyticsRecommendationsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsRecommendationsClient { + return original.NewIoTSecuritySolutionsAnalyticsRecommendationsClientWithBaseURI(baseURI, subscriptionID, ascLocation) +} +func NewIoTSecuritySolutionsClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsClient { + return original.NewIoTSecuritySolutionsClient(subscriptionID, ascLocation) +} +func NewIoTSecuritySolutionsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsClient { + return original.NewIoTSecuritySolutionsClientWithBaseURI(baseURI, subscriptionID, ascLocation) +} +func NewIoTSecuritySolutionsListIterator(page IoTSecuritySolutionsListPage) IoTSecuritySolutionsListIterator { + return original.NewIoTSecuritySolutionsListIterator(page) +} +func NewIoTSecuritySolutionsListPage(getNextPage func(context.Context, IoTSecuritySolutionsList) (IoTSecuritySolutionsList, error)) IoTSecuritySolutionsListPage { + return original.NewIoTSecuritySolutionsListPage(getNextPage) +} +func NewIoTSecuritySolutionsResourceGroupClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsResourceGroupClient { + return original.NewIoTSecuritySolutionsResourceGroupClient(subscriptionID, ascLocation) +} +func NewIoTSecuritySolutionsResourceGroupClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsResourceGroupClient { + return original.NewIoTSecuritySolutionsResourceGroupClientWithBaseURI(baseURI, subscriptionID, ascLocation) +} +func NewIotSecuritySolutionClient(subscriptionID string, ascLocation string) IotSecuritySolutionClient { + return original.NewIotSecuritySolutionClient(subscriptionID, ascLocation) +} +func NewIotSecuritySolutionClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IotSecuritySolutionClient { + return original.NewIotSecuritySolutionClientWithBaseURI(baseURI, subscriptionID, ascLocation) +} func NewJitNetworkAccessPoliciesClient(subscriptionID string, ascLocation string) JitNetworkAccessPoliciesClient { return original.NewJitNetworkAccessPoliciesClient(subscriptionID, ascLocation) } @@ -744,12 +891,18 @@ func PossibleConfigurationStatusValues() []ConfigurationStatus { func PossibleConnectionTypeValues() []ConnectionType { return original.PossibleConnectionTypeValues() } +func PossibleDataSourceValues() []DataSource { + return original.PossibleDataSourceValues() +} func PossibleEnforcementMode1Values() []EnforcementMode1 { return original.PossibleEnforcementMode1Values() } func PossibleEnforcementModeValues() []EnforcementMode { return original.PossibleEnforcementModeValues() } +func PossibleExportDataValues() []ExportData { + return original.PossibleExportDataValues() +} func PossibleExternalSecuritySolutionKindValues() []ExternalSecuritySolutionKind { return original.PossibleExternalSecuritySolutionKindValues() } @@ -780,9 +933,15 @@ func PossibleRecommendationAction1Values() []RecommendationAction1 { func PossibleRecommendationActionValues() []RecommendationAction { return original.PossibleRecommendationActionValues() } +func PossibleRecommendationConfigStatusValues() []RecommendationConfigStatus { + return original.PossibleRecommendationConfigStatusValues() +} func PossibleRecommendationStatusValues() []RecommendationStatus { return original.PossibleRecommendationStatusValues() } +func PossibleRecommendationTypeValues() []RecommendationType { + return original.PossibleRecommendationTypeValues() +} func PossibleReportedSeverityValues() []ReportedSeverity { return original.PossibleReportedSeverityValues() } @@ -792,6 +951,9 @@ func PossibleResourceStatusValues() []ResourceStatus { func PossibleSettingKindValues() []SettingKind { return original.PossibleSettingKindValues() } +func PossibleSolutionStatusValues() []SolutionStatus { + return original.PossibleSolutionStatusValues() +} func PossibleSourceSystemValues() []SourceSystem { return original.PossibleSourceSystemValues() } diff --git a/profiles/preview/preview/security/mgmt/security/securityapi/models.go b/profiles/preview/preview/security/mgmt/security/securityapi/models.go index f7833e384019..f3f1649c0b39 100644 --- a/profiles/preview/preview/security/mgmt/security/securityapi/models.go +++ b/profiles/preview/preview/security/mgmt/security/securityapi/models.go @@ -32,6 +32,14 @@ type ContactsClientAPI = original.ContactsClientAPI type DiscoveredSecuritySolutionsClientAPI = original.DiscoveredSecuritySolutionsClientAPI type ExternalSecuritySolutionsClientAPI = original.ExternalSecuritySolutionsClientAPI type InformationProtectionPoliciesClientAPI = original.InformationProtectionPoliciesClientAPI +type IoTSecuritySolutionsAnalyticsAggregatedAlertClientAPI = original.IoTSecuritySolutionsAnalyticsAggregatedAlertClientAPI +type IoTSecuritySolutionsAnalyticsAggregatedAlertsClientAPI = original.IoTSecuritySolutionsAnalyticsAggregatedAlertsClientAPI +type IoTSecuritySolutionsAnalyticsClientAPI = original.IoTSecuritySolutionsAnalyticsClientAPI +type IoTSecuritySolutionsAnalyticsRecommendationClientAPI = original.IoTSecuritySolutionsAnalyticsRecommendationClientAPI +type IoTSecuritySolutionsAnalyticsRecommendationsClientAPI = original.IoTSecuritySolutionsAnalyticsRecommendationsClientAPI +type IoTSecuritySolutionsClientAPI = original.IoTSecuritySolutionsClientAPI +type IoTSecuritySolutionsResourceGroupClientAPI = original.IoTSecuritySolutionsResourceGroupClientAPI +type IotSecuritySolutionClientAPI = original.IotSecuritySolutionClientAPI type JitNetworkAccessPoliciesClientAPI = original.JitNetworkAccessPoliciesClientAPI type LocationsClientAPI = original.LocationsClientAPI type OperationsClientAPI = original.OperationsClientAPI diff --git a/services/preview/security/mgmt/v2.0/security/models.go b/services/preview/security/mgmt/v2.0/security/models.go index 923ea5cecfed..d2369e5e53bb 100644 --- a/services/preview/security/mgmt/v2.0/security/models.go +++ b/services/preview/security/mgmt/v2.0/security/models.go @@ -4839,7 +4839,7 @@ type PricingList struct { // PricingProperties pricing properties for the relevant scope type PricingProperties struct { - // PricingTier - The pricing tier value. Possible values include: 'Free', 'Standard' + // PricingTier - The pricing tier value. Azure Security Center is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features. Possible values include: 'Free', 'Standard' PricingTier PricingTier `json:"pricingTier,omitempty"` // FreeTrialRemainingTime - READ-ONLY; The duration left for the subscriptions free trial period - in ISO 8601 format (e.g. P3Y6M4DT12H30M5S). FreeTrialRemainingTime *string `json:"freeTrialRemainingTime,omitempty"` diff --git a/services/preview/security/mgmt/v2.0/security/pricings.go b/services/preview/security/mgmt/v2.0/security/pricings.go index ceb3b3291c14..f73100cc775f 100644 --- a/services/preview/security/mgmt/v2.0/security/pricings.go +++ b/services/preview/security/mgmt/v2.0/security/pricings.go @@ -41,7 +41,9 @@ func NewPricingsClientWithBaseURI(baseURI string, subscriptionID string, ascLoca return PricingsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} } -// Get security pricing configuration in the subscription +// Get a given security pricing configuration in the subscription. Azure Security Center is available in two pricing +// tiers: Free and Standard, on multiple resource types, including Virtual machines, SQL Servers, App service plans and +// Storage accounts. // Parameters: // pricingName - name of the pricing configuration func (client PricingsClient) Get(ctx context.Context, pricingName string) (result Pricing, err error) { @@ -122,7 +124,9 @@ func (client PricingsClient) GetResponder(resp *http.Response) (result Pricing, return } -// List security pricing configurations in the subscription +// List a given security pricing configuration in the subscription. Azure Security Center is available in two pricing +// tiers: Free and Standard, on multiple resource types, including Virtual machines, SQL Servers, App service plans and +// Storage accounts. func (client PricingsClient) List(ctx context.Context) (result PricingList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PricingsClient.List") @@ -200,7 +204,9 @@ func (client PricingsClient) ListResponder(resp *http.Response) (result PricingL return } -// Update security pricing configuration in the subscription +// Update a given security pricing configuration in the subscription. Azure Security Center is available in two pricing +// tiers: Free and Standard, on multiple resource types, including Virtual machines, SQL Servers, App service plans and +// Storage accounts. // Parameters: // pricingName - name of the pricing configuration // pricing - pricing object diff --git a/services/preview/security/mgmt/v3.0/security/iotsecuritysolution.go b/services/preview/security/mgmt/v3.0/security/iotsecuritysolution.go new file mode 100644 index 000000000000..6600ee165766 --- /dev/null +++ b/services/preview/security/mgmt/v3.0/security/iotsecuritysolution.go @@ -0,0 +1,413 @@ +package security + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IotSecuritySolutionClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type IotSecuritySolutionClient struct { + BaseClient +} + +// NewIotSecuritySolutionClient creates an instance of the IotSecuritySolutionClient client. +func NewIotSecuritySolutionClient(subscriptionID string, ascLocation string) IotSecuritySolutionClient { + return NewIotSecuritySolutionClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewIotSecuritySolutionClientWithBaseURI creates an instance of the IotSecuritySolutionClient client. +func NewIotSecuritySolutionClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IotSecuritySolutionClient { + return IotSecuritySolutionClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// Create create new solution manager +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// solutionName - the solution manager name +// iotSecuritySolutionData - the security solution data +func (client IotSecuritySolutionClient) Create(ctx context.Context, resourceGroupName string, solutionName string, iotSecuritySolutionData IoTSecuritySolutionModel) (result IoTSecuritySolutionModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionClient.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}}}, + {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}}}, + {TargetValue: iotSecuritySolutionData, + Constraints: []validation.Constraint{{Target: "iotSecuritySolutionData.IoTSecuritySolutionProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "iotSecuritySolutionData.IoTSecuritySolutionProperties.Workspace", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "iotSecuritySolutionData.IoTSecuritySolutionProperties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "iotSecuritySolutionData.IoTSecuritySolutionProperties.IotHubs", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "iotSecuritySolutionData.IoTSecuritySolutionProperties.UserDefinedResources", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "iotSecuritySolutionData.IoTSecuritySolutionProperties.UserDefinedResources.Query", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "iotSecuritySolutionData.IoTSecuritySolutionProperties.UserDefinedResources.QuerySubscriptions", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("security.IotSecuritySolutionClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, solutionName, iotSecuritySolutionData) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "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.IotSecuritySolutionClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "Create", resp, "Failure responding to request") + } + + return +} + +// CreatePreparer prepares the Create request. +func (client IotSecuritySolutionClient) CreatePreparer(ctx context.Context, resourceGroupName string, solutionName string, iotSecuritySolutionData IoTSecuritySolutionModel) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "solutionName": autorest.Encode("path", solutionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + iotSecuritySolutionData.ID = nil + iotSecuritySolutionData.Name = nil + iotSecuritySolutionData.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}", pathParameters), + autorest.WithJSON(iotSecuritySolutionData), + 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 IotSecuritySolutionClient) CreateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client IotSecuritySolutionClient) CreateResponder(resp *http.Response) (result IoTSecuritySolutionModel, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete create new solution manager +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// solutionName - the solution manager name +func (client IotSecuritySolutionClient) Delete(ctx context.Context, resourceGroupName string, solutionName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.IotSecuritySolutionClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, solutionName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client IotSecuritySolutionClient) DeletePreparer(ctx context.Context, resourceGroupName string, solutionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "solutionName": autorest.Encode("path", solutionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}", 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 IotSecuritySolutionClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client IotSecuritySolutionClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get details of a specific iot security solution +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// solutionName - the solution manager name +func (client IotSecuritySolutionClient) Get(ctx context.Context, resourceGroupName string, solutionName string) (result IoTSecuritySolutionModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionClient.Get") + 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.IotSecuritySolutionClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, solutionName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "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.IotSecuritySolutionClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client IotSecuritySolutionClient) GetPreparer(ctx context.Context, resourceGroupName string, solutionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "solutionName": autorest.Encode("path", solutionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}", 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 IotSecuritySolutionClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client IotSecuritySolutionClient) GetResponder(resp *http.Response) (result IoTSecuritySolutionModel, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update existing Security Solution tags or user defined resources. To update other fields use the +// CreateOrUpdate method +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// solutionName - the solution manager name +// updateIotSecuritySolutionData - the security solution data +func (client IotSecuritySolutionClient) Update(ctx context.Context, resourceGroupName string, solutionName string, updateIotSecuritySolutionData UpdateIotSecuritySolutionData) (result IoTSecuritySolutionModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotSecuritySolutionClient.Update") + 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.IotSecuritySolutionClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, solutionName, updateIotSecuritySolutionData) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSecuritySolutionClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client IotSecuritySolutionClient) UpdatePreparer(ctx context.Context, resourceGroupName string, solutionName string, updateIotSecuritySolutionData UpdateIotSecuritySolutionData) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "solutionName": autorest.Encode("path", solutionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}", pathParameters), + autorest.WithJSON(updateIotSecuritySolutionData), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client IotSecuritySolutionClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client IotSecuritySolutionClient) UpdateResponder(resp *http.Response) (result IoTSecuritySolutionModel, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutions.go b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutions.go new file mode 100644 index 000000000000..4605efaa2ed5 --- /dev/null +++ b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutions.go @@ -0,0 +1,163 @@ +package security + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IoTSecuritySolutionsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type IoTSecuritySolutionsClient struct { + BaseClient +} + +// NewIoTSecuritySolutionsClient creates an instance of the IoTSecuritySolutionsClient client. +func NewIoTSecuritySolutionsClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsClient { + return NewIoTSecuritySolutionsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewIoTSecuritySolutionsClientWithBaseURI creates an instance of the IoTSecuritySolutionsClient client. +func NewIoTSecuritySolutionsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsClient { + return IoTSecuritySolutionsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// List list of security solutions +// Parameters: +// filter - filter the Security Solution with OData syntax. supporting filter by iotHubs +func (client IoTSecuritySolutionsClient) List(ctx context.Context, filter string) (result IoTSecuritySolutionsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsClient.List") + defer func() { + sc := -1 + if result.itssl.Response.Response != nil { + sc = result.itssl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.IoTSecuritySolutionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.itssl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsClient", "List", resp, "Failure sending request") + return + } + + result.itssl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client IoTSecuritySolutionsClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client IoTSecuritySolutionsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client IoTSecuritySolutionsClient) ListResponder(resp *http.Response) (result IoTSecuritySolutionsList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client IoTSecuritySolutionsClient) listNextResults(ctx context.Context, lastResults IoTSecuritySolutionsList) (result IoTSecuritySolutionsList, err error) { + req, err := lastResults.ioTSecuritySolutionsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client IoTSecuritySolutionsClient) ListComplete(ctx context.Context, filter string) (result IoTSecuritySolutionsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, filter) + return +} diff --git a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalytics.go b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalytics.go new file mode 100644 index 000000000000..6058a5761f13 --- /dev/null +++ b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalytics.go @@ -0,0 +1,219 @@ +package security + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IoTSecuritySolutionsAnalyticsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type IoTSecuritySolutionsAnalyticsClient struct { + BaseClient +} + +// NewIoTSecuritySolutionsAnalyticsClient creates an instance of the IoTSecuritySolutionsAnalyticsClient client. +func NewIoTSecuritySolutionsAnalyticsClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsClient { + return NewIoTSecuritySolutionsAnalyticsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewIoTSecuritySolutionsAnalyticsClientWithBaseURI creates an instance of the IoTSecuritySolutionsAnalyticsClient +// client. +func NewIoTSecuritySolutionsAnalyticsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsClient { + return IoTSecuritySolutionsAnalyticsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// GetAll security Analytics of a security solution +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// solutionName - the solution manager name +func (client IoTSecuritySolutionsAnalyticsClient) GetAll(ctx context.Context, resourceGroupName string, solutionName string) (result IoTSecuritySolutionAnalyticsModelList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsClient.GetAll") + 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.IoTSecuritySolutionsAnalyticsClient", "GetAll", err.Error()) + } + + req, err := client.GetAllPreparer(ctx, resourceGroupName, solutionName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsClient", "GetAll", nil, "Failure preparing request") + return + } + + resp, err := client.GetAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsClient", "GetAll", resp, "Failure sending request") + return + } + + result, err = client.GetAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsClient", "GetAll", resp, "Failure responding to request") + } + + return +} + +// GetAllPreparer prepares the GetAll request. +func (client IoTSecuritySolutionsAnalyticsClient) GetAllPreparer(ctx context.Context, resourceGroupName string, solutionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "solutionName": autorest.Encode("path", solutionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAllSender sends the GetAll request. The method will close the +// http.Response Body if it receives an error. +func (client IoTSecuritySolutionsAnalyticsClient) GetAllSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetAllResponder handles the response to the GetAll request. The method always +// closes the http.Response Body. +func (client IoTSecuritySolutionsAnalyticsClient) GetAllResponder(resp *http.Response) (result IoTSecuritySolutionAnalyticsModelList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDefault security Analytics of a security solution +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// solutionName - the solution manager name +func (client IoTSecuritySolutionsAnalyticsClient) GetDefault(ctx context.Context, resourceGroupName string, solutionName string) (result IoTSecuritySolutionAnalyticsModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsClient.GetDefault") + 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.IoTSecuritySolutionsAnalyticsClient", "GetDefault", err.Error()) + } + + req, err := client.GetDefaultPreparer(ctx, resourceGroupName, solutionName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsClient", "GetDefault", nil, "Failure preparing request") + return + } + + resp, err := client.GetDefaultSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsClient", "GetDefault", resp, "Failure sending request") + return + } + + result, err = client.GetDefaultResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsClient", "GetDefault", resp, "Failure responding to request") + } + + return +} + +// GetDefaultPreparer prepares the GetDefault request. +func (client IoTSecuritySolutionsAnalyticsClient) GetDefaultPreparer(ctx context.Context, resourceGroupName string, solutionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "solutionName": autorest.Encode("path", solutionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDefaultSender sends the GetDefault request. The method will close the +// http.Response Body if it receives an error. +func (client IoTSecuritySolutionsAnalyticsClient) GetDefaultSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetDefaultResponder handles the response to the GetDefault request. The method always +// closes the http.Response Body. +func (client IoTSecuritySolutionsAnalyticsClient) GetDefaultResponder(resp *http.Response) (result IoTSecuritySolutionAnalyticsModel, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsaggregatedalert.go b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsaggregatedalert.go new file mode 100644 index 000000000000..644d2d7792c1 --- /dev/null +++ b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsaggregatedalert.go @@ -0,0 +1,224 @@ +package security + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IoTSecuritySolutionsAnalyticsAggregatedAlertClient is the API spec for Microsoft.Security (Azure Security Center) +// resource provider +type IoTSecuritySolutionsAnalyticsAggregatedAlertClient struct { + BaseClient +} + +// NewIoTSecuritySolutionsAnalyticsAggregatedAlertClient creates an instance of the +// IoTSecuritySolutionsAnalyticsAggregatedAlertClient client. +func NewIoTSecuritySolutionsAnalyticsAggregatedAlertClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsAggregatedAlertClient { + return NewIoTSecuritySolutionsAnalyticsAggregatedAlertClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewIoTSecuritySolutionsAnalyticsAggregatedAlertClientWithBaseURI creates an instance of the +// IoTSecuritySolutionsAnalyticsAggregatedAlertClient client. +func NewIoTSecuritySolutionsAnalyticsAggregatedAlertClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsAggregatedAlertClient { + return IoTSecuritySolutionsAnalyticsAggregatedAlertClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// Dismiss security Analytics of a security solution +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// solutionName - the solution manager name +// aggregatedAlertName - identifier of the aggregated alert +func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) Dismiss(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsAggregatedAlertClient.Dismiss") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.IoTSecuritySolutionsAnalyticsAggregatedAlertClient", "Dismiss", err.Error()) + } + + req, err := client.DismissPreparer(ctx, resourceGroupName, solutionName, aggregatedAlertName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertClient", "Dismiss", nil, "Failure preparing request") + return + } + + resp, err := client.DismissSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertClient", "Dismiss", resp, "Failure sending request") + return + } + + result, err = client.DismissResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertClient", "Dismiss", resp, "Failure responding to request") + } + + return +} + +// DismissPreparer prepares the Dismiss request. +func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) DismissPreparer(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "aggregatedAlertName": autorest.Encode("path", aggregatedAlertName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "solutionName": autorest.Encode("path", solutionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}/dismiss", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DismissSender sends the Dismiss request. The method will close the +// http.Response Body if it receives an error. +func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) DismissSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DismissResponder handles the response to the Dismiss request. The method always +// closes the http.Response Body. +func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) DismissResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get security Analytics of a security solution +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// solutionName - the solution manager name +// aggregatedAlertName - identifier of the aggregated alert +func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) Get(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string) (result IoTSecurityAggregatedAlert, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsAggregatedAlertClient.Get") + 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.IoTSecuritySolutionsAnalyticsAggregatedAlertClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, solutionName, aggregatedAlertName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) GetPreparer(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "aggregatedAlertName": autorest.Encode("path", aggregatedAlertName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "solutionName": autorest.Encode("path", solutionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}", 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 IoTSecuritySolutionsAnalyticsAggregatedAlertClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) GetResponder(resp *http.Response) (result IoTSecurityAggregatedAlert, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsaggregatedalerts.go b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsaggregatedalerts.go new file mode 100644 index 000000000000..78cf92058350 --- /dev/null +++ b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsaggregatedalerts.go @@ -0,0 +1,175 @@ +package security + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IoTSecuritySolutionsAnalyticsAggregatedAlertsClient is the API spec for Microsoft.Security (Azure Security Center) +// resource provider +type IoTSecuritySolutionsAnalyticsAggregatedAlertsClient struct { + BaseClient +} + +// NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClient creates an instance of the +// IoTSecuritySolutionsAnalyticsAggregatedAlertsClient client. +func NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsAggregatedAlertsClient { + return NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClientWithBaseURI creates an instance of the +// IoTSecuritySolutionsAnalyticsAggregatedAlertsClient client. +func NewIoTSecuritySolutionsAnalyticsAggregatedAlertsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsAggregatedAlertsClient { + return IoTSecuritySolutionsAnalyticsAggregatedAlertsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// List security Analytics of a security solution +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// solutionName - the solution manager name +// top - the number of results to retrieve. +func (client IoTSecuritySolutionsAnalyticsAggregatedAlertsClient) List(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (result IoTSecurityAggregatedAlertListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsAggregatedAlertsClient.List") + defer func() { + sc := -1 + if result.itsaal.Response.Response != nil { + sc = result.itsaal.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, solutionName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.itsaal.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient", "List", resp, "Failure sending request") + return + } + + result.itsaal, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client IoTSecuritySolutionsAnalyticsAggregatedAlertsClient) ListPreparer(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "solutionName": autorest.Encode("path", solutionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client IoTSecuritySolutionsAnalyticsAggregatedAlertsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client IoTSecuritySolutionsAnalyticsAggregatedAlertsClient) ListResponder(resp *http.Response) (result IoTSecurityAggregatedAlertList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client IoTSecuritySolutionsAnalyticsAggregatedAlertsClient) listNextResults(ctx context.Context, lastResults IoTSecurityAggregatedAlertList) (result IoTSecurityAggregatedAlertList, err error) { + req, err := lastResults.ioTSecurityAggregatedAlertListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client IoTSecuritySolutionsAnalyticsAggregatedAlertsClient) ListComplete(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (result IoTSecurityAggregatedAlertListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsAggregatedAlertsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, solutionName, top) + return +} diff --git a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsrecommendation.go b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsrecommendation.go new file mode 100644 index 000000000000..a05c732aa31f --- /dev/null +++ b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsrecommendation.go @@ -0,0 +1,135 @@ +package security + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IoTSecuritySolutionsAnalyticsRecommendationClient is the API spec for Microsoft.Security (Azure Security Center) +// resource provider +type IoTSecuritySolutionsAnalyticsRecommendationClient struct { + BaseClient +} + +// NewIoTSecuritySolutionsAnalyticsRecommendationClient creates an instance of the +// IoTSecuritySolutionsAnalyticsRecommendationClient client. +func NewIoTSecuritySolutionsAnalyticsRecommendationClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsRecommendationClient { + return NewIoTSecuritySolutionsAnalyticsRecommendationClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewIoTSecuritySolutionsAnalyticsRecommendationClientWithBaseURI creates an instance of the +// IoTSecuritySolutionsAnalyticsRecommendationClient client. +func NewIoTSecuritySolutionsAnalyticsRecommendationClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsRecommendationClient { + return IoTSecuritySolutionsAnalyticsRecommendationClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// Get security Analytics of a security solution +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// solutionName - the solution manager name +// aggregatedRecommendationName - identifier of the aggregated recommendation +func (client IoTSecuritySolutionsAnalyticsRecommendationClient) Get(ctx context.Context, resourceGroupName string, solutionName string, aggregatedRecommendationName string) (result IoTSecurityAggregatedRecommendation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsRecommendationClient.Get") + 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.IoTSecuritySolutionsAnalyticsRecommendationClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, solutionName, aggregatedRecommendationName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client IoTSecuritySolutionsAnalyticsRecommendationClient) GetPreparer(ctx context.Context, resourceGroupName string, solutionName string, aggregatedRecommendationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "aggregatedRecommendationName": autorest.Encode("path", aggregatedRecommendationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "solutionName": autorest.Encode("path", solutionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations/{aggregatedRecommendationName}", 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 IoTSecuritySolutionsAnalyticsRecommendationClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client IoTSecuritySolutionsAnalyticsRecommendationClient) GetResponder(resp *http.Response) (result IoTSecurityAggregatedRecommendation, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsrecommendations.go b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsrecommendations.go new file mode 100644 index 000000000000..d3a01a5985be --- /dev/null +++ b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsanalyticsrecommendations.go @@ -0,0 +1,175 @@ +package security + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IoTSecuritySolutionsAnalyticsRecommendationsClient is the API spec for Microsoft.Security (Azure Security Center) +// resource provider +type IoTSecuritySolutionsAnalyticsRecommendationsClient struct { + BaseClient +} + +// NewIoTSecuritySolutionsAnalyticsRecommendationsClient creates an instance of the +// IoTSecuritySolutionsAnalyticsRecommendationsClient client. +func NewIoTSecuritySolutionsAnalyticsRecommendationsClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsRecommendationsClient { + return NewIoTSecuritySolutionsAnalyticsRecommendationsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewIoTSecuritySolutionsAnalyticsRecommendationsClientWithBaseURI creates an instance of the +// IoTSecuritySolutionsAnalyticsRecommendationsClient client. +func NewIoTSecuritySolutionsAnalyticsRecommendationsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsAnalyticsRecommendationsClient { + return IoTSecuritySolutionsAnalyticsRecommendationsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// List security Analytics of a security solution +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// solutionName - the solution manager name +// top - the number of results to retrieve. +func (client IoTSecuritySolutionsAnalyticsRecommendationsClient) List(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (result IoTSecurityAggregatedRecommendationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsRecommendationsClient.List") + defer func() { + sc := -1 + if result.itsarl.Response.Response != nil { + sc = result.itsarl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.IoTSecuritySolutionsAnalyticsRecommendationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, solutionName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.itsarl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationsClient", "List", resp, "Failure sending request") + return + } + + result.itsarl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client IoTSecuritySolutionsAnalyticsRecommendationsClient) ListPreparer(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "solutionName": autorest.Encode("path", solutionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client IoTSecuritySolutionsAnalyticsRecommendationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client IoTSecuritySolutionsAnalyticsRecommendationsClient) ListResponder(resp *http.Response) (result IoTSecurityAggregatedRecommendationList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client IoTSecuritySolutionsAnalyticsRecommendationsClient) listNextResults(ctx context.Context, lastResults IoTSecurityAggregatedRecommendationList) (result IoTSecurityAggregatedRecommendationList, err error) { + req, err := lastResults.ioTSecurityAggregatedRecommendationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsAnalyticsRecommendationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client IoTSecuritySolutionsAnalyticsRecommendationsClient) ListComplete(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (result IoTSecurityAggregatedRecommendationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsAnalyticsRecommendationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, solutionName, top) + return +} diff --git a/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsresourcegroup.go b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsresourcegroup.go new file mode 100644 index 000000000000..4b590c2a5b13 --- /dev/null +++ b/services/preview/security/mgmt/v3.0/security/iotsecuritysolutionsresourcegroup.go @@ -0,0 +1,173 @@ +package security + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IoTSecuritySolutionsResourceGroupClient is the API spec for Microsoft.Security (Azure Security Center) resource +// provider +type IoTSecuritySolutionsResourceGroupClient struct { + BaseClient +} + +// NewIoTSecuritySolutionsResourceGroupClient creates an instance of the IoTSecuritySolutionsResourceGroupClient +// client. +func NewIoTSecuritySolutionsResourceGroupClient(subscriptionID string, ascLocation string) IoTSecuritySolutionsResourceGroupClient { + return NewIoTSecuritySolutionsResourceGroupClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewIoTSecuritySolutionsResourceGroupClientWithBaseURI creates an instance of the +// IoTSecuritySolutionsResourceGroupClient client. +func NewIoTSecuritySolutionsResourceGroupClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IoTSecuritySolutionsResourceGroupClient { + return IoTSecuritySolutionsResourceGroupClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// List list of security solutions +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// filter - filter the Security Solution with OData syntax. supporting filter by iotHubs +func (client IoTSecuritySolutionsResourceGroupClient) List(ctx context.Context, resourceGroupName string, filter string) (result IoTSecuritySolutionsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsResourceGroupClient.List") + defer func() { + sc := -1 + if result.itssl.Response.Response != nil { + sc = result.itssl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.IoTSecuritySolutionsResourceGroupClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsResourceGroupClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.itssl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsResourceGroupClient", "List", resp, "Failure sending request") + return + } + + result.itssl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsResourceGroupClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client IoTSecuritySolutionsResourceGroupClient) ListPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client IoTSecuritySolutionsResourceGroupClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client IoTSecuritySolutionsResourceGroupClient) ListResponder(resp *http.Response) (result IoTSecuritySolutionsList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client IoTSecuritySolutionsResourceGroupClient) listNextResults(ctx context.Context, lastResults IoTSecuritySolutionsList) (result IoTSecuritySolutionsList, err error) { + req, err := lastResults.ioTSecuritySolutionsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsResourceGroupClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsResourceGroupClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IoTSecuritySolutionsResourceGroupClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client IoTSecuritySolutionsResourceGroupClient) ListComplete(ctx context.Context, resourceGroupName string, filter string) (result IoTSecuritySolutionsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsResourceGroupClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, filter) + return +} diff --git a/services/preview/security/mgmt/v3.0/security/models.go b/services/preview/security/mgmt/v3.0/security/models.go index e33c7168eecb..3e7b076b5bce 100644 --- a/services/preview/security/mgmt/v3.0/security/models.go +++ b/services/preview/security/mgmt/v3.0/security/models.go @@ -188,6 +188,19 @@ func PossibleConnectionTypeValues() []ConnectionType { return []ConnectionType{External, Internal} } +// DataSource enumerates the values for data source. +type DataSource string + +const ( + // TwinData Devices twin data + TwinData DataSource = "TwinData" +) + +// PossibleDataSourceValues returns an array of possible values for the DataSource const type. +func PossibleDataSourceValues() []DataSource { + return []DataSource{TwinData} +} + // EnforcementMode enumerates the values for enforcement mode. type EnforcementMode string @@ -218,6 +231,19 @@ func PossibleEnforcementMode1Values() []EnforcementMode1 { return []EnforcementMode1{EnforcementMode1Audit, EnforcementMode1Enforce} } +// ExportData enumerates the values for export data. +type ExportData string + +const ( + // RawEvents Agent raw events + RawEvents ExportData = "RawEvents" +) + +// PossibleExportDataValues returns an array of possible values for the ExportData const type. +func PossibleExportDataValues() []ExportData { + return []ExportData{RawEvents} +} + // ExternalSecuritySolutionKind enumerates the values for external security solution kind. type ExternalSecuritySolutionKind string @@ -406,6 +432,21 @@ func PossibleRecommendationAction1Values() []RecommendationAction1 { return []RecommendationAction1{RecommendationAction1Add, RecommendationAction1Recommended, RecommendationAction1Remove} } +// RecommendationConfigStatus enumerates the values for recommendation config status. +type RecommendationConfigStatus string + +const ( + // TurnedOff ... + TurnedOff RecommendationConfigStatus = "TurnedOff" + // TurnedOn ... + TurnedOn RecommendationConfigStatus = "TurnedOn" +) + +// PossibleRecommendationConfigStatusValues returns an array of possible values for the RecommendationConfigStatus const type. +func PossibleRecommendationConfigStatusValues() []RecommendationConfigStatus { + return []RecommendationConfigStatus{TurnedOff, TurnedOn} +} + // RecommendationStatus enumerates the values for recommendation status. type RecommendationStatus string @@ -425,6 +466,51 @@ func PossibleRecommendationStatusValues() []RecommendationStatus { return []RecommendationStatus{RecommendationStatusNoStatus, RecommendationStatusNotAvailable, RecommendationStatusNotRecommended, RecommendationStatusRecommended} } +// RecommendationType enumerates the values for recommendation type. +type RecommendationType string + +const ( + // DenyDefaultIPPolicy IP filter configuration should have rules defined for allowed traffic, and should by + // default, deny all other traffic by default. + DenyDefaultIPPolicy RecommendationType = "DenyDefaultIpPolicy" + // EnableDiagnosticsLog Enable logs and retain them for up to a year. Retaining logs enables you to + // recreate activity trails for investigation purposes when a security incident occurs or your network is + // compromised. + EnableDiagnosticsLog RecommendationType = "EnableDiagnosticsLog" + // IdenticalAuthenticationCredentials IoT Hub authentication credentials are used by multiple devices. This + // may indicate an illegitimate device impersonating a legitimate device. Duplicate credential use + // increases the risk of device impersonation by a malicious actor. + IdenticalAuthenticationCredentials RecommendationType = "IdenticalAuthenticationCredentials" + // OpenPortsOnDevice A listening endpoint was found on the device. + OpenPortsOnDevice RecommendationType = "OpenPortsOnDevice" + // OperationSystemNotValid Device doesn't comply with CIS Linux benchmarks. + OperationSystemNotValid RecommendationType = "OperationSystemNotValid" + // PermissiveFirewallPolicy Allowed firewall policy found (INPUT/OUTPUT). Firewall policy should deny all + // traffic by default, and define rules to allow necessary communication to/from the device. + PermissiveFirewallPolicy RecommendationType = "PermissiveFirewallPolicy" + // PermissiveFirewallRuleInput A rule in the firewall in the input chain has been found that contains a + // permissive pattern for a wide range of IP addresses or ports. + PermissiveFirewallRuleInput RecommendationType = "PermissiveFirewallRuleInput" + // PermissiveFirewallRuleOut A rule in the firewall in the output chain has been found that contains a + // permissive pattern for a wide range of IP addresses or ports. + PermissiveFirewallRuleOut RecommendationType = "PermissiveFirewallRuleOut" + // SecurityTwinConfigurationConflict Conflicts were identified in the security twin configuration. + SecurityTwinConfigurationConflict RecommendationType = "SecurityTwinConfigurationConflict" + // SecurityTwinConfigurationNotOptimal Security twin configuration is not optimal. + SecurityTwinConfigurationNotOptimal RecommendationType = "SecurityTwinConfigurationNotOptimal" + // TooLargeIPRange An allow IP filter rule source IP range is too large. Overly permissive rules can expose + // your IoT hub to malicious actors. + TooLargeIPRange RecommendationType = "TooLargeIPRange" + // UnutilizedMessagesFromAgent 10% or more of security messages were smaller than 4kb during the last 24 + // hours. + UnutilizedMessagesFromAgent RecommendationType = "UnutilizedMessagesFromAgent" +) + +// PossibleRecommendationTypeValues returns an array of possible values for the RecommendationType const type. +func PossibleRecommendationTypeValues() []RecommendationType { + return []RecommendationType{DenyDefaultIPPolicy, EnableDiagnosticsLog, IdenticalAuthenticationCredentials, OpenPortsOnDevice, OperationSystemNotValid, PermissiveFirewallPolicy, PermissiveFirewallRuleInput, PermissiveFirewallRuleOut, SecurityTwinConfigurationConflict, SecurityTwinConfigurationNotOptimal, TooLargeIPRange, UnutilizedMessagesFromAgent} +} + // ReportedSeverity enumerates the values for reported severity. type ReportedSeverity string @@ -478,6 +564,21 @@ func PossibleSettingKindValues() []SettingKind { return []SettingKind{SettingKindAlertSuppressionSetting, SettingKindDataExportSetting} } +// SolutionStatus enumerates the values for solution status. +type SolutionStatus string + +const ( + // Disabled ... + Disabled SolutionStatus = "Disabled" + // Enabled ... + Enabled SolutionStatus = "Enabled" +) + +// PossibleSolutionStatusValues returns an array of possible values for the SolutionStatus const type. +func PossibleSolutionStatusValues() []SolutionStatus { + return []SolutionStatus{Disabled, Enabled} +} + // SourceSystem enumerates the values for source system. type SourceSystem string @@ -3884,26 +3985,114 @@ type InformationType struct { Keywords *[]InformationProtectionKeyword `json:"keywords,omitempty"` } -// JitNetworkAccessPoliciesList ... -type JitNetworkAccessPoliciesList struct { +// IoTSecurityAggregatedAlert security Solution Aggregated Alert information +type IoTSecurityAggregatedAlert struct { autorest.Response `json:"-"` - Value *[]JitNetworkAccessPolicy `json:"value,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // IoTSecurityAggregatedAlertProperties - Security Solution Aggregated Alert data + *IoTSecurityAggregatedAlertProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for IoTSecurityAggregatedAlert. +func (itsaa IoTSecurityAggregatedAlert) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if itsaa.Tags != nil { + objectMap["tags"] = itsaa.Tags + } + if itsaa.IoTSecurityAggregatedAlertProperties != nil { + objectMap["properties"] = itsaa.IoTSecurityAggregatedAlertProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for IoTSecurityAggregatedAlert struct. +func (itsaa *IoTSecurityAggregatedAlert) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + itsaa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + itsaa.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + itsaa.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + itsaa.Tags = tags + } + case "properties": + if v != nil { + var ioTSecurityAggregatedAlertProperties IoTSecurityAggregatedAlertProperties + err = json.Unmarshal(*v, &ioTSecurityAggregatedAlertProperties) + if err != nil { + return err + } + itsaa.IoTSecurityAggregatedAlertProperties = &ioTSecurityAggregatedAlertProperties + } + } + } + + return nil +} + +// IoTSecurityAggregatedAlertList list of IoT aggregated security alerts +type IoTSecurityAggregatedAlertList struct { + autorest.Response `json:"-"` + // Value - List of aggregated alerts data + Value *[]IoTSecurityAggregatedAlert `json:"value,omitempty"` // NextLink - READ-ONLY; The URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` } -// JitNetworkAccessPoliciesListIterator provides access to a complete listing of JitNetworkAccessPolicy -// values. -type JitNetworkAccessPoliciesListIterator struct { +// IoTSecurityAggregatedAlertListIterator provides access to a complete listing of +// IoTSecurityAggregatedAlert values. +type IoTSecurityAggregatedAlertListIterator struct { i int - page JitNetworkAccessPoliciesListPage + page IoTSecurityAggregatedAlertListPage } // 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 *JitNetworkAccessPoliciesListIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *IoTSecurityAggregatedAlertListIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JitNetworkAccessPoliciesListIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecurityAggregatedAlertListIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -3928,62 +4117,62 @@ func (iter *JitNetworkAccessPoliciesListIterator) NextWithContext(ctx context.Co // 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 *JitNetworkAccessPoliciesListIterator) Next() error { +func (iter *IoTSecurityAggregatedAlertListIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter JitNetworkAccessPoliciesListIterator) NotDone() bool { +func (iter IoTSecurityAggregatedAlertListIterator) 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 JitNetworkAccessPoliciesListIterator) Response() JitNetworkAccessPoliciesList { +func (iter IoTSecurityAggregatedAlertListIterator) Response() IoTSecurityAggregatedAlertList { 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 JitNetworkAccessPoliciesListIterator) Value() JitNetworkAccessPolicy { +func (iter IoTSecurityAggregatedAlertListIterator) Value() IoTSecurityAggregatedAlert { if !iter.page.NotDone() { - return JitNetworkAccessPolicy{} + return IoTSecurityAggregatedAlert{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the JitNetworkAccessPoliciesListIterator type. -func NewJitNetworkAccessPoliciesListIterator(page JitNetworkAccessPoliciesListPage) JitNetworkAccessPoliciesListIterator { - return JitNetworkAccessPoliciesListIterator{page: page} +// Creates a new instance of the IoTSecurityAggregatedAlertListIterator type. +func NewIoTSecurityAggregatedAlertListIterator(page IoTSecurityAggregatedAlertListPage) IoTSecurityAggregatedAlertListIterator { + return IoTSecurityAggregatedAlertListIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (jnapl JitNetworkAccessPoliciesList) IsEmpty() bool { - return jnapl.Value == nil || len(*jnapl.Value) == 0 +func (itsaal IoTSecurityAggregatedAlertList) IsEmpty() bool { + return itsaal.Value == nil || len(*itsaal.Value) == 0 } -// jitNetworkAccessPoliciesListPreparer prepares a request to retrieve the next set of results. +// ioTSecurityAggregatedAlertListPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (jnapl JitNetworkAccessPoliciesList) jitNetworkAccessPoliciesListPreparer(ctx context.Context) (*http.Request, error) { - if jnapl.NextLink == nil || len(to.String(jnapl.NextLink)) < 1 { +func (itsaal IoTSecurityAggregatedAlertList) ioTSecurityAggregatedAlertListPreparer(ctx context.Context) (*http.Request, error) { + if itsaal.NextLink == nil || len(to.String(itsaal.NextLink)) < 1 { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(jnapl.NextLink))) + autorest.WithBaseURL(to.String(itsaal.NextLink))) } -// JitNetworkAccessPoliciesListPage contains a page of JitNetworkAccessPolicy values. -type JitNetworkAccessPoliciesListPage struct { - fn func(context.Context, JitNetworkAccessPoliciesList) (JitNetworkAccessPoliciesList, error) - jnapl JitNetworkAccessPoliciesList +// IoTSecurityAggregatedAlertListPage contains a page of IoTSecurityAggregatedAlert values. +type IoTSecurityAggregatedAlertListPage struct { + fn func(context.Context, IoTSecurityAggregatedAlertList) (IoTSecurityAggregatedAlertList, error) + itsaal IoTSecurityAggregatedAlertList } // 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 *JitNetworkAccessPoliciesListPage) NextWithContext(ctx context.Context) (err error) { +func (page *IoTSecurityAggregatedAlertListPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/JitNetworkAccessPoliciesListPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecurityAggregatedAlertListPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -3992,46 +4181,74 @@ func (page *JitNetworkAccessPoliciesListPage) NextWithContext(ctx context.Contex tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.jnapl) + next, err := page.fn(ctx, page.itsaal) if err != nil { return err } - page.jnapl = next + page.itsaal = next return nil } // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *JitNetworkAccessPoliciesListPage) Next() error { +func (page *IoTSecurityAggregatedAlertListPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page JitNetworkAccessPoliciesListPage) NotDone() bool { - return !page.jnapl.IsEmpty() +func (page IoTSecurityAggregatedAlertListPage) NotDone() bool { + return !page.itsaal.IsEmpty() } // Response returns the raw server response from the last page request. -func (page JitNetworkAccessPoliciesListPage) Response() JitNetworkAccessPoliciesList { - return page.jnapl +func (page IoTSecurityAggregatedAlertListPage) Response() IoTSecurityAggregatedAlertList { + return page.itsaal } // Values returns the slice of values for the current page or nil if there are no values. -func (page JitNetworkAccessPoliciesListPage) Values() []JitNetworkAccessPolicy { - if page.jnapl.IsEmpty() { +func (page IoTSecurityAggregatedAlertListPage) Values() []IoTSecurityAggregatedAlert { + if page.itsaal.IsEmpty() { return nil } - return *page.jnapl.Value + return *page.itsaal.Value } -// Creates a new instance of the JitNetworkAccessPoliciesListPage type. -func NewJitNetworkAccessPoliciesListPage(getNextPage func(context.Context, JitNetworkAccessPoliciesList) (JitNetworkAccessPoliciesList, error)) JitNetworkAccessPoliciesListPage { - return JitNetworkAccessPoliciesListPage{fn: getNextPage} +// Creates a new instance of the IoTSecurityAggregatedAlertListPage type. +func NewIoTSecurityAggregatedAlertListPage(getNextPage func(context.Context, IoTSecurityAggregatedAlertList) (IoTSecurityAggregatedAlertList, error)) IoTSecurityAggregatedAlertListPage { + return IoTSecurityAggregatedAlertListPage{fn: getNextPage} } -// JitNetworkAccessPolicy ... -type JitNetworkAccessPolicy struct { +// IoTSecurityAggregatedAlertProperties security Solution Aggregated Alert data +type IoTSecurityAggregatedAlertProperties struct { + // AlertType - READ-ONLY; Name of the alert type + AlertType *string `json:"alertType,omitempty"` + // AlertDisplayName - READ-ONLY; Display name of the alert type + AlertDisplayName *string `json:"alertDisplayName,omitempty"` + // AggregatedDateUtc - READ-ONLY; The date the incidents were detected by the vendor + AggregatedDateUtc *date.Date `json:"aggregatedDateUtc,omitempty"` + // VendorName - READ-ONLY; Name of the vendor that discovered the incident + VendorName *string `json:"vendorName,omitempty"` + // ReportedSeverity - READ-ONLY; Estimated severity of this alert. Possible values include: 'Informational', 'Low', 'Medium', 'High' + ReportedSeverity ReportedSeverity `json:"reportedSeverity,omitempty"` + // RemediationSteps - READ-ONLY; Recommended steps for remediation + RemediationSteps *string `json:"remediationSteps,omitempty"` + // Description - READ-ONLY; Description of the incident and what it means + Description *string `json:"description,omitempty"` + // Count - READ-ONLY; Occurrence number of the alert within the aggregated date + Count *int32 `json:"count,omitempty"` + // EffectedResourceType - READ-ONLY; Azure resource ID of the resource that got the alerts + EffectedResourceType *string `json:"effectedResourceType,omitempty"` + // SystemSource - READ-ONLY; The type of the alerted resource (Azure, Non-Azure) + SystemSource *string `json:"systemSource,omitempty"` + // ActionTaken - READ-ONLY; The action that was taken as a response to the alert (Active, Blocked etc.) + ActionTaken *string `json:"actionTaken,omitempty"` + // LogAnalyticsQuery - READ-ONLY; query in log analytics to get the list of affected devices/alerts + LogAnalyticsQuery *string `json:"logAnalyticsQuery,omitempty"` +} + +// IoTSecurityAggregatedRecommendation security Solution Recommendation Information +type IoTSecurityAggregatedRecommendation struct { autorest.Response `json:"-"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` @@ -4039,27 +4256,26 @@ type JitNetworkAccessPolicy struct { Name *string `json:"name,omitempty"` // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` - // Kind - Kind of the resource - Kind *string `json:"kind,omitempty"` - // Location - READ-ONLY; Location where the resource is stored - Location *string `json:"location,omitempty"` - *JitNetworkAccessPolicyProperties `json:"properties,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // IoTSecurityAggregatedRecommendationProperties - Security Solution data + *IoTSecurityAggregatedRecommendationProperties `json:"properties,omitempty"` } -// MarshalJSON is the custom marshaler for JitNetworkAccessPolicy. -func (jnap JitNetworkAccessPolicy) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for IoTSecurityAggregatedRecommendation. +func (itsar IoTSecurityAggregatedRecommendation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if jnap.Kind != nil { - objectMap["kind"] = jnap.Kind + if itsar.Tags != nil { + objectMap["tags"] = itsar.Tags } - if jnap.JitNetworkAccessPolicyProperties != nil { - objectMap["properties"] = jnap.JitNetworkAccessPolicyProperties + if itsar.IoTSecurityAggregatedRecommendationProperties != nil { + objectMap["properties"] = itsar.IoTSecurityAggregatedRecommendationProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for JitNetworkAccessPolicy struct. -func (jnap *JitNetworkAccessPolicy) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for IoTSecurityAggregatedRecommendation struct. +func (itsar *IoTSecurityAggregatedRecommendation) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -4074,7 +4290,7 @@ func (jnap *JitNetworkAccessPolicy) UnmarshalJSON(body []byte) error { if err != nil { return err } - jnap.ID = &ID + itsar.ID = &ID } case "name": if v != nil { @@ -4083,7 +4299,7 @@ func (jnap *JitNetworkAccessPolicy) UnmarshalJSON(body []byte) error { if err != nil { return err } - jnap.Name = &name + itsar.Name = &name } case "type": if v != nil { @@ -4092,34 +4308,25 @@ func (jnap *JitNetworkAccessPolicy) UnmarshalJSON(body []byte) error { if err != nil { return err } - jnap.Type = &typeVar - } - case "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - jnap.Kind = &kind + itsar.Type = &typeVar } - case "location": + case "tags": if v != nil { - var location string - err = json.Unmarshal(*v, &location) + var tags map[string]*string + err = json.Unmarshal(*v, &tags) if err != nil { return err } - jnap.Location = &location + itsar.Tags = tags } case "properties": if v != nil { - var jitNetworkAccessPolicyProperties JitNetworkAccessPolicyProperties - err = json.Unmarshal(*v, &jitNetworkAccessPolicyProperties) + var ioTSecurityAggregatedRecommendationProperties IoTSecurityAggregatedRecommendationProperties + err = json.Unmarshal(*v, &ioTSecurityAggregatedRecommendationProperties) if err != nil { return err } - jnap.JitNetworkAccessPolicyProperties = &jitNetworkAccessPolicyProperties + itsar.IoTSecurityAggregatedRecommendationProperties = &ioTSecurityAggregatedRecommendationProperties } } } @@ -4127,56 +4334,910 @@ func (jnap *JitNetworkAccessPolicy) UnmarshalJSON(body []byte) error { return nil } -// JitNetworkAccessPolicyInitiatePort ... -type JitNetworkAccessPolicyInitiatePort struct { - Number *int32 `json:"number,omitempty"` - // AllowedSourceAddressPrefix - Source of the allowed traffic. If omitted, the request will be for the source IP address of the initiate request. - AllowedSourceAddressPrefix *string `json:"allowedSourceAddressPrefix,omitempty"` - // EndTimeUtc - The time to close the request in UTC - EndTimeUtc *date.Time `json:"endTimeUtc,omitempty"` +// IoTSecurityAggregatedRecommendationList list of IoT aggregated security recommendations +type IoTSecurityAggregatedRecommendationList struct { + autorest.Response `json:"-"` + // Value - List of aggregated alerts data + Value *[]IoTSecurityAggregatedRecommendation `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` } -// JitNetworkAccessPolicyInitiateRequest ... -type JitNetworkAccessPolicyInitiateRequest struct { - // VirtualMachines - A list of virtual machines & ports to open access for - VirtualMachines *[]JitNetworkAccessPolicyInitiateVirtualMachine `json:"virtualMachines,omitempty"` +// IoTSecurityAggregatedRecommendationListIterator provides access to a complete listing of +// IoTSecurityAggregatedRecommendation values. +type IoTSecurityAggregatedRecommendationListIterator struct { + i int + page IoTSecurityAggregatedRecommendationListPage } -// JitNetworkAccessPolicyInitiateVirtualMachine ... -type JitNetworkAccessPolicyInitiateVirtualMachine struct { - // ID - Resource ID of the virtual machine that is linked to this policy - ID *string `json:"id,omitempty"` - // Ports - The ports to open for the resource with the `id` - Ports *[]JitNetworkAccessPolicyInitiatePort `json:"ports,omitempty"` +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *IoTSecurityAggregatedRecommendationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecurityAggregatedRecommendationListIterator.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 } -// JitNetworkAccessPolicyProperties ... -type JitNetworkAccessPolicyProperties struct { - // VirtualMachines - Configurations for Microsoft.Compute/virtualMachines resource type. - VirtualMachines *[]JitNetworkAccessPolicyVirtualMachine `json:"virtualMachines,omitempty"` - Requests *[]JitNetworkAccessRequest `json:"requests,omitempty"` - // ProvisioningState - READ-ONLY; Gets the provisioning state of the Just-in-Time policy. - ProvisioningState *string `json:"provisioningState,omitempty"` +// 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 *IoTSecurityAggregatedRecommendationListIterator) Next() error { + return iter.NextWithContext(context.Background()) } -// JitNetworkAccessPolicyVirtualMachine ... -type JitNetworkAccessPolicyVirtualMachine struct { - // ID - Resource ID of the virtual machine that is linked to this policy - ID *string `json:"id,omitempty"` - // Ports - Port configurations for the virtual machine - Ports *[]JitNetworkAccessPortRule `json:"ports,omitempty"` - // PublicIPAddress - Public IP address of the Azure Firewall that is linked to this policy, if applicable - PublicIPAddress *string `json:"publicIpAddress,omitempty"` +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter IoTSecurityAggregatedRecommendationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) } -// JitNetworkAccessPortRule ... -type JitNetworkAccessPortRule struct { - Number *int32 `json:"number,omitempty"` - // Protocol - Possible values include: 'TCP', 'UDP', 'All' - Protocol Protocol `json:"protocol,omitempty"` - // AllowedSourceAddressPrefix - Mutually exclusive with the "allowedSourceAddressPrefixes" parameter. Should be an IP address or CIDR, for example "192.168.0.3" or "192.168.0.0/16". - AllowedSourceAddressPrefix *string `json:"allowedSourceAddressPrefix,omitempty"` - // AllowedSourceAddressPrefixes - Mutually exclusive with the "allowedSourceAddressPrefix" parameter. +// Response returns the raw server response from the last page request. +func (iter IoTSecurityAggregatedRecommendationListIterator) Response() IoTSecurityAggregatedRecommendationList { + 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 IoTSecurityAggregatedRecommendationListIterator) Value() IoTSecurityAggregatedRecommendation { + if !iter.page.NotDone() { + return IoTSecurityAggregatedRecommendation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the IoTSecurityAggregatedRecommendationListIterator type. +func NewIoTSecurityAggregatedRecommendationListIterator(page IoTSecurityAggregatedRecommendationListPage) IoTSecurityAggregatedRecommendationListIterator { + return IoTSecurityAggregatedRecommendationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (itsarl IoTSecurityAggregatedRecommendationList) IsEmpty() bool { + return itsarl.Value == nil || len(*itsarl.Value) == 0 +} + +// ioTSecurityAggregatedRecommendationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (itsarl IoTSecurityAggregatedRecommendationList) ioTSecurityAggregatedRecommendationListPreparer(ctx context.Context) (*http.Request, error) { + if itsarl.NextLink == nil || len(to.String(itsarl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(itsarl.NextLink))) +} + +// IoTSecurityAggregatedRecommendationListPage contains a page of IoTSecurityAggregatedRecommendation +// values. +type IoTSecurityAggregatedRecommendationListPage struct { + fn func(context.Context, IoTSecurityAggregatedRecommendationList) (IoTSecurityAggregatedRecommendationList, error) + itsarl IoTSecurityAggregatedRecommendationList +} + +// 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 *IoTSecurityAggregatedRecommendationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecurityAggregatedRecommendationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.itsarl) + if err != nil { + return err + } + page.itsarl = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *IoTSecurityAggregatedRecommendationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page IoTSecurityAggregatedRecommendationListPage) NotDone() bool { + return !page.itsarl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page IoTSecurityAggregatedRecommendationListPage) Response() IoTSecurityAggregatedRecommendationList { + return page.itsarl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page IoTSecurityAggregatedRecommendationListPage) Values() []IoTSecurityAggregatedRecommendation { + if page.itsarl.IsEmpty() { + return nil + } + return *page.itsarl.Value +} + +// Creates a new instance of the IoTSecurityAggregatedRecommendationListPage type. +func NewIoTSecurityAggregatedRecommendationListPage(getNextPage func(context.Context, IoTSecurityAggregatedRecommendationList) (IoTSecurityAggregatedRecommendationList, error)) IoTSecurityAggregatedRecommendationListPage { + return IoTSecurityAggregatedRecommendationListPage{fn: getNextPage} +} + +// IoTSecurityAggregatedRecommendationProperties security Solution Recommendation Information +type IoTSecurityAggregatedRecommendationProperties struct { + // RecommendationName - Name of the recommendation + RecommendationName *string `json:"recommendationName,omitempty"` + // RecommendationDisplayName - READ-ONLY; Display name of the recommendation type. + RecommendationDisplayName *string `json:"recommendationDisplayName,omitempty"` + // Description - READ-ONLY; Description of the incident and what it means + Description *string `json:"description,omitempty"` + // RecommendationTypeID - READ-ONLY; The recommendation-type GUID. + RecommendationTypeID *string `json:"recommendationTypeId,omitempty"` + // DetectedBy - READ-ONLY; Name of the vendor that discovered the issue + DetectedBy *string `json:"detectedBy,omitempty"` + // RemediationSteps - READ-ONLY; Recommended steps for remediation + RemediationSteps *string `json:"remediationSteps,omitempty"` + // ReportedSeverity - READ-ONLY; Estimated severity of this recommendation. Possible values include: 'Informational', 'Low', 'Medium', 'High' + ReportedSeverity ReportedSeverity `json:"reportedSeverity,omitempty"` + // HealthyDevices - READ-ONLY; the number of the healthy devices within the solution + HealthyDevices *int32 `json:"healthyDevices,omitempty"` + // UnhealthyDeviceCount - READ-ONLY; the number of the unhealthy devices within the solution + UnhealthyDeviceCount *int32 `json:"unhealthyDeviceCount,omitempty"` + // LogAnalyticsQuery - READ-ONLY; query in log analytics to get the list of affected devices/alerts + LogAnalyticsQuery *string `json:"logAnalyticsQuery,omitempty"` +} + +// IoTSecurityAlertedDevice statistic information about the number of alerts per device during the last +// period +type IoTSecurityAlertedDevice struct { + // DeviceID - READ-ONLY; Name of the alert type + DeviceID *string `json:"deviceId,omitempty"` + // AlertsCount - READ-ONLY; the number of alerts raised for this device + AlertsCount *int32 `json:"alertsCount,omitempty"` +} + +// IoTSecurityAlertedDevicesList list of devices with the count of raised alerts +type IoTSecurityAlertedDevicesList struct { + // Value - List of aggregated alerts data + Value *[]IoTSecurityAlertedDevice `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// IoTSecurityDeviceAlert statistic information about the number of alerts per alert type during the last +// period +type IoTSecurityDeviceAlert struct { + // AlertDisplayName - READ-ONLY; Display name of the alert + AlertDisplayName *string `json:"alertDisplayName,omitempty"` + // ReportedSeverity - READ-ONLY; Estimated severity of this alert. Possible values include: 'Informational', 'Low', 'Medium', 'High' + ReportedSeverity ReportedSeverity `json:"reportedSeverity,omitempty"` + // AlertsCount - READ-ONLY; the number of alerts raised for this alert type + AlertsCount *int32 `json:"alertsCount,omitempty"` +} + +// IoTSecurityDeviceAlertsList list of alerts with the count of raised alerts +type IoTSecurityDeviceAlertsList struct { + // Value - List of top alerts data + Value *[]IoTSecurityDeviceAlert `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// IoTSecurityDeviceRecommendation statistic information about the number of recommendations per +// recommendation type +type IoTSecurityDeviceRecommendation struct { + // RecommendationDisplayName - READ-ONLY; Display name of the recommendation + RecommendationDisplayName *string `json:"recommendationDisplayName,omitempty"` + // ReportedSeverity - READ-ONLY; Estimated severity of this recommendation. Possible values include: 'Informational', 'Low', 'Medium', 'High' + ReportedSeverity ReportedSeverity `json:"reportedSeverity,omitempty"` + // DevicesCount - READ-ONLY; the number of device with this recommendation + DevicesCount *int32 `json:"devicesCount,omitempty"` +} + +// IoTSecurityDeviceRecommendationsList list of recommendations with the count of devices +type IoTSecurityDeviceRecommendationsList struct { + // Value - List of aggregated recommendation data + Value *[]IoTSecurityDeviceRecommendation `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// IoTSecuritySolutionAnalyticsModel security Analytics of a security solution +type IoTSecuritySolutionAnalyticsModel struct { + autorest.Response `json:"-"` + // IoTSecuritySolutionAnalyticsModelProperties - Security Solution Aggregated Alert data + *IoTSecuritySolutionAnalyticsModelProperties `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 IoTSecuritySolutionAnalyticsModel. +func (itssam IoTSecuritySolutionAnalyticsModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if itssam.IoTSecuritySolutionAnalyticsModelProperties != nil { + objectMap["properties"] = itssam.IoTSecuritySolutionAnalyticsModelProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for IoTSecuritySolutionAnalyticsModel struct. +func (itssam *IoTSecuritySolutionAnalyticsModel) 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 ioTSecuritySolutionAnalyticsModelProperties IoTSecuritySolutionAnalyticsModelProperties + err = json.Unmarshal(*v, &ioTSecuritySolutionAnalyticsModelProperties) + if err != nil { + return err + } + itssam.IoTSecuritySolutionAnalyticsModelProperties = &ioTSecuritySolutionAnalyticsModelProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + itssam.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + itssam.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + itssam.Type = &typeVar + } + } + } + + return nil +} + +// IoTSecuritySolutionAnalyticsModelList list of Security Analytics of a security solution +type IoTSecuritySolutionAnalyticsModelList struct { + autorest.Response `json:"-"` + // Value - List of Security Analytics of a security solution + Value *[]IoTSecuritySolutionAnalyticsModel `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// IoTSecuritySolutionAnalyticsModelProperties security Analytics of a security solution properties +type IoTSecuritySolutionAnalyticsModelProperties struct { + // Metrics - READ-ONLY; Security Analytics of a security solution + Metrics *IoTSeverityMetrics `json:"metrics,omitempty"` + // UnhealthyDeviceCount - READ-ONLY; number of unhealthy devices + UnhealthyDeviceCount *int32 `json:"unhealthyDeviceCount,omitempty"` + // DevicesMetrics - READ-ONLY; The list of devices metrics by the aggregated date. + DevicesMetrics *[]IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem `json:"devicesMetrics,omitempty"` + // TopAlertedDevices - The list of top 3 devices with the most attacked. + TopAlertedDevices *IoTSecurityAlertedDevicesList `json:"topAlertedDevices,omitempty"` + // MostPrevalentDeviceAlerts - The list of most prevalent 3 alerts. + MostPrevalentDeviceAlerts *IoTSecurityDeviceAlertsList `json:"mostPrevalentDeviceAlerts,omitempty"` + // MostPrevalentDeviceRecommendations - The list of most prevalent 3 recommendations. + MostPrevalentDeviceRecommendations *IoTSecurityDeviceRecommendationsList `json:"mostPrevalentDeviceRecommendations,omitempty"` +} + +// IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem ... +type IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem struct { + // Date - the date of the metrics + Date *date.Time `json:"date,omitempty"` + // DevicesMetrics - devices alerts count by severity. + DevicesMetrics *IoTSeverityMetrics `json:"devicesMetrics,omitempty"` +} + +// IoTSecuritySolutionModel security Solution +type IoTSecuritySolutionModel struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + // Location - The resource location. + Location *string `json:"location,omitempty"` + // IoTSecuritySolutionProperties - Security Solution data + *IoTSecuritySolutionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for IoTSecuritySolutionModel. +func (itssm IoTSecuritySolutionModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if itssm.Tags != nil { + objectMap["tags"] = itssm.Tags + } + if itssm.Location != nil { + objectMap["location"] = itssm.Location + } + if itssm.IoTSecuritySolutionProperties != nil { + objectMap["properties"] = itssm.IoTSecuritySolutionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for IoTSecuritySolutionModel struct. +func (itssm *IoTSecuritySolutionModel) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + itssm.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + itssm.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + itssm.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + itssm.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + itssm.Location = &location + } + case "properties": + if v != nil { + var ioTSecuritySolutionProperties IoTSecuritySolutionProperties + err = json.Unmarshal(*v, &ioTSecuritySolutionProperties) + if err != nil { + return err + } + itssm.IoTSecuritySolutionProperties = &ioTSecuritySolutionProperties + } + } + } + + return nil +} + +// IoTSecuritySolutionProperties security Solution setting data +type IoTSecuritySolutionProperties struct { + // Workspace - Workspace resource ID + Workspace *string `json:"workspace,omitempty"` + // DisplayName - Resource display name. + DisplayName *string `json:"displayName,omitempty"` + // Status - Security solution status. Possible values include: 'Enabled', 'Disabled' + Status SolutionStatus `json:"status,omitempty"` + // Export - List of additional export to workspace data options + Export *[]ExportData `json:"export,omitempty"` + // DisabledDataSources - Disabled data sources. Disabling these data sources compromises the system. + DisabledDataSources *[]DataSource `json:"disabledDataSources,omitempty"` + // IotHubs - IoT Hub resource IDs + IotHubs *[]string `json:"iotHubs,omitempty"` + UserDefinedResources *UserDefinedResourcesProperties `json:"userDefinedResources,omitempty"` + // AutoDiscoveredResources - READ-ONLY; List of resources that were automatically discovered as relevant to the security solution. + AutoDiscoveredResources *[]string `json:"autoDiscoveredResources,omitempty"` + RecommendationsConfiguration *[]RecommendationConfigurationProperties `json:"recommendationsConfiguration,omitempty"` +} + +// IoTSecuritySolutionsList list of iot solutions +type IoTSecuritySolutionsList struct { + autorest.Response `json:"-"` + // Value - List of security solutions + Value *[]IoTSecuritySolutionModel `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// IoTSecuritySolutionsListIterator provides access to a complete listing of IoTSecuritySolutionModel +// values. +type IoTSecuritySolutionsListIterator struct { + i int + page IoTSecuritySolutionsListPage +} + +// 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 *IoTSecuritySolutionsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsListIterator.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 *IoTSecuritySolutionsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter IoTSecuritySolutionsListIterator) 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 IoTSecuritySolutionsListIterator) Response() IoTSecuritySolutionsList { + 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 IoTSecuritySolutionsListIterator) Value() IoTSecuritySolutionModel { + if !iter.page.NotDone() { + return IoTSecuritySolutionModel{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the IoTSecuritySolutionsListIterator type. +func NewIoTSecuritySolutionsListIterator(page IoTSecuritySolutionsListPage) IoTSecuritySolutionsListIterator { + return IoTSecuritySolutionsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (itssl IoTSecuritySolutionsList) IsEmpty() bool { + return itssl.Value == nil || len(*itssl.Value) == 0 +} + +// ioTSecuritySolutionsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (itssl IoTSecuritySolutionsList) ioTSecuritySolutionsListPreparer(ctx context.Context) (*http.Request, error) { + if itssl.NextLink == nil || len(to.String(itssl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(itssl.NextLink))) +} + +// IoTSecuritySolutionsListPage contains a page of IoTSecuritySolutionModel values. +type IoTSecuritySolutionsListPage struct { + fn func(context.Context, IoTSecuritySolutionsList) (IoTSecuritySolutionsList, error) + itssl IoTSecuritySolutionsList +} + +// 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 *IoTSecuritySolutionsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IoTSecuritySolutionsListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.itssl) + if err != nil { + return err + } + page.itssl = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *IoTSecuritySolutionsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page IoTSecuritySolutionsListPage) NotDone() bool { + return !page.itssl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page IoTSecuritySolutionsListPage) Response() IoTSecuritySolutionsList { + return page.itssl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page IoTSecuritySolutionsListPage) Values() []IoTSecuritySolutionModel { + if page.itssl.IsEmpty() { + return nil + } + return *page.itssl.Value +} + +// Creates a new instance of the IoTSecuritySolutionsListPage type. +func NewIoTSecuritySolutionsListPage(getNextPage func(context.Context, IoTSecuritySolutionsList) (IoTSecuritySolutionsList, error)) IoTSecuritySolutionsListPage { + return IoTSecuritySolutionsListPage{fn: getNextPage} +} + +// IoTSeverityMetrics severity metrics +type IoTSeverityMetrics struct { + // High - count of high severity items + High *int32 `json:"high,omitempty"` + // Medium - count of medium severity items + Medium *int32 `json:"medium,omitempty"` + // Low - count of low severity items + Low *int32 `json:"low,omitempty"` +} + +// JitNetworkAccessPoliciesList ... +type JitNetworkAccessPoliciesList struct { + autorest.Response `json:"-"` + Value *[]JitNetworkAccessPolicy `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// JitNetworkAccessPoliciesListIterator provides access to a complete listing of JitNetworkAccessPolicy +// values. +type JitNetworkAccessPoliciesListIterator struct { + i int + page JitNetworkAccessPoliciesListPage +} + +// 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 *JitNetworkAccessPoliciesListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JitNetworkAccessPoliciesListIterator.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 *JitNetworkAccessPoliciesListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter JitNetworkAccessPoliciesListIterator) 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 JitNetworkAccessPoliciesListIterator) Response() JitNetworkAccessPoliciesList { + 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 JitNetworkAccessPoliciesListIterator) Value() JitNetworkAccessPolicy { + if !iter.page.NotDone() { + return JitNetworkAccessPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the JitNetworkAccessPoliciesListIterator type. +func NewJitNetworkAccessPoliciesListIterator(page JitNetworkAccessPoliciesListPage) JitNetworkAccessPoliciesListIterator { + return JitNetworkAccessPoliciesListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (jnapl JitNetworkAccessPoliciesList) IsEmpty() bool { + return jnapl.Value == nil || len(*jnapl.Value) == 0 +} + +// jitNetworkAccessPoliciesListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (jnapl JitNetworkAccessPoliciesList) jitNetworkAccessPoliciesListPreparer(ctx context.Context) (*http.Request, error) { + if jnapl.NextLink == nil || len(to.String(jnapl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(jnapl.NextLink))) +} + +// JitNetworkAccessPoliciesListPage contains a page of JitNetworkAccessPolicy values. +type JitNetworkAccessPoliciesListPage struct { + fn func(context.Context, JitNetworkAccessPoliciesList) (JitNetworkAccessPoliciesList, error) + jnapl JitNetworkAccessPoliciesList +} + +// 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 *JitNetworkAccessPoliciesListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JitNetworkAccessPoliciesListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.jnapl) + if err != nil { + return err + } + page.jnapl = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *JitNetworkAccessPoliciesListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page JitNetworkAccessPoliciesListPage) NotDone() bool { + return !page.jnapl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page JitNetworkAccessPoliciesListPage) Response() JitNetworkAccessPoliciesList { + return page.jnapl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page JitNetworkAccessPoliciesListPage) Values() []JitNetworkAccessPolicy { + if page.jnapl.IsEmpty() { + return nil + } + return *page.jnapl.Value +} + +// Creates a new instance of the JitNetworkAccessPoliciesListPage type. +func NewJitNetworkAccessPoliciesListPage(getNextPage func(context.Context, JitNetworkAccessPoliciesList) (JitNetworkAccessPoliciesList, error)) JitNetworkAccessPoliciesListPage { + return JitNetworkAccessPoliciesListPage{fn: getNextPage} +} + +// JitNetworkAccessPolicy ... +type JitNetworkAccessPolicy struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Kind - Kind of the resource + Kind *string `json:"kind,omitempty"` + // Location - READ-ONLY; Location where the resource is stored + Location *string `json:"location,omitempty"` + *JitNetworkAccessPolicyProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for JitNetworkAccessPolicy. +func (jnap JitNetworkAccessPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if jnap.Kind != nil { + objectMap["kind"] = jnap.Kind + } + if jnap.JitNetworkAccessPolicyProperties != nil { + objectMap["properties"] = jnap.JitNetworkAccessPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for JitNetworkAccessPolicy struct. +func (jnap *JitNetworkAccessPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + jnap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + jnap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + jnap.Type = &typeVar + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + jnap.Kind = &kind + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + jnap.Location = &location + } + case "properties": + if v != nil { + var jitNetworkAccessPolicyProperties JitNetworkAccessPolicyProperties + err = json.Unmarshal(*v, &jitNetworkAccessPolicyProperties) + if err != nil { + return err + } + jnap.JitNetworkAccessPolicyProperties = &jitNetworkAccessPolicyProperties + } + } + } + + return nil +} + +// JitNetworkAccessPolicyInitiatePort ... +type JitNetworkAccessPolicyInitiatePort struct { + Number *int32 `json:"number,omitempty"` + // AllowedSourceAddressPrefix - Source of the allowed traffic. If omitted, the request will be for the source IP address of the initiate request. + AllowedSourceAddressPrefix *string `json:"allowedSourceAddressPrefix,omitempty"` + // EndTimeUtc - The time to close the request in UTC + EndTimeUtc *date.Time `json:"endTimeUtc,omitempty"` +} + +// JitNetworkAccessPolicyInitiateRequest ... +type JitNetworkAccessPolicyInitiateRequest struct { + // VirtualMachines - A list of virtual machines & ports to open access for + VirtualMachines *[]JitNetworkAccessPolicyInitiateVirtualMachine `json:"virtualMachines,omitempty"` +} + +// JitNetworkAccessPolicyInitiateVirtualMachine ... +type JitNetworkAccessPolicyInitiateVirtualMachine struct { + // ID - Resource ID of the virtual machine that is linked to this policy + ID *string `json:"id,omitempty"` + // Ports - The ports to open for the resource with the `id` + Ports *[]JitNetworkAccessPolicyInitiatePort `json:"ports,omitempty"` +} + +// JitNetworkAccessPolicyProperties ... +type JitNetworkAccessPolicyProperties struct { + // VirtualMachines - Configurations for Microsoft.Compute/virtualMachines resource type. + VirtualMachines *[]JitNetworkAccessPolicyVirtualMachine `json:"virtualMachines,omitempty"` + Requests *[]JitNetworkAccessRequest `json:"requests,omitempty"` + // ProvisioningState - READ-ONLY; Gets the provisioning state of the Just-in-Time policy. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// JitNetworkAccessPolicyVirtualMachine ... +type JitNetworkAccessPolicyVirtualMachine struct { + // ID - Resource ID of the virtual machine that is linked to this policy + ID *string `json:"id,omitempty"` + // Ports - Port configurations for the virtual machine + Ports *[]JitNetworkAccessPortRule `json:"ports,omitempty"` + // PublicIPAddress - Public IP address of the Azure Firewall that is linked to this policy, if applicable + PublicIPAddress *string `json:"publicIpAddress,omitempty"` +} + +// JitNetworkAccessPortRule ... +type JitNetworkAccessPortRule struct { + Number *int32 `json:"number,omitempty"` + // Protocol - Possible values include: 'TCP', 'UDP', 'All' + Protocol Protocol `json:"protocol,omitempty"` + // AllowedSourceAddressPrefix - Mutually exclusive with the "allowedSourceAddressPrefixes" parameter. Should be an IP address or CIDR, for example "192.168.0.3" or "192.168.0.0/16". + AllowedSourceAddressPrefix *string `json:"allowedSourceAddressPrefix,omitempty"` + // AllowedSourceAddressPrefixes - Mutually exclusive with the "allowedSourceAddressPrefix" parameter. AllowedSourceAddressPrefixes *[]string `json:"allowedSourceAddressPrefixes,omitempty"` // MaxRequestAccessDuration - Maximum duration requests can be made for. In ISO 8601 duration format. Minimum 5 minutes, maximum 1 day MaxRequestAccessDuration *string `json:"maxRequestAccessDuration,omitempty"` @@ -4497,7 +5558,7 @@ type PricingList struct { // PricingProperties pricing properties for the relevant scope type PricingProperties struct { - // PricingTier - The pricing tier value. Possible values include: 'Free', 'Standard' + // PricingTier - The pricing tier value. Azure Security Center is provided in two pricing tiers: free and standard, with the standard tier available with a trial period. The standard tier offers advanced security capabilities, while the free tier offers basic security features. Possible values include: 'Free', 'Standard' PricingTier PricingTier `json:"pricingTier,omitempty"` // FreeTrialRemainingTime - READ-ONLY; The duration left for the subscriptions free trial period - in ISO 8601 format (e.g. P3Y6M4DT12H30M5S). FreeTrialRemainingTime *string `json:"freeTrialRemainingTime,omitempty"` @@ -4515,6 +5576,16 @@ type PublisherInfo struct { Version *string `json:"version,omitempty"` } +// RecommendationConfigurationProperties recommendation configuration +type RecommendationConfigurationProperties struct { + // RecommendationType - The recommendation type. Possible values include: 'OpenPortsOnDevice', 'PermissiveFirewallPolicy', 'PermissiveFirewallRuleInput', 'PermissiveFirewallRuleOut', 'OperationSystemNotValid', 'UnutilizedMessagesFromAgent', 'SecurityTwinConfigurationNotOptimal', 'SecurityTwinConfigurationConflict', 'IdenticalAuthenticationCredentials', 'DenyDefaultIPPolicy', 'TooLargeIPRange', 'EnableDiagnosticsLog' + RecommendationType RecommendationType `json:"recommendationType,omitempty"` + // Description - READ-ONLY + Description *string `json:"description,omitempty"` + // Status - Recommendation status. The recommendation is not generated when the status is turned off. Possible values include: 'TurnedOff', 'TurnedOn' + Status RecommendationConfigStatus `json:"status,omitempty"` +} + // RegulatoryComplianceAssessment regulatory compliance assessment details and state type RegulatoryComplianceAssessment struct { autorest.Response `json:"-"` @@ -5496,6 +6567,21 @@ func NewSettingsListPage(getNextPage func(context.Context, SettingsList) (Settin return SettingsListPage{fn: getNextPage} } +// TagsResource a container holding only the Tags for a resource, allowing the user to update the tags. +type TagsResource struct { + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TagsResource. +func (tr TagsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + // Task security task that we recommend to do in order to strengthen security type Task struct { autorest.Response `json:"-"` @@ -6048,6 +7134,37 @@ type TopologySingleResourceParent struct { ResourceID *string `json:"resourceId,omitempty"` } +// UpdateIotSecuritySolutionData ... +type UpdateIotSecuritySolutionData struct { + UserDefinedResources *UserDefinedResourcesProperties `json:"userDefinedResources,omitempty"` + RecommendationsConfiguration *[]RecommendationConfigurationProperties `json:"recommendationsConfiguration,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for UpdateIotSecuritySolutionData. +func (uissd UpdateIotSecuritySolutionData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if uissd.UserDefinedResources != nil { + objectMap["userDefinedResources"] = uissd.UserDefinedResources + } + if uissd.RecommendationsConfiguration != nil { + objectMap["recommendationsConfiguration"] = uissd.RecommendationsConfiguration + } + if uissd.Tags != nil { + objectMap["tags"] = uissd.Tags + } + return json.Marshal(objectMap) +} + +// UserDefinedResourcesProperties properties of the solution's user defined resources. +type UserDefinedResourcesProperties struct { + // Query - Azure Resource Graph query which represents the security solution's user defined resources. Required to start with "where type != "Microsoft.Devices/IotHubs"" + Query *string `json:"query,omitempty"` + // QuerySubscriptions - List of Azure subscription ids on which the user defined resources query should be executed. + QuerySubscriptions *[]string `json:"querySubscriptions,omitempty"` +} + // UserRecommendation represents a user that is recommended to be allowed for a certain rule type UserRecommendation struct { // Username - Represents a user that is recommended to be allowed for a certain rule diff --git a/services/preview/security/mgmt/v3.0/security/pricings.go b/services/preview/security/mgmt/v3.0/security/pricings.go index ceb3b3291c14..f73100cc775f 100644 --- a/services/preview/security/mgmt/v3.0/security/pricings.go +++ b/services/preview/security/mgmt/v3.0/security/pricings.go @@ -41,7 +41,9 @@ func NewPricingsClientWithBaseURI(baseURI string, subscriptionID string, ascLoca return PricingsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} } -// Get security pricing configuration in the subscription +// Get a given security pricing configuration in the subscription. Azure Security Center is available in two pricing +// tiers: Free and Standard, on multiple resource types, including Virtual machines, SQL Servers, App service plans and +// Storage accounts. // Parameters: // pricingName - name of the pricing configuration func (client PricingsClient) Get(ctx context.Context, pricingName string) (result Pricing, err error) { @@ -122,7 +124,9 @@ func (client PricingsClient) GetResponder(resp *http.Response) (result Pricing, return } -// List security pricing configurations in the subscription +// List a given security pricing configuration in the subscription. Azure Security Center is available in two pricing +// tiers: Free and Standard, on multiple resource types, including Virtual machines, SQL Servers, App service plans and +// Storage accounts. func (client PricingsClient) List(ctx context.Context) (result PricingList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PricingsClient.List") @@ -200,7 +204,9 @@ func (client PricingsClient) ListResponder(resp *http.Response) (result PricingL return } -// Update security pricing configuration in the subscription +// Update a given security pricing configuration in the subscription. Azure Security Center is available in two pricing +// tiers: Free and Standard, on multiple resource types, including Virtual machines, SQL Servers, App service plans and +// Storage accounts. // Parameters: // pricingName - name of the pricing configuration // pricing - pricing object 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 e1ae813ee59c..573a51be7f5f 100644 --- a/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go @@ -206,6 +206,67 @@ type WorkspaceSettingsClientAPI interface { var _ WorkspaceSettingsClientAPI = (*security.WorkspaceSettingsClient)(nil) +// IoTSecuritySolutionsClientAPI contains the set of methods on the IoTSecuritySolutionsClient type. +type IoTSecuritySolutionsClientAPI interface { + List(ctx context.Context, filter string) (result security.IoTSecuritySolutionsListPage, err error) +} + +var _ IoTSecuritySolutionsClientAPI = (*security.IoTSecuritySolutionsClient)(nil) + +// IoTSecuritySolutionsResourceGroupClientAPI contains the set of methods on the IoTSecuritySolutionsResourceGroupClient type. +type IoTSecuritySolutionsResourceGroupClientAPI interface { + List(ctx context.Context, resourceGroupName string, filter string) (result security.IoTSecuritySolutionsListPage, err error) +} + +var _ IoTSecuritySolutionsResourceGroupClientAPI = (*security.IoTSecuritySolutionsResourceGroupClient)(nil) + +// IotSecuritySolutionClientAPI contains the set of methods on the IotSecuritySolutionClient type. +type IotSecuritySolutionClientAPI interface { + Create(ctx context.Context, resourceGroupName string, solutionName string, iotSecuritySolutionData security.IoTSecuritySolutionModel) (result security.IoTSecuritySolutionModel, err error) + Delete(ctx context.Context, resourceGroupName string, solutionName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, solutionName string) (result security.IoTSecuritySolutionModel, err error) + Update(ctx context.Context, resourceGroupName string, solutionName string, updateIotSecuritySolutionData security.UpdateIotSecuritySolutionData) (result security.IoTSecuritySolutionModel, err error) +} + +var _ IotSecuritySolutionClientAPI = (*security.IotSecuritySolutionClient)(nil) + +// IoTSecuritySolutionsAnalyticsClientAPI contains the set of methods on the IoTSecuritySolutionsAnalyticsClient type. +type IoTSecuritySolutionsAnalyticsClientAPI interface { + GetAll(ctx context.Context, resourceGroupName string, solutionName string) (result security.IoTSecuritySolutionAnalyticsModelList, err error) + GetDefault(ctx context.Context, resourceGroupName string, solutionName string) (result security.IoTSecuritySolutionAnalyticsModel, err error) +} + +var _ IoTSecuritySolutionsAnalyticsClientAPI = (*security.IoTSecuritySolutionsAnalyticsClient)(nil) + +// IoTSecuritySolutionsAnalyticsAggregatedAlertsClientAPI contains the set of methods on the IoTSecuritySolutionsAnalyticsAggregatedAlertsClient type. +type IoTSecuritySolutionsAnalyticsAggregatedAlertsClientAPI interface { + List(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (result security.IoTSecurityAggregatedAlertListPage, err error) +} + +var _ IoTSecuritySolutionsAnalyticsAggregatedAlertsClientAPI = (*security.IoTSecuritySolutionsAnalyticsAggregatedAlertsClient)(nil) + +// IoTSecuritySolutionsAnalyticsAggregatedAlertClientAPI contains the set of methods on the IoTSecuritySolutionsAnalyticsAggregatedAlertClient type. +type IoTSecuritySolutionsAnalyticsAggregatedAlertClientAPI interface { + Dismiss(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string) (result security.IoTSecurityAggregatedAlert, err error) +} + +var _ IoTSecuritySolutionsAnalyticsAggregatedAlertClientAPI = (*security.IoTSecuritySolutionsAnalyticsAggregatedAlertClient)(nil) + +// IoTSecuritySolutionsAnalyticsRecommendationClientAPI contains the set of methods on the IoTSecuritySolutionsAnalyticsRecommendationClient type. +type IoTSecuritySolutionsAnalyticsRecommendationClientAPI interface { + Get(ctx context.Context, resourceGroupName string, solutionName string, aggregatedRecommendationName string) (result security.IoTSecurityAggregatedRecommendation, err error) +} + +var _ IoTSecuritySolutionsAnalyticsRecommendationClientAPI = (*security.IoTSecuritySolutionsAnalyticsRecommendationClient)(nil) + +// IoTSecuritySolutionsAnalyticsRecommendationsClientAPI contains the set of methods on the IoTSecuritySolutionsAnalyticsRecommendationsClient type. +type IoTSecuritySolutionsAnalyticsRecommendationsClientAPI interface { + List(ctx context.Context, resourceGroupName string, solutionName string, top *int32) (result security.IoTSecurityAggregatedRecommendationListPage, err error) +} + +var _ IoTSecuritySolutionsAnalyticsRecommendationsClientAPI = (*security.IoTSecuritySolutionsAnalyticsRecommendationsClient)(nil) + // RegulatoryComplianceStandardsClientAPI contains the set of methods on the RegulatoryComplianceStandardsClient type. type RegulatoryComplianceStandardsClientAPI interface { Get(ctx context.Context, regulatoryComplianceStandardName string) (result security.RegulatoryComplianceStandard, err error)