diff --git a/services/preview/security/mgmt/v2.0/security/adaptiveapplicationcontrols.go b/services/preview/security/mgmt/v2.0/security/adaptiveapplicationcontrols.go index 3539525c7196..b5c1ac56459b 100644 --- a/services/preview/security/mgmt/v2.0/security/adaptiveapplicationcontrols.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/adaptivenetworkhardenings.go b/services/preview/security/mgmt/v2.0/security/adaptivenetworkhardenings.go index 852e2eecef0f..feb538932911 100644 --- a/services/preview/security/mgmt/v2.0/security/adaptivenetworkhardenings.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/advancedthreatprotection.go b/services/preview/security/mgmt/v2.0/security/advancedthreatprotection.go index 4a29fb5efec8..2bd63720d32e 100644 --- a/services/preview/security/mgmt/v2.0/security/advancedthreatprotection.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/alerts.go b/services/preview/security/mgmt/v2.0/security/alerts.go index 27c79ff77b33..a1758dc0eeb1 100644 --- a/services/preview/security/mgmt/v2.0/security/alerts.go +++ b/services/preview/security/mgmt/v2.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()) @@ -216,7 +214,9 @@ func (client AlertsClient) GetSubscriptionLevelAlertResponder(resp *http.Respons // filter - oData filter. Optional. // selectParameter - oData select. Optional. // expand - oData expand. Optional. -func (client AlertsClient) List(ctx context.Context, filter string, selectParameter string, expand string) (result AlertListPage, err error) { +// autoDismissRuleName - the name of an existing auto dismiss rule. Use it to simulate the rule on existing +// alerts and get the alerts that would have been dismissed if the rule was enabled when the alert was created +func (client AlertsClient) List(ctx context.Context, filter string, selectParameter string, expand string, autoDismissRuleName string) (result AlertListPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.List") defer func() { @@ -234,7 +234,7 @@ func (client AlertsClient) List(ctx context.Context, filter string, selectParame } result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, filter, selectParameter, expand) + req, err := client.ListPreparer(ctx, filter, selectParameter, expand, autoDismissRuleName) if err != nil { err = autorest.NewErrorWithError(err, "security.AlertsClient", "List", nil, "Failure preparing request") return @@ -256,7 +256,7 @@ func (client AlertsClient) List(ctx context.Context, filter string, selectParame } // ListPreparer prepares the List request. -func (client AlertsClient) ListPreparer(ctx context.Context, filter string, selectParameter string, expand string) (*http.Request, error) { +func (client AlertsClient) ListPreparer(ctx context.Context, filter string, selectParameter string, expand string, autoDismissRuleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -274,6 +274,9 @@ func (client AlertsClient) ListPreparer(ctx context.Context, filter string, sele if len(expand) > 0 { queryParameters["$expand"] = autorest.Encode("query", expand) } + if len(autoDismissRuleName) > 0 { + queryParameters["autoDismissRuleName"] = autorest.Encode("query", autoDismissRuleName) + } preparer := autorest.CreatePreparer( autorest.AsGet(), @@ -294,7 +297,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()) @@ -324,7 +326,7 @@ func (client AlertsClient) listNextResults(ctx context.Context, lastResults Aler } // ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client AlertsClient) ListComplete(ctx context.Context, filter string, selectParameter string, expand string) (result AlertListIterator, err error) { +func (client AlertsClient) ListComplete(ctx context.Context, filter string, selectParameter string, expand string, autoDismissRuleName string) (result AlertListIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.List") defer func() { @@ -335,7 +337,7 @@ func (client AlertsClient) ListComplete(ctx context.Context, filter string, sele tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.List(ctx, filter, selectParameter, expand) + result.page, err = client.List(ctx, filter, selectParameter, expand, autoDismissRuleName) return } @@ -346,7 +348,9 @@ func (client AlertsClient) ListComplete(ctx context.Context, filter string, sele // filter - oData filter. Optional. // selectParameter - oData select. Optional. // expand - oData expand. Optional. -func (client AlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string) (result AlertListPage, err error) { +// autoDismissRuleName - the name of an existing auto dismiss rule. Use it to simulate the rule on existing +// alerts and get the alerts that would have been dismissed if the rule was enabled when the alert was created +func (client AlertsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string, autoDismissRuleName string) (result AlertListPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListByResourceGroup") defer func() { @@ -368,7 +372,7 @@ func (client AlertsClient) ListByResourceGroup(ctx context.Context, resourceGrou } result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, selectParameter, expand) + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, selectParameter, expand, autoDismissRuleName) if err != nil { err = autorest.NewErrorWithError(err, "security.AlertsClient", "ListByResourceGroup", nil, "Failure preparing request") return @@ -390,7 +394,7 @@ func (client AlertsClient) ListByResourceGroup(ctx context.Context, resourceGrou } // ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client AlertsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string) (*http.Request, error) { +func (client AlertsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string, autoDismissRuleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), @@ -409,6 +413,9 @@ func (client AlertsClient) ListByResourceGroupPreparer(ctx context.Context, reso if len(expand) > 0 { queryParameters["$expand"] = autorest.Encode("query", expand) } + if len(autoDismissRuleName) > 0 { + queryParameters["autoDismissRuleName"] = autorest.Encode("query", autoDismissRuleName) + } preparer := autorest.CreatePreparer( autorest.AsGet(), @@ -429,7 +436,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()) @@ -459,7 +465,7 @@ func (client AlertsClient) listByResourceGroupNextResults(ctx context.Context, l } // ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client AlertsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string) (result AlertListIterator, err error) { +func (client AlertsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string, autoDismissRuleName string) (result AlertListIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListByResourceGroup") defer func() { @@ -470,7 +476,7 @@ func (client AlertsClient) ListByResourceGroupComplete(ctx context.Context, reso tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, filter, selectParameter, expand) + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, filter, selectParameter, expand, autoDismissRuleName) return } @@ -482,7 +488,9 @@ func (client AlertsClient) ListByResourceGroupComplete(ctx context.Context, reso // filter - oData filter. Optional. // selectParameter - oData select. Optional. // expand - oData expand. Optional. -func (client AlertsClient) ListResourceGroupLevelAlertsByRegion(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string) (result AlertListPage, err error) { +// autoDismissRuleName - the name of an existing auto dismiss rule. Use it to simulate the rule on existing +// alerts and get the alerts that would have been dismissed if the rule was enabled when the alert was created +func (client AlertsClient) ListResourceGroupLevelAlertsByRegion(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string, autoDismissRuleName string) (result AlertListPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListResourceGroupLevelAlertsByRegion") defer func() { @@ -504,7 +512,7 @@ func (client AlertsClient) ListResourceGroupLevelAlertsByRegion(ctx context.Cont } result.fn = client.listResourceGroupLevelAlertsByRegionNextResults - req, err := client.ListResourceGroupLevelAlertsByRegionPreparer(ctx, resourceGroupName, filter, selectParameter, expand) + req, err := client.ListResourceGroupLevelAlertsByRegionPreparer(ctx, resourceGroupName, filter, selectParameter, expand, autoDismissRuleName) if err != nil { err = autorest.NewErrorWithError(err, "security.AlertsClient", "ListResourceGroupLevelAlertsByRegion", nil, "Failure preparing request") return @@ -526,7 +534,7 @@ func (client AlertsClient) ListResourceGroupLevelAlertsByRegion(ctx context.Cont } // ListResourceGroupLevelAlertsByRegionPreparer prepares the ListResourceGroupLevelAlertsByRegion request. -func (client AlertsClient) ListResourceGroupLevelAlertsByRegionPreparer(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string) (*http.Request, error) { +func (client AlertsClient) ListResourceGroupLevelAlertsByRegionPreparer(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string, autoDismissRuleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "ascLocation": autorest.Encode("path", client.AscLocation), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -546,6 +554,9 @@ func (client AlertsClient) ListResourceGroupLevelAlertsByRegionPreparer(ctx cont if len(expand) > 0 { queryParameters["$expand"] = autorest.Encode("query", expand) } + if len(autoDismissRuleName) > 0 { + queryParameters["autoDismissRuleName"] = autorest.Encode("query", autoDismissRuleName) + } preparer := autorest.CreatePreparer( autorest.AsGet(), @@ -566,7 +577,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()) @@ -596,7 +606,7 @@ func (client AlertsClient) listResourceGroupLevelAlertsByRegionNextResults(ctx c } // ListResourceGroupLevelAlertsByRegionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AlertsClient) ListResourceGroupLevelAlertsByRegionComplete(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string) (result AlertListIterator, err error) { +func (client AlertsClient) ListResourceGroupLevelAlertsByRegionComplete(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string, autoDismissRuleName string) (result AlertListIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListResourceGroupLevelAlertsByRegion") defer func() { @@ -607,7 +617,7 @@ func (client AlertsClient) ListResourceGroupLevelAlertsByRegionComplete(ctx cont tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.ListResourceGroupLevelAlertsByRegion(ctx, resourceGroupName, filter, selectParameter, expand) + result.page, err = client.ListResourceGroupLevelAlertsByRegion(ctx, resourceGroupName, filter, selectParameter, expand, autoDismissRuleName) return } @@ -617,7 +627,9 @@ func (client AlertsClient) ListResourceGroupLevelAlertsByRegionComplete(ctx cont // filter - oData filter. Optional. // selectParameter - oData select. Optional. // expand - oData expand. Optional. -func (client AlertsClient) ListSubscriptionLevelAlertsByRegion(ctx context.Context, filter string, selectParameter string, expand string) (result AlertListPage, err error) { +// autoDismissRuleName - the name of an existing auto dismiss rule. Use it to simulate the rule on existing +// alerts and get the alerts that would have been dismissed if the rule was enabled when the alert was created +func (client AlertsClient) ListSubscriptionLevelAlertsByRegion(ctx context.Context, filter string, selectParameter string, expand string, autoDismissRuleName string) (result AlertListPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListSubscriptionLevelAlertsByRegion") defer func() { @@ -635,7 +647,7 @@ func (client AlertsClient) ListSubscriptionLevelAlertsByRegion(ctx context.Conte } result.fn = client.listSubscriptionLevelAlertsByRegionNextResults - req, err := client.ListSubscriptionLevelAlertsByRegionPreparer(ctx, filter, selectParameter, expand) + req, err := client.ListSubscriptionLevelAlertsByRegionPreparer(ctx, filter, selectParameter, expand, autoDismissRuleName) if err != nil { err = autorest.NewErrorWithError(err, "security.AlertsClient", "ListSubscriptionLevelAlertsByRegion", nil, "Failure preparing request") return @@ -657,7 +669,7 @@ func (client AlertsClient) ListSubscriptionLevelAlertsByRegion(ctx context.Conte } // ListSubscriptionLevelAlertsByRegionPreparer prepares the ListSubscriptionLevelAlertsByRegion request. -func (client AlertsClient) ListSubscriptionLevelAlertsByRegionPreparer(ctx context.Context, filter string, selectParameter string, expand string) (*http.Request, error) { +func (client AlertsClient) ListSubscriptionLevelAlertsByRegionPreparer(ctx context.Context, filter string, selectParameter string, expand string, autoDismissRuleName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "ascLocation": autorest.Encode("path", client.AscLocation), "subscriptionId": autorest.Encode("path", client.SubscriptionID), @@ -676,6 +688,9 @@ func (client AlertsClient) ListSubscriptionLevelAlertsByRegionPreparer(ctx conte if len(expand) > 0 { queryParameters["$expand"] = autorest.Encode("query", expand) } + if len(autoDismissRuleName) > 0 { + queryParameters["autoDismissRuleName"] = autorest.Encode("query", autoDismissRuleName) + } preparer := autorest.CreatePreparer( autorest.AsGet(), @@ -696,7 +711,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()) @@ -726,7 +740,7 @@ func (client AlertsClient) listSubscriptionLevelAlertsByRegionNextResults(ctx co } // ListSubscriptionLevelAlertsByRegionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AlertsClient) ListSubscriptionLevelAlertsByRegionComplete(ctx context.Context, filter string, selectParameter string, expand string) (result AlertListIterator, err error) { +func (client AlertsClient) ListSubscriptionLevelAlertsByRegionComplete(ctx context.Context, filter string, selectParameter string, expand string, autoDismissRuleName string) (result AlertListIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListSubscriptionLevelAlertsByRegion") defer func() { @@ -737,7 +751,7 @@ func (client AlertsClient) ListSubscriptionLevelAlertsByRegionComplete(ctx conte tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.ListSubscriptionLevelAlertsByRegion(ctx, filter, selectParameter, expand) + result.page, err = client.ListSubscriptionLevelAlertsByRegion(ctx, filter, selectParameter, expand, autoDismissRuleName) return } @@ -821,7 +835,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 +921,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 +1000,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 +1079,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/v2.0/security/alertssuppressionrules.go b/services/preview/security/mgmt/v2.0/security/alertssuppressionrules.go new file mode 100644 index 000000000000..4fcb7d39434b --- /dev/null +++ b/services/preview/security/mgmt/v2.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/v2.0/security/allowedconnections.go b/services/preview/security/mgmt/v2.0/security/allowedconnections.go index 0eeca0685693..f1643b702af1 100644 --- a/services/preview/security/mgmt/v2.0/security/allowedconnections.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/automations.go b/services/preview/security/mgmt/v2.0/security/automations.go index d4e9b1c35bcd..06ab18f48a8b 100644 --- a/services/preview/security/mgmt/v2.0/security/automations.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/autoprovisioningsettings.go b/services/preview/security/mgmt/v2.0/security/autoprovisioningsettings.go index 433630bd659d..d626b2049917 100644 --- a/services/preview/security/mgmt/v2.0/security/autoprovisioningsettings.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/compliances.go b/services/preview/security/mgmt/v2.0/security/compliances.go index 2f0fa49be6a0..4f33618da8c0 100644 --- a/services/preview/security/mgmt/v2.0/security/compliances.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/contacts.go b/services/preview/security/mgmt/v2.0/security/contacts.go index bbf7b35c4675..efedb961a1f7 100644 --- a/services/preview/security/mgmt/v2.0/security/contacts.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/devicesecuritygroups.go b/services/preview/security/mgmt/v2.0/security/devicesecuritygroups.go index 5743a87ed3e5..8d7530224bdd 100644 --- a/services/preview/security/mgmt/v2.0/security/devicesecuritygroups.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/discoveredsecuritysolutions.go b/services/preview/security/mgmt/v2.0/security/discoveredsecuritysolutions.go index 5cad25154319..e14904a8aaf0 100644 --- a/services/preview/security/mgmt/v2.0/security/discoveredsecuritysolutions.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/externalsecuritysolutions.go b/services/preview/security/mgmt/v2.0/security/externalsecuritysolutions.go index 614aa067c07b..25285174c4ea 100644 --- a/services/preview/security/mgmt/v2.0/security/externalsecuritysolutions.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/informationprotectionpolicies.go b/services/preview/security/mgmt/v2.0/security/informationprotectionpolicies.go index b1ca96db2f94..433b07e8986b 100644 --- a/services/preview/security/mgmt/v2.0/security/informationprotectionpolicies.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/iotsecuritysolution.go b/services/preview/security/mgmt/v2.0/security/iotsecuritysolution.go index 30b1651d4806..02804ebcea95 100644 --- a/services/preview/security/mgmt/v2.0/security/iotsecuritysolution.go +++ b/services/preview/security/mgmt/v2.0/security/iotsecuritysolution.go @@ -138,7 +138,6 @@ func (client IotSecuritySolutionClient) CreateSender(req *http.Request) (*http.R func (client IotSecuritySolutionClient) CreateResponder(resp *http.Response) (result IoTSecuritySolutionModel, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -225,7 +224,6 @@ func (client IotSecuritySolutionClient) DeleteSender(req *http.Request) (*http.R func (client IotSecuritySolutionClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByClosing()) result.Response = resp @@ -311,7 +309,6 @@ func (client IotSecuritySolutionClient) GetSender(req *http.Request) (*http.Resp func (client IotSecuritySolutionClient) GetResponder(resp *http.Response) (result IoTSecuritySolutionModel, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -402,7 +399,6 @@ func (client IotSecuritySolutionClient) UpdateSender(req *http.Request) (*http.R func (client IotSecuritySolutionClient) UpdateResponder(resp *http.Response) (result IoTSecuritySolutionModel, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v2.0/security/iotsecuritysolutions.go b/services/preview/security/mgmt/v2.0/security/iotsecuritysolutions.go index 42e6ca90dec6..993e06259a7c 100644 --- a/services/preview/security/mgmt/v2.0/security/iotsecuritysolutions.go +++ b/services/preview/security/mgmt/v2.0/security/iotsecuritysolutions.go @@ -118,7 +118,6 @@ func (client IoTSecuritySolutionsClient) ListSender(req *http.Request) (*http.Re func (client IoTSecuritySolutionsClient) ListResponder(resp *http.Response) (result IoTSecuritySolutionsList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalytics.go b/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalytics.go index dfdf863ccef7..bde4297ac2fa 100644 --- a/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalytics.go +++ b/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalytics.go @@ -122,7 +122,6 @@ func (client IoTSecuritySolutionsAnalyticsClient) GetAllSender(req *http.Request func (client IoTSecuritySolutionsAnalyticsClient) GetAllResponder(resp *http.Response) (result IoTSecuritySolutionAnalyticsModelList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -209,7 +208,6 @@ func (client IoTSecuritySolutionsAnalyticsClient) GetDefaultSender(req *http.Req func (client IoTSecuritySolutionsAnalyticsClient) GetDefaultResponder(resp *http.Response) (result IoTSecuritySolutionAnalyticsModel, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalyticsaggregatedalert.go b/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalyticsaggregatedalert.go index baefead50e1f..755eac8f5f40 100644 --- a/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalyticsaggregatedalert.go +++ b/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalyticsaggregatedalert.go @@ -126,7 +126,6 @@ func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) DismissSender(r func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) DismissResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByClosing()) result.Response = resp @@ -214,7 +213,6 @@ func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) GetSender(req * func (client IoTSecuritySolutionsAnalyticsAggregatedAlertClient) GetResponder(resp *http.Response) (result IoTSecurityAggregatedAlert, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalyticsaggregatedalerts.go b/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalyticsaggregatedalerts.go index 48270fdb3ef1..a548445362fc 100644 --- a/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalyticsaggregatedalerts.go +++ b/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalyticsaggregatedalerts.go @@ -129,7 +129,6 @@ func (client IoTSecuritySolutionsAnalyticsAggregatedAlertsClient) ListSender(req func (client IoTSecuritySolutionsAnalyticsAggregatedAlertsClient) ListResponder(resp *http.Response) (result IoTSecurityAggregatedAlertList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalyticsrecommendation.go b/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalyticsrecommendation.go index 672a2dc6b150..a519cb94a1a4 100644 --- a/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalyticsrecommendation.go +++ b/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalyticsrecommendation.go @@ -126,7 +126,6 @@ func (client IoTSecuritySolutionsAnalyticsRecommendationClient) GetSender(req *h func (client IoTSecuritySolutionsAnalyticsRecommendationClient) GetResponder(resp *http.Response) (result IoTSecurityAggregatedRecommendation, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalyticsrecommendations.go b/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalyticsrecommendations.go index 2ff348e050c7..b51a68e2327e 100644 --- a/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalyticsrecommendations.go +++ b/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsanalyticsrecommendations.go @@ -129,7 +129,6 @@ func (client IoTSecuritySolutionsAnalyticsRecommendationsClient) ListSender(req func (client IoTSecuritySolutionsAnalyticsRecommendationsClient) ListResponder(resp *http.Response) (result IoTSecurityAggregatedRecommendationList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsresourcegroup.go b/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsresourcegroup.go index 1efd724859ea..4816421d0590 100644 --- a/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsresourcegroup.go +++ b/services/preview/security/mgmt/v2.0/security/iotsecuritysolutionsresourcegroup.go @@ -127,7 +127,6 @@ func (client IoTSecuritySolutionsResourceGroupClient) ListSender(req *http.Reque func (client IoTSecuritySolutionsResourceGroupClient) ListResponder(resp *http.Response) (result IoTSecuritySolutionsList, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) diff --git a/services/preview/security/mgmt/v2.0/security/jitnetworkaccesspolicies.go b/services/preview/security/mgmt/v2.0/security/jitnetworkaccesspolicies.go index 82115488a008..1e0d94528bc3 100644 --- a/services/preview/security/mgmt/v2.0/security/jitnetworkaccesspolicies.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/locations.go b/services/preview/security/mgmt/v2.0/security/locations.go index cd6fdf271b9a..571c190ee208 100644 --- a/services/preview/security/mgmt/v2.0/security/locations.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/models.go b/services/preview/security/mgmt/v2.0/security/models.go index f09db4a30eef..731c30bee958 100644 --- a/services/preview/security/mgmt/v2.0/security/models.go +++ b/services/preview/security/mgmt/v2.0/security/models.go @@ -227,6 +227,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} +} + // DataSource enumerates the values for data source. type DataSource string @@ -355,6 +370,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} +} + // ExportData enumerates the values for export data. type ExportData string @@ -566,6 +594,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 @@ -708,6 +757,23 @@ func PossibleReportedSeverityValues() []ReportedSeverity { return []ReportedSeverity{High, Informational, Low, Medium} } +// 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 @@ -1777,6 +1843,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:"-"` @@ -3370,6 +3672,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"` @@ -5388,6 +5696,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. @@ -5410,8 +5720,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. @@ -7927,72 +8239,964 @@ 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 -} - -// AsAdditionalData is the BasicAdditionalData implementation for ServerVulnerabilityProperties. -func (svp ServerVulnerabilityProperties) AsAdditionalData() (*AdditionalData, bool) { - return nil, false -} - -// AsBasicAdditionalData is the BasicAdditionalData implementation for ServerVulnerabilityProperties. -func (svp ServerVulnerabilityProperties) AsBasicAdditionalData() (BasicAdditionalData, bool) { - return &svp, true -} - -// Setting represents a security setting in Azure Security Center. +// 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 + } + } + } + + return nil +} + +// 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"` +} + +// 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 + 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) +} + +// 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 - 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"` +} + +// SecureScoreControlDefinitionListIterator provides access to a complete listing of +// SecureScoreControlDefinitionItem values. +type SecureScoreControlDefinitionListIterator struct { + i int + 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 *SecureScoreControlDefinitionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoreControlDefinitionListIterator.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 *SecureScoreControlDefinitionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +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 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 SecureScoreControlDefinitionListIterator) Value() SecureScoreControlDefinitionItem { + if !iter.page.NotDone() { + return SecureScoreControlDefinitionItem{} + } + return iter.page.Values()[iter.i] +} + +// 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 (sscdl SecureScoreControlDefinitionList) IsEmpty() bool { + return sscdl.Value == nil || len(*sscdl.Value) == 0 +} + +// secureScoreControlDefinitionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +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(sscdl.NextLink))) +} + +// 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 *SecureScoreControlDefinitionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecureScoreControlDefinitionListPage.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.sscdl) + if err != nil { + return err + } + 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 *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 SecureScoreControlDefinitionListPage) NotDone() bool { + return !page.sscdl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +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 SecureScoreControlDefinitionListPage) Values() []SecureScoreControlDefinitionItem { + if page.sscdl.IsEmpty() { + return nil + } + return *page.sscdl.Value +} + +// Creates a new instance of the SecureScoreControlDefinitionListPage type. +func NewSecureScoreControlDefinitionListPage(getNextPage func(context.Context, SecureScoreControlDefinitionList) (SecureScoreControlDefinitionList, error)) SecureScoreControlDefinitionListPage { + return SecureScoreControlDefinitionListPage{fn: getNextPage} +} + +// 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"` +} + +// MarshalJSON is the custom marshaler for SecureScoreControlDetails. +func (sscd SecureScoreControlDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + 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 +} + +// 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' @@ -8562,6 +9766,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/v2.0/security/operations.go b/services/preview/security/mgmt/v2.0/security/operations.go index 916396d2b42f..4a28b4b47df6 100644 --- a/services/preview/security/mgmt/v2.0/security/operations.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/pricings.go b/services/preview/security/mgmt/v2.0/security/pricings.go index c1bf0d78ce22..4a7b973d2049 100644 --- a/services/preview/security/mgmt/v2.0/security/pricings.go +++ b/services/preview/security/mgmt/v2.0/security/pricings.go @@ -114,7 +114,6 @@ func (client PricingsClient) GetSender(req *http.Request) (*http.Response, error func (client PricingsClient) GetResponder(resp *http.Response) (result Pricing, err error) { err = autorest.Respond( resp, - client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) @@ -191,7 +190,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()) @@ -274,7 +272,6 @@ func (client PricingsClient) UpdateSender(req *http.Request) (*http.Response, er func (client PricingsClient) UpdateResponder(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/v2.0/security/regulatorycomplianceassessments.go b/services/preview/security/mgmt/v2.0/security/regulatorycomplianceassessments.go index 77deedf9991a..6c24ac9cca9e 100644 --- a/services/preview/security/mgmt/v2.0/security/regulatorycomplianceassessments.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/regulatorycompliancecontrols.go b/services/preview/security/mgmt/v2.0/security/regulatorycompliancecontrols.go index 197250e80444..75c1d438a3b2 100644 --- a/services/preview/security/mgmt/v2.0/security/regulatorycompliancecontrols.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/regulatorycompliancestandards.go b/services/preview/security/mgmt/v2.0/security/regulatorycompliancestandards.go index 4ef6e1a66d78..a711d560f34e 100644 --- a/services/preview/security/mgmt/v2.0/security/regulatorycompliancestandards.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/securescorecontroldefinitions.go b/services/preview/security/mgmt/v2.0/security/securescorecontroldefinitions.go new file mode 100644 index 000000000000..ea112d977ea4 --- /dev/null +++ b/services/preview/security/mgmt/v2.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/v2.0/security/securescorecontrols.go b/services/preview/security/mgmt/v2.0/security/securescorecontrols.go new file mode 100644 index 000000000000..4685aeb1b7a2 --- /dev/null +++ b/services/preview/security/mgmt/v2.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/v2.0/security/securescores.go b/services/preview/security/mgmt/v2.0/security/securescores.go new file mode 100644 index 000000000000..b9b5d5698196 --- /dev/null +++ b/services/preview/security/mgmt/v2.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/v2.0/security/securityapi/interfaces.go b/services/preview/security/mgmt/v2.0/security/securityapi/interfaces.go index 8ff4675042ab..a55e272b0775 100644 --- a/services/preview/security/mgmt/v2.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v2.0/security/securityapi/interfaces.go @@ -23,6 +23,35 @@ 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) + // 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) @@ -158,7 +187,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) @@ -268,14 +297,14 @@ var _ TasksClientAPI = (*security.TasksClient)(nil) type AlertsClientAPI interface { GetResourceGroupLevelAlerts(ctx context.Context, alertName string, resourceGroupName string) (result security.Alert, err error) GetSubscriptionLevelAlert(ctx context.Context, alertName string) (result security.Alert, err error) - List(ctx context.Context, filter string, selectParameter string, expand string) (result security.AlertListPage, err error) - ListComplete(ctx context.Context, filter string, selectParameter string, expand string) (result security.AlertListIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string) (result security.AlertListPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string) (result security.AlertListIterator, err error) - ListResourceGroupLevelAlertsByRegion(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string) (result security.AlertListPage, err error) - ListResourceGroupLevelAlertsByRegionComplete(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string) (result security.AlertListIterator, err error) - ListSubscriptionLevelAlertsByRegion(ctx context.Context, filter string, selectParameter string, expand string) (result security.AlertListPage, err error) - ListSubscriptionLevelAlertsByRegionComplete(ctx context.Context, filter string, selectParameter string, expand string) (result security.AlertListIterator, err error) + List(ctx context.Context, filter string, selectParameter string, expand string, autoDismissRuleName string) (result security.AlertListPage, err error) + ListComplete(ctx context.Context, filter string, selectParameter string, expand string, autoDismissRuleName string) (result security.AlertListIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string, autoDismissRuleName string) (result security.AlertListPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string, autoDismissRuleName string) (result security.AlertListIterator, err error) + ListResourceGroupLevelAlertsByRegion(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string, autoDismissRuleName string) (result security.AlertListPage, err error) + ListResourceGroupLevelAlertsByRegionComplete(ctx context.Context, resourceGroupName string, filter string, selectParameter string, expand string, autoDismissRuleName string) (result security.AlertListIterator, err error) + ListSubscriptionLevelAlertsByRegion(ctx context.Context, filter string, selectParameter string, expand string, autoDismissRuleName string) (result security.AlertListPage, err error) + ListSubscriptionLevelAlertsByRegionComplete(ctx context.Context, filter string, selectParameter string, expand string, autoDismissRuleName string) (result security.AlertListIterator, err error) UpdateResourceGroupLevelAlertStateToDismiss(ctx context.Context, alertName string, resourceGroupName string) (result autorest.Response, err error) UpdateResourceGroupLevelAlertStateToReactivate(ctx context.Context, alertName string, resourceGroupName string) (result autorest.Response, err error) UpdateSubscriptionLevelAlertStateToDismiss(ctx context.Context, alertName string) (result autorest.Response, err error) @@ -315,6 +344,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) @@ -364,3 +394,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/v2.0/security/settings.go b/services/preview/security/mgmt/v2.0/security/settings.go index f325c1261329..1f97596f454c 100644 --- a/services/preview/security/mgmt/v2.0/security/settings.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/subassessments.go b/services/preview/security/mgmt/v2.0/security/subassessments.go index 4b1a429a3e90..0698d13a7f60 100644 --- a/services/preview/security/mgmt/v2.0/security/subassessments.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/tasks.go b/services/preview/security/mgmt/v2.0/security/tasks.go index 5215444c7a73..e224a9a5e10f 100644 --- a/services/preview/security/mgmt/v2.0/security/tasks.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/topology.go b/services/preview/security/mgmt/v2.0/security/topology.go index 5a020bc9863c..899f20b0cf05 100644 --- a/services/preview/security/mgmt/v2.0/security/topology.go +++ b/services/preview/security/mgmt/v2.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/v2.0/security/version.go b/services/preview/security/mgmt/v2.0/security/version.go index 95435f54dd8b..7b1b48bca005 100644 --- a/services/preview/security/mgmt/v2.0/security/version.go +++ b/services/preview/security/mgmt/v2.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/v2.0" + return "Azure-SDK-For-Go/" + Version() + " security/v2.0" } // Version returns the semantic version (see http://semver.org) of the client. diff --git a/services/preview/security/mgmt/v2.0/security/workspacesettings.go b/services/preview/security/mgmt/v2.0/security/workspacesettings.go index e34ac16bdae2..b8fa662d8c0e 100644 --- a/services/preview/security/mgmt/v2.0/security/workspacesettings.go +++ b/services/preview/security/mgmt/v2.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())