From 2b602a3b77b3e35e59a642dab0031d04face6506 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Sun, 28 Jun 2020 03:09:04 +0000 Subject: [PATCH] Generated from a9ed5043091171d44d57e25aa9bf22829be34643 Merge branch 'master' into alerts-2019-08-01 --- .../security/adaptiveapplicationcontrols.go | 82 +- .../security/adaptivenetworkhardenings.go | 3 - .../v1.0/security/advancedthreatprotection.go | 6 +- .../security/mgmt/v1.0/security/alerts.go | 10 - .../v1.0/security/alertssuppressionrules.go | 409 +++ .../mgmt/v1.0/security/allowedconnections.go | 3 - .../mgmt/v1.0/security/automations.go | 6 - .../v1.0/security/autoprovisioningsettings.go | 3 - .../mgmt/v1.0/security/compliances.go | 6 +- .../security/mgmt/v1.0/security/connectors.go | 397 +++ .../security/mgmt/v1.0/security/contacts.go | 5 - .../v1.0/security/devicesecuritygroups.go | 12 +- .../security/discoveredsecuritysolutions.go | 3 - .../security/externalsecuritysolutions.go | 3 - .../security/informationprotectionpolicies.go | 18 +- .../v1.0/security/jitnetworkaccesspolicies.go | 8 - .../security/mgmt/v1.0/security/locations.go | 2 - .../security/mgmt/v1.0/security/models.go | 2459 +++++++++++++++-- .../security/mgmt/v1.0/security/operations.go | 1 - .../security/mgmt/v1.0/security/pricings.go | 6 - .../regulatorycomplianceassessments.go | 2 - .../security/regulatorycompliancecontrols.go | 2 - .../security/regulatorycompliancestandards.go | 2 - .../security/securescorecontroldefinitions.go | 263 ++ .../mgmt/v1.0/security/securescorecontrols.go | 285 ++ .../mgmt/v1.0/security/securescores.go | 238 ++ .../v1.0/security/securityapi/interfaces.go | 54 +- .../security/mgmt/v1.0/security/settings.go | 3 - .../mgmt/v1.0/security/subassessments.go | 9 +- .../security/mgmt/v1.0/security/tasks.go | 7 - .../security/mgmt/v1.0/security/topology.go | 3 - .../security/mgmt/v1.0/security/version.go | 2 +- .../mgmt/v1.0/security/workspacesettings.go | 5 - 33 files changed, 3923 insertions(+), 394 deletions(-) create mode 100644 services/preview/security/mgmt/v1.0/security/alertssuppressionrules.go create mode 100644 services/preview/security/mgmt/v1.0/security/connectors.go create mode 100644 services/preview/security/mgmt/v1.0/security/securescorecontroldefinitions.go create mode 100644 services/preview/security/mgmt/v1.0/security/securescorecontrols.go create mode 100644 services/preview/security/mgmt/v1.0/security/securescores.go diff --git a/services/preview/security/mgmt/v1.0/security/adaptiveapplicationcontrols.go b/services/preview/security/mgmt/v1.0/security/adaptiveapplicationcontrols.go index 3539525c7196..b5c1ac56459b 100644 --- a/services/preview/security/mgmt/v1.0/security/adaptiveapplicationcontrols.go +++ b/services/preview/security/mgmt/v1.0/security/adaptiveapplicationcontrols.go @@ -43,6 +43,85 @@ func NewAdaptiveApplicationControlsClientWithBaseURI(baseURI string, subscriptio return AdaptiveApplicationControlsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} } +// Delete delete an application control VM/server group +// Parameters: +// groupName - name of an application control VM/server group +func (client AdaptiveApplicationControlsClient) Delete(ctx context.Context, groupName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AdaptiveApplicationControlsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AdaptiveApplicationControlsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, groupName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AdaptiveApplicationControlsClient) DeletePreparer(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.AsDelete(), + 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)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AdaptiveApplicationControlsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AdaptiveApplicationControlsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + // Get gets an application control VM/server group. // Parameters: // groupName - name of an application control VM/server group @@ -116,7 +195,6 @@ func (client AdaptiveApplicationControlsClient) GetSender(req *http.Request) (*h 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()) @@ -202,7 +280,6 @@ func (client AdaptiveApplicationControlsClient) ListSender(req *http.Request) (* 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()) @@ -286,7 +363,6 @@ func (client AdaptiveApplicationControlsClient) PutSender(req *http.Request) (*h 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()) diff --git a/services/preview/security/mgmt/v1.0/security/adaptivenetworkhardenings.go b/services/preview/security/mgmt/v1.0/security/adaptivenetworkhardenings.go index 852e2eecef0f..feb538932911 100644 --- a/services/preview/security/mgmt/v1.0/security/adaptivenetworkhardenings.go +++ b/services/preview/security/mgmt/v1.0/security/adaptivenetworkhardenings.go @@ -134,7 +134,6 @@ func (client AdaptiveNetworkHardeningsClient) EnforceSender(req *http.Request) ( func (client AdaptiveNetworkHardeningsClient) EnforceResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp @@ -226,7 +225,6 @@ func (client AdaptiveNetworkHardeningsClient) GetSender(req *http.Request) (*htt func (client AdaptiveNetworkHardeningsClient) GetResponder(resp *http.Response) (result AdaptiveNetworkHardening, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -318,7 +316,6 @@ func (client AdaptiveNetworkHardeningsClient) ListByExtendedResourceSender(req * func (client AdaptiveNetworkHardeningsClient) ListByExtendedResourceResponder(resp *http.Response) (result AdaptiveNetworkHardeningsList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/advancedthreatprotection.go b/services/preview/security/mgmt/v1.0/security/advancedthreatprotection.go index 4a29fb5efec8..2bd63720d32e 100644 --- a/services/preview/security/mgmt/v1.0/security/advancedthreatprotection.go +++ b/services/preview/security/mgmt/v1.0/security/advancedthreatprotection.go @@ -81,7 +81,7 @@ func (client AdvancedThreatProtectionClient) Create(ctx context.Context, resourc // CreatePreparer prepares the Create request. func (client AdvancedThreatProtectionClient) CreatePreparer(ctx context.Context, resourceID string, advancedThreatProtectionSetting AdvancedThreatProtectionSetting) (*http.Request, error) { pathParameters := map[string]interface{}{ - "resourceId": autorest.Encode("path", resourceID), + "resourceId": resourceID, "settingName": autorest.Encode("path", "current"), } @@ -111,7 +111,6 @@ func (client AdvancedThreatProtectionClient) CreateSender(req *http.Request) (*h func (client AdvancedThreatProtectionClient) CreateResponder(resp *http.Response) (result AdvancedThreatProtectionSetting, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -157,7 +156,7 @@ func (client AdvancedThreatProtectionClient) Get(ctx context.Context, resourceID // GetPreparer prepares the Get request. func (client AdvancedThreatProtectionClient) GetPreparer(ctx context.Context, resourceID string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "resourceId": autorest.Encode("path", resourceID), + "resourceId": resourceID, "settingName": autorest.Encode("path", "current"), } @@ -185,7 +184,6 @@ func (client AdvancedThreatProtectionClient) GetSender(req *http.Request) (*http func (client AdvancedThreatProtectionClient) GetResponder(resp *http.Response) (result AdvancedThreatProtectionSetting, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/alerts.go b/services/preview/security/mgmt/v1.0/security/alerts.go index f0d07a284f76..5f45e140a19b 100644 --- a/services/preview/security/mgmt/v1.0/security/alerts.go +++ b/services/preview/security/mgmt/v1.0/security/alerts.go @@ -122,7 +122,6 @@ func (client AlertsClient) GetResourceGroupLevelAlertsSender(req *http.Request) func (client AlertsClient) GetResourceGroupLevelAlertsResponder(resp *http.Response) (result Alert, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -203,7 +202,6 @@ func (client AlertsClient) GetSubscriptionLevelAlertSender(req *http.Request) (* func (client AlertsClient) GetSubscriptionLevelAlertResponder(resp *http.Response) (result Alert, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -294,7 +292,6 @@ func (client AlertsClient) ListSender(req *http.Request) (*http.Response, error) func (client AlertsClient) ListResponder(resp *http.Response) (result AlertList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -429,7 +426,6 @@ func (client AlertsClient) ListByResourceGroupSender(req *http.Request) (*http.R func (client AlertsClient) ListByResourceGroupResponder(resp *http.Response) (result AlertList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -566,7 +562,6 @@ func (client AlertsClient) ListResourceGroupLevelAlertsByRegionSender(req *http. func (client AlertsClient) ListResourceGroupLevelAlertsByRegionResponder(resp *http.Response) (result AlertList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -696,7 +691,6 @@ func (client AlertsClient) ListSubscriptionLevelAlertsByRegionSender(req *http.R func (client AlertsClient) ListSubscriptionLevelAlertsByRegionResponder(resp *http.Response) (result AlertList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -821,7 +815,6 @@ func (client AlertsClient) UpdateResourceGroupLevelAlertStateToDismissSender(req func (client AlertsClient) UpdateResourceGroupLevelAlertStateToDismissResponder(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 @@ -908,7 +901,6 @@ func (client AlertsClient) UpdateResourceGroupLevelAlertStateToReactivateSender( func (client AlertsClient) UpdateResourceGroupLevelAlertStateToReactivateResponder(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 @@ -988,7 +980,6 @@ func (client AlertsClient) UpdateSubscriptionLevelAlertStateToDismissSender(req func (client AlertsClient) UpdateSubscriptionLevelAlertStateToDismissResponder(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 @@ -1068,7 +1059,6 @@ func (client AlertsClient) UpdateSubscriptionLevelAlertStateToReactivateSender(r func (client AlertsClient) UpdateSubscriptionLevelAlertStateToReactivateResponder(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 diff --git a/services/preview/security/mgmt/v1.0/security/alertssuppressionrules.go b/services/preview/security/mgmt/v1.0/security/alertssuppressionrules.go new file mode 100644 index 000000000000..4fcb7d39434b --- /dev/null +++ b/services/preview/security/mgmt/v1.0/security/alertssuppressionrules.go @@ -0,0 +1,409 @@ +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" +) + +// AlertsSuppressionRulesClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type AlertsSuppressionRulesClient struct { + BaseClient +} + +// NewAlertsSuppressionRulesClient creates an instance of the AlertsSuppressionRulesClient client. +func NewAlertsSuppressionRulesClient(subscriptionID string, ascLocation string) AlertsSuppressionRulesClient { + return NewAlertsSuppressionRulesClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewAlertsSuppressionRulesClientWithBaseURI creates an instance of the AlertsSuppressionRulesClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewAlertsSuppressionRulesClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) AlertsSuppressionRulesClient { + return AlertsSuppressionRulesClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// Delete delete dismiss alert rule for this subscription. +// Parameters: +// alertsSuppressionRuleName - the unique name of the suppression alert rule +func (client AlertsSuppressionRulesClient) Delete(ctx context.Context, alertsSuppressionRuleName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsSuppressionRulesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AlertsSuppressionRulesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, alertsSuppressionRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AlertsSuppressionRulesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.AlertsSuppressionRulesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AlertsSuppressionRulesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AlertsSuppressionRulesClient) DeletePreparer(ctx context.Context, alertsSuppressionRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "alertsSuppressionRuleName": autorest.Encode("path", alertsSuppressionRuleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}", 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 AlertsSuppressionRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AlertsSuppressionRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get dismiss rule, with name: {alertsSuppressionRuleName}, for the given subscription +// Parameters: +// alertsSuppressionRuleName - the unique name of the suppression alert rule +func (client AlertsSuppressionRulesClient) Get(ctx context.Context, alertsSuppressionRuleName string) (result AlertsSuppressionRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsSuppressionRulesClient.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.AlertsSuppressionRulesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, alertsSuppressionRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AlertsSuppressionRulesClient", "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.AlertsSuppressionRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AlertsSuppressionRulesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AlertsSuppressionRulesClient) GetPreparer(ctx context.Context, alertsSuppressionRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "alertsSuppressionRuleName": autorest.Encode("path", alertsSuppressionRuleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}", 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 AlertsSuppressionRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AlertsSuppressionRulesClient) GetResponder(resp *http.Response) (result AlertsSuppressionRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list of all the dismiss rules for the given subscription +// Parameters: +// alertType - type of the alert to get rules for +func (client AlertsSuppressionRulesClient) List(ctx context.Context, alertType string) (result AlertsSuppressionRulesListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsSuppressionRulesClient.List") + defer func() { + sc := -1 + if result.asrl.Response.Response != nil { + sc = result.asrl.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.AlertsSuppressionRulesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, alertType) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AlertsSuppressionRulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.asrl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AlertsSuppressionRulesClient", "List", resp, "Failure sending request") + return + } + + result.asrl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AlertsSuppressionRulesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AlertsSuppressionRulesClient) ListPreparer(ctx context.Context, alertType string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(alertType) > 0 { + queryParameters["AlertType"] = autorest.Encode("query", alertType) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules", 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 AlertsSuppressionRulesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AlertsSuppressionRulesClient) ListResponder(resp *http.Response) (result AlertsSuppressionRulesList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AlertsSuppressionRulesClient) listNextResults(ctx context.Context, lastResults AlertsSuppressionRulesList) (result AlertsSuppressionRulesList, err error) { + req, err := lastResults.alertsSuppressionRulesListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.AlertsSuppressionRulesClient", "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.AlertsSuppressionRulesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AlertsSuppressionRulesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AlertsSuppressionRulesClient) ListComplete(ctx context.Context, alertType string) (result AlertsSuppressionRulesListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsSuppressionRulesClient.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, alertType) + return +} + +// Update update existing rule or create new rule if it doesn't exist +// Parameters: +// alertsSuppressionRuleName - the unique name of the suppression alert rule +// alertsSuppressionRule - suppression rule object +func (client AlertsSuppressionRulesClient) Update(ctx context.Context, alertsSuppressionRuleName string, alertsSuppressionRule AlertsSuppressionRule) (result AlertsSuppressionRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsSuppressionRulesClient.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: alertsSuppressionRule, + Constraints: []validation.Constraint{{Target: "alertsSuppressionRule.AlertsSuppressionRuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "alertsSuppressionRule.AlertsSuppressionRuleProperties.AlertType", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "alertsSuppressionRule.AlertsSuppressionRuleProperties.Reason", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "alertsSuppressionRule.AlertsSuppressionRuleProperties.SuppressionAlertsScope", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "alertsSuppressionRule.AlertsSuppressionRuleProperties.SuppressionAlertsScope.AllOf", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("security.AlertsSuppressionRulesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, alertsSuppressionRuleName, alertsSuppressionRule) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AlertsSuppressionRulesClient", "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.AlertsSuppressionRulesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AlertsSuppressionRulesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AlertsSuppressionRulesClient) UpdatePreparer(ctx context.Context, alertsSuppressionRuleName string, alertsSuppressionRule AlertsSuppressionRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "alertsSuppressionRuleName": autorest.Encode("path", alertsSuppressionRuleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}", pathParameters), + autorest.WithJSON(alertsSuppressionRule), + 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 AlertsSuppressionRulesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AlertsSuppressionRulesClient) UpdateResponder(resp *http.Response) (result AlertsSuppressionRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/security/mgmt/v1.0/security/allowedconnections.go b/services/preview/security/mgmt/v1.0/security/allowedconnections.go index 0eeca0685693..f1643b702af1 100644 --- a/services/preview/security/mgmt/v1.0/security/allowedconnections.go +++ b/services/preview/security/mgmt/v1.0/security/allowedconnections.go @@ -124,7 +124,6 @@ func (client AllowedConnectionsClient) GetSender(req *http.Request) (*http.Respo func (client AllowedConnectionsClient) GetResponder(resp *http.Response) (result AllowedConnectionsResource, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -202,7 +201,6 @@ func (client AllowedConnectionsClient) ListSender(req *http.Request) (*http.Resp func (client AllowedConnectionsClient) ListResponder(resp *http.Response) (result AllowedConnectionsList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -318,7 +316,6 @@ func (client AllowedConnectionsClient) ListByHomeRegionSender(req *http.Request) func (client AllowedConnectionsClient) ListByHomeRegionResponder(resp *http.Response) (result AllowedConnectionsList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/automations.go b/services/preview/security/mgmt/v1.0/security/automations.go index d4e9b1c35bcd..06ab18f48a8b 100644 --- a/services/preview/security/mgmt/v1.0/security/automations.go +++ b/services/preview/security/mgmt/v1.0/security/automations.go @@ -125,7 +125,6 @@ func (client AutomationsClient) CreateOrUpdateSender(req *http.Request) (*http.R func (client AutomationsClient) CreateOrUpdateResponder(resp *http.Response) (result Automation, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -212,7 +211,6 @@ func (client AutomationsClient) DeleteSender(req *http.Request) (*http.Response, func (client AutomationsClient) 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 @@ -298,7 +296,6 @@ func (client AutomationsClient) GetSender(req *http.Request) (*http.Response, er func (client AutomationsClient) GetResponder(resp *http.Response) (result Automation, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -377,7 +374,6 @@ func (client AutomationsClient) ListSender(req *http.Request) (*http.Response, e func (client AutomationsClient) ListResponder(resp *http.Response) (result AutomationList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -501,7 +497,6 @@ func (client AutomationsClient) ListByResourceGroupSender(req *http.Request) (*h func (client AutomationsClient) ListByResourceGroupResponder(resp *http.Response) (result AutomationList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -629,7 +624,6 @@ func (client AutomationsClient) ValidateSender(req *http.Request) (*http.Respons func (client AutomationsClient) ValidateResponder(resp *http.Response) (result AutomationValidationStatus, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/autoprovisioningsettings.go b/services/preview/security/mgmt/v1.0/security/autoprovisioningsettings.go index 433630bd659d..d626b2049917 100644 --- a/services/preview/security/mgmt/v1.0/security/autoprovisioningsettings.go +++ b/services/preview/security/mgmt/v1.0/security/autoprovisioningsettings.go @@ -118,7 +118,6 @@ func (client AutoProvisioningSettingsClient) CreateSender(req *http.Request) (*h func (client AutoProvisioningSettingsClient) CreateResponder(resp *http.Response) (result AutoProvisioningSetting, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -198,7 +197,6 @@ func (client AutoProvisioningSettingsClient) GetSender(req *http.Request) (*http func (client AutoProvisioningSettingsClient) GetResponder(resp *http.Response) (result AutoProvisioningSetting, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -276,7 +274,6 @@ func (client AutoProvisioningSettingsClient) ListSender(req *http.Request) (*htt func (client AutoProvisioningSettingsClient) ListResponder(resp *http.Response) (result AutoProvisioningSettingList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/compliances.go b/services/preview/security/mgmt/v1.0/security/compliances.go index 2f0fa49be6a0..4f33618da8c0 100644 --- a/services/preview/security/mgmt/v1.0/security/compliances.go +++ b/services/preview/security/mgmt/v1.0/security/compliances.go @@ -82,7 +82,7 @@ func (client CompliancesClient) Get(ctx context.Context, scope string, complianc func (client CompliancesClient) GetPreparer(ctx context.Context, scope string, complianceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "complianceName": autorest.Encode("path", complianceName), - "scope": autorest.Encode("path", scope), + "scope": scope, } const APIVersion = "2017-08-01-preview" @@ -109,7 +109,6 @@ func (client CompliancesClient) GetSender(req *http.Request) (*http.Response, er func (client CompliancesClient) GetResponder(resp *http.Response) (result Compliance, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -157,7 +156,7 @@ func (client CompliancesClient) List(ctx context.Context, scope string) (result // ListPreparer prepares the List request. func (client CompliancesClient) ListPreparer(ctx context.Context, scope string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "scope": autorest.Encode("path", scope), + "scope": scope, } const APIVersion = "2017-08-01-preview" @@ -184,7 +183,6 @@ func (client CompliancesClient) ListSender(req *http.Request) (*http.Response, e func (client CompliancesClient) ListResponder(resp *http.Response) (result ComplianceList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/connectors.go b/services/preview/security/mgmt/v1.0/security/connectors.go new file mode 100644 index 000000000000..3af65acfa895 --- /dev/null +++ b/services/preview/security/mgmt/v1.0/security/connectors.go @@ -0,0 +1,397 @@ +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" +) + +// ConnectorsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type ConnectorsClient struct { + BaseClient +} + +// NewConnectorsClient creates an instance of the ConnectorsClient client. +func NewConnectorsClient(subscriptionID string, ascLocation string) ConnectorsClient { + return NewConnectorsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewConnectorsClientWithBaseURI creates an instance of the ConnectorsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewConnectorsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) ConnectorsClient { + return ConnectorsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// CreateOrUpdate create a cloud account connector or update an existing one. Connect to your AWS cloud account using +// either account credentials or role-based authentication. +// Parameters: +// connectorName - name of the cloud account connector +// connectorSetting - settings for the cloud account connector +func (client ConnectorsClient) CreateOrUpdate(ctx context.Context, connectorName string, connectorSetting ConnectorSetting) (result ConnectorSetting, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectorsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.ConnectorsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, connectorName, connectorSetting) + if err != nil { + err = autorest.NewErrorWithError(err, "security.ConnectorsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.ConnectorsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.ConnectorsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ConnectorsClient) CreateOrUpdatePreparer(ctx context.Context, connectorName string, connectorSetting ConnectorSetting) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectorName": autorest.Encode("path", connectorName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}", pathParameters), + autorest.WithJSON(connectorSetting), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectorsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ConnectorsClient) CreateOrUpdateResponder(resp *http.Response) (result ConnectorSetting, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a cloud account connector from a subscription +// Parameters: +// connectorName - name of the cloud account connector +func (client ConnectorsClient) Delete(ctx context.Context, connectorName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectorsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.ConnectorsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, connectorName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.ConnectorsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.ConnectorsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.ConnectorsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ConnectorsClient) DeletePreparer(ctx context.Context, connectorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectorName": autorest.Encode("path", connectorName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}", 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 ConnectorsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ConnectorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get details of a specific cloud account connector +// Parameters: +// connectorName - name of the cloud account connector +func (client ConnectorsClient) Get(ctx context.Context, connectorName string) (result ConnectorSetting, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectorsClient.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.ConnectorsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, connectorName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.ConnectorsClient", "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.ConnectorsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.ConnectorsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConnectorsClient) GetPreparer(ctx context.Context, connectorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectorName": autorest.Encode("path", connectorName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}", 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 ConnectorsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ConnectorsClient) GetResponder(resp *http.Response) (result ConnectorSetting, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List cloud accounts connectors of a subscription +func (client ConnectorsClient) List(ctx context.Context) (result ConnectorSettingListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectorsClient.List") + defer func() { + sc := -1 + if result.csl.Response.Response != nil { + sc = result.csl.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.ConnectorsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.ConnectorsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.csl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.ConnectorsClient", "List", resp, "Failure sending request") + return + } + + result.csl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.ConnectorsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ConnectorsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors", 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 ConnectorsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ConnectorsClient) ListResponder(resp *http.Response) (result ConnectorSettingList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ConnectorsClient) listNextResults(ctx context.Context, lastResults ConnectorSettingList) (result ConnectorSettingList, err error) { + req, err := lastResults.connectorSettingListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.ConnectorsClient", "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.ConnectorsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.ConnectorsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ConnectorsClient) ListComplete(ctx context.Context) (result ConnectorSettingListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectorsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/security/mgmt/v1.0/security/contacts.go b/services/preview/security/mgmt/v1.0/security/contacts.go index bbf7b35c4675..efedb961a1f7 100644 --- a/services/preview/security/mgmt/v1.0/security/contacts.go +++ b/services/preview/security/mgmt/v1.0/security/contacts.go @@ -120,7 +120,6 @@ func (client ContactsClient) CreateSender(req *http.Request) (*http.Response, er func (client ContactsClient) CreateResponder(resp *http.Response) (result Contact, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -200,7 +199,6 @@ func (client ContactsClient) DeleteSender(req *http.Request) (*http.Response, er func (client ContactsClient) 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 @@ -279,7 +277,6 @@ func (client ContactsClient) GetSender(req *http.Request) (*http.Response, error func (client ContactsClient) GetResponder(resp *http.Response) (result Contact, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -357,7 +354,6 @@ func (client ContactsClient) ListSender(req *http.Request) (*http.Response, erro func (client ContactsClient) ListResponder(resp *http.Response) (result ContactList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -477,7 +473,6 @@ func (client ContactsClient) UpdateSender(req *http.Request) (*http.Response, er func (client ContactsClient) UpdateResponder(resp *http.Response) (result Contact, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/devicesecuritygroups.go b/services/preview/security/mgmt/v1.0/security/devicesecuritygroups.go index 5743a87ed3e5..8d7530224bdd 100644 --- a/services/preview/security/mgmt/v1.0/security/devicesecuritygroups.go +++ b/services/preview/security/mgmt/v1.0/security/devicesecuritygroups.go @@ -83,7 +83,7 @@ func (client DeviceSecurityGroupsClient) CreateOrUpdate(ctx context.Context, res func (client DeviceSecurityGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceID string, deviceSecurityGroupName string, deviceSecurityGroup DeviceSecurityGroup) (*http.Request, error) { pathParameters := map[string]interface{}{ "deviceSecurityGroupName": autorest.Encode("path", deviceSecurityGroupName), - "resourceId": autorest.Encode("path", resourceID), + "resourceId": resourceID, } const APIVersion = "2017-08-01-preview" @@ -112,7 +112,6 @@ func (client DeviceSecurityGroupsClient) CreateOrUpdateSender(req *http.Request) func (client DeviceSecurityGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result DeviceSecurityGroup, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -160,7 +159,7 @@ func (client DeviceSecurityGroupsClient) Delete(ctx context.Context, resourceID func (client DeviceSecurityGroupsClient) DeletePreparer(ctx context.Context, resourceID string, deviceSecurityGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "deviceSecurityGroupName": autorest.Encode("path", deviceSecurityGroupName), - "resourceId": autorest.Encode("path", resourceID), + "resourceId": resourceID, } const APIVersion = "2017-08-01-preview" @@ -187,7 +186,6 @@ func (client DeviceSecurityGroupsClient) DeleteSender(req *http.Request) (*http. func (client DeviceSecurityGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByClosing()) result.Response = resp @@ -234,7 +232,7 @@ func (client DeviceSecurityGroupsClient) Get(ctx context.Context, resourceID str func (client DeviceSecurityGroupsClient) GetPreparer(ctx context.Context, resourceID string, deviceSecurityGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "deviceSecurityGroupName": autorest.Encode("path", deviceSecurityGroupName), - "resourceId": autorest.Encode("path", resourceID), + "resourceId": resourceID, } const APIVersion = "2017-08-01-preview" @@ -261,7 +259,6 @@ func (client DeviceSecurityGroupsClient) GetSender(req *http.Request) (*http.Res func (client DeviceSecurityGroupsClient) GetResponder(resp *http.Response) (result DeviceSecurityGroup, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -308,7 +305,7 @@ func (client DeviceSecurityGroupsClient) List(ctx context.Context, resourceID st // ListPreparer prepares the List request. func (client DeviceSecurityGroupsClient) ListPreparer(ctx context.Context, resourceID string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "resourceId": autorest.Encode("path", resourceID), + "resourceId": resourceID, } const APIVersion = "2017-08-01-preview" @@ -335,7 +332,6 @@ func (client DeviceSecurityGroupsClient) ListSender(req *http.Request) (*http.Re func (client DeviceSecurityGroupsClient) ListResponder(resp *http.Response) (result DeviceSecurityGroupList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/discoveredsecuritysolutions.go b/services/preview/security/mgmt/v1.0/security/discoveredsecuritysolutions.go index 5cad25154319..e14904a8aaf0 100644 --- a/services/preview/security/mgmt/v1.0/security/discoveredsecuritysolutions.go +++ b/services/preview/security/mgmt/v1.0/security/discoveredsecuritysolutions.go @@ -123,7 +123,6 @@ func (client DiscoveredSecuritySolutionsClient) GetSender(req *http.Request) (*h func (client DiscoveredSecuritySolutionsClient) GetResponder(resp *http.Response) (result DiscoveredSecuritySolution, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -201,7 +200,6 @@ func (client DiscoveredSecuritySolutionsClient) ListSender(req *http.Request) (* func (client DiscoveredSecuritySolutionsClient) ListResponder(resp *http.Response) (result DiscoveredSecuritySolutionList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -317,7 +315,6 @@ func (client DiscoveredSecuritySolutionsClient) ListByHomeRegionSender(req *http func (client DiscoveredSecuritySolutionsClient) ListByHomeRegionResponder(resp *http.Response) (result DiscoveredSecuritySolutionList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/externalsecuritysolutions.go b/services/preview/security/mgmt/v1.0/security/externalsecuritysolutions.go index 614aa067c07b..25285174c4ea 100644 --- a/services/preview/security/mgmt/v1.0/security/externalsecuritysolutions.go +++ b/services/preview/security/mgmt/v1.0/security/externalsecuritysolutions.go @@ -123,7 +123,6 @@ func (client ExternalSecuritySolutionsClient) GetSender(req *http.Request) (*htt func (client ExternalSecuritySolutionsClient) GetResponder(resp *http.Response) (result ExternalSecuritySolutionModel, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -201,7 +200,6 @@ func (client ExternalSecuritySolutionsClient) ListSender(req *http.Request) (*ht func (client ExternalSecuritySolutionsClient) ListResponder(resp *http.Response) (result ExternalSecuritySolutionList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -317,7 +315,6 @@ func (client ExternalSecuritySolutionsClient) ListByHomeRegionSender(req *http.R func (client ExternalSecuritySolutionsClient) ListByHomeRegionResponder(resp *http.Response) (result ExternalSecuritySolutionList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/informationprotectionpolicies.go b/services/preview/security/mgmt/v1.0/security/informationprotectionpolicies.go index b1ca96db2f94..433b07e8986b 100644 --- a/services/preview/security/mgmt/v1.0/security/informationprotectionpolicies.go +++ b/services/preview/security/mgmt/v1.0/security/informationprotectionpolicies.go @@ -47,7 +47,8 @@ func NewInformationProtectionPoliciesClientWithBaseURI(baseURI string, subscript // scope - scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or // management group (/providers/Microsoft.Management/managementGroups/mgName). // informationProtectionPolicyName - name of the information protection policy. -func (client InformationProtectionPoliciesClient) CreateOrUpdate(ctx context.Context, scope string, informationProtectionPolicyName string) (result InformationProtectionPolicy, err error) { +// informationProtectionPolicy - information protection policy. +func (client InformationProtectionPoliciesClient) CreateOrUpdate(ctx context.Context, scope string, informationProtectionPolicyName string, informationProtectionPolicy InformationProtectionPolicy) (result InformationProtectionPolicy, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/InformationProtectionPoliciesClient.CreateOrUpdate") defer func() { @@ -58,7 +59,7 @@ func (client InformationProtectionPoliciesClient) CreateOrUpdate(ctx context.Con tracing.EndSpan(ctx, sc, err) }() } - req, err := client.CreateOrUpdatePreparer(ctx, scope, informationProtectionPolicyName) + req, err := client.CreateOrUpdatePreparer(ctx, scope, informationProtectionPolicyName, informationProtectionPolicy) if err != nil { err = autorest.NewErrorWithError(err, "security.InformationProtectionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") return @@ -80,10 +81,10 @@ func (client InformationProtectionPoliciesClient) CreateOrUpdate(ctx context.Con } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client InformationProtectionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, scope string, informationProtectionPolicyName string) (*http.Request, error) { +func (client InformationProtectionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, scope string, informationProtectionPolicyName string, informationProtectionPolicy InformationProtectionPolicy) (*http.Request, error) { pathParameters := map[string]interface{}{ "informationProtectionPolicyName": autorest.Encode("path", informationProtectionPolicyName), - "scope": autorest.Encode("path", scope), + "scope": scope, } const APIVersion = "2017-08-01-preview" @@ -92,9 +93,11 @@ func (client InformationProtectionPoliciesClient) CreateOrUpdatePreparer(ctx con } preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}", pathParameters), + autorest.WithJSON(informationProtectionPolicy), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -110,7 +113,6 @@ func (client InformationProtectionPoliciesClient) CreateOrUpdateSender(req *http func (client InformationProtectionPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result InformationProtectionPolicy, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -159,7 +161,7 @@ func (client InformationProtectionPoliciesClient) Get(ctx context.Context, scope func (client InformationProtectionPoliciesClient) GetPreparer(ctx context.Context, scope string, informationProtectionPolicyName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "informationProtectionPolicyName": autorest.Encode("path", informationProtectionPolicyName), - "scope": autorest.Encode("path", scope), + "scope": scope, } const APIVersion = "2017-08-01-preview" @@ -186,7 +188,6 @@ func (client InformationProtectionPoliciesClient) GetSender(req *http.Request) ( func (client InformationProtectionPoliciesClient) GetResponder(resp *http.Response) (result InformationProtectionPolicy, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -234,7 +235,7 @@ func (client InformationProtectionPoliciesClient) List(ctx context.Context, scop // ListPreparer prepares the List request. func (client InformationProtectionPoliciesClient) ListPreparer(ctx context.Context, scope string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "scope": autorest.Encode("path", scope), + "scope": scope, } const APIVersion = "2017-08-01-preview" @@ -261,7 +262,6 @@ func (client InformationProtectionPoliciesClient) ListSender(req *http.Request) func (client InformationProtectionPoliciesClient) ListResponder(resp *http.Response) (result InformationProtectionPolicyList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/jitnetworkaccesspolicies.go b/services/preview/security/mgmt/v1.0/security/jitnetworkaccesspolicies.go index 82115488a008..1e0d94528bc3 100644 --- a/services/preview/security/mgmt/v1.0/security/jitnetworkaccesspolicies.go +++ b/services/preview/security/mgmt/v1.0/security/jitnetworkaccesspolicies.go @@ -132,7 +132,6 @@ func (client JitNetworkAccessPoliciesClient) CreateOrUpdateSender(req *http.Requ func (client JitNetworkAccessPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result JitNetworkAccessPolicy, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -220,7 +219,6 @@ func (client JitNetworkAccessPoliciesClient) DeleteSender(req *http.Request) (*h func (client JitNetworkAccessPoliciesClient) 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 @@ -307,7 +305,6 @@ func (client JitNetworkAccessPoliciesClient) GetSender(req *http.Request) (*http func (client JitNetworkAccessPoliciesClient) GetResponder(resp *http.Response) (result JitNetworkAccessPolicy, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -400,7 +397,6 @@ func (client JitNetworkAccessPoliciesClient) InitiateSender(req *http.Request) ( func (client JitNetworkAccessPoliciesClient) InitiateResponder(resp *http.Response) (result JitNetworkAccessRequest, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -478,7 +474,6 @@ func (client JitNetworkAccessPoliciesClient) ListSender(req *http.Request) (*htt func (client JitNetworkAccessPoliciesClient) ListResponder(resp *http.Response) (result JitNetworkAccessPoliciesList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -594,7 +589,6 @@ func (client JitNetworkAccessPoliciesClient) ListByRegionSender(req *http.Reques func (client JitNetworkAccessPoliciesClient) ListByRegionResponder(resp *http.Response) (result JitNetworkAccessPoliciesList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -718,7 +712,6 @@ func (client JitNetworkAccessPoliciesClient) ListByResourceGroupSender(req *http func (client JitNetworkAccessPoliciesClient) ListByResourceGroupResponder(resp *http.Response) (result JitNetworkAccessPoliciesList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -843,7 +836,6 @@ func (client JitNetworkAccessPoliciesClient) ListByResourceGroupAndRegionSender( func (client JitNetworkAccessPoliciesClient) ListByResourceGroupAndRegionResponder(resp *http.Response) (result JitNetworkAccessPoliciesList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/locations.go b/services/preview/security/mgmt/v1.0/security/locations.go index cd6fdf271b9a..571c190ee208 100644 --- a/services/preview/security/mgmt/v1.0/security/locations.go +++ b/services/preview/security/mgmt/v1.0/security/locations.go @@ -112,7 +112,6 @@ func (client LocationsClient) GetSender(req *http.Request) (*http.Response, erro func (client LocationsClient) GetResponder(resp *http.Response) (result AscLocation, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -192,7 +191,6 @@ func (client LocationsClient) ListSender(req *http.Request) (*http.Response, err func (client LocationsClient) ListResponder(resp *http.Response) (result AscLocationList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/models.go b/services/preview/security/mgmt/v1.0/security/models.go index 3bd892fb46d9..8b67213ef740 100644 --- a/services/preview/security/mgmt/v1.0/security/models.go +++ b/services/preview/security/mgmt/v1.0/security/models.go @@ -134,13 +134,51 @@ func PossibleAssessedResourceTypeValues() []AssessedResourceType { return []AssessedResourceType{AssessedResourceTypeAdditionalData, AssessedResourceTypeContainerRegistryVulnerability, AssessedResourceTypeServerVulnerabilityAssessment, AssessedResourceTypeSQLServerVulnerability} } +// AuthenticationProvisioningState enumerates the values for authentication provisioning state. +type AuthenticationProvisioningState string + +const ( + // Expired the connection is expired + Expired AuthenticationProvisioningState = "Expired" + // IncorrectPolicy Incorrect policy of the connector + IncorrectPolicy AuthenticationProvisioningState = "IncorrectPolicy" + // Invalid Invalid connector + Invalid AuthenticationProvisioningState = "Invalid" + // Valid Valid connector + Valid AuthenticationProvisioningState = "Valid" +) + +// PossibleAuthenticationProvisioningStateValues returns an array of possible values for the AuthenticationProvisioningState const type. +func PossibleAuthenticationProvisioningStateValues() []AuthenticationProvisioningState { + return []AuthenticationProvisioningState{Expired, IncorrectPolicy, Invalid, Valid} +} + +// AuthenticationType enumerates the values for authentication type. +type AuthenticationType string + +const ( + // AuthenticationTypeAuthenticationDetailsProperties ... + AuthenticationTypeAuthenticationDetailsProperties AuthenticationType = "AuthenticationDetailsProperties" + // AuthenticationTypeAwsAssumeRole ... + AuthenticationTypeAwsAssumeRole AuthenticationType = "awsAssumeRole" + // AuthenticationTypeAwsCreds ... + AuthenticationTypeAwsCreds AuthenticationType = "awsCreds" + // AuthenticationTypeGcpCredentials ... + AuthenticationTypeGcpCredentials AuthenticationType = "gcpCredentials" +) + +// PossibleAuthenticationTypeValues returns an array of possible values for the AuthenticationType const type. +func PossibleAuthenticationTypeValues() []AuthenticationType { + return []AuthenticationType{AuthenticationTypeAuthenticationDetailsProperties, AuthenticationTypeAwsAssumeRole, AuthenticationTypeAwsCreds, AuthenticationTypeGcpCredentials} +} + // AutoProvision enumerates the values for auto provision. type AutoProvision string const ( - // AutoProvisionOff Do not install security agent on the VMs automatically + // AutoProvisionOff Do not install Azure Arc agent on the VMs automatically AutoProvisionOff AutoProvision = "Off" - // AutoProvisionOn Install missing security agent on VMs automatically + // AutoProvisionOn Install missing Azure Arc agent on VMs automatically AutoProvisionOn AutoProvision = "On" ) @@ -227,6 +265,21 @@ func PossibleConnectionTypeValues() []ConnectionType { return []ConnectionType{External, Internal} } +// ControlType enumerates the values for control type. +type ControlType string + +const ( + // BuiltIn Azure Security Center managed assessments + BuiltIn ControlType = "BuiltIn" + // Custom Non Azure Security Center managed assessments + Custom ControlType = "Custom" +) + +// PossibleControlTypeValues returns an array of possible values for the ControlType const type. +func PossibleControlTypeValues() []ControlType { + return []ControlType{BuiltIn, Custom} +} + // Direction enumerates the values for direction. type Direction string @@ -342,6 +395,19 @@ func PossibleExecutableValues() []Executable { return []Executable{ExecutableAudit, ExecutableEnforce, ExecutableNone} } +// ExpandControlsEnum enumerates the values for expand controls enum. +type ExpandControlsEnum string + +const ( + // Definition Add definition object for each control + Definition ExpandControlsEnum = "definition" +) + +// PossibleExpandControlsEnumValues returns an array of possible values for the ExpandControlsEnum const type. +func PossibleExpandControlsEnumValues() []ExpandControlsEnum { + return []ExpandControlsEnum{Definition} +} + // ExternalSecuritySolutionKind enumerates the values for external security solution kind. type ExternalSecuritySolutionKind string @@ -401,6 +467,23 @@ func PossibleFileTypeValues() []FileType { return []FileType{FileTypeDll, FileTypeExe, FileTypeExecutable, FileTypeMsi, FileTypeScript, FileTypeUnknown} } +// HybridComputeProvisioningState enumerates the values for hybrid compute provisioning state. +type HybridComputeProvisioningState string + +const ( + // HybridComputeProvisioningStateExpired the service principal details are expired + HybridComputeProvisioningStateExpired HybridComputeProvisioningState = "Expired" + // HybridComputeProvisioningStateInvalid Invalid service principal details. + HybridComputeProvisioningStateInvalid HybridComputeProvisioningState = "Invalid" + // HybridComputeProvisioningStateValid Valid service principal details. + HybridComputeProvisioningStateValid HybridComputeProvisioningState = "Valid" +) + +// PossibleHybridComputeProvisioningStateValues returns an array of possible values for the HybridComputeProvisioningState const type. +func PossibleHybridComputeProvisioningStateValues() []HybridComputeProvisioningState { + return []HybridComputeProvisioningState{HybridComputeProvisioningStateExpired, HybridComputeProvisioningStateInvalid, HybridComputeProvisioningStateValid} +} + // Issue enumerates the values for issue. type Issue string @@ -489,6 +572,26 @@ func PossibleOperatorValues() []Operator { return []Operator{Contains, EndsWith, Equals, GreaterThan, GreaterThanOrEqualTo, LesserThan, LesserThanOrEqualTo, NotEquals, StartsWith} } +// PermissionProperty enumerates the values for permission property. +type PermissionProperty string + +const ( + // AWSAmazonSSMAutomationRole The permission provides for EC2 Automation service to execute activities + // defined within Automation documents. + AWSAmazonSSMAutomationRole PermissionProperty = "AWS::AmazonSSMAutomationRole" + // AWSAWSSecurityHubReadOnlyAccess This permission provides read only access to AWS Security Hub resources. + AWSAWSSecurityHubReadOnlyAccess PermissionProperty = "AWS::AWSSecurityHubReadOnlyAccess" + // AWSSecurityAudit This permission grants access to read security configuration metadata. + AWSSecurityAudit PermissionProperty = "AWS::SecurityAudit" + // GCPSecurityCenterAdminViewer This permission provides read only access to GCP Security Command Center. + GCPSecurityCenterAdminViewer PermissionProperty = "GCP::Security Center Admin Viewer" +) + +// PossiblePermissionPropertyValues returns an array of possible values for the PermissionProperty const type. +func PossiblePermissionPropertyValues() []PermissionProperty { + return []PermissionProperty{AWSAmazonSSMAutomationRole, AWSAWSSecurityHubReadOnlyAccess, AWSSecurityAudit, GCPSecurityCenterAdminViewer} +} + // PricingTier enumerates the values for pricing tier. type PricingTier string @@ -540,6 +643,27 @@ func PossibleProtocolValues() []Protocol { return []Protocol{All, TCP, UDP} } +// Rank enumerates the values for rank. +type Rank string + +const ( + // RankCritical ... + RankCritical Rank = "Critical" + // RankHigh ... + RankHigh Rank = "High" + // RankLow ... + RankLow Rank = "Low" + // RankMedium ... + RankMedium Rank = "Medium" + // RankNone ... + RankNone Rank = "None" +) + +// PossibleRankValues returns an array of possible values for the Rank const type. +func PossibleRankValues() []Rank { + return []Rank{RankCritical, RankHigh, RankLow, RankMedium, RankNone} +} + // RecommendationAction enumerates the values for recommendation action. type RecommendationAction string @@ -612,6 +736,23 @@ func PossibleReportedSeverityValues() []ReportedSeverity { return []ReportedSeverity{High, Information, Low, Silent} } +// RuleState enumerates the values for rule state. +type RuleState string + +const ( + // RuleStateDisabled ... + RuleStateDisabled RuleState = "Disabled" + // RuleStateEnabled ... + RuleStateEnabled RuleState = "Enabled" + // RuleStateExpired ... + RuleStateExpired RuleState = "Expired" +) + +// PossibleRuleStateValues returns an array of possible values for the RuleState const type. +func PossibleRuleStateValues() []RuleState { + return []RuleState{RuleStateDisabled, RuleStateEnabled, RuleStateExpired} +} + // Script enumerates the values for script. type Script string @@ -738,17 +879,17 @@ func PossibleStatusValues() []Status { type StatusReason string const ( - // Expired ... - Expired StatusReason = "Expired" - // NewerRequestInitiated ... - NewerRequestInitiated StatusReason = "NewerRequestInitiated" - // UserRequested ... - UserRequested StatusReason = "UserRequested" + // StatusReasonExpired ... + StatusReasonExpired StatusReason = "Expired" + // StatusReasonNewerRequestInitiated ... + StatusReasonNewerRequestInitiated StatusReason = "NewerRequestInitiated" + // StatusReasonUserRequested ... + StatusReasonUserRequested StatusReason = "UserRequested" ) // PossibleStatusReasonValues returns an array of possible values for the StatusReason const type. func PossibleStatusReasonValues() []StatusReason { - return []StatusReason{Expired, NewerRequestInitiated, UserRequested} + return []StatusReason{StatusReasonExpired, StatusReasonNewerRequestInitiated, StatusReasonUserRequested} } // SubAssessmentStatusCode enumerates the values for sub assessment status code. @@ -1666,6 +1807,242 @@ func (ap AlertProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// AlertsSuppressionRule describes the suppression rule +type AlertsSuppressionRule struct { + autorest.Response `json:"-"` + *AlertsSuppressionRuleProperties `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 AlertsSuppressionRule. +func (asr AlertsSuppressionRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asr.AlertsSuppressionRuleProperties != nil { + objectMap["properties"] = asr.AlertsSuppressionRuleProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AlertsSuppressionRule struct. +func (asr *AlertsSuppressionRule) 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 alertsSuppressionRuleProperties AlertsSuppressionRuleProperties + err = json.Unmarshal(*v, &alertsSuppressionRuleProperties) + if err != nil { + return err + } + asr.AlertsSuppressionRuleProperties = &alertsSuppressionRuleProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + asr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + asr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asr.Type = &typeVar + } + } + } + + return nil +} + +// AlertsSuppressionRuleProperties describes AlertsSuppressionRule properties +type AlertsSuppressionRuleProperties struct { + // AlertType - Type of the alert to automatically suppress. For all alert types, use '*' + AlertType *string `json:"alertType,omitempty"` + // LastModifiedUtc - READ-ONLY; The last time this rule was modified + LastModifiedUtc *date.Time `json:"lastModifiedUtc,omitempty"` + // ExpirationDateUtc - Expiration date of the rule, if value is not provided or provided as null this field will default to the maximum allowed expiration date. + ExpirationDateUtc *date.Time `json:"expirationDateUtc,omitempty"` + // Reason - The reason for dismissing the alert + Reason *string `json:"reason,omitempty"` + // State - Possible states of the rule. Possible values include: 'RuleStateEnabled', 'RuleStateDisabled', 'RuleStateExpired' + State RuleState `json:"state,omitempty"` + // Comment - Any comment regarding the rule + Comment *string `json:"comment,omitempty"` + // SuppressionAlertsScope - The suppression conditions + SuppressionAlertsScope *SuppressionAlertsScope `json:"suppressionAlertsScope,omitempty"` +} + +// AlertsSuppressionRulesList suppression rules list for subscription. +type AlertsSuppressionRulesList struct { + autorest.Response `json:"-"` + Value *[]AlertsSuppressionRule `json:"value,omitempty"` + // NextLink - READ-ONLY; URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// AlertsSuppressionRulesListIterator provides access to a complete listing of AlertsSuppressionRule +// values. +type AlertsSuppressionRulesListIterator struct { + i int + page AlertsSuppressionRulesListPage +} + +// 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 *AlertsSuppressionRulesListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsSuppressionRulesListIterator.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 *AlertsSuppressionRulesListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AlertsSuppressionRulesListIterator) 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 AlertsSuppressionRulesListIterator) Response() AlertsSuppressionRulesList { + 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 AlertsSuppressionRulesListIterator) Value() AlertsSuppressionRule { + if !iter.page.NotDone() { + return AlertsSuppressionRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AlertsSuppressionRulesListIterator type. +func NewAlertsSuppressionRulesListIterator(page AlertsSuppressionRulesListPage) AlertsSuppressionRulesListIterator { + return AlertsSuppressionRulesListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (asrl AlertsSuppressionRulesList) IsEmpty() bool { + return asrl.Value == nil || len(*asrl.Value) == 0 +} + +// alertsSuppressionRulesListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (asrl AlertsSuppressionRulesList) alertsSuppressionRulesListPreparer(ctx context.Context) (*http.Request, error) { + if asrl.NextLink == nil || len(to.String(asrl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(asrl.NextLink))) +} + +// AlertsSuppressionRulesListPage contains a page of AlertsSuppressionRule values. +type AlertsSuppressionRulesListPage struct { + fn func(context.Context, AlertsSuppressionRulesList) (AlertsSuppressionRulesList, error) + asrl AlertsSuppressionRulesList +} + +// 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 *AlertsSuppressionRulesListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsSuppressionRulesListPage.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.asrl) + if err != nil { + return err + } + page.asrl = 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 *AlertsSuppressionRulesListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AlertsSuppressionRulesListPage) NotDone() bool { + return !page.asrl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AlertsSuppressionRulesListPage) Response() AlertsSuppressionRulesList { + return page.asrl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AlertsSuppressionRulesListPage) Values() []AlertsSuppressionRule { + if page.asrl.IsEmpty() { + return nil + } + return *page.asrl.Value +} + +// Creates a new instance of the AlertsSuppressionRulesListPage type. +func NewAlertsSuppressionRulesListPage(getNextPage func(context.Context, AlertsSuppressionRulesList) (AlertsSuppressionRulesList, error)) AlertsSuppressionRulesListPage { + return AlertsSuppressionRulesListPage{fn: getNextPage} +} + // AllowedConnectionsList list of all possible traffic between Azure resources type AllowedConnectionsList struct { autorest.Response `json:"-"` @@ -2350,55 +2727,153 @@ func (asp *AtaSolutionProperties) UnmarshalJSON(body []byte) error { return nil } -// Automation the security automation resource. -type Automation struct { - autorest.Response `json:"-"` - // AutomationProperties - Security automation data - *AutomationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - READ-ONLY; Location where the resource is stored - Location *string `json:"location,omitempty"` - // Kind - Kind of the resource - Kind *string `json:"kind,omitempty"` - // Etag - Entity tag is used for comparing two or more entities from the same requested resource. - Etag *string `json:"etag,omitempty"` - // Tags - A list of key value pairs that describe the resource. - Tags map[string]*string `json:"tags"` +// BasicAuthenticationDetailsProperties settings for cloud authentication management +type BasicAuthenticationDetailsProperties interface { + AsAwsCredsAuthenticationDetailsProperties() (*AwsCredsAuthenticationDetailsProperties, bool) + AsAwAssumeRoleAuthenticationDetailsProperties() (*AwAssumeRoleAuthenticationDetailsProperties, bool) + AsGcpCredentialsDetailsProperties() (*GcpCredentialsDetailsProperties, bool) + AsAuthenticationDetailsProperties() (*AuthenticationDetailsProperties, bool) } -// MarshalJSON is the custom marshaler for Automation. -func (a Automation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.AutomationProperties != nil { - objectMap["properties"] = a.AutomationProperties - } - if a.Kind != nil { - objectMap["kind"] = a.Kind - } - if a.Etag != nil { - objectMap["etag"] = a.Etag - } - if a.Tags != nil { - objectMap["tags"] = a.Tags - } - return json.Marshal(objectMap) +// AuthenticationDetailsProperties settings for cloud authentication management +type AuthenticationDetailsProperties struct { + // AuthenticationProvisioningState - READ-ONLY; State of the multi-cloud connector. Possible values include: 'Valid', 'Invalid', 'Expired', 'IncorrectPolicy' + AuthenticationProvisioningState AuthenticationProvisioningState `json:"authenticationProvisioningState,omitempty"` + // GrantedPermissions - READ-ONLY; The permissions detected in the cloud account. + GrantedPermissions *[]PermissionProperty `json:"grantedPermissions,omitempty"` + // AuthenticationType - Possible values include: 'AuthenticationTypeAuthenticationDetailsProperties', 'AuthenticationTypeAwsCreds', 'AuthenticationTypeAwsAssumeRole', 'AuthenticationTypeGcpCredentials' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` } -// UnmarshalJSON is the custom unmarshaler for Automation struct. -func (a *Automation) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage +func unmarshalBasicAuthenticationDetailsProperties(body []byte) (BasicAuthenticationDetailsProperties, error) { + var m map[string]interface{} err := json.Unmarshal(body, &m) if err != nil { - return err + return nil, err } - for k, v := range m { - switch k { - case "properties": + + switch m["authenticationType"] { + case string(AuthenticationTypeAwsCreds): + var acadp AwsCredsAuthenticationDetailsProperties + err := json.Unmarshal(body, &acadp) + return acadp, err + case string(AuthenticationTypeAwsAssumeRole): + var aaradp AwAssumeRoleAuthenticationDetailsProperties + err := json.Unmarshal(body, &aaradp) + return aaradp, err + case string(AuthenticationTypeGcpCredentials): + var gcdp GcpCredentialsDetailsProperties + err := json.Unmarshal(body, &gcdp) + return gcdp, err + default: + var adp AuthenticationDetailsProperties + err := json.Unmarshal(body, &adp) + return adp, err + } +} +func unmarshalBasicAuthenticationDetailsPropertiesArray(body []byte) ([]BasicAuthenticationDetailsProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + adpArray := make([]BasicAuthenticationDetailsProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + adp, err := unmarshalBasicAuthenticationDetailsProperties(*rawMessage) + if err != nil { + return nil, err + } + adpArray[index] = adp + } + return adpArray, nil +} + +// MarshalJSON is the custom marshaler for AuthenticationDetailsProperties. +func (adp AuthenticationDetailsProperties) MarshalJSON() ([]byte, error) { + adp.AuthenticationType = AuthenticationTypeAuthenticationDetailsProperties + objectMap := make(map[string]interface{}) + if adp.AuthenticationType != "" { + objectMap["authenticationType"] = adp.AuthenticationType + } + return json.Marshal(objectMap) +} + +// AsAwsCredsAuthenticationDetailsProperties is the BasicAuthenticationDetailsProperties implementation for AuthenticationDetailsProperties. +func (adp AuthenticationDetailsProperties) AsAwsCredsAuthenticationDetailsProperties() (*AwsCredsAuthenticationDetailsProperties, bool) { + return nil, false +} + +// AsAwAssumeRoleAuthenticationDetailsProperties is the BasicAuthenticationDetailsProperties implementation for AuthenticationDetailsProperties. +func (adp AuthenticationDetailsProperties) AsAwAssumeRoleAuthenticationDetailsProperties() (*AwAssumeRoleAuthenticationDetailsProperties, bool) { + return nil, false +} + +// AsGcpCredentialsDetailsProperties is the BasicAuthenticationDetailsProperties implementation for AuthenticationDetailsProperties. +func (adp AuthenticationDetailsProperties) AsGcpCredentialsDetailsProperties() (*GcpCredentialsDetailsProperties, bool) { + return nil, false +} + +// AsAuthenticationDetailsProperties is the BasicAuthenticationDetailsProperties implementation for AuthenticationDetailsProperties. +func (adp AuthenticationDetailsProperties) AsAuthenticationDetailsProperties() (*AuthenticationDetailsProperties, bool) { + return &adp, true +} + +// AsBasicAuthenticationDetailsProperties is the BasicAuthenticationDetailsProperties implementation for AuthenticationDetailsProperties. +func (adp AuthenticationDetailsProperties) AsBasicAuthenticationDetailsProperties() (BasicAuthenticationDetailsProperties, bool) { + return &adp, true +} + +// Automation the security automation resource. +type Automation struct { + autorest.Response `json:"-"` + // AutomationProperties - Security automation data + *AutomationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Location where the resource is stored + Location *string `json:"location,omitempty"` + // Kind - Kind of the resource + Kind *string `json:"kind,omitempty"` + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. + Etag *string `json:"etag,omitempty"` + // Tags - A list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Automation. +func (a Automation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.AutomationProperties != nil { + objectMap["properties"] = a.AutomationProperties + } + if a.Kind != nil { + objectMap["kind"] = a.Kind + } + if a.Etag != nil { + objectMap["etag"] = a.Etag + } + if a.Tags != nil { + objectMap["tags"] = a.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Automation struct. +func (a *Automation) 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 automationProperties AutomationProperties err = json.Unmarshal(*v, &automationProperties) @@ -3221,6 +3696,127 @@ type AutoProvisioningSettingProperties struct { AutoProvision AutoProvision `json:"autoProvision,omitempty"` } +// AwAssumeRoleAuthenticationDetailsProperties AWS cloud account connector based assume role, the role +// enables delegating access to your AWS resources. The role is composed of role arn and external id, for +// more details, refer to Creating a Role to +// Delegate Permissions to an IAM User (write only) +type AwAssumeRoleAuthenticationDetailsProperties struct { + // AccountID - READ-ONLY; The ID of the cloud account + AccountID *string `json:"accountId,omitempty"` + // AwsAssumeRoleArn - Assumed role ID is an identifier that you can use to create temporary security credentials. + AwsAssumeRoleArn *string `json:"awsAssumeRoleArn,omitempty"` + // AwsExternalID - A unique identifier that is required when you assume a role in another account. + AwsExternalID *string `json:"awsExternalId,omitempty"` + // AuthenticationProvisioningState - READ-ONLY; State of the multi-cloud connector. Possible values include: 'Valid', 'Invalid', 'Expired', 'IncorrectPolicy' + AuthenticationProvisioningState AuthenticationProvisioningState `json:"authenticationProvisioningState,omitempty"` + // GrantedPermissions - READ-ONLY; The permissions detected in the cloud account. + GrantedPermissions *[]PermissionProperty `json:"grantedPermissions,omitempty"` + // AuthenticationType - Possible values include: 'AuthenticationTypeAuthenticationDetailsProperties', 'AuthenticationTypeAwsCreds', 'AuthenticationTypeAwsAssumeRole', 'AuthenticationTypeGcpCredentials' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AwAssumeRoleAuthenticationDetailsProperties. +func (aaradp AwAssumeRoleAuthenticationDetailsProperties) MarshalJSON() ([]byte, error) { + aaradp.AuthenticationType = AuthenticationTypeAwsAssumeRole + objectMap := make(map[string]interface{}) + if aaradp.AwsAssumeRoleArn != nil { + objectMap["awsAssumeRoleArn"] = aaradp.AwsAssumeRoleArn + } + if aaradp.AwsExternalID != nil { + objectMap["awsExternalId"] = aaradp.AwsExternalID + } + if aaradp.AuthenticationType != "" { + objectMap["authenticationType"] = aaradp.AuthenticationType + } + return json.Marshal(objectMap) +} + +// AsAwsCredsAuthenticationDetailsProperties is the BasicAuthenticationDetailsProperties implementation for AwAssumeRoleAuthenticationDetailsProperties. +func (aaradp AwAssumeRoleAuthenticationDetailsProperties) AsAwsCredsAuthenticationDetailsProperties() (*AwsCredsAuthenticationDetailsProperties, bool) { + return nil, false +} + +// AsAwAssumeRoleAuthenticationDetailsProperties is the BasicAuthenticationDetailsProperties implementation for AwAssumeRoleAuthenticationDetailsProperties. +func (aaradp AwAssumeRoleAuthenticationDetailsProperties) AsAwAssumeRoleAuthenticationDetailsProperties() (*AwAssumeRoleAuthenticationDetailsProperties, bool) { + return &aaradp, true +} + +// AsGcpCredentialsDetailsProperties is the BasicAuthenticationDetailsProperties implementation for AwAssumeRoleAuthenticationDetailsProperties. +func (aaradp AwAssumeRoleAuthenticationDetailsProperties) AsGcpCredentialsDetailsProperties() (*GcpCredentialsDetailsProperties, bool) { + return nil, false +} + +// AsAuthenticationDetailsProperties is the BasicAuthenticationDetailsProperties implementation for AwAssumeRoleAuthenticationDetailsProperties. +func (aaradp AwAssumeRoleAuthenticationDetailsProperties) AsAuthenticationDetailsProperties() (*AuthenticationDetailsProperties, bool) { + return nil, false +} + +// AsBasicAuthenticationDetailsProperties is the BasicAuthenticationDetailsProperties implementation for AwAssumeRoleAuthenticationDetailsProperties. +func (aaradp AwAssumeRoleAuthenticationDetailsProperties) AsBasicAuthenticationDetailsProperties() (BasicAuthenticationDetailsProperties, bool) { + return &aaradp, true +} + +// AwsCredsAuthenticationDetailsProperties AWS cloud account connector based credentials, the credentials +// is composed of access key id and secret key, for more details, refer to Creating an IAM User in +// Your AWS Account (write only) +type AwsCredsAuthenticationDetailsProperties struct { + // AccountID - READ-ONLY; The ID of the cloud account + AccountID *string `json:"accountId,omitempty"` + // AwsAccessKeyID - Public key element of the AWS credential object (write only) + AwsAccessKeyID *string `json:"awsAccessKeyId,omitempty"` + // AwsSecretAccessKey - Secret key element of the AWS credential object (write only) + AwsSecretAccessKey *string `json:"awsSecretAccessKey,omitempty"` + // AuthenticationProvisioningState - READ-ONLY; State of the multi-cloud connector. Possible values include: 'Valid', 'Invalid', 'Expired', 'IncorrectPolicy' + AuthenticationProvisioningState AuthenticationProvisioningState `json:"authenticationProvisioningState,omitempty"` + // GrantedPermissions - READ-ONLY; The permissions detected in the cloud account. + GrantedPermissions *[]PermissionProperty `json:"grantedPermissions,omitempty"` + // AuthenticationType - Possible values include: 'AuthenticationTypeAuthenticationDetailsProperties', 'AuthenticationTypeAwsCreds', 'AuthenticationTypeAwsAssumeRole', 'AuthenticationTypeGcpCredentials' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AwsCredsAuthenticationDetailsProperties. +func (acadp AwsCredsAuthenticationDetailsProperties) MarshalJSON() ([]byte, error) { + acadp.AuthenticationType = AuthenticationTypeAwsCreds + objectMap := make(map[string]interface{}) + if acadp.AwsAccessKeyID != nil { + objectMap["awsAccessKeyId"] = acadp.AwsAccessKeyID + } + if acadp.AwsSecretAccessKey != nil { + objectMap["awsSecretAccessKey"] = acadp.AwsSecretAccessKey + } + if acadp.AuthenticationType != "" { + objectMap["authenticationType"] = acadp.AuthenticationType + } + return json.Marshal(objectMap) +} + +// AsAwsCredsAuthenticationDetailsProperties is the BasicAuthenticationDetailsProperties implementation for AwsCredsAuthenticationDetailsProperties. +func (acadp AwsCredsAuthenticationDetailsProperties) AsAwsCredsAuthenticationDetailsProperties() (*AwsCredsAuthenticationDetailsProperties, bool) { + return &acadp, true +} + +// AsAwAssumeRoleAuthenticationDetailsProperties is the BasicAuthenticationDetailsProperties implementation for AwsCredsAuthenticationDetailsProperties. +func (acadp AwsCredsAuthenticationDetailsProperties) AsAwAssumeRoleAuthenticationDetailsProperties() (*AwAssumeRoleAuthenticationDetailsProperties, bool) { + return nil, false +} + +// AsGcpCredentialsDetailsProperties is the BasicAuthenticationDetailsProperties implementation for AwsCredsAuthenticationDetailsProperties. +func (acadp AwsCredsAuthenticationDetailsProperties) AsGcpCredentialsDetailsProperties() (*GcpCredentialsDetailsProperties, bool) { + return nil, false +} + +// AsAuthenticationDetailsProperties is the BasicAuthenticationDetailsProperties implementation for AwsCredsAuthenticationDetailsProperties. +func (acadp AwsCredsAuthenticationDetailsProperties) AsAuthenticationDetailsProperties() (*AuthenticationDetailsProperties, bool) { + return nil, false +} + +// AsBasicAuthenticationDetailsProperties is the BasicAuthenticationDetailsProperties implementation for AwsCredsAuthenticationDetailsProperties. +func (acadp AwsCredsAuthenticationDetailsProperties) AsBasicAuthenticationDetailsProperties() (BasicAuthenticationDetailsProperties, bool) { + return &acadp, true +} + // AzureResourceDetails details of the Azure resource that was assessed type AzureResourceDetails struct { // ID - READ-ONLY; Azure resource Id of the assessed resource @@ -3259,6 +3855,12 @@ func (ard AzureResourceDetails) AsBasicResourceDetails() (BasicResourceDetails, return &ard, true } +// AzureResourceLink describes an Azure resource with kind +type AzureResourceLink struct { + // ID - READ-ONLY; Azure resource Id + ID *string `json:"id,omitempty"` +} + // CefExternalSecuritySolution represents a security solution which sends CEF logs to an OMS workspace type CefExternalSecuritySolution struct { Properties *CefSolutionProperties `json:"properties,omitempty"` @@ -3744,11 +4346,11 @@ type ConnectedWorkspace struct { ID *string `json:"id,omitempty"` } -// Contact contact details for security issues -type Contact struct { +// ConnectorSetting the connector setting +type ConnectorSetting struct { autorest.Response `json:"-"` - // ContactProperties - Security contact data - *ContactProperties `json:"properties,omitempty"` + // ConnectorSettingProperties - Connector setting data + *ConnectorSettingProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name @@ -3757,17 +4359,17 @@ type Contact struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for Contact. -func (c Contact) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for ConnectorSetting. +func (cs ConnectorSetting) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if c.ContactProperties != nil { - objectMap["properties"] = c.ContactProperties + if cs.ConnectorSettingProperties != nil { + objectMap["properties"] = cs.ConnectorSettingProperties } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for Contact struct. -func (c *Contact) UnmarshalJSON(body []byte) error { +// UnmarshalJSON is the custom unmarshaler for ConnectorSetting struct. +func (cs *ConnectorSetting) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -3777,12 +4379,12 @@ func (c *Contact) UnmarshalJSON(body []byte) error { switch k { case "properties": if v != nil { - var contactProperties ContactProperties - err = json.Unmarshal(*v, &contactProperties) + var connectorSettingProperties ConnectorSettingProperties + err = json.Unmarshal(*v, &connectorSettingProperties) if err != nil { return err } - c.ContactProperties = &contactProperties + cs.ConnectorSettingProperties = &connectorSettingProperties } case "id": if v != nil { @@ -3791,7 +4393,7 @@ func (c *Contact) UnmarshalJSON(body []byte) error { if err != nil { return err } - c.ID = &ID + cs.ID = &ID } case "name": if v != nil { @@ -3800,7 +4402,7 @@ func (c *Contact) UnmarshalJSON(body []byte) error { if err != nil { return err } - c.Name = &name + cs.Name = &name } case "type": if v != nil { @@ -3809,7 +4411,7 @@ func (c *Contact) UnmarshalJSON(body []byte) error { if err != nil { return err } - c.Type = &typeVar + cs.Type = &typeVar } } } @@ -3817,26 +4419,26 @@ func (c *Contact) UnmarshalJSON(body []byte) error { return nil } -// ContactList list of security contacts response -type ContactList struct { +// ConnectorSettingList for a subscription, list of all cloud account connectors and their settings +type ConnectorSettingList struct { autorest.Response `json:"-"` - // Value - READ-ONLY; List of security contacts - Value *[]Contact `json:"value,omitempty"` + // Value - List of all the cloud account connector settings + Value *[]ConnectorSetting `json:"value,omitempty"` // NextLink - READ-ONLY; The URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` } -// ContactListIterator provides access to a complete listing of Contact values. -type ContactListIterator struct { +// ConnectorSettingListIterator provides access to a complete listing of ConnectorSetting values. +type ConnectorSettingListIterator struct { i int - page ContactListPage + page ConnectorSettingListPage } // 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 *ContactListIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *ConnectorSettingListIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContactListIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectorSettingListIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -3861,62 +4463,62 @@ func (iter *ContactListIterator) NextWithContext(ctx context.Context) (err error // 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 *ContactListIterator) Next() error { +func (iter *ConnectorSettingListIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ContactListIterator) NotDone() bool { +func (iter ConnectorSettingListIterator) 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 ContactListIterator) Response() ContactList { +func (iter ConnectorSettingListIterator) Response() ConnectorSettingList { 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 ContactListIterator) Value() Contact { +func (iter ConnectorSettingListIterator) Value() ConnectorSetting { if !iter.page.NotDone() { - return Contact{} + return ConnectorSetting{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the ContactListIterator type. -func NewContactListIterator(page ContactListPage) ContactListIterator { - return ContactListIterator{page: page} +// Creates a new instance of the ConnectorSettingListIterator type. +func NewConnectorSettingListIterator(page ConnectorSettingListPage) ConnectorSettingListIterator { + return ConnectorSettingListIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (cl ContactList) IsEmpty() bool { - return cl.Value == nil || len(*cl.Value) == 0 +func (csl ConnectorSettingList) IsEmpty() bool { + return csl.Value == nil || len(*csl.Value) == 0 } -// contactListPreparer prepares a request to retrieve the next set of results. +// connectorSettingListPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (cl ContactList) contactListPreparer(ctx context.Context) (*http.Request, error) { - if cl.NextLink == nil || len(to.String(cl.NextLink)) < 1 { +func (csl ConnectorSettingList) connectorSettingListPreparer(ctx context.Context) (*http.Request, error) { + if csl.NextLink == nil || len(to.String(csl.NextLink)) < 1 { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(cl.NextLink))) + autorest.WithBaseURL(to.String(csl.NextLink))) } -// ContactListPage contains a page of Contact values. -type ContactListPage struct { - fn func(context.Context, ContactList) (ContactList, error) - cl ContactList +// ConnectorSettingListPage contains a page of ConnectorSetting values. +type ConnectorSettingListPage struct { + fn func(context.Context, ConnectorSettingList) (ConnectorSettingList, error) + csl ConnectorSettingList } // 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 *ContactListPage) NextWithContext(ctx context.Context) (err error) { +func (page *ConnectorSettingListPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ContactListPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectorSettingListPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -3925,85 +4527,344 @@ func (page *ContactListPage) NextWithContext(ctx context.Context) (err error) { tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.cl) + next, err := page.fn(ctx, page.csl) if err != nil { return err } - page.cl = next + page.csl = 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 *ContactListPage) Next() error { +func (page *ConnectorSettingListPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ContactListPage) NotDone() bool { - return !page.cl.IsEmpty() +func (page ConnectorSettingListPage) NotDone() bool { + return !page.csl.IsEmpty() } // Response returns the raw server response from the last page request. -func (page ContactListPage) Response() ContactList { - return page.cl +func (page ConnectorSettingListPage) Response() ConnectorSettingList { + return page.csl } // Values returns the slice of values for the current page or nil if there are no values. -func (page ContactListPage) Values() []Contact { - if page.cl.IsEmpty() { +func (page ConnectorSettingListPage) Values() []ConnectorSetting { + if page.csl.IsEmpty() { return nil } - return *page.cl.Value + return *page.csl.Value } -// Creates a new instance of the ContactListPage type. -func NewContactListPage(getNextPage func(context.Context, ContactList) (ContactList, error)) ContactListPage { - return ContactListPage{fn: getNextPage} +// Creates a new instance of the ConnectorSettingListPage type. +func NewConnectorSettingListPage(getNextPage func(context.Context, ConnectorSettingList) (ConnectorSettingList, error)) ConnectorSettingListPage { + return ConnectorSettingListPage{fn: getNextPage} } -// ContactProperties describes security contact properties -type ContactProperties struct { - // Email - The email of this security contact - Email *string `json:"email,omitempty"` - // Phone - The phone number of this security contact - Phone *string `json:"phone,omitempty"` - // AlertNotifications - Whether to send security alerts notifications to the security contact. Possible values include: 'On', 'Off' - AlertNotifications AlertNotifications `json:"alertNotifications,omitempty"` - // AlertsToAdmins - Whether to send security alerts notifications to subscription admins. Possible values include: 'AlertsToAdminsOn', 'AlertsToAdminsOff' - AlertsToAdmins AlertsToAdmins `json:"alertsToAdmins,omitempty"` +// ConnectorSettingProperties describes properties of an connector setting +type ConnectorSettingProperties struct { + // HybridComputeSettings - Settings for hybrid compute management, these settings are relevant only Arc autoProvision (Hybrid Compute). + HybridComputeSettings *HybridComputeSettingsProperties `json:"hybridComputeSettings,omitempty"` + // AuthenticationDetails - Settings for authentication management, these settings are relevant only for the cloud connector. + AuthenticationDetails BasicAuthenticationDetailsProperties `json:"authenticationDetails,omitempty"` } -// ContainerRegistryVulnerabilityProperties additional context fields for container registry Vulnerability -// assessment -type ContainerRegistryVulnerabilityProperties struct { - // Type - READ-ONLY; Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, Information Gathered, Vulnerability +// UnmarshalJSON is the custom unmarshaler for ConnectorSettingProperties struct. +func (csp *ConnectorSettingProperties) 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 "hybridComputeSettings": + if v != nil { + var hybridComputeSettings HybridComputeSettingsProperties + err = json.Unmarshal(*v, &hybridComputeSettings) + if err != nil { + return err + } + csp.HybridComputeSettings = &hybridComputeSettings + } + case "authenticationDetails": + if v != nil { + authenticationDetails, err := unmarshalBasicAuthenticationDetailsProperties(*v) + if err != nil { + return err + } + csp.AuthenticationDetails = authenticationDetails + } + } + } + + return nil +} + +// Contact contact details for security issues +type Contact struct { + autorest.Response `json:"-"` + // ContactProperties - Security contact data + *ContactProperties `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"` - // Cvss - READ-ONLY; Dictionary from cvss version to cvss details object - Cvss map[string]*CVSS `json:"cvss"` - // Patchable - READ-ONLY; Indicates whether a patch is available or not - Patchable *bool `json:"patchable,omitempty"` - // Cve - READ-ONLY; List of CVEs - Cve *[]CVE `json:"cve,omitempty"` - // PublishedTime - READ-ONLY; Published time - PublishedTime *date.Time `json:"publishedTime,omitempty"` - // VendorReferences - READ-ONLY - VendorReferences *[]VendorReference `json:"vendorReferences,omitempty"` - // RepositoryName - READ-ONLY; Name of the repository which the vulnerable image belongs to - RepositoryName *string `json:"repositoryName,omitempty"` - // ImageDigest - READ-ONLY; Digest of the vulnerable image - ImageDigest *string `json:"imageDigest,omitempty"` - // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' - AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` } -// MarshalJSON is the custom marshaler for ContainerRegistryVulnerabilityProperties. -func (crvp ContainerRegistryVulnerabilityProperties) MarshalJSON() ([]byte, error) { - crvp.AssessedResourceType = AssessedResourceTypeContainerRegistryVulnerability +// MarshalJSON is the custom marshaler for Contact. +func (c Contact) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if crvp.AssessedResourceType != "" { - objectMap["assessedResourceType"] = crvp.AssessedResourceType + if c.ContactProperties != nil { + objectMap["properties"] = c.ContactProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Contact struct. +func (c *Contact) 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 contactProperties ContactProperties + err = json.Unmarshal(*v, &contactProperties) + if err != nil { + return err + } + c.ContactProperties = &contactProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + c.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + c.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + c.Type = &typeVar + } + } + } + + return nil +} + +// ContactList list of security contacts response +type ContactList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of security contacts + Value *[]Contact `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// ContactListIterator provides access to a complete listing of Contact values. +type ContactListIterator struct { + i int + page ContactListPage +} + +// 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 *ContactListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContactListIterator.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 *ContactListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ContactListIterator) 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 ContactListIterator) Response() ContactList { + 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 ContactListIterator) Value() Contact { + if !iter.page.NotDone() { + return Contact{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ContactListIterator type. +func NewContactListIterator(page ContactListPage) ContactListIterator { + return ContactListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cl ContactList) IsEmpty() bool { + return cl.Value == nil || len(*cl.Value) == 0 +} + +// contactListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cl ContactList) contactListPreparer(ctx context.Context) (*http.Request, error) { + if cl.NextLink == nil || len(to.String(cl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cl.NextLink))) +} + +// ContactListPage contains a page of Contact values. +type ContactListPage struct { + fn func(context.Context, ContactList) (ContactList, error) + cl ContactList +} + +// 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 *ContactListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContactListPage.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.cl) + if err != nil { + return err + } + page.cl = 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 *ContactListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ContactListPage) NotDone() bool { + return !page.cl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ContactListPage) Response() ContactList { + return page.cl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ContactListPage) Values() []Contact { + if page.cl.IsEmpty() { + return nil + } + return *page.cl.Value +} + +// Creates a new instance of the ContactListPage type. +func NewContactListPage(getNextPage func(context.Context, ContactList) (ContactList, error)) ContactListPage { + return ContactListPage{fn: getNextPage} +} + +// ContactProperties describes security contact properties +type ContactProperties struct { + // Email - The email of this security contact + Email *string `json:"email,omitempty"` + // Phone - The phone number of this security contact + Phone *string `json:"phone,omitempty"` + // AlertNotifications - Whether to send security alerts notifications to the security contact. Possible values include: 'On', 'Off' + AlertNotifications AlertNotifications `json:"alertNotifications,omitempty"` + // AlertsToAdmins - Whether to send security alerts notifications to subscription admins. Possible values include: 'AlertsToAdminsOn', 'AlertsToAdminsOff' + AlertsToAdmins AlertsToAdmins `json:"alertsToAdmins,omitempty"` +} + +// ContainerRegistryVulnerabilityProperties additional context fields for container registry Vulnerability +// assessment +type ContainerRegistryVulnerabilityProperties struct { + // Type - READ-ONLY; Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, Information Gathered, Vulnerability + Type *string `json:"type,omitempty"` + // Cvss - READ-ONLY; Dictionary from cvss version to cvss details object + Cvss map[string]*CVSS `json:"cvss"` + // Patchable - READ-ONLY; Indicates whether a patch is available or not + Patchable *bool `json:"patchable,omitempty"` + // Cve - READ-ONLY; List of CVEs + Cve *[]CVE `json:"cve,omitempty"` + // PublishedTime - READ-ONLY; Published time + PublishedTime *date.Time `json:"publishedTime,omitempty"` + // VendorReferences - READ-ONLY + VendorReferences *[]VendorReference `json:"vendorReferences,omitempty"` + // RepositoryName - READ-ONLY; Name of the repository which the vulnerable image belongs to + RepositoryName *string `json:"repositoryName,omitempty"` + // ImageDigest - READ-ONLY; Digest of the vulnerable image + ImageDigest *string `json:"imageDigest,omitempty"` + // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' + AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerRegistryVulnerabilityProperties. +func (crvp ContainerRegistryVulnerabilityProperties) MarshalJSON() ([]byte, error) { + crvp.AssessedResourceType = AssessedResourceTypeContainerRegistryVulnerability + objectMap := make(map[string]interface{}) + if crvp.AssessedResourceType != "" { + objectMap["assessedResourceType"] = crvp.AssessedResourceType } return json.Marshal(objectMap) } @@ -5041,20 +5902,137 @@ func (essp *ExternalSecuritySolutionProperties) UnmarshalJSON(body []byte) error return nil } -// InformationProtectionKeyword the information type keyword. -type InformationProtectionKeyword struct { - // Pattern - The keyword pattern. - Pattern *string `json:"pattern,omitempty"` - // Custom - Indicates whether the keyword is custom or not. - Custom *bool `json:"custom,omitempty"` - // CanBeNumeric - Indicates whether the keyword can be applied on numeric types or not. - CanBeNumeric *bool `json:"canBeNumeric,omitempty"` - // Excluded - Indicates whether the keyword is excluded or not. - Excluded *bool `json:"excluded,omitempty"` -} - -// InformationProtectionPolicy information protection policy. -type InformationProtectionPolicy struct { +// GcpCredentialsDetailsProperties GCP cloud account connector based service to service credentials, the +// credentials is composed of organization id and json api key (write only) +type GcpCredentialsDetailsProperties struct { + // OrganizationID - The Organization ID of the GCP cloud account + OrganizationID *string `json:"organizationId,omitempty"` + // Type - Type field of the API key (write only) + Type *string `json:"type,omitempty"` + // ProjectID - Project Id field of the API key (write only) + ProjectID *string `json:"projectId,omitempty"` + // PrivateKeyID - Private key Id field of the API key (write only) + PrivateKeyID *string `json:"privateKeyId,omitempty"` + // PrivateKey - Private key field of the API key (write only) + PrivateKey *string `json:"privateKey,omitempty"` + // ClientEmail - Client email field of the API key (write only) + ClientEmail *string `json:"clientEmail,omitempty"` + // ClientID - Client Id field of the API key (write only) + ClientID *string `json:"clientId,omitempty"` + // AuthURI - Auth Uri field of the API key (write only) + AuthURI *string `json:"authUri,omitempty"` + // TokenURI - Token Uri field of the API key (write only) + TokenURI *string `json:"tokenUri,omitempty"` + // AuthProviderX509CertURL - Auth provider x509 certificate url field of the API key (write only) + AuthProviderX509CertURL *string `json:"authProviderX509CertUrl,omitempty"` + // ClientX509CertURL - Client x509 certificate url field of the API key (write only) + ClientX509CertURL *string `json:"clientX509CertUrl,omitempty"` + // AuthenticationProvisioningState - READ-ONLY; State of the multi-cloud connector. Possible values include: 'Valid', 'Invalid', 'Expired', 'IncorrectPolicy' + AuthenticationProvisioningState AuthenticationProvisioningState `json:"authenticationProvisioningState,omitempty"` + // GrantedPermissions - READ-ONLY; The permissions detected in the cloud account. + GrantedPermissions *[]PermissionProperty `json:"grantedPermissions,omitempty"` + // AuthenticationType - Possible values include: 'AuthenticationTypeAuthenticationDetailsProperties', 'AuthenticationTypeAwsCreds', 'AuthenticationTypeAwsAssumeRole', 'AuthenticationTypeGcpCredentials' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` +} + +// MarshalJSON is the custom marshaler for GcpCredentialsDetailsProperties. +func (gcdp GcpCredentialsDetailsProperties) MarshalJSON() ([]byte, error) { + gcdp.AuthenticationType = AuthenticationTypeGcpCredentials + objectMap := make(map[string]interface{}) + if gcdp.OrganizationID != nil { + objectMap["organizationId"] = gcdp.OrganizationID + } + if gcdp.Type != nil { + objectMap["type"] = gcdp.Type + } + if gcdp.ProjectID != nil { + objectMap["projectId"] = gcdp.ProjectID + } + if gcdp.PrivateKeyID != nil { + objectMap["privateKeyId"] = gcdp.PrivateKeyID + } + if gcdp.PrivateKey != nil { + objectMap["privateKey"] = gcdp.PrivateKey + } + if gcdp.ClientEmail != nil { + objectMap["clientEmail"] = gcdp.ClientEmail + } + if gcdp.ClientID != nil { + objectMap["clientId"] = gcdp.ClientID + } + if gcdp.AuthURI != nil { + objectMap["authUri"] = gcdp.AuthURI + } + if gcdp.TokenURI != nil { + objectMap["tokenUri"] = gcdp.TokenURI + } + if gcdp.AuthProviderX509CertURL != nil { + objectMap["authProviderX509CertUrl"] = gcdp.AuthProviderX509CertURL + } + if gcdp.ClientX509CertURL != nil { + objectMap["clientX509CertUrl"] = gcdp.ClientX509CertURL + } + if gcdp.AuthenticationType != "" { + objectMap["authenticationType"] = gcdp.AuthenticationType + } + return json.Marshal(objectMap) +} + +// AsAwsCredsAuthenticationDetailsProperties is the BasicAuthenticationDetailsProperties implementation for GcpCredentialsDetailsProperties. +func (gcdp GcpCredentialsDetailsProperties) AsAwsCredsAuthenticationDetailsProperties() (*AwsCredsAuthenticationDetailsProperties, bool) { + return nil, false +} + +// AsAwAssumeRoleAuthenticationDetailsProperties is the BasicAuthenticationDetailsProperties implementation for GcpCredentialsDetailsProperties. +func (gcdp GcpCredentialsDetailsProperties) AsAwAssumeRoleAuthenticationDetailsProperties() (*AwAssumeRoleAuthenticationDetailsProperties, bool) { + return nil, false +} + +// AsGcpCredentialsDetailsProperties is the BasicAuthenticationDetailsProperties implementation for GcpCredentialsDetailsProperties. +func (gcdp GcpCredentialsDetailsProperties) AsGcpCredentialsDetailsProperties() (*GcpCredentialsDetailsProperties, bool) { + return &gcdp, true +} + +// AsAuthenticationDetailsProperties is the BasicAuthenticationDetailsProperties implementation for GcpCredentialsDetailsProperties. +func (gcdp GcpCredentialsDetailsProperties) AsAuthenticationDetailsProperties() (*AuthenticationDetailsProperties, bool) { + return nil, false +} + +// AsBasicAuthenticationDetailsProperties is the BasicAuthenticationDetailsProperties implementation for GcpCredentialsDetailsProperties. +func (gcdp GcpCredentialsDetailsProperties) AsBasicAuthenticationDetailsProperties() (BasicAuthenticationDetailsProperties, bool) { + return &gcdp, true +} + +// HybridComputeSettingsProperties settings for hybrid compute management +type HybridComputeSettingsProperties struct { + // HybridComputeProvisioningState - READ-ONLY; State of the service principal and its secret. Possible values include: 'HybridComputeProvisioningStateValid', 'HybridComputeProvisioningStateInvalid', 'HybridComputeProvisioningStateExpired' + HybridComputeProvisioningState HybridComputeProvisioningState `json:"hybridComputeProvisioningState,omitempty"` + // AutoProvision - Whether or not to automatically install Azure Arc (hybrid compute) agents on machines. Possible values include: 'AutoProvisionOn', 'AutoProvisionOff' + AutoProvision AutoProvision `json:"autoProvision,omitempty"` + // ResourceGroupName - The name of the resource group where Arc (Hybrid Compute) connectors are connected. + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + // Region - The location where the meta data of machines will be stored + Region *string `json:"region,omitempty"` + // ProxyServer - For a non-Azure machine that is not connected directly to the internet, specify a proxy server that the non-Azure machine can use. + ProxyServer *ProxyServerProperties `json:"proxyServer,omitempty"` + // ServicePrincipal - An object to access resources that are secured by an Azure AD tenant. + ServicePrincipal *ServicePrincipalProperties `json:"servicePrincipal,omitempty"` +} + +// InformationProtectionKeyword the information type keyword. +type InformationProtectionKeyword struct { + // Pattern - The keyword pattern. + Pattern *string `json:"pattern,omitempty"` + // Custom - Indicates whether the keyword is custom or not. + Custom *bool `json:"custom,omitempty"` + // CanBeNumeric - Indicates whether the keyword can be applied on numeric types or not. + CanBeNumeric *bool `json:"canBeNumeric,omitempty"` + // Excluded - Indicates whether the keyword is excluded or not. + Excluded *bool `json:"excluded,omitempty"` +} + +// InformationProtectionPolicy information protection policy. +type InformationProtectionPolicy struct { autorest.Response `json:"-"` // InformationProtectionPolicyProperties - Information protection policy data *InformationProtectionPolicyProperties `json:"properties,omitempty"` @@ -5277,6 +6255,8 @@ func NewInformationProtectionPolicyListPage(getNextPage func(context.Context, In type InformationProtectionPolicyProperties struct { // LastModifiedUtc - READ-ONLY; Describes the last UTC time the policy was modified. LastModifiedUtc *date.Time `json:"lastModifiedUtc,omitempty"` + // Version - READ-ONLY; Describes the version of the policy. + Version *string `json:"version,omitempty"` // Labels - Dictionary of sensitivity labels. Labels map[string]*SensitivityLabel `json:"labels"` // InformationTypes - The sensitivity information types. @@ -5299,8 +6279,10 @@ func (ippp InformationProtectionPolicyProperties) MarshalJSON() ([]byte, error) type InformationType struct { // DisplayName - The name of the information type. DisplayName *string `json:"displayName,omitempty"` + // Description - The description of the information type. + Description *string `json:"description,omitempty"` // Order - The order of the information type. - Order *float64 `json:"order,omitempty"` + Order *int32 `json:"order,omitempty"` // RecommendedLabelID - The recommended label id to be associated with this information type. RecommendedLabelID *uuid.UUID `json:"recommendedLabelId,omitempty"` // Enabled - Indicates whether the information type is enabled or not. @@ -5634,7 +6616,7 @@ type JitNetworkAccessRequestPort struct { EndTimeUtc *date.Time `json:"endTimeUtc,omitempty"` // Status - The status of the port. Possible values include: 'Revoked', 'Initiated' Status Status `json:"status,omitempty"` - // StatusReason - A description of why the `status` has its value. Possible values include: 'Expired', 'UserRequested', 'NewerRequestInitiated' + // StatusReason - A description of why the `status` has its value. Possible values include: 'StatusReasonExpired', 'StatusReasonUserRequested', 'StatusReasonNewerRequestInitiated' StatusReason StatusReason `json:"statusReason,omitempty"` // MappedPort - The port which is mapped to this port's `number` in the Azure Firewall, if applicable MappedPort *int32 `json:"mappedPort,omitempty"` @@ -6154,6 +7136,15 @@ type ProtectionMode struct { Executable Executable `json:"executable,omitempty"` } +// ProxyServerProperties for a non-Azure machine that is not connected directly to the internet, specify a +// proxy server that the non-Azure machine can use. +type ProxyServerProperties struct { + // IP - Proxy server IP + IP *string `json:"ip,omitempty"` + // Port - Proxy server port + Port *string `json:"port,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 @@ -6981,76 +7972,73 @@ type Rule struct { IPAddresses *[]string `json:"ipAddresses,omitempty"` } -// SensitivityLabel the sensitivity label. -type SensitivityLabel struct { - // DisplayName - The name of the sensitivity label. - DisplayName *string `json:"displayName,omitempty"` - // Order - The order of the sensitivity label. - Order *float64 `json:"order,omitempty"` - // Enabled - Indicates whether the label is enabled or not. - Enabled *bool `json:"enabled,omitempty"` -} - -// ServerVulnerabilityProperties additional context fields for server vulnerability assessment -type ServerVulnerabilityProperties struct { - // Type - READ-ONLY; Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, Information Gathered - Type *string `json:"type,omitempty"` - // Cvss - READ-ONLY; Dictionary from cvss version to cvss details object - Cvss map[string]*CVSS `json:"cvss"` - // Patchable - READ-ONLY; Indicates whether a patch is available or not - Patchable *bool `json:"patchable,omitempty"` - // Cve - READ-ONLY; List of CVEs - Cve *[]CVE `json:"cve,omitempty"` - // Threat - READ-ONLY; Threat name - Threat *string `json:"threat,omitempty"` - // PublishedTime - READ-ONLY; Published time - PublishedTime *date.Time `json:"publishedTime,omitempty"` - // VendorReferences - READ-ONLY - VendorReferences *[]VendorReference `json:"vendorReferences,omitempty"` - // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' - AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` +// ScopeElement a more specific scope used to identify the alerts to suppress. +type ScopeElement struct { + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // Field - The alert entity type to suppress by. + Field *string `json:"field,omitempty"` } -// MarshalJSON is the custom marshaler for ServerVulnerabilityProperties. -func (svp ServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { - svp.AssessedResourceType = AssessedResourceTypeServerVulnerabilityAssessment +// MarshalJSON is the custom marshaler for ScopeElement. +func (se ScopeElement) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if svp.AssessedResourceType != "" { - objectMap["assessedResourceType"] = svp.AssessedResourceType + if se.Field != nil { + objectMap["field"] = se.Field + } + for k, v := range se.AdditionalProperties { + objectMap[k] = v } return json.Marshal(objectMap) } -// AsSQLServerVulnerabilityProperties is the BasicAdditionalData implementation for ServerVulnerabilityProperties. -func (svp ServerVulnerabilityProperties) AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) { - return nil, false -} - -// AsContainerRegistryVulnerabilityProperties is the BasicAdditionalData implementation for ServerVulnerabilityProperties. -func (svp ServerVulnerabilityProperties) AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) { - return nil, false -} - -// AsServerVulnerabilityProperties is the BasicAdditionalData implementation for ServerVulnerabilityProperties. -func (svp ServerVulnerabilityProperties) AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) { - return &svp, true -} +// UnmarshalJSON is the custom unmarshaler for ScopeElement struct. +func (se *ScopeElement) 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 { + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if se.AdditionalProperties == nil { + se.AdditionalProperties = make(map[string]interface{}) + } + se.AdditionalProperties[k] = additionalProperties + } + case "field": + if v != nil { + var field string + err = json.Unmarshal(*v, &field) + if err != nil { + return err + } + se.Field = &field + } + } + } -// AsAdditionalData is the BasicAdditionalData implementation for ServerVulnerabilityProperties. -func (svp ServerVulnerabilityProperties) AsAdditionalData() (*AdditionalData, bool) { - return nil, false + return nil } -// AsBasicAdditionalData is the BasicAdditionalData implementation for ServerVulnerabilityProperties. -func (svp ServerVulnerabilityProperties) AsBasicAdditionalData() (BasicAdditionalData, bool) { - return &svp, true +// ScoreDetails calculation result data +type ScoreDetails struct { + // Max - READ-ONLY; Maximum score available + Max *int32 `json:"max,omitempty"` + // Current - READ-ONLY; Current score + Current *float64 `json:"current,omitempty"` } -// Setting represents a security setting in Azure Security Center. -type Setting struct { - autorest.Response `json:"-"` - // Kind - the kind of the settings string (DataExportSetting). Possible values include: 'SettingKindDataExportSetting', 'SettingKindAlertSuppressionSetting' - Kind SettingKind `json:"kind,omitempty"` +// SecureScoreControlDefinitionItem information about the security control. +type SecureScoreControlDefinitionItem struct { + *SecureScoreControlDefinitionItemProperties `json:"properties,omitempty"` // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` // Name - READ-ONLY; Resource name @@ -7059,38 +8047,101 @@ type Setting struct { Type *string `json:"type,omitempty"` } -// SettingResource the kind of the security setting -type SettingResource struct { - // Kind - the kind of the settings string (DataExportSetting). Possible values include: 'SettingKindDataExportSetting', 'SettingKindAlertSuppressionSetting' - Kind SettingKind `json:"kind,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` +// MarshalJSON is the custom marshaler for SecureScoreControlDefinitionItem. +func (sscdi SecureScoreControlDefinitionItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sscdi.SecureScoreControlDefinitionItemProperties != nil { + objectMap["properties"] = sscdi.SecureScoreControlDefinitionItemProperties + } + return json.Marshal(objectMap) } -// SettingsList subscription settings list. -type SettingsList struct { +// UnmarshalJSON is the custom unmarshaler for SecureScoreControlDefinitionItem struct. +func (sscdi *SecureScoreControlDefinitionItem) 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 secureScoreControlDefinitionItemProperties SecureScoreControlDefinitionItemProperties + err = json.Unmarshal(*v, &secureScoreControlDefinitionItemProperties) + if err != nil { + return err + } + sscdi.SecureScoreControlDefinitionItemProperties = &secureScoreControlDefinitionItemProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sscdi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sscdi.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sscdi.Type = &typeVar + } + } + } + + return nil +} + +// SecureScoreControlDefinitionItemProperties security Control Definition Properties. +type SecureScoreControlDefinitionItemProperties struct { + // DisplayName - READ-ONLY; User friendly display name of the control + DisplayName *string `json:"displayName,omitempty"` + // Description - READ-ONLY; User friendly description of the control + Description *string `json:"description,omitempty"` + // MaxScore - READ-ONLY; Maximum control score (0..10) + MaxScore *int32 `json:"maxScore,omitempty"` + // Source - READ-ONLY; Source object from which the control was created + Source *SecureScoreControlDefinitionSource `json:"source,omitempty"` + // AssessmentDefinitions - READ-ONLY; Array of assessments metadata IDs that are included in this security control + AssessmentDefinitions *[]AzureResourceLink `json:"assessmentDefinitions,omitempty"` +} + +// SecureScoreControlDefinitionList list of security controls definition +type SecureScoreControlDefinitionList struct { autorest.Response `json:"-"` - // Value - The settings list. - Value *[]Setting `json:"value,omitempty"` + // Value - READ-ONLY; Collection of security controls definition in this page + Value *[]SecureScoreControlDefinitionItem `json:"value,omitempty"` // NextLink - READ-ONLY; The URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` } -// SettingsListIterator provides access to a complete listing of Setting values. -type SettingsListIterator struct { +// SecureScoreControlDefinitionListIterator provides access to a complete listing of +// SecureScoreControlDefinitionItem values. +type SecureScoreControlDefinitionListIterator struct { i int - page SettingsListPage + page SecureScoreControlDefinitionListPage } // NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *SettingsListIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *SecureScoreControlDefinitionListIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SettingsListIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoreControlDefinitionListIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -7115,62 +8166,62 @@ func (iter *SettingsListIterator) NextWithContext(ctx context.Context) (err erro // Next advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (iter *SettingsListIterator) Next() error { +func (iter *SecureScoreControlDefinitionListIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SettingsListIterator) NotDone() bool { +func (iter SecureScoreControlDefinitionListIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) } // Response returns the raw server response from the last page request. -func (iter SettingsListIterator) Response() SettingsList { +func (iter SecureScoreControlDefinitionListIterator) Response() SecureScoreControlDefinitionList { return iter.page.Response() } // Value returns the current value or a zero-initialized value if the // iterator has advanced beyond the end of the collection. -func (iter SettingsListIterator) Value() Setting { +func (iter SecureScoreControlDefinitionListIterator) Value() SecureScoreControlDefinitionItem { if !iter.page.NotDone() { - return Setting{} + return SecureScoreControlDefinitionItem{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the SettingsListIterator type. -func NewSettingsListIterator(page SettingsListPage) SettingsListIterator { - return SettingsListIterator{page: page} +// Creates a new instance of the SecureScoreControlDefinitionListIterator type. +func NewSecureScoreControlDefinitionListIterator(page SecureScoreControlDefinitionListPage) SecureScoreControlDefinitionListIterator { + return SecureScoreControlDefinitionListIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (sl SettingsList) IsEmpty() bool { - return sl.Value == nil || len(*sl.Value) == 0 +func (sscdl SecureScoreControlDefinitionList) IsEmpty() bool { + return sscdl.Value == nil || len(*sscdl.Value) == 0 } -// settingsListPreparer prepares a request to retrieve the next set of results. +// secureScoreControlDefinitionListPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (sl SettingsList) settingsListPreparer(ctx context.Context) (*http.Request, error) { - if sl.NextLink == nil || len(to.String(sl.NextLink)) < 1 { +func (sscdl SecureScoreControlDefinitionList) secureScoreControlDefinitionListPreparer(ctx context.Context) (*http.Request, error) { + if sscdl.NextLink == nil || len(to.String(sscdl.NextLink)) < 1 { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(sl.NextLink))) + autorest.WithBaseURL(to.String(sscdl.NextLink))) } -// SettingsListPage contains a page of Setting values. -type SettingsListPage struct { - fn func(context.Context, SettingsList) (SettingsList, error) - sl SettingsList +// SecureScoreControlDefinitionListPage contains a page of SecureScoreControlDefinitionItem values. +type SecureScoreControlDefinitionListPage struct { + fn func(context.Context, SecureScoreControlDefinitionList) (SecureScoreControlDefinitionList, error) + sscdl SecureScoreControlDefinitionList } // NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *SettingsListPage) NextWithContext(ctx context.Context) (err error) { +func (page *SecureScoreControlDefinitionListPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SettingsListPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoreControlDefinitionListPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -7179,59 +8230,899 @@ func (page *SettingsListPage) NextWithContext(ctx context.Context) (err error) { tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.sl) + next, err := page.fn(ctx, page.sscdl) if err != nil { return err } - page.sl = next + page.sscdl = next return nil } // Next advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. // Deprecated: Use NextWithContext() instead. -func (page *SettingsListPage) Next() error { +func (page *SecureScoreControlDefinitionListPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SettingsListPage) NotDone() bool { - return !page.sl.IsEmpty() +func (page SecureScoreControlDefinitionListPage) NotDone() bool { + return !page.sscdl.IsEmpty() } // Response returns the raw server response from the last page request. -func (page SettingsListPage) Response() SettingsList { - return page.sl +func (page SecureScoreControlDefinitionListPage) Response() SecureScoreControlDefinitionList { + return page.sscdl } // Values returns the slice of values for the current page or nil if there are no values. -func (page SettingsListPage) Values() []Setting { - if page.sl.IsEmpty() { +func (page SecureScoreControlDefinitionListPage) Values() []SecureScoreControlDefinitionItem { + if page.sscdl.IsEmpty() { return nil } - return *page.sl.Value + return *page.sscdl.Value } -// Creates a new instance of the SettingsListPage type. -func NewSettingsListPage(getNextPage func(context.Context, SettingsList) (SettingsList, error)) SettingsListPage { - return SettingsListPage{fn: getNextPage} +// Creates a new instance of the SecureScoreControlDefinitionListPage type. +func NewSecureScoreControlDefinitionListPage(getNextPage func(context.Context, SecureScoreControlDefinitionList) (SecureScoreControlDefinitionList, error)) SecureScoreControlDefinitionListPage { + return SecureScoreControlDefinitionListPage{fn: getNextPage} } -// SQLServerVulnerabilityProperties details of the resource that was assessed -type SQLServerVulnerabilityProperties struct { - // Type - READ-ONLY; The resource type the sub assessment refers to in its resource details +// SecureScoreControlDefinitionSource the type of the security control (For example, BuiltIn) +type SecureScoreControlDefinitionSource struct { + // SourceType - The type of security control (for example, BuiltIn). Possible values include: 'BuiltIn', 'Custom' + SourceType ControlType `json:"sourceType,omitempty"` +} + +// SecureScoreControlDetails details of the security control, its score, and the health status of the +// relevant resources. +type SecureScoreControlDetails struct { + *SecureScoreControlScoreDetails `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"` - // Query - READ-ONLY; The T-SQL query that runs on your SQL database to perform the particular check - Query *string `json:"query,omitempty"` - // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' - AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` } -// MarshalJSON is the custom marshaler for SQLServerVulnerabilityProperties. -func (ssvp SQLServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { - ssvp.AssessedResourceType = AssessedResourceTypeSQLServerVulnerability +// MarshalJSON is the custom marshaler for SecureScoreControlDetails. +func (sscd SecureScoreControlDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ssvp.AssessedResourceType != "" { + if sscd.SecureScoreControlScoreDetails != nil { + objectMap["properties"] = sscd.SecureScoreControlScoreDetails + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecureScoreControlDetails struct. +func (sscd *SecureScoreControlDetails) 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 secureScoreControlScoreDetails SecureScoreControlScoreDetails + err = json.Unmarshal(*v, &secureScoreControlScoreDetails) + if err != nil { + return err + } + sscd.SecureScoreControlScoreDetails = &secureScoreControlScoreDetails + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sscd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sscd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sscd.Type = &typeVar + } + } + } + + return nil +} + +// SecureScoreControlList list of security controls +type SecureScoreControlList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Collection of security controls in this page + Value *[]SecureScoreControlDetails `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// SecureScoreControlListIterator provides access to a complete listing of SecureScoreControlDetails +// values. +type SecureScoreControlListIterator struct { + i int + page SecureScoreControlListPage +} + +// 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 *SecureScoreControlListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoreControlListIterator.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 *SecureScoreControlListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SecureScoreControlListIterator) 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 SecureScoreControlListIterator) Response() SecureScoreControlList { + 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 SecureScoreControlListIterator) Value() SecureScoreControlDetails { + if !iter.page.NotDone() { + return SecureScoreControlDetails{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SecureScoreControlListIterator type. +func NewSecureScoreControlListIterator(page SecureScoreControlListPage) SecureScoreControlListIterator { + return SecureScoreControlListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sscl SecureScoreControlList) IsEmpty() bool { + return sscl.Value == nil || len(*sscl.Value) == 0 +} + +// secureScoreControlListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sscl SecureScoreControlList) secureScoreControlListPreparer(ctx context.Context) (*http.Request, error) { + if sscl.NextLink == nil || len(to.String(sscl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sscl.NextLink))) +} + +// SecureScoreControlListPage contains a page of SecureScoreControlDetails values. +type SecureScoreControlListPage struct { + fn func(context.Context, SecureScoreControlList) (SecureScoreControlList, error) + sscl SecureScoreControlList +} + +// 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 *SecureScoreControlListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoreControlListPage.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.sscl) + if err != nil { + return err + } + page.sscl = 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 *SecureScoreControlListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SecureScoreControlListPage) NotDone() bool { + return !page.sscl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SecureScoreControlListPage) Response() SecureScoreControlList { + return page.sscl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SecureScoreControlListPage) Values() []SecureScoreControlDetails { + if page.sscl.IsEmpty() { + return nil + } + return *page.sscl.Value +} + +// Creates a new instance of the SecureScoreControlListPage type. +func NewSecureScoreControlListPage(getNextPage func(context.Context, SecureScoreControlList) (SecureScoreControlList, error)) SecureScoreControlListPage { + return SecureScoreControlListPage{fn: getNextPage} +} + +// SecureScoreControlScore calculation result data +type SecureScoreControlScore struct { + // Max - READ-ONLY; Maximum control score (0..10) + Max *int32 `json:"max,omitempty"` + // Current - READ-ONLY; Actual score for the control = (achieved points / total points) * max score. if total points is zeroed, the return number is 0.00 + Current *float64 `json:"current,omitempty"` +} + +// SecureScoreControlScoreDetails calculation result data in control level +type SecureScoreControlScoreDetails struct { + // DisplayName - READ-ONLY; User friendly display name of the control + DisplayName *string `json:"displayName,omitempty"` + // ScoreDetails - Actual score object for the control + *ScoreDetails `json:"score,omitempty"` + // HealthyResourceCount - READ-ONLY; Number of healthy resources in the control + HealthyResourceCount *int32 `json:"healthyResourceCount,omitempty"` + // UnhealthyResourceCount - READ-ONLY; Number of unhealthy resources in the control + UnhealthyResourceCount *int32 `json:"unhealthyResourceCount,omitempty"` + // NotApplicableResourceCount - READ-ONLY; Number of not applicable resources in the control + NotApplicableResourceCount *int32 `json:"notApplicableResourceCount,omitempty"` + Definition *SecureScoreControlDefinitionItem `json:"definition,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecureScoreControlScoreDetails. +func (sscsd SecureScoreControlScoreDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sscsd.ScoreDetails != nil { + objectMap["score"] = sscsd.ScoreDetails + } + if sscsd.Definition != nil { + objectMap["definition"] = sscsd.Definition + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecureScoreControlScoreDetails struct. +func (sscsd *SecureScoreControlScoreDetails) 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 "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + sscsd.DisplayName = &displayName + } + case "score": + if v != nil { + var scoreDetails ScoreDetails + err = json.Unmarshal(*v, &scoreDetails) + if err != nil { + return err + } + sscsd.ScoreDetails = &scoreDetails + } + case "healthyResourceCount": + if v != nil { + var healthyResourceCount int32 + err = json.Unmarshal(*v, &healthyResourceCount) + if err != nil { + return err + } + sscsd.HealthyResourceCount = &healthyResourceCount + } + case "unhealthyResourceCount": + if v != nil { + var unhealthyResourceCount int32 + err = json.Unmarshal(*v, &unhealthyResourceCount) + if err != nil { + return err + } + sscsd.UnhealthyResourceCount = &unhealthyResourceCount + } + case "notApplicableResourceCount": + if v != nil { + var notApplicableResourceCount int32 + err = json.Unmarshal(*v, ¬ApplicableResourceCount) + if err != nil { + return err + } + sscsd.NotApplicableResourceCount = ¬ApplicableResourceCount + } + case "definition": + if v != nil { + var definition SecureScoreControlDefinitionItem + err = json.Unmarshal(*v, &definition) + if err != nil { + return err + } + sscsd.Definition = &definition + } + } + } + + return nil +} + +// SecureScoreItem secure score item data model +type SecureScoreItem struct { + autorest.Response `json:"-"` + // SecureScoreItemProperties - READ-ONLY; Secure score item + *SecureScoreItemProperties `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 SecureScoreItem. +func (ssi SecureScoreItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecureScoreItem struct. +func (ssi *SecureScoreItem) 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 secureScoreItemProperties SecureScoreItemProperties + err = json.Unmarshal(*v, &secureScoreItemProperties) + if err != nil { + return err + } + ssi.SecureScoreItemProperties = &secureScoreItemProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ssi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ssi.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ssi.Type = &typeVar + } + } + } + + return nil +} + +// SecureScoreItemProperties describes properties of a calculated secure score. +type SecureScoreItemProperties struct { + // DisplayName - READ-ONLY; The initiative’s name + DisplayName *string `json:"displayName,omitempty"` + // ScoreDetails - READ-ONLY; score object + *ScoreDetails `json:"score,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecureScoreItemProperties. +func (ssip SecureScoreItemProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecureScoreItemProperties struct. +func (ssip *SecureScoreItemProperties) 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 "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + ssip.DisplayName = &displayName + } + case "score": + if v != nil { + var scoreDetails ScoreDetails + err = json.Unmarshal(*v, &scoreDetails) + if err != nil { + return err + } + ssip.ScoreDetails = &scoreDetails + } + } + } + + return nil +} + +// SecureScoresList list of secure scores +type SecureScoresList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Collection of secure scores in this page + Value *[]SecureScoreItem `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// SecureScoresListIterator provides access to a complete listing of SecureScoreItem values. +type SecureScoresListIterator struct { + i int + page SecureScoresListPage +} + +// 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 *SecureScoresListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoresListIterator.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 *SecureScoresListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SecureScoresListIterator) 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 SecureScoresListIterator) Response() SecureScoresList { + 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 SecureScoresListIterator) Value() SecureScoreItem { + if !iter.page.NotDone() { + return SecureScoreItem{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SecureScoresListIterator type. +func NewSecureScoresListIterator(page SecureScoresListPage) SecureScoresListIterator { + return SecureScoresListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ssl SecureScoresList) IsEmpty() bool { + return ssl.Value == nil || len(*ssl.Value) == 0 +} + +// secureScoresListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ssl SecureScoresList) secureScoresListPreparer(ctx context.Context) (*http.Request, error) { + if ssl.NextLink == nil || len(to.String(ssl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ssl.NextLink))) +} + +// SecureScoresListPage contains a page of SecureScoreItem values. +type SecureScoresListPage struct { + fn func(context.Context, SecureScoresList) (SecureScoresList, error) + ssl SecureScoresList +} + +// 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 *SecureScoresListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoresListPage.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.ssl) + if err != nil { + return err + } + page.ssl = 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 *SecureScoresListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SecureScoresListPage) NotDone() bool { + return !page.ssl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SecureScoresListPage) Response() SecureScoresList { + return page.ssl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SecureScoresListPage) Values() []SecureScoreItem { + if page.ssl.IsEmpty() { + return nil + } + return *page.ssl.Value +} + +// Creates a new instance of the SecureScoresListPage type. +func NewSecureScoresListPage(getNextPage func(context.Context, SecureScoresList) (SecureScoresList, error)) SecureScoresListPage { + return SecureScoresListPage{fn: getNextPage} +} + +// SensitivityLabel the sensitivity label. +type SensitivityLabel struct { + // DisplayName - The name of the sensitivity label. + DisplayName *string `json:"displayName,omitempty"` + // Description - The description of the sensitivity label. + Description *string `json:"description,omitempty"` + // Rank - The rank of the sensitivity label. Possible values include: 'RankNone', 'RankLow', 'RankMedium', 'RankHigh', 'RankCritical' + Rank Rank `json:"rank,omitempty"` + // Order - The order of the sensitivity label. + Order *int32 `json:"order,omitempty"` + // Enabled - Indicates whether the label is enabled or not. + Enabled *bool `json:"enabled,omitempty"` +} + +// ServerVulnerabilityProperties additional context fields for server vulnerability assessment +type ServerVulnerabilityProperties struct { + // Type - READ-ONLY; Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, Information Gathered + Type *string `json:"type,omitempty"` + // Cvss - READ-ONLY; Dictionary from cvss version to cvss details object + Cvss map[string]*CVSS `json:"cvss"` + // Patchable - READ-ONLY; Indicates whether a patch is available or not + Patchable *bool `json:"patchable,omitempty"` + // Cve - READ-ONLY; List of CVEs + Cve *[]CVE `json:"cve,omitempty"` + // Threat - READ-ONLY; Threat name + Threat *string `json:"threat,omitempty"` + // PublishedTime - READ-ONLY; Published time + PublishedTime *date.Time `json:"publishedTime,omitempty"` + // VendorReferences - READ-ONLY + VendorReferences *[]VendorReference `json:"vendorReferences,omitempty"` + // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' + AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { + svp.AssessedResourceType = AssessedResourceTypeServerVulnerabilityAssessment + objectMap := make(map[string]interface{}) + if svp.AssessedResourceType != "" { + objectMap["assessedResourceType"] = svp.AssessedResourceType + } + return json.Marshal(objectMap) +} + +// AsSQLServerVulnerabilityProperties is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsSQLServerVulnerabilityProperties() (*SQLServerVulnerabilityProperties, bool) { + return nil, false +} + +// AsContainerRegistryVulnerabilityProperties is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsContainerRegistryVulnerabilityProperties() (*ContainerRegistryVulnerabilityProperties, bool) { + return nil, false +} + +// AsServerVulnerabilityProperties is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsServerVulnerabilityProperties() (*ServerVulnerabilityProperties, bool) { + return &svp, true +} + +// AsAdditionalData is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsAdditionalData() (*AdditionalData, bool) { + return nil, false +} + +// AsBasicAdditionalData is the BasicAdditionalData implementation for ServerVulnerabilityProperties. +func (svp ServerVulnerabilityProperties) AsBasicAdditionalData() (BasicAdditionalData, bool) { + return &svp, true +} + +// ServicePrincipalProperties details of the service principal. +type ServicePrincipalProperties struct { + // ApplicationID - Application id of service principal. + ApplicationID *string `json:"applicationId,omitempty"` + // Secret - A secret string that the application uses to prove its identity, also can be referred to as application password (write only). + Secret *string `json:"secret,omitempty"` +} + +// Setting represents a security setting in Azure Security Center. +type Setting struct { + autorest.Response `json:"-"` + // Kind - the kind of the settings string (DataExportSetting). Possible values include: 'SettingKindDataExportSetting', 'SettingKindAlertSuppressionSetting' + Kind SettingKind `json:"kind,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// SettingResource the kind of the security setting +type SettingResource struct { + // Kind - the kind of the settings string (DataExportSetting). Possible values include: 'SettingKindDataExportSetting', 'SettingKindAlertSuppressionSetting' + Kind SettingKind `json:"kind,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// SettingsList subscription settings list. +type SettingsList struct { + autorest.Response `json:"-"` + // Value - The settings list. + Value *[]Setting `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// SettingsListIterator provides access to a complete listing of Setting values. +type SettingsListIterator struct { + i int + page SettingsListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SettingsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SettingsListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SettingsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SettingsListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SettingsListIterator) Response() SettingsList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SettingsListIterator) Value() Setting { + if !iter.page.NotDone() { + return Setting{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SettingsListIterator type. +func NewSettingsListIterator(page SettingsListPage) SettingsListIterator { + return SettingsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sl SettingsList) IsEmpty() bool { + return sl.Value == nil || len(*sl.Value) == 0 +} + +// settingsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sl SettingsList) settingsListPreparer(ctx context.Context) (*http.Request, error) { + if sl.NextLink == nil || len(to.String(sl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sl.NextLink))) +} + +// SettingsListPage contains a page of Setting values. +type SettingsListPage struct { + fn func(context.Context, SettingsList) (SettingsList, error) + sl SettingsList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SettingsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SettingsListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.sl) + if err != nil { + return err + } + page.sl = next + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SettingsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SettingsListPage) NotDone() bool { + return !page.sl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SettingsListPage) Response() SettingsList { + return page.sl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SettingsListPage) Values() []Setting { + if page.sl.IsEmpty() { + return nil + } + return *page.sl.Value +} + +// Creates a new instance of the SettingsListPage type. +func NewSettingsListPage(getNextPage func(context.Context, SettingsList) (SettingsList, error)) SettingsListPage { + return SettingsListPage{fn: getNextPage} +} + +// SQLServerVulnerabilityProperties details of the resource that was assessed +type SQLServerVulnerabilityProperties struct { + // Type - READ-ONLY; The resource type the sub assessment refers to in its resource details + Type *string `json:"type,omitempty"` + // Query - READ-ONLY; The T-SQL query that runs on your SQL database to perform the particular check + Query *string `json:"query,omitempty"` + // AssessedResourceType - Possible values include: 'AssessedResourceTypeAdditionalData', 'AssessedResourceTypeSQLServerVulnerability', 'AssessedResourceTypeContainerRegistryVulnerability', 'AssessedResourceTypeServerVulnerabilityAssessment' + AssessedResourceType AssessedResourceType `json:"assessedResourceType,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLServerVulnerabilityProperties. +func (ssvp SQLServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { + ssvp.AssessedResourceType = AssessedResourceTypeSQLServerVulnerability + objectMap := make(map[string]interface{}) + if ssvp.AssessedResourceType != "" { objectMap["assessedResourceType"] = ssvp.AssessedResourceType } return json.Marshal(objectMap) @@ -7616,6 +9507,12 @@ type SubAssessmentStatus struct { Severity Severity `json:"severity,omitempty"` } +// SuppressionAlertsScope ... +type SuppressionAlertsScope struct { + // AllOf - All the conditions inside need to be true in order to suppress the alert + AllOf *[]ScopeElement `json:"allOf,omitempty"` +} + // Tags a list of key value pairs that describe the resource. type Tags struct { // Tags - A list of key value pairs that describe the resource. diff --git a/services/preview/security/mgmt/v1.0/security/operations.go b/services/preview/security/mgmt/v1.0/security/operations.go index 916396d2b42f..4a28b4b47df6 100644 --- a/services/preview/security/mgmt/v1.0/security/operations.go +++ b/services/preview/security/mgmt/v1.0/security/operations.go @@ -101,7 +101,6 @@ func (client OperationsClient) ListSender(req *http.Request) (*http.Response, er func (client OperationsClient) ListResponder(resp *http.Response) (result OperationList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/pricings.go b/services/preview/security/mgmt/v1.0/security/pricings.go index 698671e154dd..cd1b47ad368a 100644 --- a/services/preview/security/mgmt/v1.0/security/pricings.go +++ b/services/preview/security/mgmt/v1.0/security/pricings.go @@ -124,7 +124,6 @@ func (client PricingsClient) CreateOrUpdateResourceGroupPricingSender(req *http. func (client PricingsClient) CreateOrUpdateResourceGroupPricingResponder(resp *http.Response) (result Pricing, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -211,7 +210,6 @@ func (client PricingsClient) GetResourceGroupPricingSender(req *http.Request) (* func (client PricingsClient) GetResourceGroupPricingResponder(resp *http.Response) (result Pricing, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -292,7 +290,6 @@ func (client PricingsClient) GetSubscriptionPricingSender(req *http.Request) (*h func (client PricingsClient) GetSubscriptionPricingResponder(resp *http.Response) (result Pricing, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -370,7 +367,6 @@ func (client PricingsClient) ListSender(req *http.Request) (*http.Response, erro func (client PricingsClient) ListResponder(resp *http.Response) (result PricingList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -493,7 +489,6 @@ func (client PricingsClient) ListByResourceGroupSender(req *http.Request) (*http func (client PricingsClient) ListByResourceGroupResponder(resp *http.Response) (result PricingList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -613,7 +608,6 @@ func (client PricingsClient) UpdateSubscriptionPricingSender(req *http.Request) func (client PricingsClient) UpdateSubscriptionPricingResponder(resp *http.Response) (result Pricing, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/regulatorycomplianceassessments.go b/services/preview/security/mgmt/v1.0/security/regulatorycomplianceassessments.go index 77deedf9991a..6c24ac9cca9e 100644 --- a/services/preview/security/mgmt/v1.0/security/regulatorycomplianceassessments.go +++ b/services/preview/security/mgmt/v1.0/security/regulatorycomplianceassessments.go @@ -120,7 +120,6 @@ func (client RegulatoryComplianceAssessmentsClient) GetSender(req *http.Request) func (client RegulatoryComplianceAssessmentsClient) GetResponder(resp *http.Response) (result RegulatoryComplianceAssessment, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -207,7 +206,6 @@ func (client RegulatoryComplianceAssessmentsClient) ListSender(req *http.Request func (client RegulatoryComplianceAssessmentsClient) ListResponder(resp *http.Response) (result RegulatoryComplianceAssessmentList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/regulatorycompliancecontrols.go b/services/preview/security/mgmt/v1.0/security/regulatorycompliancecontrols.go index 197250e80444..75c1d438a3b2 100644 --- a/services/preview/security/mgmt/v1.0/security/regulatorycompliancecontrols.go +++ b/services/preview/security/mgmt/v1.0/security/regulatorycompliancecontrols.go @@ -117,7 +117,6 @@ func (client RegulatoryComplianceControlsClient) GetSender(req *http.Request) (* func (client RegulatoryComplianceControlsClient) GetResponder(resp *http.Response) (result RegulatoryComplianceControl, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -202,7 +201,6 @@ func (client RegulatoryComplianceControlsClient) ListSender(req *http.Request) ( func (client RegulatoryComplianceControlsClient) ListResponder(resp *http.Response) (result RegulatoryComplianceControlList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/regulatorycompliancestandards.go b/services/preview/security/mgmt/v1.0/security/regulatorycompliancestandards.go index 4ef6e1a66d78..a711d560f34e 100644 --- a/services/preview/security/mgmt/v1.0/security/regulatorycompliancestandards.go +++ b/services/preview/security/mgmt/v1.0/security/regulatorycompliancestandards.go @@ -115,7 +115,6 @@ func (client RegulatoryComplianceStandardsClient) GetSender(req *http.Request) ( func (client RegulatoryComplianceStandardsClient) GetResponder(resp *http.Response) (result RegulatoryComplianceStandard, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -198,7 +197,6 @@ func (client RegulatoryComplianceStandardsClient) ListSender(req *http.Request) func (client RegulatoryComplianceStandardsClient) ListResponder(resp *http.Response) (result RegulatoryComplianceStandardList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/securescorecontroldefinitions.go b/services/preview/security/mgmt/v1.0/security/securescorecontroldefinitions.go new file mode 100644 index 000000000000..ea112d977ea4 --- /dev/null +++ b/services/preview/security/mgmt/v1.0/security/securescorecontroldefinitions.go @@ -0,0 +1,263 @@ +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" +) + +// SecureScoreControlDefinitionsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type SecureScoreControlDefinitionsClient struct { + BaseClient +} + +// NewSecureScoreControlDefinitionsClient creates an instance of the SecureScoreControlDefinitionsClient client. +func NewSecureScoreControlDefinitionsClient(subscriptionID string, ascLocation string) SecureScoreControlDefinitionsClient { + return NewSecureScoreControlDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewSecureScoreControlDefinitionsClientWithBaseURI creates an instance of the SecureScoreControlDefinitionsClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewSecureScoreControlDefinitionsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) SecureScoreControlDefinitionsClient { + return SecureScoreControlDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// List list the available security controls, their assessments, and the max score +func (client SecureScoreControlDefinitionsClient) List(ctx context.Context) (result SecureScoreControlDefinitionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoreControlDefinitionsClient.List") + defer func() { + sc := -1 + if result.sscdl.Response.Response != nil { + sc = result.sscdl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SecureScoreControlDefinitionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sscdl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SecureScoreControlDefinitionsClient", "List", resp, "Failure sending request") + return + } + + result.sscdl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SecureScoreControlDefinitionsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SecureScoreControlDefinitionsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2020-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Security/secureScoreControlDefinitions"), + 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 SecureScoreControlDefinitionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SecureScoreControlDefinitionsClient) ListResponder(resp *http.Response) (result SecureScoreControlDefinitionList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SecureScoreControlDefinitionsClient) listNextResults(ctx context.Context, lastResults SecureScoreControlDefinitionList) (result SecureScoreControlDefinitionList, err error) { + req, err := lastResults.secureScoreControlDefinitionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.SecureScoreControlDefinitionsClient", "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.SecureScoreControlDefinitionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SecureScoreControlDefinitionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SecureScoreControlDefinitionsClient) ListComplete(ctx context.Context) (result SecureScoreControlDefinitionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoreControlDefinitionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListBySubscription for a specified subscription, list the available security controls, their assessments, and the +// max score +func (client SecureScoreControlDefinitionsClient) ListBySubscription(ctx context.Context) (result SecureScoreControlDefinitionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoreControlDefinitionsClient.ListBySubscription") + defer func() { + sc := -1 + if result.sscdl.Response.Response != nil { + sc = result.sscdl.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.SecureScoreControlDefinitionsClient", "ListBySubscription", err.Error()) + } + + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SecureScoreControlDefinitionsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.sscdl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SecureScoreControlDefinitionsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.sscdl, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SecureScoreControlDefinitionsClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client SecureScoreControlDefinitionsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client SecureScoreControlDefinitionsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client SecureScoreControlDefinitionsClient) ListBySubscriptionResponder(resp *http.Response) (result SecureScoreControlDefinitionList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client SecureScoreControlDefinitionsClient) listBySubscriptionNextResults(ctx context.Context, lastResults SecureScoreControlDefinitionList) (result SecureScoreControlDefinitionList, err error) { + req, err := lastResults.secureScoreControlDefinitionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.SecureScoreControlDefinitionsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.SecureScoreControlDefinitionsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SecureScoreControlDefinitionsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client SecureScoreControlDefinitionsClient) ListBySubscriptionComplete(ctx context.Context) (result SecureScoreControlDefinitionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoreControlDefinitionsClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} diff --git a/services/preview/security/mgmt/v1.0/security/securescorecontrols.go b/services/preview/security/mgmt/v1.0/security/securescorecontrols.go new file mode 100644 index 000000000000..4685aeb1b7a2 --- /dev/null +++ b/services/preview/security/mgmt/v1.0/security/securescorecontrols.go @@ -0,0 +1,285 @@ +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" +) + +// SecureScoreControlsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type SecureScoreControlsClient struct { + BaseClient +} + +// NewSecureScoreControlsClient creates an instance of the SecureScoreControlsClient client. +func NewSecureScoreControlsClient(subscriptionID string, ascLocation string) SecureScoreControlsClient { + return NewSecureScoreControlsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewSecureScoreControlsClientWithBaseURI creates an instance of the SecureScoreControlsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewSecureScoreControlsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) SecureScoreControlsClient { + return SecureScoreControlsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// List get all security controls within a scope +// Parameters: +// expand - oData expand. Optional. +func (client SecureScoreControlsClient) List(ctx context.Context, expand ExpandControlsEnum) (result SecureScoreControlListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoreControlsClient.List") + defer func() { + sc := -1 + if result.sscl.Response.Response != nil { + sc = result.sscl.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.SecureScoreControlsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SecureScoreControlsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sscl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SecureScoreControlsClient", "List", resp, "Failure sending request") + return + } + + result.sscl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SecureScoreControlsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SecureScoreControlsClient) ListPreparer(ctx context.Context, expand ExpandControlsEnum) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(expand)) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls", 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 SecureScoreControlsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SecureScoreControlsClient) ListResponder(resp *http.Response) (result SecureScoreControlList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SecureScoreControlsClient) listNextResults(ctx context.Context, lastResults SecureScoreControlList) (result SecureScoreControlList, err error) { + req, err := lastResults.secureScoreControlListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.SecureScoreControlsClient", "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.SecureScoreControlsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SecureScoreControlsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SecureScoreControlsClient) ListComplete(ctx context.Context, expand ExpandControlsEnum) (result SecureScoreControlListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoreControlsClient.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, expand) + return +} + +// ListBySecureScore get all security controls for a specific initiative within a scope +// Parameters: +// secureScoreName - the initiative name. For the ASC Default initiative, use 'ascScore' as in the sample +// request below. +// expand - oData expand. Optional. +func (client SecureScoreControlsClient) ListBySecureScore(ctx context.Context, secureScoreName string, expand ExpandControlsEnum) (result SecureScoreControlListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoreControlsClient.ListBySecureScore") + defer func() { + sc := -1 + if result.sscl.Response.Response != nil { + sc = result.sscl.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.SecureScoreControlsClient", "ListBySecureScore", err.Error()) + } + + result.fn = client.listBySecureScoreNextResults + req, err := client.ListBySecureScorePreparer(ctx, secureScoreName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SecureScoreControlsClient", "ListBySecureScore", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySecureScoreSender(req) + if err != nil { + result.sscl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SecureScoreControlsClient", "ListBySecureScore", resp, "Failure sending request") + return + } + + result.sscl, err = client.ListBySecureScoreResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SecureScoreControlsClient", "ListBySecureScore", resp, "Failure responding to request") + } + + return +} + +// ListBySecureScorePreparer prepares the ListBySecureScore request. +func (client SecureScoreControlsClient) ListBySecureScorePreparer(ctx context.Context, secureScoreName string, expand ExpandControlsEnum) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "secureScoreName": autorest.Encode("path", secureScoreName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(expand)) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}/secureScoreControls", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySecureScoreSender sends the ListBySecureScore request. The method will close the +// http.Response Body if it receives an error. +func (client SecureScoreControlsClient) ListBySecureScoreSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySecureScoreResponder handles the response to the ListBySecureScore request. The method always +// closes the http.Response Body. +func (client SecureScoreControlsClient) ListBySecureScoreResponder(resp *http.Response) (result SecureScoreControlList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySecureScoreNextResults retrieves the next set of results, if any. +func (client SecureScoreControlsClient) listBySecureScoreNextResults(ctx context.Context, lastResults SecureScoreControlList) (result SecureScoreControlList, err error) { + req, err := lastResults.secureScoreControlListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.SecureScoreControlsClient", "listBySecureScoreNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySecureScoreSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.SecureScoreControlsClient", "listBySecureScoreNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySecureScoreResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SecureScoreControlsClient", "listBySecureScoreNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySecureScoreComplete enumerates all values, automatically crossing page boundaries as required. +func (client SecureScoreControlsClient) ListBySecureScoreComplete(ctx context.Context, secureScoreName string, expand ExpandControlsEnum) (result SecureScoreControlListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoreControlsClient.ListBySecureScore") + 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.ListBySecureScore(ctx, secureScoreName, expand) + return +} diff --git a/services/preview/security/mgmt/v1.0/security/securescores.go b/services/preview/security/mgmt/v1.0/security/securescores.go new file mode 100644 index 000000000000..b9b5d5698196 --- /dev/null +++ b/services/preview/security/mgmt/v1.0/security/securescores.go @@ -0,0 +1,238 @@ +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" +) + +// SecureScoresClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type SecureScoresClient struct { + BaseClient +} + +// NewSecureScoresClient creates an instance of the SecureScoresClient client. +func NewSecureScoresClient(subscriptionID string, ascLocation string) SecureScoresClient { + return NewSecureScoresClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewSecureScoresClientWithBaseURI creates an instance of the SecureScoresClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSecureScoresClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) SecureScoresClient { + return SecureScoresClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// Get get secure score for a specific Security Center initiative within your current scope. For the ASC Default +// initiative, use 'ascScore'. +// Parameters: +// secureScoreName - the initiative name. For the ASC Default initiative, use 'ascScore' as in the sample +// request below. +func (client SecureScoresClient) Get(ctx context.Context, secureScoreName string) (result SecureScoreItem, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoresClient.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.SecureScoresClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, secureScoreName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SecureScoresClient", "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.SecureScoresClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SecureScoresClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SecureScoresClient) GetPreparer(ctx context.Context, secureScoreName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "secureScoreName": autorest.Encode("path", secureScoreName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}", 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 SecureScoresClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SecureScoresClient) GetResponder(resp *http.Response) (result SecureScoreItem, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list secure scores for all your Security Center initiatives within your current scope. +func (client SecureScoresClient) List(ctx context.Context) (result SecureScoresListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoresClient.List") + defer func() { + sc := -1 + if result.ssl.Response.Response != nil { + sc = result.ssl.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.SecureScoresClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SecureScoresClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ssl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SecureScoresClient", "List", resp, "Failure sending request") + return + } + + result.ssl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SecureScoresClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client SecureScoresClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores", 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 SecureScoresClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SecureScoresClient) ListResponder(resp *http.Response) (result SecureScoresList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SecureScoresClient) listNextResults(ctx context.Context, lastResults SecureScoresList) (result SecureScoresList, err error) { + req, err := lastResults.secureScoresListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.SecureScoresClient", "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.SecureScoresClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SecureScoresClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SecureScoresClient) ListComplete(ctx context.Context) (result SecureScoresListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoresClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} 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 9c35c4776471..338cab3f1591 100644 --- a/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go @@ -23,6 +23,46 @@ import ( "github.com/Azure/go-autorest/autorest" ) +// SecureScoresClientAPI contains the set of methods on the SecureScoresClient type. +type SecureScoresClientAPI interface { + Get(ctx context.Context, secureScoreName string) (result security.SecureScoreItem, err error) + List(ctx context.Context) (result security.SecureScoresListPage, err error) + ListComplete(ctx context.Context) (result security.SecureScoresListIterator, err error) +} + +var _ SecureScoresClientAPI = (*security.SecureScoresClient)(nil) + +// SecureScoreControlsClientAPI contains the set of methods on the SecureScoreControlsClient type. +type SecureScoreControlsClientAPI interface { + List(ctx context.Context, expand security.ExpandControlsEnum) (result security.SecureScoreControlListPage, err error) + ListComplete(ctx context.Context, expand security.ExpandControlsEnum) (result security.SecureScoreControlListIterator, err error) + ListBySecureScore(ctx context.Context, secureScoreName string, expand security.ExpandControlsEnum) (result security.SecureScoreControlListPage, err error) + ListBySecureScoreComplete(ctx context.Context, secureScoreName string, expand security.ExpandControlsEnum) (result security.SecureScoreControlListIterator, err error) +} + +var _ SecureScoreControlsClientAPI = (*security.SecureScoreControlsClient)(nil) + +// SecureScoreControlDefinitionsClientAPI contains the set of methods on the SecureScoreControlDefinitionsClient type. +type SecureScoreControlDefinitionsClientAPI interface { + List(ctx context.Context) (result security.SecureScoreControlDefinitionListPage, err error) + ListComplete(ctx context.Context) (result security.SecureScoreControlDefinitionListIterator, err error) + ListBySubscription(ctx context.Context) (result security.SecureScoreControlDefinitionListPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result security.SecureScoreControlDefinitionListIterator, err error) +} + +var _ SecureScoreControlDefinitionsClientAPI = (*security.SecureScoreControlDefinitionsClient)(nil) + +// ConnectorsClientAPI contains the set of methods on the ConnectorsClient type. +type ConnectorsClientAPI interface { + CreateOrUpdate(ctx context.Context, connectorName string, connectorSetting security.ConnectorSetting) (result security.ConnectorSetting, err error) + Delete(ctx context.Context, connectorName string) (result autorest.Response, err error) + Get(ctx context.Context, connectorName string) (result security.ConnectorSetting, err error) + List(ctx context.Context) (result security.ConnectorSettingListPage, err error) + ListComplete(ctx context.Context) (result security.ConnectorSettingListIterator, err error) +} + +var _ ConnectorsClientAPI = (*security.ConnectorsClient)(nil) + // AutomationsClientAPI contains the set of methods on the AutomationsClient type. type AutomationsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, automationName string, automation security.Automation) (result security.Automation, err error) @@ -163,7 +203,7 @@ var _ SettingsClientAPI = (*security.SettingsClient)(nil) // InformationProtectionPoliciesClientAPI contains the set of methods on the InformationProtectionPoliciesClient type. type InformationProtectionPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, scope string, informationProtectionPolicyName string) (result security.InformationProtectionPolicy, err error) + CreateOrUpdate(ctx context.Context, scope string, informationProtectionPolicyName string, informationProtectionPolicy security.InformationProtectionPolicy) (result security.InformationProtectionPolicy, err error) Get(ctx context.Context, scope string, informationProtectionPolicyName string) (result security.InformationProtectionPolicy, err error) List(ctx context.Context, scope string) (result security.InformationProtectionPolicyListPage, err error) ListComplete(ctx context.Context, scope string) (result security.InformationProtectionPolicyListIterator, err error) @@ -255,6 +295,7 @@ var _ JitNetworkAccessPoliciesClientAPI = (*security.JitNetworkAccessPoliciesCli // AdaptiveApplicationControlsClientAPI contains the set of methods on the AdaptiveApplicationControlsClient type. type AdaptiveApplicationControlsClientAPI interface { + Delete(ctx context.Context, groupName string) (result autorest.Response, err error) 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) @@ -304,3 +345,14 @@ type AdaptiveNetworkHardeningsClientAPI interface { } var _ AdaptiveNetworkHardeningsClientAPI = (*security.AdaptiveNetworkHardeningsClient)(nil) + +// AlertsSuppressionRulesClientAPI contains the set of methods on the AlertsSuppressionRulesClient type. +type AlertsSuppressionRulesClientAPI interface { + Delete(ctx context.Context, alertsSuppressionRuleName string) (result autorest.Response, err error) + Get(ctx context.Context, alertsSuppressionRuleName string) (result security.AlertsSuppressionRule, err error) + List(ctx context.Context, alertType string) (result security.AlertsSuppressionRulesListPage, err error) + ListComplete(ctx context.Context, alertType string) (result security.AlertsSuppressionRulesListIterator, err error) + Update(ctx context.Context, alertsSuppressionRuleName string, alertsSuppressionRule security.AlertsSuppressionRule) (result security.AlertsSuppressionRule, err error) +} + +var _ AlertsSuppressionRulesClientAPI = (*security.AlertsSuppressionRulesClient)(nil) diff --git a/services/preview/security/mgmt/v1.0/security/settings.go b/services/preview/security/mgmt/v1.0/security/settings.go index f325c1261329..1f97596f454c 100644 --- a/services/preview/security/mgmt/v1.0/security/settings.go +++ b/services/preview/security/mgmt/v1.0/security/settings.go @@ -114,7 +114,6 @@ func (client SettingsClient) GetSender(req *http.Request) (*http.Response, error func (client SettingsClient) GetResponder(resp *http.Response) (result Setting, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -192,7 +191,6 @@ func (client SettingsClient) ListSender(req *http.Request) (*http.Response, erro func (client SettingsClient) ListResponder(resp *http.Response) (result SettingsList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -312,7 +310,6 @@ func (client SettingsClient) UpdateSender(req *http.Request) (*http.Response, er func (client SettingsClient) UpdateResponder(resp *http.Response) (result Setting, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/subassessments.go b/services/preview/security/mgmt/v1.0/security/subassessments.go index 4b1a429a3e90..0698d13a7f60 100644 --- a/services/preview/security/mgmt/v1.0/security/subassessments.go +++ b/services/preview/security/mgmt/v1.0/security/subassessments.go @@ -83,7 +83,7 @@ func (client SubAssessmentsClient) Get(ctx context.Context, scope string, assess func (client SubAssessmentsClient) GetPreparer(ctx context.Context, scope string, assessmentName string, subAssessmentName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "assessmentName": autorest.Encode("path", assessmentName), - "scope": autorest.Encode("path", scope), + "scope": scope, "subAssessmentName": autorest.Encode("path", subAssessmentName), } @@ -111,7 +111,6 @@ func (client SubAssessmentsClient) GetSender(req *http.Request) (*http.Response, func (client SubAssessmentsClient) GetResponder(resp *http.Response) (result SubAssessment, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -161,7 +160,7 @@ func (client SubAssessmentsClient) List(ctx context.Context, scope string, asses func (client SubAssessmentsClient) ListPreparer(ctx context.Context, scope string, assessmentName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "assessmentName": autorest.Encode("path", assessmentName), - "scope": autorest.Encode("path", scope), + "scope": scope, } const APIVersion = "2019-01-01-preview" @@ -188,7 +187,6 @@ func (client SubAssessmentsClient) ListSender(req *http.Request) (*http.Response func (client SubAssessmentsClient) ListResponder(resp *http.Response) (result SubAssessmentList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -273,7 +271,7 @@ func (client SubAssessmentsClient) ListAll(ctx context.Context, scope string) (r // ListAllPreparer prepares the ListAll request. func (client SubAssessmentsClient) ListAllPreparer(ctx context.Context, scope string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "scope": autorest.Encode("path", scope), + "scope": scope, } const APIVersion = "2019-01-01-preview" @@ -300,7 +298,6 @@ func (client SubAssessmentsClient) ListAllSender(req *http.Request) (*http.Respo func (client SubAssessmentsClient) ListAllResponder(resp *http.Response) (result SubAssessmentList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/tasks.go b/services/preview/security/mgmt/v1.0/security/tasks.go index 5215444c7a73..e224a9a5e10f 100644 --- a/services/preview/security/mgmt/v1.0/security/tasks.go +++ b/services/preview/security/mgmt/v1.0/security/tasks.go @@ -122,7 +122,6 @@ func (client TasksClient) GetResourceGroupLevelTaskSender(req *http.Request) (*h func (client TasksClient) GetResourceGroupLevelTaskResponder(resp *http.Response) (result Task, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -203,7 +202,6 @@ func (client TasksClient) GetSubscriptionLevelTaskSender(req *http.Request) (*ht func (client TasksClient) GetSubscriptionLevelTaskResponder(resp *http.Response) (result Task, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -286,7 +284,6 @@ func (client TasksClient) ListSender(req *http.Request) (*http.Response, error) func (client TasksClient) ListResponder(resp *http.Response) (result TaskList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -407,7 +404,6 @@ func (client TasksClient) ListByHomeRegionSender(req *http.Request) (*http.Respo func (client TasksClient) ListByHomeRegionResponder(resp *http.Response) (result TaskList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -535,7 +531,6 @@ func (client TasksClient) ListByResourceGroupSender(req *http.Request) (*http.Re func (client TasksClient) ListByResourceGroupResponder(resp *http.Response) (result TaskList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -663,7 +658,6 @@ func (client TasksClient) UpdateResourceGroupLevelTaskStateSender(req *http.Requ func (client TasksClient) UpdateResourceGroupLevelTaskStateResponder(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 @@ -746,7 +740,6 @@ func (client TasksClient) UpdateSubscriptionLevelTaskStateSender(req *http.Reque func (client TasksClient) UpdateSubscriptionLevelTaskStateResponder(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 diff --git a/services/preview/security/mgmt/v1.0/security/topology.go b/services/preview/security/mgmt/v1.0/security/topology.go index 5a020bc9863c..899f20b0cf05 100644 --- a/services/preview/security/mgmt/v1.0/security/topology.go +++ b/services/preview/security/mgmt/v1.0/security/topology.go @@ -122,7 +122,6 @@ func (client TopologyClient) GetSender(req *http.Request) (*http.Response, error func (client TopologyClient) GetResponder(resp *http.Response) (result TopologyResource, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -200,7 +199,6 @@ func (client TopologyClient) ListSender(req *http.Request) (*http.Response, erro func (client TopologyClient) ListResponder(resp *http.Response) (result TopologyList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -316,7 +314,6 @@ func (client TopologyClient) ListByHomeRegionSender(req *http.Request) (*http.Re func (client TopologyClient) ListByHomeRegionResponder(resp *http.Response) (result TopologyList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v1.0/security/version.go b/services/preview/security/mgmt/v1.0/security/version.go index 700532fb79c7..f4e685baba51 100644 --- a/services/preview/security/mgmt/v1.0/security/version.go +++ b/services/preview/security/mgmt/v1.0/security/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " security/v1.0" + return "Azure-SDK-For-Go/" + Version() + " security/v1.0" } // Version returns the semantic version (see http://semver.org) of the client. diff --git a/services/preview/security/mgmt/v1.0/security/workspacesettings.go b/services/preview/security/mgmt/v1.0/security/workspacesettings.go index e34ac16bdae2..b8fa662d8c0e 100644 --- a/services/preview/security/mgmt/v1.0/security/workspacesettings.go +++ b/services/preview/security/mgmt/v1.0/security/workspacesettings.go @@ -123,7 +123,6 @@ func (client WorkspaceSettingsClient) CreateSender(req *http.Request) (*http.Res func (client WorkspaceSettingsClient) CreateResponder(resp *http.Response) (result WorkspaceSetting, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -203,7 +202,6 @@ func (client WorkspaceSettingsClient) DeleteSender(req *http.Request) (*http.Res func (client WorkspaceSettingsClient) 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 @@ -283,7 +281,6 @@ func (client WorkspaceSettingsClient) GetSender(req *http.Request) (*http.Respon func (client WorkspaceSettingsClient) GetResponder(resp *http.Response) (result WorkspaceSetting, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -362,7 +359,6 @@ func (client WorkspaceSettingsClient) ListSender(req *http.Request) (*http.Respo func (client WorkspaceSettingsClient) ListResponder(resp *http.Response) (result WorkspaceSettingList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -482,7 +478,6 @@ func (client WorkspaceSettingsClient) UpdateSender(req *http.Request) (*http.Res func (client WorkspaceSettingsClient) UpdateResponder(resp *http.Response) (result WorkspaceSetting, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing())