diff --git a/profiles/preview/preview/securityinsight/mgmt/securityinsight/models.go b/profiles/preview/preview/securityinsight/mgmt/securityinsight/models.go index 76762b15a8bc..8fd7b86edf04 100644 --- a/profiles/preview/preview/securityinsight/mgmt/securityinsight/models.go +++ b/profiles/preview/preview/securityinsight/mgmt/securityinsight/models.go @@ -192,11 +192,8 @@ type AggregationsKind1 = original.AggregationsKind1 type AggregationsModel = original.AggregationsModel type AlertRule = original.AlertRule type AlertRuleKind1 = original.AlertRuleKind1 -type AlertRuleModel = original.AlertRuleModel type AlertRulesClient = original.AlertRulesClient type AlertRulesList = original.AlertRulesList -type AlertRulesListIterator = original.AlertRulesListIterator -type AlertRulesListPage = original.AlertRulesListPage type AlertsDataTypeOfDataConnector = original.AlertsDataTypeOfDataConnector type AlertsDataTypeOfDataConnectorAlerts = original.AlertsDataTypeOfDataConnectorAlerts type BaseClient = original.BaseClient @@ -264,6 +261,9 @@ type ProductSettingsClient = original.ProductSettingsClient type Resource = original.Resource type ScheduledAlertRule = original.ScheduledAlertRule type ScheduledAlertRuleProperties = original.ScheduledAlertRuleProperties +type ScheduledAlertRulesList = original.ScheduledAlertRulesList +type ScheduledAlertRulesListIterator = original.ScheduledAlertRulesListIterator +type ScheduledAlertRulesListPage = original.ScheduledAlertRulesListPage type Settings = original.Settings type SettingsKind = original.SettingsKind type SettingsModel = original.SettingsModel @@ -298,12 +298,6 @@ func NewAlertRulesClient(subscriptionID string) AlertRulesClient { func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) AlertRulesClient { return original.NewAlertRulesClientWithBaseURI(baseURI, subscriptionID) } -func NewAlertRulesListIterator(page AlertRulesListPage) AlertRulesListIterator { - return original.NewAlertRulesListIterator(page) -} -func NewAlertRulesListPage(getNextPage func(context.Context, AlertRulesList) (AlertRulesList, error)) AlertRulesListPage { - return original.NewAlertRulesListPage(getNextPage) -} func NewBookmarkListIterator(page BookmarkListPage) BookmarkListIterator { return original.NewBookmarkListIterator(page) } @@ -388,6 +382,12 @@ func NewProductSettingsClient(subscriptionID string) ProductSettingsClient { func NewProductSettingsClientWithBaseURI(baseURI string, subscriptionID string) ProductSettingsClient { return original.NewProductSettingsClientWithBaseURI(baseURI, subscriptionID) } +func NewScheduledAlertRulesListIterator(page ScheduledAlertRulesListPage) ScheduledAlertRulesListIterator { + return original.NewScheduledAlertRulesListIterator(page) +} +func NewScheduledAlertRulesListPage(getNextPage func(context.Context, ScheduledAlertRulesList) (ScheduledAlertRulesList, error)) ScheduledAlertRulesListPage { + return original.NewScheduledAlertRulesListPage(getNextPage) +} func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return original.NewWithBaseURI(baseURI, subscriptionID) } diff --git a/services/preview/securityinsight/mgmt/2017-08-01-preview/securityinsight/alertrules.go b/services/preview/securityinsight/mgmt/2017-08-01-preview/securityinsight/alertrules.go index 4a6b70f60563..ae8df138d3d9 100644 --- a/services/preview/securityinsight/mgmt/2017-08-01-preview/securityinsight/alertrules.go +++ b/services/preview/securityinsight/mgmt/2017-08-01-preview/securityinsight/alertrules.go @@ -41,7 +41,7 @@ func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) Alert return AlertRulesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// CreateOrUpdate creates or updates the alert rule. +// CreateOrUpdate creates or updates the scheduled alert rule. // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. The name is case // insensitive. @@ -49,8 +49,8 @@ func NewAlertRulesClientWithBaseURI(baseURI string, subscriptionID string) Alert // Microsoft.OperationalInsights. // workspaceName - the name of the workspace. // ruleID - alert rule ID -// alertRule - the alert rule -func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string, ruleID string, alertRule BasicAlertRule) (result AlertRuleModel, err error) { +// scheduledAlertRule - the scheduled alert rule +func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string, ruleID string, scheduledAlertRule ScheduledAlertRule) (result ScheduledAlertRule, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.CreateOrUpdate") defer func() { @@ -70,11 +70,23 @@ func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroup {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: scheduledAlertRule, + Constraints: []validation.Constraint{{Target: "scheduledAlertRule.ScheduledAlertRuleProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "scheduledAlertRule.ScheduledAlertRuleProperties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "scheduledAlertRule.ScheduledAlertRuleProperties.Description", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "scheduledAlertRule.ScheduledAlertRuleProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "scheduledAlertRule.ScheduledAlertRuleProperties.Query", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "scheduledAlertRule.ScheduledAlertRuleProperties.QueryFrequency", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "scheduledAlertRule.ScheduledAlertRuleProperties.QueryPeriod", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "scheduledAlertRule.ScheduledAlertRuleProperties.TriggerThreshold", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "scheduledAlertRule.ScheduledAlertRuleProperties.SuppressionEnabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "scheduledAlertRule.ScheduledAlertRuleProperties.SuppressionDuration", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { return result, validation.NewError("securityinsight.AlertRulesClient", "CreateOrUpdate", err.Error()) } - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleID, alertRule) + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleID, scheduledAlertRule) if err != nil { err = autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "CreateOrUpdate", nil, "Failure preparing request") return @@ -96,7 +108,7 @@ func (client AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroup } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string, ruleID string, alertRule BasicAlertRule) (*http.Request, error) { +func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string, ruleID string, scheduledAlertRule ScheduledAlertRule) (*http.Request, error) { pathParameters := map[string]interface{}{ "operationalInsightsResourceProvider": autorest.Encode("path", operationalInsightsResourceProvider), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -115,7 +127,7 @@ func (client AlertRulesClient) CreateOrUpdatePreparer(ctx context.Context, resou autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}", pathParameters), - autorest.WithJSON(alertRule), + autorest.WithJSON(scheduledAlertRule), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -129,7 +141,7 @@ func (client AlertRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Re // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. -func (client AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (result AlertRuleModel, err error) { +func (client AlertRulesClient) CreateOrUpdateResponder(resp *http.Response) (result ScheduledAlertRule, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -433,7 +445,7 @@ func (client AlertRulesClient) DeleteActionResponder(resp *http.Response) (resul return } -// Get gets the alert rule. +// Get gets the scheduled alert rule. // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. The name is case // insensitive. @@ -441,7 +453,7 @@ func (client AlertRulesClient) DeleteActionResponder(resp *http.Response) (resul // Microsoft.OperationalInsights. // workspaceName - the name of the workspace. // ruleID - alert rule ID -func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string, ruleID string) (result AlertRuleModel, err error) { +func (client AlertRulesClient) Get(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string, ruleID string) (result ScheduledAlertRule, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.Get") defer func() { @@ -518,7 +530,7 @@ func (client AlertRulesClient) GetSender(req *http.Request) (*http.Response, err // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client AlertRulesClient) GetResponder(resp *http.Response) (result AlertRuleModel, err error) { +func (client AlertRulesClient) GetResponder(resp *http.Response) (result ScheduledAlertRule, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -627,20 +639,20 @@ func (client AlertRulesClient) GetActionResponder(resp *http.Response) (result A return } -// List gets all alert rules. +// List gets all scheduled alert rules. // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. The name is case // insensitive. // operationalInsightsResourceProvider - the namespace of workspaces resource provider- // Microsoft.OperationalInsights. // workspaceName - the name of the workspace. -func (client AlertRulesClient) List(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string) (result AlertRulesListPage, err error) { +func (client AlertRulesClient) List(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string) (result ScheduledAlertRulesListPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.List") defer func() { sc := -1 - if result.arl.Response.Response != nil { - sc = result.arl.Response.Response.StatusCode + if result.sarl.Response.Response != nil { + sc = result.sarl.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -667,12 +679,12 @@ func (client AlertRulesClient) List(ctx context.Context, resourceGroupName strin resp, err := client.ListSender(req) if err != nil { - result.arl.Response = autorest.Response{Response: resp} + result.sarl.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "List", resp, "Failure sending request") return } - result.arl, err = client.ListResponder(resp) + result.sarl, err = client.ListResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "List", resp, "Failure responding to request") } @@ -711,7 +723,7 @@ func (client AlertRulesClient) ListSender(req *http.Request) (*http.Response, er // ListResponder handles the response to the List request. The method always // closes the http.Response Body. -func (client AlertRulesClient) ListResponder(resp *http.Response) (result AlertRulesList, err error) { +func (client AlertRulesClient) ListResponder(resp *http.Response) (result ScheduledAlertRulesList, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -723,8 +735,8 @@ func (client AlertRulesClient) ListResponder(resp *http.Response) (result AlertR } // listNextResults retrieves the next set of results, if any. -func (client AlertRulesClient) listNextResults(ctx context.Context, lastResults AlertRulesList) (result AlertRulesList, err error) { - req, err := lastResults.alertRulesListPreparer(ctx) +func (client AlertRulesClient) listNextResults(ctx context.Context, lastResults ScheduledAlertRulesList) (result ScheduledAlertRulesList, err error) { + req, err := lastResults.scheduledAlertRulesListPreparer(ctx) if err != nil { return result, autorest.NewErrorWithError(err, "securityinsight.AlertRulesClient", "listNextResults", nil, "Failure preparing next results request") } @@ -744,7 +756,7 @@ func (client AlertRulesClient) listNextResults(ctx context.Context, lastResults } // ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client AlertRulesClient) ListComplete(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string) (result AlertRulesListIterator, err error) { +func (client AlertRulesClient) ListComplete(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string) (result ScheduledAlertRulesListIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesClient.List") defer func() { diff --git a/services/preview/securityinsight/mgmt/2017-08-01-preview/securityinsight/cases.go b/services/preview/securityinsight/mgmt/2017-08-01-preview/securityinsight/cases.go index 1f4a027471e5..9281c0bd67c0 100644 --- a/services/preview/securityinsight/mgmt/2017-08-01-preview/securityinsight/cases.go +++ b/services/preview/securityinsight/mgmt/2017-08-01-preview/securityinsight/cases.go @@ -70,10 +70,7 @@ func (client CasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, {TargetValue: workspaceName, Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, - {TargetValue: caseParameter, - Constraints: []validation.Constraint{{Target: "caseParameter.CaseProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "caseParameter.CaseProperties.Title", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + {Target: "workspaceName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("securityinsight.CasesClient", "CreateOrUpdate", err.Error()) } diff --git a/services/preview/securityinsight/mgmt/2017-08-01-preview/securityinsight/models.go b/services/preview/securityinsight/mgmt/2017-08-01-preview/securityinsight/models.go index dac49f34e0b1..3d58a03e5f90 100644 --- a/services/preview/securityinsight/mgmt/2017-08-01-preview/securityinsight/models.go +++ b/services/preview/securityinsight/mgmt/2017-08-01-preview/securityinsight/models.go @@ -996,7 +996,6 @@ type BasicAlertRule interface { // AlertRule alert rule. type AlertRule struct { - autorest.Response `json:"-"` // ID - Azure resource Id ID *string `json:"id,omitempty"` // Type - Azure resource type @@ -1089,26 +1088,8 @@ type AlertRuleKind1 struct { Kind AlertRuleKind `json:"kind,omitempty"` } -// AlertRuleModel ... -type AlertRuleModel struct { - autorest.Response `json:"-"` - Value BasicAlertRule `json:"value,omitempty"` -} - -// UnmarshalJSON is the custom unmarshaler for AlertRuleModel struct. -func (arm *AlertRuleModel) UnmarshalJSON(body []byte) error { - ar, err := unmarshalBasicAlertRule(body) - if err != nil { - return err - } - arm.Value = ar - - return nil -} - // AlertRulesList list all the alert rules. type AlertRulesList struct { - autorest.Response `json:"-"` // NextLink - URL to fetch the next set of alert rules. NextLink *string `json:"nextLink,omitempty"` // Value - Array of alert rules. @@ -1147,143 +1128,6 @@ func (arl *AlertRulesList) UnmarshalJSON(body []byte) error { return nil } -// AlertRulesListIterator provides access to a complete listing of AlertRule values. -type AlertRulesListIterator struct { - i int - page AlertRulesListPage -} - -// 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 *AlertRulesListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesListIterator.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 *AlertRulesListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AlertRulesListIterator) 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 AlertRulesListIterator) Response() AlertRulesList { - 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 AlertRulesListIterator) Value() BasicAlertRule { - if !iter.page.NotDone() { - return AlertRule{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AlertRulesListIterator type. -func NewAlertRulesListIterator(page AlertRulesListPage) AlertRulesListIterator { - return AlertRulesListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (arl AlertRulesList) IsEmpty() bool { - return arl.Value == nil || len(*arl.Value) == 0 -} - -// alertRulesListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (arl AlertRulesList) alertRulesListPreparer(ctx context.Context) (*http.Request, error) { - if arl.NextLink == nil || len(to.String(arl.NextLink)) < 1 { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(arl.NextLink))) -} - -// AlertRulesListPage contains a page of BasicAlertRule values. -type AlertRulesListPage struct { - fn func(context.Context, AlertRulesList) (AlertRulesList, error) - arl AlertRulesList -} - -// 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 *AlertRulesListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertRulesListPage.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.arl) - if err != nil { - return err - } - page.arl = 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 *AlertRulesListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AlertRulesListPage) NotDone() bool { - return !page.arl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AlertRulesListPage) Response() AlertRulesList { - return page.arl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AlertRulesListPage) Values() []BasicAlertRule { - if page.arl.IsEmpty() { - return nil - } - return *page.arl.Value -} - -// Creates a new instance of the AlertRulesListPage type. -func NewAlertRulesListPage(getNextPage func(context.Context, AlertRulesList) (AlertRulesList, error)) AlertRulesListPage { - return AlertRulesListPage{fn: getNextPage} -} - // AlertsDataTypeOfDataConnector alerts data type for data connectors. type AlertsDataTypeOfDataConnector struct { // Alerts - Alerts data type connection. @@ -1956,27 +1800,27 @@ func NewCaseListPage(getNextPage func(context.Context, CaseList) (CaseList, erro // CaseProperties describes case properties type CaseProperties struct { // LastUpdatedTimeUtc - The last time the case was updated - LastUpdatedTimeUtc *date.Time `json:"lastUpdatedTimeUtc,omitempty"` + LastUpdatedTimeUtc *date.Time `json:"LastUpdatedTimeUtc,omitempty"` // CreatedTimeUtc - The time the case was created - CreatedTimeUtc *date.Time `json:"createdTimeUtc,omitempty"` + CreatedTimeUtc *date.Time `json:"CreatedTimeUtc,omitempty"` // EndTimeUtc - The end time of the case - EndTimeUtc *date.Time `json:"endTimeUtc,omitempty"` + EndTimeUtc *date.Time `json:"EndTimeUtc,omitempty"` // StartTimeUtc - The start time of the case - StartTimeUtc *date.Time `json:"startTimeUtc,omitempty"` + StartTimeUtc *date.Time `json:"StartTimeUtc,omitempty"` // Labels - List of labels relevant to this case - Labels *[]string `json:"labels,omitempty"` + Labels *[]string `json:"Labels,omitempty"` // Description - The description of the case - Description *string `json:"description,omitempty"` + Description *string `json:"Description,omitempty"` // Title - The title of the case - Title *string `json:"title,omitempty"` + Title *string `json:"Title,omitempty"` // AssignedTo - Describes a user that the case is assigned to - AssignedTo *UserInfo `json:"assignedTo,omitempty"` + AssignedTo *UserInfo `json:"AssignedTo,omitempty"` // Severity - The severity of the case. Possible values include: 'CaseSeverityCritical', 'CaseSeverityHigh', 'CaseSeverityMedium', 'CaseSeverityLow', 'CaseSeverityInformational' - Severity CaseSeverity `json:"severity,omitempty"` + Severity CaseSeverity `json:"Severity,omitempty"` // Status - The status of the case. Possible values include: 'Draft', 'Open', 'InProgress', 'Closed' - Status CaseStatus `json:"status,omitempty"` + Status CaseStatus `json:"Status,omitempty"` // CloseReason - The reason the case was closed. Possible values include: 'Resolved', 'Dismissed', 'Other' - CloseReason CloseReason `json:"closeReason,omitempty"` + CloseReason CloseReason `json:"CloseReason,omitempty"` } // CloudError error response structure. @@ -3703,6 +3547,7 @@ type Resource struct { // ScheduledAlertRule represents scheduled alert rule. type ScheduledAlertRule struct { + autorest.Response `json:"-"` // ScheduledAlertRuleProperties - Scheduled alert rule properties *ScheduledAlertRuleProperties `json:"properties,omitempty"` // ID - Azure resource Id @@ -3854,6 +3699,152 @@ type ScheduledAlertRuleProperties struct { LastModifiedUtc *string `json:"lastModifiedUtc,omitempty"` } +// ScheduledAlertRulesList list all the schdeuled alert rules. +type ScheduledAlertRulesList struct { + autorest.Response `json:"-"` + // NextLink - URL to fetch the next set of scheduled alert rules. + NextLink *string `json:"nextLink,omitempty"` + // Value - Array of scheduled alert rules. + Value *[]ScheduledAlertRule `json:"value,omitempty"` +} + +// ScheduledAlertRulesListIterator provides access to a complete listing of ScheduledAlertRule values. +type ScheduledAlertRulesListIterator struct { + i int + page ScheduledAlertRulesListPage +} + +// 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 *ScheduledAlertRulesListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledAlertRulesListIterator.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 *ScheduledAlertRulesListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ScheduledAlertRulesListIterator) 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 ScheduledAlertRulesListIterator) Response() ScheduledAlertRulesList { + 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 ScheduledAlertRulesListIterator) Value() ScheduledAlertRule { + if !iter.page.NotDone() { + return ScheduledAlertRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ScheduledAlertRulesListIterator type. +func NewScheduledAlertRulesListIterator(page ScheduledAlertRulesListPage) ScheduledAlertRulesListIterator { + return ScheduledAlertRulesListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sarl ScheduledAlertRulesList) IsEmpty() bool { + return sarl.Value == nil || len(*sarl.Value) == 0 +} + +// scheduledAlertRulesListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sarl ScheduledAlertRulesList) scheduledAlertRulesListPreparer(ctx context.Context) (*http.Request, error) { + if sarl.NextLink == nil || len(to.String(sarl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sarl.NextLink))) +} + +// ScheduledAlertRulesListPage contains a page of ScheduledAlertRule values. +type ScheduledAlertRulesListPage struct { + fn func(context.Context, ScheduledAlertRulesList) (ScheduledAlertRulesList, error) + sarl ScheduledAlertRulesList +} + +// 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 *ScheduledAlertRulesListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScheduledAlertRulesListPage.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.sarl) + if err != nil { + return err + } + page.sarl = 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 *ScheduledAlertRulesListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ScheduledAlertRulesListPage) NotDone() bool { + return !page.sarl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ScheduledAlertRulesListPage) Response() ScheduledAlertRulesList { + return page.sarl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ScheduledAlertRulesListPage) Values() []ScheduledAlertRule { + if page.sarl.IsEmpty() { + return nil + } + return *page.sarl.Value +} + +// Creates a new instance of the ScheduledAlertRulesListPage type. +func NewScheduledAlertRulesListPage(getNextPage func(context.Context, ScheduledAlertRulesList) (ScheduledAlertRulesList, error)) ScheduledAlertRulesListPage { + return ScheduledAlertRulesListPage{fn: getNextPage} +} + // BasicSettings the Setting. type BasicSettings interface { AsUebaSettings() (*UebaSettings, bool) diff --git a/services/preview/securityinsight/mgmt/2017-08-01-preview/securityinsight/securityinsightapi/interfaces.go b/services/preview/securityinsight/mgmt/2017-08-01-preview/securityinsight/securityinsightapi/interfaces.go index db0717a1bd3d..49e4b31e029d 100644 --- a/services/preview/securityinsight/mgmt/2017-08-01-preview/securityinsight/securityinsightapi/interfaces.go +++ b/services/preview/securityinsight/mgmt/2017-08-01-preview/securityinsight/securityinsightapi/interfaces.go @@ -32,13 +32,13 @@ var _ OperationsClientAPI = (*securityinsight.OperationsClient)(nil) // AlertRulesClientAPI contains the set of methods on the AlertRulesClient type. type AlertRulesClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string, ruleID string, alertRule securityinsight.BasicAlertRule) (result securityinsight.AlertRuleModel, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string, ruleID string, scheduledAlertRule securityinsight.ScheduledAlertRule) (result securityinsight.ScheduledAlertRule, err error) CreateOrUpdateAction(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string, ruleID string, actionID string, action securityinsight.Action) (result securityinsight.Action, err error) Delete(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string, ruleID string) (result autorest.Response, err error) DeleteAction(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string, ruleID string, actionID string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string, ruleID string) (result securityinsight.AlertRuleModel, err error) + Get(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string, ruleID string) (result securityinsight.ScheduledAlertRule, err error) GetAction(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string, ruleID string, actionID string) (result securityinsight.Action, err error) - List(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string) (result securityinsight.AlertRulesListPage, err error) + List(ctx context.Context, resourceGroupName string, operationalInsightsResourceProvider string, workspaceName string) (result securityinsight.ScheduledAlertRulesListPage, err error) } var _ AlertRulesClientAPI = (*securityinsight.AlertRulesClient)(nil)