diff --git a/profiles/preview/preview/security/mgmt/security/models.go b/profiles/preview/preview/security/mgmt/security/models.go index 9971446ce1d6..34926a49a44b 100644 --- a/profiles/preview/preview/security/mgmt/security/models.go +++ b/profiles/preview/preview/security/mgmt/security/models.go @@ -45,6 +45,19 @@ const ( Remove Action = original.Remove ) +type ActionType = original.ActionType + +const ( + ActionTypeAutomationAction ActionType = original.ActionTypeAutomationAction + ActionTypeEventHub ActionType = original.ActionTypeEventHub + ActionTypeEventHub1 ActionType = original.ActionTypeEventHub1 + ActionTypeEventHub2 ActionType = original.ActionTypeEventHub2 + ActionTypeLogicApp ActionType = original.ActionTypeLogicApp + ActionTypeLogicApp1 ActionType = original.ActionTypeLogicApp1 + ActionTypeLogicApp2 ActionType = original.ActionTypeLogicApp2 + ActionTypeWorkspace ActionType = original.ActionTypeWorkspace +) + type AlertNotifications = original.AlertNotifications const ( @@ -134,6 +147,13 @@ const ( EnforcementMode1None EnforcementMode1 = original.EnforcementMode1None ) +type EventSource = original.EventSource + +const ( + Alerts EventSource = original.Alerts + Assessments EventSource = original.Assessments +) + type Exe = original.Exe const ( @@ -212,6 +232,20 @@ const ( MsiNone Msi = original.MsiNone ) +type Operator = original.Operator + +const ( + Contains Operator = original.Contains + EndsWith Operator = original.EndsWith + Equals Operator = original.Equals + GreaterThan Operator = original.GreaterThan + GreaterThanOrEqualTo Operator = original.GreaterThanOrEqualTo + LesserThan Operator = original.LesserThan + LesserThanOrEqualTo Operator = original.LesserThanOrEqualTo + NotEquals Operator = original.NotEquals + StartsWith Operator = original.StartsWith +) + type PricingTier = original.PricingTier const ( @@ -219,6 +253,15 @@ const ( Standard PricingTier = original.Standard ) +type PropertyType = original.PropertyType + +const ( + Boolean PropertyType = original.Boolean + Integer PropertyType = original.Integer + Number PropertyType = original.Number + String PropertyType = original.String +) + type Protocol = original.Protocol const ( @@ -409,8 +452,8 @@ const ( type ValueType = original.ValueType const ( - IPCidr ValueType = original.IPCidr - String ValueType = original.String + ValueTypeIPCidr ValueType = original.ValueTypeIPCidr + ValueTypeString ValueType = original.ValueTypeString ) type AadConnectivityState1 = original.AadConnectivityState1 @@ -453,10 +496,33 @@ type AutoProvisioningSettingListIterator = original.AutoProvisioningSettingListI type AutoProvisioningSettingListPage = original.AutoProvisioningSettingListPage type AutoProvisioningSettingProperties = original.AutoProvisioningSettingProperties type AutoProvisioningSettingsClient = original.AutoProvisioningSettingsClient +type Automation = original.Automation +type AutomationAction = original.AutomationAction +type AutomationActionEventHub = original.AutomationActionEventHub +type AutomationActionEventHubInput = original.AutomationActionEventHubInput +type AutomationActionEventHubOutput = original.AutomationActionEventHubOutput +type AutomationActionLogicApp = original.AutomationActionLogicApp +type AutomationActionLogicAppInput = original.AutomationActionLogicAppInput +type AutomationActionLogicAppOutput = original.AutomationActionLogicAppOutput +type AutomationActionWorkspace = original.AutomationActionWorkspace +type AutomationList = original.AutomationList +type AutomationListIterator = original.AutomationListIterator +type AutomationListPage = original.AutomationListPage +type AutomationMetadata = original.AutomationMetadata +type AutomationProperties = original.AutomationProperties +type AutomationRuleSet = original.AutomationRuleSet +type AutomationScope = original.AutomationScope +type AutomationSource = original.AutomationSource +type AutomationTriggeringRule = original.AutomationTriggeringRule +type AutomationValidationStatus = original.AutomationValidationStatus +type AutomationsClient = original.AutomationsClient type AwsResourceDetails = original.AwsResourceDetails type AzureResourceDetails = original.AzureResourceDetails type BaseClient = original.BaseClient type BasicAdditionalData = original.BasicAdditionalData +type BasicAutomationAction = original.BasicAutomationAction +type BasicAutomationActionEventHub = original.BasicAutomationActionEventHub +type BasicAutomationActionLogicApp = original.BasicAutomationActionLogicApp type BasicExternalSecuritySolution = original.BasicExternalSecuritySolution type BasicResourceDetails = original.BasicResourceDetails type CVE = original.CVE @@ -504,6 +570,7 @@ type DiscoveredSecuritySolutionListIterator = original.DiscoveredSecuritySolutio type DiscoveredSecuritySolutionListPage = original.DiscoveredSecuritySolutionListPage type DiscoveredSecuritySolutionProperties = original.DiscoveredSecuritySolutionProperties type DiscoveredSecuritySolutionsClient = original.DiscoveredSecuritySolutionsClient +type ETag = original.ETag type ExternalSecuritySolution = original.ExternalSecuritySolution type ExternalSecuritySolutionKind1 = original.ExternalSecuritySolutionKind1 type ExternalSecuritySolutionList = original.ExternalSecuritySolutionList @@ -620,6 +687,7 @@ type SubAssessmentListPage = original.SubAssessmentListPage type SubAssessmentProperties = original.SubAssessmentProperties type SubAssessmentStatus = original.SubAssessmentStatus type SubAssessmentsClient = original.SubAssessmentsClient +type Tags = original.Tags type TagsResource = original.TagsResource type Task = original.Task type TaskList = original.TaskList @@ -639,6 +707,7 @@ type TopologyResourceProperties = original.TopologyResourceProperties type TopologySingleResource = original.TopologySingleResource type TopologySingleResourceChild = original.TopologySingleResourceChild type TopologySingleResourceParent = original.TopologySingleResourceParent +type TrackedResource = original.TrackedResource type UpdateIoTSecuritySolutionProperties = original.UpdateIoTSecuritySolutionProperties type UpdateIotSecuritySolutionData = original.UpdateIotSecuritySolutionData type UserDefinedResourcesProperties = original.UserDefinedResourcesProperties @@ -709,6 +778,18 @@ func NewAutoProvisioningSettingsClient(subscriptionID string, ascLocation string func NewAutoProvisioningSettingsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) AutoProvisioningSettingsClient { return original.NewAutoProvisioningSettingsClientWithBaseURI(baseURI, subscriptionID, ascLocation) } +func NewAutomationListIterator(page AutomationListPage) AutomationListIterator { + return original.NewAutomationListIterator(page) +} +func NewAutomationListPage(getNextPage func(context.Context, AutomationList) (AutomationList, error)) AutomationListPage { + return original.NewAutomationListPage(getNextPage) +} +func NewAutomationsClient(subscriptionID string, ascLocation string) AutomationsClient { + return original.NewAutomationsClient(subscriptionID, ascLocation) +} +func NewAutomationsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) AutomationsClient { + return original.NewAutomationsClientWithBaseURI(baseURI, subscriptionID, ascLocation) +} func NewComplianceListIterator(page ComplianceListPage) ComplianceListIterator { return original.NewComplianceListIterator(page) } @@ -979,6 +1060,9 @@ func NewWorkspaceSettingsClientWithBaseURI(baseURI string, subscriptionID string func PossibleAadConnectivityStateValues() []AadConnectivityState { return original.PossibleAadConnectivityStateValues() } +func PossibleActionTypeValues() []ActionType { + return original.PossibleActionTypeValues() +} func PossibleActionValues() []Action { return original.PossibleActionValues() } @@ -1015,6 +1099,9 @@ func PossibleEnforcementMode1Values() []EnforcementMode1 { func PossibleEnforcementModeValues() []EnforcementMode { return original.PossibleEnforcementModeValues() } +func PossibleEventSourceValues() []EventSource { + return original.PossibleEventSourceValues() +} func PossibleExeValues() []Exe { return original.PossibleExeValues() } @@ -1042,9 +1129,15 @@ func PossibleKindEnumValues() []KindEnum { func PossibleMsiValues() []Msi { return original.PossibleMsiValues() } +func PossibleOperatorValues() []Operator { + return original.PossibleOperatorValues() +} func PossiblePricingTierValues() []PricingTier { return original.PossiblePricingTierValues() } +func PossiblePropertyTypeValues() []PropertyType { + return original.PossiblePropertyTypeValues() +} func PossibleProtocolValues() []Protocol { return original.PossibleProtocolValues() } diff --git a/profiles/preview/preview/security/mgmt/security/securityapi/models.go b/profiles/preview/preview/security/mgmt/security/securityapi/models.go index 6291ca8035f2..7e83ea774e55 100644 --- a/profiles/preview/preview/security/mgmt/security/securityapi/models.go +++ b/profiles/preview/preview/security/mgmt/security/securityapi/models.go @@ -26,6 +26,7 @@ type AdvancedThreatProtectionClientAPI = original.AdvancedThreatProtectionClient type AlertsClientAPI = original.AlertsClientAPI type AllowedConnectionsClientAPI = original.AllowedConnectionsClientAPI type AutoProvisioningSettingsClientAPI = original.AutoProvisioningSettingsClientAPI +type AutomationsClientAPI = original.AutomationsClientAPI type ComplianceResultsClientAPI = original.ComplianceResultsClientAPI type CompliancesClientAPI = original.CompliancesClientAPI type ContactsClientAPI = original.ContactsClientAPI diff --git a/services/preview/security/mgmt/v1.0/security/automations.go b/services/preview/security/mgmt/v1.0/security/automations.go new file mode 100644 index 000000000000..605cb35a072d --- /dev/null +++ b/services/preview/security/mgmt/v1.0/security/automations.go @@ -0,0 +1,643 @@ +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" +) + +// AutomationsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type AutomationsClient struct { + BaseClient +} + +// NewAutomationsClient creates an instance of the AutomationsClient client. +func NewAutomationsClient(subscriptionID string, ascLocation string) AutomationsClient { + return NewAutomationsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewAutomationsClientWithBaseURI creates an instance of the AutomationsClient client. +func NewAutomationsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) AutomationsClient { + return AutomationsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// CreateOrUpdate creates or updates a security automation. If a security automation is already created and a +// subsequent request is issued for the same automation id, then it will be updated. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// automationName - the security automation name. +// automation - the security automation resource +func (client AutomationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationName string, automation Automation) (result Automation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AutomationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationName, automation) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AutomationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationName string, automation Automation) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationName": autorest.Encode("path", automationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}", pathParameters), + autorest.WithJSON(automation), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AutomationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +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()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a security automation. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// automationName - the security automation name. +func (client AutomationsClient) Delete(ctx context.Context, resourceGroupName string, automationName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AutomationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, automationName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AutomationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationName": autorest.Encode("path", automationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}", 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 AutomationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +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 + return +} + +// Get retrieves information about the model of a security automation. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// automationName - the security automation name. +func (client AutomationsClient) Get(ctx context.Context, resourceGroupName string, automationName string) (result Automation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AutomationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, automationName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "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.AutomationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AutomationsClient) GetPreparer(ctx context.Context, resourceGroupName string, automationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationName": autorest.Encode("path", automationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}", 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 AutomationsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +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()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the security automations in the specified subscription. Use the 'nextLink' property in the response +// to get the next page of security automations for the specified subscription. +func (client AutomationsClient) List(ctx context.Context) (result AutomationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.List") + defer func() { + sc := -1 + if result.al.Response.Response != nil { + sc = result.al.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.AutomationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.al.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "List", resp, "Failure sending request") + return + } + + result.al, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AutomationsClient) ListPreparer(ctx context.Context) (*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, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/automations", 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 AutomationsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +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()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AutomationsClient) listNextResults(ctx context.Context, lastResults AutomationList) (result AutomationList, err error) { + req, err := lastResults.automationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.AutomationsClient", "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.AutomationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AutomationsClient) ListComplete(ctx context.Context) (result AutomationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.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 +} + +// ListByResourceGroup lists all the security automations in the specified resource group. Use the 'nextLink' property +// in the response to get the next page of security automations for the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +func (client AutomationsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutomationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.al.Response.Response != nil { + sc = result.al.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AutomationsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.al.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.al, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AutomationsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AutomationsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +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()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client AutomationsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AutomationList) (result AutomationList, err error) { + req, err := lastResults.automationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.AutomationsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.AutomationsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AutomationsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AutomationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.ListByResourceGroup") + 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.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Validate validates the security automation model before create or update. Any validation errors are returned to the +// client. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// automationName - the security automation name. +// automation - the security automation resource +func (client AutomationsClient) Validate(ctx context.Context, resourceGroupName string, automationName string, automation Automation) (result AutomationValidationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.Validate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AutomationsClient", "Validate", err.Error()) + } + + req, err := client.ValidatePreparer(ctx, resourceGroupName, automationName, automation) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Validate", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Validate", resp, "Failure sending request") + return + } + + result, err = client.ValidateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Validate", resp, "Failure responding to request") + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client AutomationsClient) ValidatePreparer(ctx context.Context, resourceGroupName string, automationName string, automation Automation) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationName": autorest.Encode("path", automationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}/validate", pathParameters), + autorest.WithJSON(automation), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client AutomationsClient) ValidateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +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()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/security/mgmt/v1.0/security/models.go b/services/preview/security/mgmt/v1.0/security/models.go index f19291c333e0..6e0742f71f59 100644 --- a/services/preview/security/mgmt/v1.0/security/models.go +++ b/services/preview/security/mgmt/v1.0/security/models.go @@ -66,6 +66,33 @@ func PossibleActionValues() []Action { return []Action{Add, Recommended, Remove} } +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // ActionTypeAutomationAction ... + ActionTypeAutomationAction ActionType = "AutomationAction" + // ActionTypeEventHub ... + ActionTypeEventHub ActionType = "EventHub" + // ActionTypeEventHub1 ... + ActionTypeEventHub1 ActionType = "EventHub" + // ActionTypeEventHub2 ... + ActionTypeEventHub2 ActionType = "EventHub" + // ActionTypeLogicApp ... + ActionTypeLogicApp ActionType = "LogicApp" + // ActionTypeLogicApp1 ... + ActionTypeLogicApp1 ActionType = "LogicApp" + // ActionTypeLogicApp2 ... + ActionTypeLogicApp2 ActionType = "LogicApp" + // ActionTypeWorkspace ... + ActionTypeWorkspace ActionType = "Workspace" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ActionTypeAutomationAction, ActionTypeEventHub, ActionTypeEventHub1, ActionTypeEventHub2, ActionTypeLogicApp, ActionTypeLogicApp1, ActionTypeLogicApp2, ActionTypeWorkspace} +} + // AlertNotifications enumerates the values for alert notifications. type AlertNotifications string @@ -257,6 +284,21 @@ func PossibleEnforcementMode1Values() []EnforcementMode1 { return []EnforcementMode1{EnforcementMode1Audit, EnforcementMode1Enforce, EnforcementMode1None} } +// EventSource enumerates the values for event source. +type EventSource string + +const ( + // Alerts ... + Alerts EventSource = "Alerts" + // Assessments ... + Assessments EventSource = "Assessments" +) + +// PossibleEventSourceValues returns an array of possible values for the EventSource const type. +func PossibleEventSourceValues() []EventSource { + return []EventSource{Alerts, Assessments} +} + // Exe enumerates the values for exe. type Exe string @@ -409,6 +451,35 @@ func PossibleMsiValues() []Msi { return []Msi{MsiAudit, MsiEnforce, MsiNone} } +// Operator enumerates the values for operator. +type Operator string + +const ( + // Contains ... + Contains Operator = "Contains" + // EndsWith ... + EndsWith Operator = "EndsWith" + // Equals ... + Equals Operator = "Equals" + // GreaterThan ... + GreaterThan Operator = "GreaterThan" + // GreaterThanOrEqualTo ... + GreaterThanOrEqualTo Operator = "GreaterThanOrEqualTo" + // LesserThan ... + LesserThan Operator = "LesserThan" + // LesserThanOrEqualTo ... + LesserThanOrEqualTo Operator = "LesserThanOrEqualTo" + // NotEquals ... + NotEquals Operator = "NotEquals" + // StartsWith ... + StartsWith Operator = "StartsWith" +) + +// PossibleOperatorValues returns an array of possible values for the Operator const type. +func PossibleOperatorValues() []Operator { + return []Operator{Contains, EndsWith, Equals, GreaterThan, GreaterThanOrEqualTo, LesserThan, LesserThanOrEqualTo, NotEquals, StartsWith} +} + // PricingTier enumerates the values for pricing tier. type PricingTier string @@ -424,6 +495,25 @@ func PossiblePricingTierValues() []PricingTier { return []PricingTier{Free, Standard} } +// PropertyType enumerates the values for property type. +type PropertyType string + +const ( + // Boolean ... + Boolean PropertyType = "Boolean" + // Integer ... + Integer PropertyType = "Integer" + // Number ... + Number PropertyType = "Number" + // String ... + String PropertyType = "String" +) + +// PossiblePropertyTypeValues returns an array of possible values for the PropertyType const type. +func PossiblePropertyTypeValues() []PropertyType { + return []PropertyType{Boolean, Integer, Number, String} +} + // Protocol enumerates the values for protocol. type Protocol string @@ -711,15 +801,15 @@ func PossibleTypeValues() []Type { type ValueType string const ( - // IPCidr An IP range in CIDR format (e.g. '192.168.0.1/8'). - IPCidr ValueType = "IpCidr" - // String Any string value. - String ValueType = "String" + // ValueTypeIPCidr An IP range in CIDR format (e.g. '192.168.0.1/8'). + ValueTypeIPCidr ValueType = "IpCidr" + // ValueTypeString Any string value. + ValueTypeString ValueType = "String" ) // PossibleValueTypeValues returns an array of possible values for the ValueType const type. func PossibleValueTypeValues() []ValueType { - return []ValueType{IPCidr, String} + return []ValueType{ValueTypeIPCidr, ValueTypeString} } // AadConnectivityState1 describes an Azure resource with kind @@ -1809,7 +1899,7 @@ type AllowedConnectionsResourceProperties struct { type AllowlistCustomAlertRule struct { // AllowlistValues - The values to allow. The format of the values depends on the rule type. AllowlistValues *[]string `json:"allowlistValues,omitempty"` - // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'IPCidr', 'String' + // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'ValueTypeIPCidr', 'ValueTypeString' ValueType ValueType `json:"valueType,omitempty"` // DisplayName - READ-ONLY; The display name of the custom alert. DisplayName *string `json:"displayName,omitempty"` @@ -1901,83 +1991,1295 @@ func (awg *AppWhitelistingGroup) UnmarshalJSON(body []byte) error { } } - return nil + return nil +} + +// AppWhitelistingGroupData represents a VM/server group and set of rules that are Recommended by Azure +// Security Center to be allowed +type AppWhitelistingGroupData struct { + // EnforcementMode - Possible values include: 'Audit', 'Enforce', 'None' + EnforcementMode EnforcementMode `json:"enforcementMode,omitempty"` + ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` + // ConfigurationStatus - Possible values include: 'ConfigurationStatus2Configured', 'ConfigurationStatus2NotConfigured', 'ConfigurationStatus2InProgress', 'ConfigurationStatus2Failed', 'ConfigurationStatus2NoStatus' + ConfigurationStatus ConfigurationStatus2 `json:"configurationStatus,omitempty"` + // RecommendationStatus - Possible values include: 'RecommendationStatusRecommended', 'RecommendationStatusNotRecommended', 'RecommendationStatusNotAvailable', 'RecommendationStatusNoStatus' + RecommendationStatus RecommendationStatus `json:"recommendationStatus,omitempty"` + Issues *[]AppWhitelistingIssueSummary `json:"issues,omitempty"` + // SourceSystem - Possible values include: 'SourceSystemAzureAppLocker', 'SourceSystemAzureAuditD', 'SourceSystemNonAzureAppLocker', 'SourceSystemNonAzureAuditD', 'SourceSystemNone' + SourceSystem SourceSystem `json:"sourceSystem,omitempty"` + VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` + PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +} + +// AppWhitelistingGroups represents a list of VM/server groups and set of rules that are Recommended by +// Azure Security Center to be allowed +type AppWhitelistingGroups struct { + autorest.Response `json:"-"` + Value *[]AppWhitelistingGroup `json:"value,omitempty"` +} + +// AppWhitelistingIssueSummary represents a summary of the alerts of the VM/server group +type AppWhitelistingIssueSummary struct { + // Issue - Possible values include: 'ViolationsAudited', 'ViolationsBlocked', 'MsiAndScriptViolationsAudited', 'MsiAndScriptViolationsBlocked', 'ExecutableViolationsAudited', 'RulesViolatedManually' + Issue Issue `json:"issue,omitempty"` + // NumberOfVms - The number of machines in the VM/server group that have this alert + NumberOfVms *float64 `json:"numberOfVms,omitempty"` +} + +// AppWhitelistingPutGroupData the altered data of the recommended VM/server group policy +type AppWhitelistingPutGroupData struct { + // EnforcementMode - The enforcement mode of the group. Can also be defined per collection type by using ProtectionMode. Possible values include: 'EnforcementMode1Audit', 'EnforcementMode1Enforce', 'EnforcementMode1None' + EnforcementMode EnforcementMode1 `json:"enforcementMode,omitempty"` + // ProtectionMode - The protection mode of the group per collection type. Can also be defined for all collection types by using EnforcementMode + ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` + VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` + PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +} + +// AscLocation the ASC location of the subscription is in the "name" field +type AscLocation struct { + autorest.Response `json:"-"` + Properties interface{} `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// AscLocationList list of locations where ASC saves your data +type AscLocationList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY + Value *[]AscLocation `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// AscLocationListIterator provides access to a complete listing of AscLocation values. +type AscLocationListIterator struct { + i int + page AscLocationListPage +} + +// 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 *AscLocationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AscLocationListIterator.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 *AscLocationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AscLocationListIterator) 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 AscLocationListIterator) Response() AscLocationList { + 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 AscLocationListIterator) Value() AscLocation { + if !iter.page.NotDone() { + return AscLocation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AscLocationListIterator type. +func NewAscLocationListIterator(page AscLocationListPage) AscLocationListIterator { + return AscLocationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (all AscLocationList) IsEmpty() bool { + return all.Value == nil || len(*all.Value) == 0 +} + +// ascLocationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (all AscLocationList) ascLocationListPreparer(ctx context.Context) (*http.Request, error) { + if all.NextLink == nil || len(to.String(all.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(all.NextLink))) +} + +// AscLocationListPage contains a page of AscLocation values. +type AscLocationListPage struct { + fn func(context.Context, AscLocationList) (AscLocationList, error) + all AscLocationList +} + +// 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 *AscLocationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AscLocationListPage.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.all) + if err != nil { + return err + } + page.all = 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 *AscLocationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AscLocationListPage) NotDone() bool { + return !page.all.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AscLocationListPage) Response() AscLocationList { + return page.all +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AscLocationListPage) Values() []AscLocation { + if page.all.IsEmpty() { + return nil + } + return *page.all.Value +} + +// Creates a new instance of the AscLocationListPage type. +func NewAscLocationListPage(getNextPage func(context.Context, AscLocationList) (AscLocationList, error)) AscLocationListPage { + return AscLocationListPage{fn: getNextPage} +} + +// AtaExternalSecuritySolution represents an ATA security solution which sends logs to an OMS workspace +type AtaExternalSecuritySolution struct { + Properties *AtaSolutionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Location where the resource is stored + Location *string `json:"location,omitempty"` + // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' + Kind KindEnum `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) MarshalJSON() ([]byte, error) { + aess.Kind = KindATA + objectMap := make(map[string]interface{}) + if aess.Properties != nil { + objectMap["properties"] = aess.Properties + } + if aess.Kind != "" { + objectMap["kind"] = aess.Kind + } + return json.Marshal(objectMap) +} + +// AsCefExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) AsCefExternalSecuritySolution() (*CefExternalSecuritySolution, bool) { + return nil, false +} + +// AsAtaExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) AsAtaExternalSecuritySolution() (*AtaExternalSecuritySolution, bool) { + return &aess, true +} + +// AsAadExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) AsAadExternalSecuritySolution() (*AadExternalSecuritySolution, bool) { + return nil, false +} + +// AsExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) AsExternalSecuritySolution() (*ExternalSecuritySolution, bool) { + return nil, false +} + +// AsBasicExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) AsBasicExternalSecuritySolution() (BasicExternalSecuritySolution, bool) { + return &aess, true +} + +// AtaSolutionProperties ... +type AtaSolutionProperties struct { + LastEventReceived *string `json:"lastEventReceived,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + DeviceVendor *string `json:"deviceVendor,omitempty"` + DeviceType *string `json:"deviceType,omitempty"` + Workspace *ConnectedWorkspace `json:"workspace,omitempty"` +} + +// MarshalJSON is the custom marshaler for AtaSolutionProperties. +func (asp AtaSolutionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asp.LastEventReceived != nil { + objectMap["lastEventReceived"] = asp.LastEventReceived + } + if asp.DeviceVendor != nil { + objectMap["deviceVendor"] = asp.DeviceVendor + } + if asp.DeviceType != nil { + objectMap["deviceType"] = asp.DeviceType + } + if asp.Workspace != nil { + objectMap["workspace"] = asp.Workspace + } + for k, v := range asp.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AtaSolutionProperties struct. +func (asp *AtaSolutionProperties) 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 "lastEventReceived": + if v != nil { + var lastEventReceived string + err = json.Unmarshal(*v, &lastEventReceived) + if err != nil { + return err + } + asp.LastEventReceived = &lastEventReceived + } + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if asp.AdditionalProperties == nil { + asp.AdditionalProperties = make(map[string]interface{}) + } + asp.AdditionalProperties[k] = additionalProperties + } + case "deviceVendor": + if v != nil { + var deviceVendor string + err = json.Unmarshal(*v, &deviceVendor) + if err != nil { + return err + } + asp.DeviceVendor = &deviceVendor + } + case "deviceType": + if v != nil { + var deviceType string + err = json.Unmarshal(*v, &deviceType) + if err != nil { + return err + } + asp.DeviceType = &deviceType + } + case "workspace": + if v != nil { + var workspace ConnectedWorkspace + err = json.Unmarshal(*v, &workspace) + if err != nil { + return err + } + asp.Workspace = &workspace + } + } + } + + return nil +} + +// Automation the security automation resource. +type Automation struct { + autorest.Response `json:"-"` + // AutomationProperties - Security automation data + *AutomationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Location where the resource is stored + Location *string `json:"location,omitempty"` + // Kind - Kind of the resource + Kind *string `json:"kind,omitempty"` + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. + Etag *string `json:"etag,omitempty"` + // Tags - A list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Automation. +func (a Automation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.AutomationProperties != nil { + objectMap["properties"] = a.AutomationProperties + } + if a.Kind != nil { + objectMap["kind"] = a.Kind + } + if a.Etag != nil { + objectMap["etag"] = a.Etag + } + if a.Tags != nil { + objectMap["tags"] = a.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Automation struct. +func (a *Automation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var automationProperties AutomationProperties + err = json.Unmarshal(*v, &automationProperties) + if err != nil { + return err + } + a.AutomationProperties = &automationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + a.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + a.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + a.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + a.Location = &location + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + a.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + a.Etag = &etag + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + a.Tags = tags + } + } + } + + return nil +} + +// BasicAutomationAction the action that should be triggered. +type BasicAutomationAction interface { + AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) + AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) + AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) + AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) + AsAutomationActionEventHub() (*AutomationActionEventHub, bool) + AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) + AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) + AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) + AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) + AsAutomationAction() (*AutomationAction, bool) +} + +// AutomationAction the action that should be triggered. +type AutomationAction struct { + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +func unmarshalBasicAutomationAction(body []byte) (BasicAutomationAction, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["actionType"] { + case string(ActionTypeLogicApp): + var aala AutomationActionLogicApp + err := json.Unmarshal(body, &aala) + return aala, err + case string(ActionTypeLogicApp): + var aalai AutomationActionLogicAppInput + err := json.Unmarshal(body, &aalai) + return aalai, err + case string(ActionTypeLogicApp): + var aalao AutomationActionLogicAppOutput + err := json.Unmarshal(body, &aalao) + return aalao, err + case string(ActionTypeEventHub): + var aaeh AutomationActionEventHub + err := json.Unmarshal(body, &aaeh) + return aaeh, err + case string(ActionTypeEventHub): + var aaehi AutomationActionEventHubInput + err := json.Unmarshal(body, &aaehi) + return aaehi, err + case string(ActionTypeEventHub): + var aaeho AutomationActionEventHubOutput + err := json.Unmarshal(body, &aaeho) + return aaeho, err + case string(ActionTypeWorkspace): + var aaw AutomationActionWorkspace + err := json.Unmarshal(body, &aaw) + return aaw, err + default: + var aa AutomationAction + err := json.Unmarshal(body, &aa) + return aa, err + } +} +func unmarshalBasicAutomationActionArray(body []byte) ([]BasicAutomationAction, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + aaArray := make([]BasicAutomationAction, len(rawMessages)) + + for index, rawMessage := range rawMessages { + aa, err := unmarshalBasicAutomationAction(*rawMessage) + if err != nil { + return nil, err + } + aaArray[index] = aa + } + return aaArray, nil +} + +// MarshalJSON is the custom marshaler for AutomationAction. +func (aa AutomationAction) MarshalJSON() ([]byte, error) { + aa.ActionType = ActionTypeAutomationAction + objectMap := make(map[string]interface{}) + if aa.ActionType != "" { + objectMap["actionType"] = aa.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return nil, false +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return nil, false +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationAction() (*AutomationAction, bool) { + return &aa, true +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aa, true +} + +// BasicAutomationActionEventHub the target Event Hub to which event data will be exported. +type BasicAutomationActionEventHub interface { + AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) + AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) + AsAutomationActionEventHub() (*AutomationActionEventHub, bool) +} + +// AutomationActionEventHub the target Event Hub to which event data will be exported. +type AutomationActionEventHub struct { + // EventHubResourceID - The target Event Hub Azure Resource ID. + EventHubResourceID *string `json:"eventHubResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +func unmarshalBasicAutomationActionEventHub(body []byte) (BasicAutomationActionEventHub, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["actionType"] { + case string(ActionTypeEventHub): + var aaehi AutomationActionEventHubInput + err := json.Unmarshal(body, &aaehi) + return aaehi, err + case string(ActionTypeEventHub): + var aaeho AutomationActionEventHubOutput + err := json.Unmarshal(body, &aaeho) + return aaeho, err + default: + var aaeh AutomationActionEventHub + err := json.Unmarshal(body, &aaeh) + return aaeh, err + } +} +func unmarshalBasicAutomationActionEventHubArray(body []byte) ([]BasicAutomationActionEventHub, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + aaehArray := make([]BasicAutomationActionEventHub, len(rawMessages)) + + for index, rawMessage := range rawMessages { + aaeh, err := unmarshalBasicAutomationActionEventHub(*rawMessage) + if err != nil { + return nil, err + } + aaehArray[index] = aaeh + } + return aaehArray, nil +} + +// MarshalJSON is the custom marshaler for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) MarshalJSON() ([]byte, error) { + aaeh.ActionType = ActionTypeEventHub + objectMap := make(map[string]interface{}) + if aaeh.EventHubResourceID != nil { + objectMap["eventHubResourceId"] = aaeh.EventHubResourceID + } + if aaeh.ActionType != "" { + objectMap["actionType"] = aaeh.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return nil, false +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return &aaeh, true +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return &aaeh, true +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aaeh, true +} + +// AutomationActionEventHubInput the target Event Hub to which event data will be exported. +type AutomationActionEventHubInput struct { + // ConnectionString - The target Event Hub connection string + ConnectionString *string `json:"connectionString,omitempty"` + // EventHubResourceID - The target Event Hub Azure Resource ID. + EventHubResourceID *string `json:"eventHubResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) MarshalJSON() ([]byte, error) { + aaehi.ActionType = ActionTypeEventHub + objectMap := make(map[string]interface{}) + if aaehi.ConnectionString != nil { + objectMap["connectionString"] = aaehi.ConnectionString + } + if aaehi.EventHubResourceID != nil { + objectMap["eventHubResourceId"] = aaehi.EventHubResourceID + } + if aaehi.ActionType != "" { + objectMap["actionType"] = aaehi.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return nil, false +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return &aaehi, true +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return &aaehi, true +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aaehi, true +} + +// AutomationActionEventHubOutput the target Event Hub to which event data will be exported. +type AutomationActionEventHubOutput struct { + // SasPolicyName - The target Event Hub SAS policy name. + SasPolicyName *string `json:"sasPolicyName,omitempty"` + // EventHubResourceID - The target Event Hub Azure Resource ID. + EventHubResourceID *string `json:"eventHubResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) MarshalJSON() ([]byte, error) { + aaeho.ActionType = ActionTypeEventHub + objectMap := make(map[string]interface{}) + if aaeho.SasPolicyName != nil { + objectMap["sasPolicyName"] = aaeho.SasPolicyName + } + if aaeho.EventHubResourceID != nil { + objectMap["eventHubResourceId"] = aaeho.EventHubResourceID + } + if aaeho.ActionType != "" { + objectMap["actionType"] = aaeho.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return nil, false +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return &aaeho, true +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return &aaeho, true +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aaeho, true +} + +// BasicAutomationActionLogicApp the logic app action that should be triggered. +type BasicAutomationActionLogicApp interface { + AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) + AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) + AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) +} + +// AutomationActionLogicApp the logic app action that should be triggered. +type AutomationActionLogicApp struct { + // LogicAppResourceID - The triggered Logic App Azure Resource ID. This can also reside on other subscriptions, given that you have permissions to trigger the Logic App + LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +func unmarshalBasicAutomationActionLogicApp(body []byte) (BasicAutomationActionLogicApp, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["actionType"] { + case string(ActionTypeLogicApp): + var aalai AutomationActionLogicAppInput + err := json.Unmarshal(body, &aalai) + return aalai, err + case string(ActionTypeLogicApp): + var aalao AutomationActionLogicAppOutput + err := json.Unmarshal(body, &aalao) + return aalao, err + default: + var aala AutomationActionLogicApp + err := json.Unmarshal(body, &aala) + return aala, err + } +} +func unmarshalBasicAutomationActionLogicAppArray(body []byte) ([]BasicAutomationActionLogicApp, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + aalaArray := make([]BasicAutomationActionLogicApp, len(rawMessages)) + + for index, rawMessage := range rawMessages { + aala, err := unmarshalBasicAutomationActionLogicApp(*rawMessage) + if err != nil { + return nil, err + } + aalaArray[index] = aala + } + return aalaArray, nil +} + +// MarshalJSON is the custom marshaler for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) MarshalJSON() ([]byte, error) { + aala.ActionType = ActionTypeLogicApp + objectMap := make(map[string]interface{}) + if aala.LogicAppResourceID != nil { + objectMap["logicAppResourceId"] = aala.LogicAppResourceID + } + if aala.ActionType != "" { + objectMap["actionType"] = aala.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return &aala, true +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return &aala, true +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return nil, false +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aala, true +} + +// AutomationActionLogicAppInput the logic app action that should be triggered. +type AutomationActionLogicAppInput struct { + // URI - The Logic App trigger URI endpoint. + URI *string `json:"uri,omitempty"` + // LogicAppResourceID - The triggered Logic App Azure Resource ID. This can also reside on other subscriptions, given that you have permissions to trigger the Logic App + LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) MarshalJSON() ([]byte, error) { + aalai.ActionType = ActionTypeLogicApp + objectMap := make(map[string]interface{}) + if aalai.URI != nil { + objectMap["uri"] = aalai.URI + } + if aalai.LogicAppResourceID != nil { + objectMap["logicAppResourceId"] = aalai.LogicAppResourceID + } + if aalai.ActionType != "" { + objectMap["actionType"] = aalai.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return &aalai, true +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return &aalai, true +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return nil, false +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aalai, true +} + +// AutomationActionLogicAppOutput the logic app action that should be triggered. +type AutomationActionLogicAppOutput struct { + // LogicAppResourceID - The triggered Logic App Azure Resource ID. This can also reside on other subscriptions, given that you have permissions to trigger the Logic App + LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) MarshalJSON() ([]byte, error) { + aalao.ActionType = ActionTypeLogicApp + objectMap := make(map[string]interface{}) + if aalao.LogicAppResourceID != nil { + objectMap["logicAppResourceId"] = aalao.LogicAppResourceID + } + if aalao.ActionType != "" { + objectMap["actionType"] = aalao.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return &aalao, true +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return &aalao, true +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return nil, false +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aalao, true +} + +// AutomationActionWorkspace the Log Analytics Workspace to which event data will be exported. Security +// alerts data will reside in the 'SecurityAlert' table and the assessments data will reside in the +// 'SecurityRecommendation' table (under the 'Security'/'SecurityCenterFree' solutions). Note that in order +// to view the data in the workspace, the Security Center Log Analytics free/standard solution needs to be +// enabled on that workspace. +type AutomationActionWorkspace struct { + // WorkspaceResourceID - The fully qualified Log Analytics Workspace Azure Resource ID. + WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) MarshalJSON() ([]byte, error) { + aaw.ActionType = ActionTypeWorkspace + objectMap := make(map[string]interface{}) + if aaw.WorkspaceResourceID != nil { + objectMap["workspaceResourceId"] = aaw.WorkspaceResourceID + } + if aaw.ActionType != "" { + objectMap["actionType"] = aaw.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return nil, false +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false } -// AppWhitelistingGroupData represents a VM/server group and set of rules that are Recommended by Azure -// Security Center to be allowed -type AppWhitelistingGroupData struct { - // EnforcementMode - Possible values include: 'Audit', 'Enforce', 'None' - EnforcementMode EnforcementMode `json:"enforcementMode,omitempty"` - ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` - // ConfigurationStatus - Possible values include: 'ConfigurationStatus2Configured', 'ConfigurationStatus2NotConfigured', 'ConfigurationStatus2InProgress', 'ConfigurationStatus2Failed', 'ConfigurationStatus2NoStatus' - ConfigurationStatus ConfigurationStatus2 `json:"configurationStatus,omitempty"` - // RecommendationStatus - Possible values include: 'RecommendationStatusRecommended', 'RecommendationStatusNotRecommended', 'RecommendationStatusNotAvailable', 'RecommendationStatusNoStatus' - RecommendationStatus RecommendationStatus `json:"recommendationStatus,omitempty"` - Issues *[]AppWhitelistingIssueSummary `json:"issues,omitempty"` - // SourceSystem - Possible values include: 'SourceSystemAzureAppLocker', 'SourceSystemAzureAuditD', 'SourceSystemNonAzureAppLocker', 'SourceSystemNonAzureAuditD', 'SourceSystemNone' - SourceSystem SourceSystem `json:"sourceSystem,omitempty"` - VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` - PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false } -// AppWhitelistingGroups represents a list of VM/server groups and set of rules that are Recommended by -// Azure Security Center to be allowed -type AppWhitelistingGroups struct { - autorest.Response `json:"-"` - Value *[]AppWhitelistingGroup `json:"value,omitempty"` +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return nil, false } -// AppWhitelistingIssueSummary represents a summary of the alerts of the VM/server group -type AppWhitelistingIssueSummary struct { - // Issue - Possible values include: 'ViolationsAudited', 'ViolationsBlocked', 'MsiAndScriptViolationsAudited', 'MsiAndScriptViolationsBlocked', 'ExecutableViolationsAudited', 'RulesViolatedManually' - Issue Issue `json:"issue,omitempty"` - // NumberOfVms - The number of machines in the VM/server group that have this alert - NumberOfVms *float64 `json:"numberOfVms,omitempty"` +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false } -// AppWhitelistingPutGroupData the altered data of the recommended VM/server group policy -type AppWhitelistingPutGroupData struct { - // EnforcementMode - The enforcement mode of the group. Can also be defined per collection type by using ProtectionMode. Possible values include: 'EnforcementMode1Audit', 'EnforcementMode1Enforce', 'EnforcementMode1None' - EnforcementMode EnforcementMode1 `json:"enforcementMode,omitempty"` - // ProtectionMode - The protection mode of the group per collection type. Can also be defined for all collection types by using EnforcementMode - ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` - VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` - PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false } -// AscLocation the ASC location of the subscription is in the "name" field -type AscLocation struct { - autorest.Response `json:"-"` - Properties interface{} `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return &aaw, true } -// AscLocationList list of locations where ASC saves your data -type AscLocationList struct { +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aaw, true +} + +// AutomationList list of security automations response. +type AutomationList struct { autorest.Response `json:"-"` - // Value - READ-ONLY - Value *[]AscLocation `json:"value,omitempty"` + // Value - The list of security automations under the given scope. + Value *[]Automation `json:"value,omitempty"` // NextLink - READ-ONLY; The URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` } -// AscLocationListIterator provides access to a complete listing of AscLocation values. -type AscLocationListIterator struct { +// AutomationListIterator provides access to a complete listing of Automation values. +type AutomationListIterator struct { i int - page AscLocationListPage + page AutomationListPage } // 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 *AscLocationListIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *AutomationListIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AscLocationListIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationListIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -2002,62 +3304,62 @@ func (iter *AscLocationListIterator) NextWithContext(ctx context.Context) (err e // 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 *AscLocationListIterator) Next() error { +func (iter *AutomationListIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AscLocationListIterator) NotDone() bool { +func (iter AutomationListIterator) 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 AscLocationListIterator) Response() AscLocationList { +func (iter AutomationListIterator) Response() AutomationList { 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 AscLocationListIterator) Value() AscLocation { +func (iter AutomationListIterator) Value() Automation { if !iter.page.NotDone() { - return AscLocation{} + return Automation{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the AscLocationListIterator type. -func NewAscLocationListIterator(page AscLocationListPage) AscLocationListIterator { - return AscLocationListIterator{page: page} +// Creates a new instance of the AutomationListIterator type. +func NewAutomationListIterator(page AutomationListPage) AutomationListIterator { + return AutomationListIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (all AscLocationList) IsEmpty() bool { - return all.Value == nil || len(*all.Value) == 0 +func (al AutomationList) IsEmpty() bool { + return al.Value == nil || len(*al.Value) == 0 } -// ascLocationListPreparer prepares a request to retrieve the next set of results. +// automationListPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (all AscLocationList) ascLocationListPreparer(ctx context.Context) (*http.Request, error) { - if all.NextLink == nil || len(to.String(all.NextLink)) < 1 { +func (al AutomationList) automationListPreparer(ctx context.Context) (*http.Request, error) { + if al.NextLink == nil || len(to.String(al.NextLink)) < 1 { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(all.NextLink))) + autorest.WithBaseURL(to.String(al.NextLink))) } -// AscLocationListPage contains a page of AscLocation values. -type AscLocationListPage struct { - fn func(context.Context, AscLocationList) (AscLocationList, error) - all AscLocationList +// AutomationListPage contains a page of Automation values. +type AutomationListPage struct { + fn func(context.Context, AutomationList) (AutomationList, error) + al AutomationList } // 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 *AscLocationListPage) NextWithContext(ctx context.Context) (err error) { +func (page *AutomationListPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AscLocationListPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationListPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -2066,130 +3368,76 @@ func (page *AscLocationListPage) NextWithContext(ctx context.Context) (err error tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.all) + next, err := page.fn(ctx, page.al) if err != nil { return err } - page.all = next + page.al = 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 *AscLocationListPage) Next() error { +func (page *AutomationListPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AscLocationListPage) NotDone() bool { - return !page.all.IsEmpty() +func (page AutomationListPage) NotDone() bool { + return !page.al.IsEmpty() } // Response returns the raw server response from the last page request. -func (page AscLocationListPage) Response() AscLocationList { - return page.all +func (page AutomationListPage) Response() AutomationList { + return page.al } // Values returns the slice of values for the current page or nil if there are no values. -func (page AscLocationListPage) Values() []AscLocation { - if page.all.IsEmpty() { +func (page AutomationListPage) Values() []Automation { + if page.al.IsEmpty() { return nil } - return *page.all.Value -} - -// Creates a new instance of the AscLocationListPage type. -func NewAscLocationListPage(getNextPage func(context.Context, AscLocationList) (AscLocationList, error)) AscLocationListPage { - return AscLocationListPage{fn: getNextPage} -} - -// AtaExternalSecuritySolution represents an ATA security solution which sends logs to an OMS workspace -type AtaExternalSecuritySolution struct { - Properties *AtaSolutionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - READ-ONLY; Location where the resource is stored - Location *string `json:"location,omitempty"` - // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' - Kind KindEnum `json:"kind,omitempty"` -} - -// MarshalJSON is the custom marshaler for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) MarshalJSON() ([]byte, error) { - aess.Kind = KindATA - objectMap := make(map[string]interface{}) - if aess.Properties != nil { - objectMap["properties"] = aess.Properties - } - if aess.Kind != "" { - objectMap["kind"] = aess.Kind - } - return json.Marshal(objectMap) -} - -// AsCefExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) AsCefExternalSecuritySolution() (*CefExternalSecuritySolution, bool) { - return nil, false -} - -// AsAtaExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) AsAtaExternalSecuritySolution() (*AtaExternalSecuritySolution, bool) { - return &aess, true -} - -// AsAadExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) AsAadExternalSecuritySolution() (*AadExternalSecuritySolution, bool) { - return nil, false -} - -// AsExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) AsExternalSecuritySolution() (*ExternalSecuritySolution, bool) { - return nil, false -} - -// AsBasicExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) AsBasicExternalSecuritySolution() (BasicExternalSecuritySolution, bool) { - return &aess, true + return *page.al.Value } -// AtaSolutionProperties ... -type AtaSolutionProperties struct { - LastEventReceived *string `json:"lastEventReceived,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - DeviceVendor *string `json:"deviceVendor,omitempty"` - DeviceType *string `json:"deviceType,omitempty"` - Workspace *ConnectedWorkspace `json:"workspace,omitempty"` +// Creates a new instance of the AutomationListPage type. +func NewAutomationListPage(getNextPage func(context.Context, AutomationList) (AutomationList, error)) AutomationListPage { + return AutomationListPage{fn: getNextPage} } -// MarshalJSON is the custom marshaler for AtaSolutionProperties. -func (asp AtaSolutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asp.LastEventReceived != nil { - objectMap["lastEventReceived"] = asp.LastEventReceived - } - if asp.DeviceVendor != nil { - objectMap["deviceVendor"] = asp.DeviceVendor - } - if asp.DeviceType != nil { - objectMap["deviceType"] = asp.DeviceType - } - if asp.Workspace != nil { - objectMap["workspace"] = asp.Workspace - } - for k, v := range asp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) +// AutomationMetadata the metadata of the security automation resource. +type AutomationMetadata struct { + // CreatedDateTimeUtc - READ-ONLY; The security automation creation date. + CreatedDateTimeUtc *date.Time `json:"createdDateTimeUtc,omitempty"` + // CreatedBy - READ-ONLY; The AAD object ID of the entity that created the security automation. + CreatedBy *string `json:"createdBy,omitempty"` + // LastUpdatedDateTimeUtc - READ-ONLY; The security automation last updated date. + LastUpdatedDateTimeUtc *date.Time `json:"lastUpdatedDateTimeUtc,omitempty"` + // LastUpdatedBy - READ-ONLY; The AAD object ID of the entity that last updated the security automation. + LastUpdatedBy *string `json:"lastUpdatedBy,omitempty"` } -// UnmarshalJSON is the custom unmarshaler for AtaSolutionProperties struct. -func (asp *AtaSolutionProperties) UnmarshalJSON(body []byte) error { +// AutomationProperties a set of properties that defines the behavior of the automation configuration. To +// learn more about the supported security events data models schemas - please visit +// https://aka.ms/ASCAutomationSchemas. +type AutomationProperties struct { + // Description - The security automation description. + Description *string `json:"description,omitempty"` + // IsEnabled - Indicates whether the security automation is enabled. + IsEnabled *bool `json:"isEnabled,omitempty"` + // Metadata - The metadata of the security automation resource. + Metadata *AutomationMetadata `json:"metadata,omitempty"` + // Scopes - A collection of scopes on which the security automations logic is applied. Supported scopes are the subscription itself or a resource group under that subscription. The automation will only apply on defined scopes. + Scopes *[]AutomationScope `json:"scopes,omitempty"` + // Sources - A collection of the source event types which evaluate the security automation set of rules. + Sources *[]AutomationSource `json:"sources,omitempty"` + // Actions - A collection of the actions which are triggered if all the configured rules evaluations, within at least one rule set, are true. + Actions *[]BasicAutomationAction `json:"actions,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for AutomationProperties struct. +func (ap *AutomationProperties) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -2197,53 +3445,58 @@ func (asp *AtaSolutionProperties) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "lastEventReceived": + case "description": if v != nil { - var lastEventReceived string - err = json.Unmarshal(*v, &lastEventReceived) + var description string + err = json.Unmarshal(*v, &description) if err != nil { return err } - asp.LastEventReceived = &lastEventReceived + ap.Description = &description } - default: + case "isEnabled": if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) + var isEnabled bool + err = json.Unmarshal(*v, &isEnabled) if err != nil { return err } - if asp.AdditionalProperties == nil { - asp.AdditionalProperties = make(map[string]interface{}) + ap.IsEnabled = &isEnabled + } + case "metadata": + if v != nil { + var metadata AutomationMetadata + err = json.Unmarshal(*v, &metadata) + if err != nil { + return err } - asp.AdditionalProperties[k] = additionalProperties + ap.Metadata = &metadata } - case "deviceVendor": + case "scopes": if v != nil { - var deviceVendor string - err = json.Unmarshal(*v, &deviceVendor) + var scopes []AutomationScope + err = json.Unmarshal(*v, &scopes) if err != nil { return err } - asp.DeviceVendor = &deviceVendor + ap.Scopes = &scopes } - case "deviceType": + case "sources": if v != nil { - var deviceType string - err = json.Unmarshal(*v, &deviceType) + var sources []AutomationSource + err = json.Unmarshal(*v, &sources) if err != nil { return err } - asp.DeviceType = &deviceType + ap.Sources = &sources } - case "workspace": + case "actions": if v != nil { - var workspace ConnectedWorkspace - err = json.Unmarshal(*v, &workspace) + actions, err := unmarshalBasicAutomationActionArray(*v) if err != nil { return err } - asp.Workspace = &workspace + ap.Actions = &actions } } } @@ -2251,6 +3504,53 @@ func (asp *AtaSolutionProperties) UnmarshalJSON(body []byte) error { return nil } +// AutomationRuleSet a rule set which evaluates all its rules upon an event interception. Only when all the +// included rules in the rule set will be evaluated as 'true', will the event trigger the defined actions. +type AutomationRuleSet struct { + Rules *[]AutomationTriggeringRule `json:"rules,omitempty"` +} + +// AutomationScope a single automation scope. +type AutomationScope struct { + // Description - The resources scope description. + Description *string `json:"description,omitempty"` + // ScopePath - The resources scope path. Can be the subscription on which the automation is defined on or a resource group under that subscription (fully qualified Azure resource IDs). + ScopePath *string `json:"scopePath,omitempty"` +} + +// AutomationSource the source event types which evaluate the security automation set of rules. For example +// - security alerts and security assessments. To learn more about the supported security events data +// models schemas - please visit https://aka.ms/ASCAutomationSchemas. +type AutomationSource struct { + // EventSource - A valid event source type. Possible values include: 'Assessments', 'Alerts' + EventSource EventSource `json:"eventSource,omitempty"` + // RuleSets - A set of rules which evaluate upon event interception. A logical disjunction is applied between defined rule sets (logical 'or'). + RuleSets *[]AutomationRuleSet `json:"ruleSets,omitempty"` +} + +// AutomationTriggeringRule a rule which is evaluated upon event interception. The rule is configured by +// comparing a specific value from the event model to an expected value. This comparison is done by using +// one of the supported operators set. +type AutomationTriggeringRule struct { + // PropertyJPath - The JPath of the entity model property that should be checked. + PropertyJPath *string `json:"propertyJPath,omitempty"` + // PropertyType - The data type of the compared operands (string, integer, floating point number or a boolean [true/false]]. Possible values include: 'String', 'Integer', 'Number', 'Boolean' + PropertyType PropertyType `json:"propertyType,omitempty"` + // ExpectedValue - The expected value. + ExpectedValue *string `json:"expectedValue,omitempty"` + // Operator - A valid comparer operator to use. Possible values include: 'Equals', 'GreaterThan', 'GreaterThanOrEqualTo', 'LesserThan', 'LesserThanOrEqualTo', 'NotEquals', 'Contains', 'StartsWith', 'EndsWith' + Operator Operator `json:"operator,omitempty"` +} + +// AutomationValidationStatus the security automation model state property bag. +type AutomationValidationStatus struct { + autorest.Response `json:"-"` + // IsValid - Indicates whether the model is valid or not. + IsValid *bool `json:"isValid,omitempty"` + // Message - The validation message. + Message *string `json:"message,omitempty"` +} + // AutoProvisioningSetting auto provisioning setting type AutoProvisioningSetting struct { autorest.Response `json:"-"` @@ -3452,7 +4752,7 @@ type DataExportSettingProperties struct { type DenylistCustomAlertRule struct { // DenylistValues - The values to deny. The format of the values depends on the rule type. DenylistValues *[]string `json:"denylistValues,omitempty"` - // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'IPCidr', 'String' + // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'ValueTypeIPCidr', 'ValueTypeString' ValueType ValueType `json:"valueType,omitempty"` // DisplayName - READ-ONLY; The display name of the custom alert. DisplayName *string `json:"displayName,omitempty"` @@ -3944,6 +5244,12 @@ type EffectiveNetworkSecurityGroups struct { NetworkSecurityGroups *[]string `json:"networkSecurityGroups,omitempty"` } +// ETag entity tag is used for comparing two or more entities from the same requested resource. +type ETag struct { + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. + Etag *string `json:"etag,omitempty"` +} + // BasicExternalSecuritySolution represents a security solution external to Azure Security Center which sends // information to an OMS workspace and whose data is displayed by Azure Security Center. type BasicExternalSecuritySolution interface { @@ -4946,7 +6252,7 @@ type Kind struct { // ListCustomAlertRule a List custom alert rule type ListCustomAlertRule struct { - // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'IPCidr', 'String' + // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'ValueTypeIPCidr', 'ValueTypeString' ValueType ValueType `json:"valueType,omitempty"` // DisplayName - READ-ONLY; The display name of the custom alert. DisplayName *string `json:"displayName,omitempty"` @@ -6850,6 +8156,21 @@ type SubAssessmentStatus struct { Severity Severity `json:"severity,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. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Tags. +func (t Tags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.Tags != nil { + objectMap["tags"] = t.Tags + } + return json.Marshal(objectMap) +} + // Task security task that we recommend to do in order to strengthen security type Task struct { autorest.Response `json:"-"` @@ -7438,6 +8759,39 @@ type TopologySingleResourceParent struct { ResourceID *string `json:"resourceId,omitempty"` } +// TrackedResource describes an Azure tracked resource. +type TrackedResource struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Location where the resource is stored + Location *string `json:"location,omitempty"` + // Kind - Kind of the resource + Kind *string `json:"kind,omitempty"` + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. + Etag *string `json:"etag,omitempty"` + // Tags - A list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Kind != nil { + objectMap["kind"] = tr.Kind + } + if tr.Etag != nil { + objectMap["etag"] = tr.Etag + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + // UserRecommendation represents a user that is recommended to be allowed for a certain rule type UserRecommendation struct { // Username - Represents a user that is recommended to be allowed for a certain rule diff --git a/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go b/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go index f5068b92147a..9cb2574b8476 100644 --- a/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go @@ -23,6 +23,18 @@ import ( "github.com/Azure/go-autorest/autorest" ) +// 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) + Delete(ctx context.Context, resourceGroupName string, automationName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, automationName string) (result security.Automation, err error) + List(ctx context.Context) (result security.AutomationListPage, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result security.AutomationListPage, err error) + Validate(ctx context.Context, resourceGroupName string, automationName string, automation security.Automation) (result security.AutomationValidationStatus, err error) +} + +var _ AutomationsClientAPI = (*security.AutomationsClient)(nil) + // SubAssessmentsClientAPI contains the set of methods on the SubAssessmentsClient type. type SubAssessmentsClientAPI interface { Get(ctx context.Context, scope string, assessmentName string, subAssessmentName string) (result security.SubAssessment, err error) diff --git a/services/preview/security/mgmt/v2.0/security/automations.go b/services/preview/security/mgmt/v2.0/security/automations.go new file mode 100644 index 000000000000..605cb35a072d --- /dev/null +++ b/services/preview/security/mgmt/v2.0/security/automations.go @@ -0,0 +1,643 @@ +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" +) + +// AutomationsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type AutomationsClient struct { + BaseClient +} + +// NewAutomationsClient creates an instance of the AutomationsClient client. +func NewAutomationsClient(subscriptionID string, ascLocation string) AutomationsClient { + return NewAutomationsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewAutomationsClientWithBaseURI creates an instance of the AutomationsClient client. +func NewAutomationsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) AutomationsClient { + return AutomationsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// CreateOrUpdate creates or updates a security automation. If a security automation is already created and a +// subsequent request is issued for the same automation id, then it will be updated. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// automationName - the security automation name. +// automation - the security automation resource +func (client AutomationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationName string, automation Automation) (result Automation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AutomationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationName, automation) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AutomationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationName string, automation Automation) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationName": autorest.Encode("path", automationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}", pathParameters), + autorest.WithJSON(automation), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AutomationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +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()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a security automation. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// automationName - the security automation name. +func (client AutomationsClient) Delete(ctx context.Context, resourceGroupName string, automationName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AutomationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, automationName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AutomationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationName": autorest.Encode("path", automationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}", 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 AutomationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +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 + return +} + +// Get retrieves information about the model of a security automation. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// automationName - the security automation name. +func (client AutomationsClient) Get(ctx context.Context, resourceGroupName string, automationName string) (result Automation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AutomationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, automationName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "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.AutomationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AutomationsClient) GetPreparer(ctx context.Context, resourceGroupName string, automationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationName": autorest.Encode("path", automationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}", 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 AutomationsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +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()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the security automations in the specified subscription. Use the 'nextLink' property in the response +// to get the next page of security automations for the specified subscription. +func (client AutomationsClient) List(ctx context.Context) (result AutomationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.List") + defer func() { + sc := -1 + if result.al.Response.Response != nil { + sc = result.al.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.AutomationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.al.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "List", resp, "Failure sending request") + return + } + + result.al, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AutomationsClient) ListPreparer(ctx context.Context) (*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, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/automations", 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 AutomationsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +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()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AutomationsClient) listNextResults(ctx context.Context, lastResults AutomationList) (result AutomationList, err error) { + req, err := lastResults.automationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.AutomationsClient", "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.AutomationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AutomationsClient) ListComplete(ctx context.Context) (result AutomationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.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 +} + +// ListByResourceGroup lists all the security automations in the specified resource group. Use the 'nextLink' property +// in the response to get the next page of security automations for the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +func (client AutomationsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutomationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.al.Response.Response != nil { + sc = result.al.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AutomationsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.al.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.al, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AutomationsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AutomationsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +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()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client AutomationsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AutomationList) (result AutomationList, err error) { + req, err := lastResults.automationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.AutomationsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.AutomationsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AutomationsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AutomationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.ListByResourceGroup") + 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.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Validate validates the security automation model before create or update. Any validation errors are returned to the +// client. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// automationName - the security automation name. +// automation - the security automation resource +func (client AutomationsClient) Validate(ctx context.Context, resourceGroupName string, automationName string, automation Automation) (result AutomationValidationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.Validate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AutomationsClient", "Validate", err.Error()) + } + + req, err := client.ValidatePreparer(ctx, resourceGroupName, automationName, automation) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Validate", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Validate", resp, "Failure sending request") + return + } + + result, err = client.ValidateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Validate", resp, "Failure responding to request") + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client AutomationsClient) ValidatePreparer(ctx context.Context, resourceGroupName string, automationName string, automation Automation) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationName": autorest.Encode("path", automationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}/validate", pathParameters), + autorest.WithJSON(automation), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client AutomationsClient) ValidateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +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()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/security/mgmt/v2.0/security/models.go b/services/preview/security/mgmt/v2.0/security/models.go index b6c26676de8d..cee44b1a4a87 100644 --- a/services/preview/security/mgmt/v2.0/security/models.go +++ b/services/preview/security/mgmt/v2.0/security/models.go @@ -66,6 +66,33 @@ func PossibleActionValues() []Action { return []Action{Add, Recommended, Remove} } +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // ActionTypeAutomationAction ... + ActionTypeAutomationAction ActionType = "AutomationAction" + // ActionTypeEventHub ... + ActionTypeEventHub ActionType = "EventHub" + // ActionTypeEventHub1 ... + ActionTypeEventHub1 ActionType = "EventHub" + // ActionTypeEventHub2 ... + ActionTypeEventHub2 ActionType = "EventHub" + // ActionTypeLogicApp ... + ActionTypeLogicApp ActionType = "LogicApp" + // ActionTypeLogicApp1 ... + ActionTypeLogicApp1 ActionType = "LogicApp" + // ActionTypeLogicApp2 ... + ActionTypeLogicApp2 ActionType = "LogicApp" + // ActionTypeWorkspace ... + ActionTypeWorkspace ActionType = "Workspace" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ActionTypeAutomationAction, ActionTypeEventHub, ActionTypeEventHub1, ActionTypeEventHub2, ActionTypeLogicApp, ActionTypeLogicApp1, ActionTypeLogicApp2, ActionTypeWorkspace} +} + // AlertNotifications enumerates the values for alert notifications. type AlertNotifications string @@ -270,6 +297,21 @@ func PossibleEnforcementMode1Values() []EnforcementMode1 { return []EnforcementMode1{EnforcementMode1Audit, EnforcementMode1Enforce, EnforcementMode1None} } +// EventSource enumerates the values for event source. +type EventSource string + +const ( + // Alerts ... + Alerts EventSource = "Alerts" + // Assessments ... + Assessments EventSource = "Assessments" +) + +// PossibleEventSourceValues returns an array of possible values for the EventSource const type. +func PossibleEventSourceValues() []EventSource { + return []EventSource{Alerts, Assessments} +} + // Exe enumerates the values for exe. type Exe string @@ -435,6 +477,35 @@ func PossibleMsiValues() []Msi { return []Msi{MsiAudit, MsiEnforce, MsiNone} } +// Operator enumerates the values for operator. +type Operator string + +const ( + // Contains ... + Contains Operator = "Contains" + // EndsWith ... + EndsWith Operator = "EndsWith" + // Equals ... + Equals Operator = "Equals" + // GreaterThan ... + GreaterThan Operator = "GreaterThan" + // GreaterThanOrEqualTo ... + GreaterThanOrEqualTo Operator = "GreaterThanOrEqualTo" + // LesserThan ... + LesserThan Operator = "LesserThan" + // LesserThanOrEqualTo ... + LesserThanOrEqualTo Operator = "LesserThanOrEqualTo" + // NotEquals ... + NotEquals Operator = "NotEquals" + // StartsWith ... + StartsWith Operator = "StartsWith" +) + +// PossibleOperatorValues returns an array of possible values for the Operator const type. +func PossibleOperatorValues() []Operator { + return []Operator{Contains, EndsWith, Equals, GreaterThan, GreaterThanOrEqualTo, LesserThan, LesserThanOrEqualTo, NotEquals, StartsWith} +} + // PricingTier enumerates the values for pricing tier. type PricingTier string @@ -450,6 +521,25 @@ func PossiblePricingTierValues() []PricingTier { return []PricingTier{Free, Standard} } +// PropertyType enumerates the values for property type. +type PropertyType string + +const ( + // Boolean ... + Boolean PropertyType = "Boolean" + // Integer ... + Integer PropertyType = "Integer" + // Number ... + Number PropertyType = "Number" + // String ... + String PropertyType = "String" +) + +// PossiblePropertyTypeValues returns an array of possible values for the PropertyType const type. +func PossiblePropertyTypeValues() []PropertyType { + return []PropertyType{Boolean, Integer, Number, String} +} + // Protocol enumerates the values for protocol. type Protocol string @@ -822,15 +912,15 @@ func PossibleTypeValues() []Type { type ValueType string const ( - // IPCidr An IP range in CIDR format (e.g. '192.168.0.1/8'). - IPCidr ValueType = "IpCidr" - // String Any string value. - String ValueType = "String" + // ValueTypeIPCidr An IP range in CIDR format (e.g. '192.168.0.1/8'). + ValueTypeIPCidr ValueType = "IpCidr" + // ValueTypeString Any string value. + ValueTypeString ValueType = "String" ) // PossibleValueTypeValues returns an array of possible values for the ValueType const type. func PossibleValueTypeValues() []ValueType { - return []ValueType{IPCidr, String} + return []ValueType{ValueTypeIPCidr, ValueTypeString} } // AadConnectivityState1 describes an Azure resource with kind @@ -1920,7 +2010,7 @@ type AllowedConnectionsResourceProperties struct { type AllowlistCustomAlertRule struct { // AllowlistValues - The values to allow. The format of the values depends on the rule type. AllowlistValues *[]string `json:"allowlistValues,omitempty"` - // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'IPCidr', 'String' + // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'ValueTypeIPCidr', 'ValueTypeString' ValueType ValueType `json:"valueType,omitempty"` // DisplayName - READ-ONLY; The display name of the custom alert. DisplayName *string `json:"displayName,omitempty"` @@ -2012,83 +2102,1295 @@ func (awg *AppWhitelistingGroup) UnmarshalJSON(body []byte) error { } } - return nil + return nil +} + +// AppWhitelistingGroupData represents a VM/server group and set of rules that are Recommended by Azure +// Security Center to be allowed +type AppWhitelistingGroupData struct { + // EnforcementMode - Possible values include: 'Audit', 'Enforce', 'None' + EnforcementMode EnforcementMode `json:"enforcementMode,omitempty"` + ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` + // ConfigurationStatus - Possible values include: 'ConfigurationStatus2Configured', 'ConfigurationStatus2NotConfigured', 'ConfigurationStatus2InProgress', 'ConfigurationStatus2Failed', 'ConfigurationStatus2NoStatus' + ConfigurationStatus ConfigurationStatus2 `json:"configurationStatus,omitempty"` + // RecommendationStatus - Possible values include: 'RecommendationStatusRecommended', 'RecommendationStatusNotRecommended', 'RecommendationStatusNotAvailable', 'RecommendationStatusNoStatus' + RecommendationStatus RecommendationStatus `json:"recommendationStatus,omitempty"` + Issues *[]AppWhitelistingIssueSummary `json:"issues,omitempty"` + // SourceSystem - Possible values include: 'SourceSystemAzureAppLocker', 'SourceSystemAzureAuditD', 'SourceSystemNonAzureAppLocker', 'SourceSystemNonAzureAuditD', 'SourceSystemNone' + SourceSystem SourceSystem `json:"sourceSystem,omitempty"` + VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` + PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +} + +// AppWhitelistingGroups represents a list of VM/server groups and set of rules that are Recommended by +// Azure Security Center to be allowed +type AppWhitelistingGroups struct { + autorest.Response `json:"-"` + Value *[]AppWhitelistingGroup `json:"value,omitempty"` +} + +// AppWhitelistingIssueSummary represents a summary of the alerts of the VM/server group +type AppWhitelistingIssueSummary struct { + // Issue - Possible values include: 'ViolationsAudited', 'ViolationsBlocked', 'MsiAndScriptViolationsAudited', 'MsiAndScriptViolationsBlocked', 'ExecutableViolationsAudited', 'RulesViolatedManually' + Issue Issue `json:"issue,omitempty"` + // NumberOfVms - The number of machines in the VM/server group that have this alert + NumberOfVms *float64 `json:"numberOfVms,omitempty"` +} + +// AppWhitelistingPutGroupData the altered data of the recommended VM/server group policy +type AppWhitelistingPutGroupData struct { + // EnforcementMode - The enforcement mode of the group. Can also be defined per collection type by using ProtectionMode. Possible values include: 'EnforcementMode1Audit', 'EnforcementMode1Enforce', 'EnforcementMode1None' + EnforcementMode EnforcementMode1 `json:"enforcementMode,omitempty"` + // ProtectionMode - The protection mode of the group per collection type. Can also be defined for all collection types by using EnforcementMode + ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` + VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` + PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +} + +// AscLocation the ASC location of the subscription is in the "name" field +type AscLocation struct { + autorest.Response `json:"-"` + Properties interface{} `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// AscLocationList list of locations where ASC saves your data +type AscLocationList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY + Value *[]AscLocation `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// AscLocationListIterator provides access to a complete listing of AscLocation values. +type AscLocationListIterator struct { + i int + page AscLocationListPage +} + +// 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 *AscLocationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AscLocationListIterator.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 *AscLocationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AscLocationListIterator) 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 AscLocationListIterator) Response() AscLocationList { + 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 AscLocationListIterator) Value() AscLocation { + if !iter.page.NotDone() { + return AscLocation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AscLocationListIterator type. +func NewAscLocationListIterator(page AscLocationListPage) AscLocationListIterator { + return AscLocationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (all AscLocationList) IsEmpty() bool { + return all.Value == nil || len(*all.Value) == 0 +} + +// ascLocationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (all AscLocationList) ascLocationListPreparer(ctx context.Context) (*http.Request, error) { + if all.NextLink == nil || len(to.String(all.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(all.NextLink))) +} + +// AscLocationListPage contains a page of AscLocation values. +type AscLocationListPage struct { + fn func(context.Context, AscLocationList) (AscLocationList, error) + all AscLocationList +} + +// 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 *AscLocationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AscLocationListPage.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.all) + if err != nil { + return err + } + page.all = 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 *AscLocationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AscLocationListPage) NotDone() bool { + return !page.all.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AscLocationListPage) Response() AscLocationList { + return page.all +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AscLocationListPage) Values() []AscLocation { + if page.all.IsEmpty() { + return nil + } + return *page.all.Value +} + +// Creates a new instance of the AscLocationListPage type. +func NewAscLocationListPage(getNextPage func(context.Context, AscLocationList) (AscLocationList, error)) AscLocationListPage { + return AscLocationListPage{fn: getNextPage} +} + +// AtaExternalSecuritySolution represents an ATA security solution which sends logs to an OMS workspace +type AtaExternalSecuritySolution struct { + Properties *AtaSolutionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Location where the resource is stored + Location *string `json:"location,omitempty"` + // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' + Kind KindEnum `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) MarshalJSON() ([]byte, error) { + aess.Kind = KindATA + objectMap := make(map[string]interface{}) + if aess.Properties != nil { + objectMap["properties"] = aess.Properties + } + if aess.Kind != "" { + objectMap["kind"] = aess.Kind + } + return json.Marshal(objectMap) +} + +// AsCefExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) AsCefExternalSecuritySolution() (*CefExternalSecuritySolution, bool) { + return nil, false +} + +// AsAtaExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) AsAtaExternalSecuritySolution() (*AtaExternalSecuritySolution, bool) { + return &aess, true +} + +// AsAadExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) AsAadExternalSecuritySolution() (*AadExternalSecuritySolution, bool) { + return nil, false +} + +// AsExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) AsExternalSecuritySolution() (*ExternalSecuritySolution, bool) { + return nil, false +} + +// AsBasicExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) AsBasicExternalSecuritySolution() (BasicExternalSecuritySolution, bool) { + return &aess, true +} + +// AtaSolutionProperties ... +type AtaSolutionProperties struct { + LastEventReceived *string `json:"lastEventReceived,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + DeviceVendor *string `json:"deviceVendor,omitempty"` + DeviceType *string `json:"deviceType,omitempty"` + Workspace *ConnectedWorkspace `json:"workspace,omitempty"` +} + +// MarshalJSON is the custom marshaler for AtaSolutionProperties. +func (asp AtaSolutionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asp.LastEventReceived != nil { + objectMap["lastEventReceived"] = asp.LastEventReceived + } + if asp.DeviceVendor != nil { + objectMap["deviceVendor"] = asp.DeviceVendor + } + if asp.DeviceType != nil { + objectMap["deviceType"] = asp.DeviceType + } + if asp.Workspace != nil { + objectMap["workspace"] = asp.Workspace + } + for k, v := range asp.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AtaSolutionProperties struct. +func (asp *AtaSolutionProperties) 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 "lastEventReceived": + if v != nil { + var lastEventReceived string + err = json.Unmarshal(*v, &lastEventReceived) + if err != nil { + return err + } + asp.LastEventReceived = &lastEventReceived + } + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if asp.AdditionalProperties == nil { + asp.AdditionalProperties = make(map[string]interface{}) + } + asp.AdditionalProperties[k] = additionalProperties + } + case "deviceVendor": + if v != nil { + var deviceVendor string + err = json.Unmarshal(*v, &deviceVendor) + if err != nil { + return err + } + asp.DeviceVendor = &deviceVendor + } + case "deviceType": + if v != nil { + var deviceType string + err = json.Unmarshal(*v, &deviceType) + if err != nil { + return err + } + asp.DeviceType = &deviceType + } + case "workspace": + if v != nil { + var workspace ConnectedWorkspace + err = json.Unmarshal(*v, &workspace) + if err != nil { + return err + } + asp.Workspace = &workspace + } + } + } + + return nil +} + +// Automation the security automation resource. +type Automation struct { + autorest.Response `json:"-"` + // AutomationProperties - Security automation data + *AutomationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Location where the resource is stored + Location *string `json:"location,omitempty"` + // Kind - Kind of the resource + Kind *string `json:"kind,omitempty"` + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. + Etag *string `json:"etag,omitempty"` + // Tags - A list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Automation. +func (a Automation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.AutomationProperties != nil { + objectMap["properties"] = a.AutomationProperties + } + if a.Kind != nil { + objectMap["kind"] = a.Kind + } + if a.Etag != nil { + objectMap["etag"] = a.Etag + } + if a.Tags != nil { + objectMap["tags"] = a.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Automation struct. +func (a *Automation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var automationProperties AutomationProperties + err = json.Unmarshal(*v, &automationProperties) + if err != nil { + return err + } + a.AutomationProperties = &automationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + a.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + a.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + a.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + a.Location = &location + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + a.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + a.Etag = &etag + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + a.Tags = tags + } + } + } + + return nil +} + +// BasicAutomationAction the action that should be triggered. +type BasicAutomationAction interface { + AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) + AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) + AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) + AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) + AsAutomationActionEventHub() (*AutomationActionEventHub, bool) + AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) + AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) + AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) + AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) + AsAutomationAction() (*AutomationAction, bool) +} + +// AutomationAction the action that should be triggered. +type AutomationAction struct { + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +func unmarshalBasicAutomationAction(body []byte) (BasicAutomationAction, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["actionType"] { + case string(ActionTypeLogicApp): + var aala AutomationActionLogicApp + err := json.Unmarshal(body, &aala) + return aala, err + case string(ActionTypeLogicApp): + var aalai AutomationActionLogicAppInput + err := json.Unmarshal(body, &aalai) + return aalai, err + case string(ActionTypeLogicApp): + var aalao AutomationActionLogicAppOutput + err := json.Unmarshal(body, &aalao) + return aalao, err + case string(ActionTypeEventHub): + var aaeh AutomationActionEventHub + err := json.Unmarshal(body, &aaeh) + return aaeh, err + case string(ActionTypeEventHub): + var aaehi AutomationActionEventHubInput + err := json.Unmarshal(body, &aaehi) + return aaehi, err + case string(ActionTypeEventHub): + var aaeho AutomationActionEventHubOutput + err := json.Unmarshal(body, &aaeho) + return aaeho, err + case string(ActionTypeWorkspace): + var aaw AutomationActionWorkspace + err := json.Unmarshal(body, &aaw) + return aaw, err + default: + var aa AutomationAction + err := json.Unmarshal(body, &aa) + return aa, err + } +} +func unmarshalBasicAutomationActionArray(body []byte) ([]BasicAutomationAction, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + aaArray := make([]BasicAutomationAction, len(rawMessages)) + + for index, rawMessage := range rawMessages { + aa, err := unmarshalBasicAutomationAction(*rawMessage) + if err != nil { + return nil, err + } + aaArray[index] = aa + } + return aaArray, nil +} + +// MarshalJSON is the custom marshaler for AutomationAction. +func (aa AutomationAction) MarshalJSON() ([]byte, error) { + aa.ActionType = ActionTypeAutomationAction + objectMap := make(map[string]interface{}) + if aa.ActionType != "" { + objectMap["actionType"] = aa.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return nil, false +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return nil, false +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationAction() (*AutomationAction, bool) { + return &aa, true +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aa, true +} + +// BasicAutomationActionEventHub the target Event Hub to which event data will be exported. +type BasicAutomationActionEventHub interface { + AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) + AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) + AsAutomationActionEventHub() (*AutomationActionEventHub, bool) +} + +// AutomationActionEventHub the target Event Hub to which event data will be exported. +type AutomationActionEventHub struct { + // EventHubResourceID - The target Event Hub Azure Resource ID. + EventHubResourceID *string `json:"eventHubResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +func unmarshalBasicAutomationActionEventHub(body []byte) (BasicAutomationActionEventHub, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["actionType"] { + case string(ActionTypeEventHub): + var aaehi AutomationActionEventHubInput + err := json.Unmarshal(body, &aaehi) + return aaehi, err + case string(ActionTypeEventHub): + var aaeho AutomationActionEventHubOutput + err := json.Unmarshal(body, &aaeho) + return aaeho, err + default: + var aaeh AutomationActionEventHub + err := json.Unmarshal(body, &aaeh) + return aaeh, err + } +} +func unmarshalBasicAutomationActionEventHubArray(body []byte) ([]BasicAutomationActionEventHub, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + aaehArray := make([]BasicAutomationActionEventHub, len(rawMessages)) + + for index, rawMessage := range rawMessages { + aaeh, err := unmarshalBasicAutomationActionEventHub(*rawMessage) + if err != nil { + return nil, err + } + aaehArray[index] = aaeh + } + return aaehArray, nil +} + +// MarshalJSON is the custom marshaler for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) MarshalJSON() ([]byte, error) { + aaeh.ActionType = ActionTypeEventHub + objectMap := make(map[string]interface{}) + if aaeh.EventHubResourceID != nil { + objectMap["eventHubResourceId"] = aaeh.EventHubResourceID + } + if aaeh.ActionType != "" { + objectMap["actionType"] = aaeh.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return nil, false +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return &aaeh, true +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return &aaeh, true +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aaeh, true +} + +// AutomationActionEventHubInput the target Event Hub to which event data will be exported. +type AutomationActionEventHubInput struct { + // ConnectionString - The target Event Hub connection string + ConnectionString *string `json:"connectionString,omitempty"` + // EventHubResourceID - The target Event Hub Azure Resource ID. + EventHubResourceID *string `json:"eventHubResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) MarshalJSON() ([]byte, error) { + aaehi.ActionType = ActionTypeEventHub + objectMap := make(map[string]interface{}) + if aaehi.ConnectionString != nil { + objectMap["connectionString"] = aaehi.ConnectionString + } + if aaehi.EventHubResourceID != nil { + objectMap["eventHubResourceId"] = aaehi.EventHubResourceID + } + if aaehi.ActionType != "" { + objectMap["actionType"] = aaehi.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return nil, false +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return &aaehi, true +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return &aaehi, true +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aaehi, true +} + +// AutomationActionEventHubOutput the target Event Hub to which event data will be exported. +type AutomationActionEventHubOutput struct { + // SasPolicyName - The target Event Hub SAS policy name. + SasPolicyName *string `json:"sasPolicyName,omitempty"` + // EventHubResourceID - The target Event Hub Azure Resource ID. + EventHubResourceID *string `json:"eventHubResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) MarshalJSON() ([]byte, error) { + aaeho.ActionType = ActionTypeEventHub + objectMap := make(map[string]interface{}) + if aaeho.SasPolicyName != nil { + objectMap["sasPolicyName"] = aaeho.SasPolicyName + } + if aaeho.EventHubResourceID != nil { + objectMap["eventHubResourceId"] = aaeho.EventHubResourceID + } + if aaeho.ActionType != "" { + objectMap["actionType"] = aaeho.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return nil, false +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return &aaeho, true +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return &aaeho, true +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aaeho, true +} + +// BasicAutomationActionLogicApp the logic app action that should be triggered. +type BasicAutomationActionLogicApp interface { + AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) + AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) + AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) +} + +// AutomationActionLogicApp the logic app action that should be triggered. +type AutomationActionLogicApp struct { + // LogicAppResourceID - The triggered Logic App Azure Resource ID. This can also reside on other subscriptions, given that you have permissions to trigger the Logic App + LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +func unmarshalBasicAutomationActionLogicApp(body []byte) (BasicAutomationActionLogicApp, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["actionType"] { + case string(ActionTypeLogicApp): + var aalai AutomationActionLogicAppInput + err := json.Unmarshal(body, &aalai) + return aalai, err + case string(ActionTypeLogicApp): + var aalao AutomationActionLogicAppOutput + err := json.Unmarshal(body, &aalao) + return aalao, err + default: + var aala AutomationActionLogicApp + err := json.Unmarshal(body, &aala) + return aala, err + } +} +func unmarshalBasicAutomationActionLogicAppArray(body []byte) ([]BasicAutomationActionLogicApp, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + aalaArray := make([]BasicAutomationActionLogicApp, len(rawMessages)) + + for index, rawMessage := range rawMessages { + aala, err := unmarshalBasicAutomationActionLogicApp(*rawMessage) + if err != nil { + return nil, err + } + aalaArray[index] = aala + } + return aalaArray, nil +} + +// MarshalJSON is the custom marshaler for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) MarshalJSON() ([]byte, error) { + aala.ActionType = ActionTypeLogicApp + objectMap := make(map[string]interface{}) + if aala.LogicAppResourceID != nil { + objectMap["logicAppResourceId"] = aala.LogicAppResourceID + } + if aala.ActionType != "" { + objectMap["actionType"] = aala.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return &aala, true +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return &aala, true +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return nil, false +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aala, true +} + +// AutomationActionLogicAppInput the logic app action that should be triggered. +type AutomationActionLogicAppInput struct { + // URI - The Logic App trigger URI endpoint. + URI *string `json:"uri,omitempty"` + // LogicAppResourceID - The triggered Logic App Azure Resource ID. This can also reside on other subscriptions, given that you have permissions to trigger the Logic App + LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) MarshalJSON() ([]byte, error) { + aalai.ActionType = ActionTypeLogicApp + objectMap := make(map[string]interface{}) + if aalai.URI != nil { + objectMap["uri"] = aalai.URI + } + if aalai.LogicAppResourceID != nil { + objectMap["logicAppResourceId"] = aalai.LogicAppResourceID + } + if aalai.ActionType != "" { + objectMap["actionType"] = aalai.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return &aalai, true +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return &aalai, true +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return nil, false +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aalai, true +} + +// AutomationActionLogicAppOutput the logic app action that should be triggered. +type AutomationActionLogicAppOutput struct { + // LogicAppResourceID - The triggered Logic App Azure Resource ID. This can also reside on other subscriptions, given that you have permissions to trigger the Logic App + LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) MarshalJSON() ([]byte, error) { + aalao.ActionType = ActionTypeLogicApp + objectMap := make(map[string]interface{}) + if aalao.LogicAppResourceID != nil { + objectMap["logicAppResourceId"] = aalao.LogicAppResourceID + } + if aalao.ActionType != "" { + objectMap["actionType"] = aalao.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return &aalao, true +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return &aalao, true +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return nil, false +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aalao, true +} + +// AutomationActionWorkspace the Log Analytics Workspace to which event data will be exported. Security +// alerts data will reside in the 'SecurityAlert' table and the assessments data will reside in the +// 'SecurityRecommendation' table (under the 'Security'/'SecurityCenterFree' solutions). Note that in order +// to view the data in the workspace, the Security Center Log Analytics free/standard solution needs to be +// enabled on that workspace. +type AutomationActionWorkspace struct { + // WorkspaceResourceID - The fully qualified Log Analytics Workspace Azure Resource ID. + WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) MarshalJSON() ([]byte, error) { + aaw.ActionType = ActionTypeWorkspace + objectMap := make(map[string]interface{}) + if aaw.WorkspaceResourceID != nil { + objectMap["workspaceResourceId"] = aaw.WorkspaceResourceID + } + if aaw.ActionType != "" { + objectMap["actionType"] = aaw.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return nil, false +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return nil, false } -// AppWhitelistingGroupData represents a VM/server group and set of rules that are Recommended by Azure -// Security Center to be allowed -type AppWhitelistingGroupData struct { - // EnforcementMode - Possible values include: 'Audit', 'Enforce', 'None' - EnforcementMode EnforcementMode `json:"enforcementMode,omitempty"` - ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` - // ConfigurationStatus - Possible values include: 'ConfigurationStatus2Configured', 'ConfigurationStatus2NotConfigured', 'ConfigurationStatus2InProgress', 'ConfigurationStatus2Failed', 'ConfigurationStatus2NoStatus' - ConfigurationStatus ConfigurationStatus2 `json:"configurationStatus,omitempty"` - // RecommendationStatus - Possible values include: 'RecommendationStatusRecommended', 'RecommendationStatusNotRecommended', 'RecommendationStatusNotAvailable', 'RecommendationStatusNoStatus' - RecommendationStatus RecommendationStatus `json:"recommendationStatus,omitempty"` - Issues *[]AppWhitelistingIssueSummary `json:"issues,omitempty"` - // SourceSystem - Possible values include: 'SourceSystemAzureAppLocker', 'SourceSystemAzureAuditD', 'SourceSystemNonAzureAppLocker', 'SourceSystemNonAzureAuditD', 'SourceSystemNone' - SourceSystem SourceSystem `json:"sourceSystem,omitempty"` - VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` - PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false } -// AppWhitelistingGroups represents a list of VM/server groups and set of rules that are Recommended by -// Azure Security Center to be allowed -type AppWhitelistingGroups struct { - autorest.Response `json:"-"` - Value *[]AppWhitelistingGroup `json:"value,omitempty"` +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false } -// AppWhitelistingIssueSummary represents a summary of the alerts of the VM/server group -type AppWhitelistingIssueSummary struct { - // Issue - Possible values include: 'ViolationsAudited', 'ViolationsBlocked', 'MsiAndScriptViolationsAudited', 'MsiAndScriptViolationsBlocked', 'ExecutableViolationsAudited', 'RulesViolatedManually' - Issue Issue `json:"issue,omitempty"` - // NumberOfVms - The number of machines in the VM/server group that have this alert - NumberOfVms *float64 `json:"numberOfVms,omitempty"` +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return &aaw, true } -// AppWhitelistingPutGroupData the altered data of the recommended VM/server group policy -type AppWhitelistingPutGroupData struct { - // EnforcementMode - The enforcement mode of the group. Can also be defined per collection type by using ProtectionMode. Possible values include: 'EnforcementMode1Audit', 'EnforcementMode1Enforce', 'EnforcementMode1None' - EnforcementMode EnforcementMode1 `json:"enforcementMode,omitempty"` - // ProtectionMode - The protection mode of the group per collection type. Can also be defined for all collection types by using EnforcementMode - ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` - VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` - PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationAction() (*AutomationAction, bool) { + return nil, false } -// AscLocation the ASC location of the subscription is in the "name" field -type AscLocation struct { - autorest.Response `json:"-"` - Properties interface{} `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aaw, true } -// AscLocationList list of locations where ASC saves your data -type AscLocationList struct { +// AutomationList list of security automations response. +type AutomationList struct { autorest.Response `json:"-"` - // Value - READ-ONLY - Value *[]AscLocation `json:"value,omitempty"` + // Value - The list of security automations under the given scope. + Value *[]Automation `json:"value,omitempty"` // NextLink - READ-ONLY; The URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` } -// AscLocationListIterator provides access to a complete listing of AscLocation values. -type AscLocationListIterator struct { +// AutomationListIterator provides access to a complete listing of Automation values. +type AutomationListIterator struct { i int - page AscLocationListPage + page AutomationListPage } // 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 *AscLocationListIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *AutomationListIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AscLocationListIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationListIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -2113,62 +3415,62 @@ func (iter *AscLocationListIterator) NextWithContext(ctx context.Context) (err e // 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 *AscLocationListIterator) Next() error { +func (iter *AutomationListIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AscLocationListIterator) NotDone() bool { +func (iter AutomationListIterator) 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 AscLocationListIterator) Response() AscLocationList { +func (iter AutomationListIterator) Response() AutomationList { 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 AscLocationListIterator) Value() AscLocation { +func (iter AutomationListIterator) Value() Automation { if !iter.page.NotDone() { - return AscLocation{} + return Automation{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the AscLocationListIterator type. -func NewAscLocationListIterator(page AscLocationListPage) AscLocationListIterator { - return AscLocationListIterator{page: page} +// Creates a new instance of the AutomationListIterator type. +func NewAutomationListIterator(page AutomationListPage) AutomationListIterator { + return AutomationListIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (all AscLocationList) IsEmpty() bool { - return all.Value == nil || len(*all.Value) == 0 +func (al AutomationList) IsEmpty() bool { + return al.Value == nil || len(*al.Value) == 0 } -// ascLocationListPreparer prepares a request to retrieve the next set of results. +// automationListPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (all AscLocationList) ascLocationListPreparer(ctx context.Context) (*http.Request, error) { - if all.NextLink == nil || len(to.String(all.NextLink)) < 1 { +func (al AutomationList) automationListPreparer(ctx context.Context) (*http.Request, error) { + if al.NextLink == nil || len(to.String(al.NextLink)) < 1 { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(all.NextLink))) + autorest.WithBaseURL(to.String(al.NextLink))) } -// AscLocationListPage contains a page of AscLocation values. -type AscLocationListPage struct { - fn func(context.Context, AscLocationList) (AscLocationList, error) - all AscLocationList +// AutomationListPage contains a page of Automation values. +type AutomationListPage struct { + fn func(context.Context, AutomationList) (AutomationList, error) + al AutomationList } // 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 *AscLocationListPage) NextWithContext(ctx context.Context) (err error) { +func (page *AutomationListPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AscLocationListPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationListPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -2177,130 +3479,76 @@ func (page *AscLocationListPage) NextWithContext(ctx context.Context) (err error tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.all) + next, err := page.fn(ctx, page.al) if err != nil { return err } - page.all = next + page.al = 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 *AscLocationListPage) Next() error { +func (page *AutomationListPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AscLocationListPage) NotDone() bool { - return !page.all.IsEmpty() +func (page AutomationListPage) NotDone() bool { + return !page.al.IsEmpty() } // Response returns the raw server response from the last page request. -func (page AscLocationListPage) Response() AscLocationList { - return page.all +func (page AutomationListPage) Response() AutomationList { + return page.al } // Values returns the slice of values for the current page or nil if there are no values. -func (page AscLocationListPage) Values() []AscLocation { - if page.all.IsEmpty() { +func (page AutomationListPage) Values() []Automation { + if page.al.IsEmpty() { return nil } - return *page.all.Value -} - -// Creates a new instance of the AscLocationListPage type. -func NewAscLocationListPage(getNextPage func(context.Context, AscLocationList) (AscLocationList, error)) AscLocationListPage { - return AscLocationListPage{fn: getNextPage} -} - -// AtaExternalSecuritySolution represents an ATA security solution which sends logs to an OMS workspace -type AtaExternalSecuritySolution struct { - Properties *AtaSolutionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - READ-ONLY; Location where the resource is stored - Location *string `json:"location,omitempty"` - // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' - Kind KindEnum `json:"kind,omitempty"` -} - -// MarshalJSON is the custom marshaler for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) MarshalJSON() ([]byte, error) { - aess.Kind = KindATA - objectMap := make(map[string]interface{}) - if aess.Properties != nil { - objectMap["properties"] = aess.Properties - } - if aess.Kind != "" { - objectMap["kind"] = aess.Kind - } - return json.Marshal(objectMap) -} - -// AsCefExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) AsCefExternalSecuritySolution() (*CefExternalSecuritySolution, bool) { - return nil, false -} - -// AsAtaExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) AsAtaExternalSecuritySolution() (*AtaExternalSecuritySolution, bool) { - return &aess, true -} - -// AsAadExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) AsAadExternalSecuritySolution() (*AadExternalSecuritySolution, bool) { - return nil, false -} - -// AsExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) AsExternalSecuritySolution() (*ExternalSecuritySolution, bool) { - return nil, false -} - -// AsBasicExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) AsBasicExternalSecuritySolution() (BasicExternalSecuritySolution, bool) { - return &aess, true + return *page.al.Value } -// AtaSolutionProperties ... -type AtaSolutionProperties struct { - LastEventReceived *string `json:"lastEventReceived,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - DeviceVendor *string `json:"deviceVendor,omitempty"` - DeviceType *string `json:"deviceType,omitempty"` - Workspace *ConnectedWorkspace `json:"workspace,omitempty"` +// Creates a new instance of the AutomationListPage type. +func NewAutomationListPage(getNextPage func(context.Context, AutomationList) (AutomationList, error)) AutomationListPage { + return AutomationListPage{fn: getNextPage} } -// MarshalJSON is the custom marshaler for AtaSolutionProperties. -func (asp AtaSolutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asp.LastEventReceived != nil { - objectMap["lastEventReceived"] = asp.LastEventReceived - } - if asp.DeviceVendor != nil { - objectMap["deviceVendor"] = asp.DeviceVendor - } - if asp.DeviceType != nil { - objectMap["deviceType"] = asp.DeviceType - } - if asp.Workspace != nil { - objectMap["workspace"] = asp.Workspace - } - for k, v := range asp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) +// AutomationMetadata the metadata of the security automation resource. +type AutomationMetadata struct { + // CreatedDateTimeUtc - READ-ONLY; The security automation creation date. + CreatedDateTimeUtc *date.Time `json:"createdDateTimeUtc,omitempty"` + // CreatedBy - READ-ONLY; The AAD object ID of the entity that created the security automation. + CreatedBy *string `json:"createdBy,omitempty"` + // LastUpdatedDateTimeUtc - READ-ONLY; The security automation last updated date. + LastUpdatedDateTimeUtc *date.Time `json:"lastUpdatedDateTimeUtc,omitempty"` + // LastUpdatedBy - READ-ONLY; The AAD object ID of the entity that last updated the security automation. + LastUpdatedBy *string `json:"lastUpdatedBy,omitempty"` } -// UnmarshalJSON is the custom unmarshaler for AtaSolutionProperties struct. -func (asp *AtaSolutionProperties) UnmarshalJSON(body []byte) error { +// AutomationProperties a set of properties that defines the behavior of the automation configuration. To +// learn more about the supported security events data models schemas - please visit +// https://aka.ms/ASCAutomationSchemas. +type AutomationProperties struct { + // Description - The security automation description. + Description *string `json:"description,omitempty"` + // IsEnabled - Indicates whether the security automation is enabled. + IsEnabled *bool `json:"isEnabled,omitempty"` + // Metadata - The metadata of the security automation resource. + Metadata *AutomationMetadata `json:"metadata,omitempty"` + // Scopes - A collection of scopes on which the security automations logic is applied. Supported scopes are the subscription itself or a resource group under that subscription. The automation will only apply on defined scopes. + Scopes *[]AutomationScope `json:"scopes,omitempty"` + // Sources - A collection of the source event types which evaluate the security automation set of rules. + Sources *[]AutomationSource `json:"sources,omitempty"` + // Actions - A collection of the actions which are triggered if all the configured rules evaluations, within at least one rule set, are true. + Actions *[]BasicAutomationAction `json:"actions,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for AutomationProperties struct. +func (ap *AutomationProperties) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -2308,53 +3556,58 @@ func (asp *AtaSolutionProperties) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "lastEventReceived": + case "description": if v != nil { - var lastEventReceived string - err = json.Unmarshal(*v, &lastEventReceived) + var description string + err = json.Unmarshal(*v, &description) if err != nil { return err } - asp.LastEventReceived = &lastEventReceived + ap.Description = &description } - default: + case "isEnabled": if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) + var isEnabled bool + err = json.Unmarshal(*v, &isEnabled) if err != nil { return err } - if asp.AdditionalProperties == nil { - asp.AdditionalProperties = make(map[string]interface{}) + ap.IsEnabled = &isEnabled + } + case "metadata": + if v != nil { + var metadata AutomationMetadata + err = json.Unmarshal(*v, &metadata) + if err != nil { + return err } - asp.AdditionalProperties[k] = additionalProperties + ap.Metadata = &metadata } - case "deviceVendor": + case "scopes": if v != nil { - var deviceVendor string - err = json.Unmarshal(*v, &deviceVendor) + var scopes []AutomationScope + err = json.Unmarshal(*v, &scopes) if err != nil { return err } - asp.DeviceVendor = &deviceVendor + ap.Scopes = &scopes } - case "deviceType": + case "sources": if v != nil { - var deviceType string - err = json.Unmarshal(*v, &deviceType) + var sources []AutomationSource + err = json.Unmarshal(*v, &sources) if err != nil { return err } - asp.DeviceType = &deviceType + ap.Sources = &sources } - case "workspace": + case "actions": if v != nil { - var workspace ConnectedWorkspace - err = json.Unmarshal(*v, &workspace) + actions, err := unmarshalBasicAutomationActionArray(*v) if err != nil { return err } - asp.Workspace = &workspace + ap.Actions = &actions } } } @@ -2362,6 +3615,53 @@ func (asp *AtaSolutionProperties) UnmarshalJSON(body []byte) error { return nil } +// AutomationRuleSet a rule set which evaluates all its rules upon an event interception. Only when all the +// included rules in the rule set will be evaluated as 'true', will the event trigger the defined actions. +type AutomationRuleSet struct { + Rules *[]AutomationTriggeringRule `json:"rules,omitempty"` +} + +// AutomationScope a single automation scope. +type AutomationScope struct { + // Description - The resources scope description. + Description *string `json:"description,omitempty"` + // ScopePath - The resources scope path. Can be the subscription on which the automation is defined on or a resource group under that subscription (fully qualified Azure resource IDs). + ScopePath *string `json:"scopePath,omitempty"` +} + +// AutomationSource the source event types which evaluate the security automation set of rules. For example +// - security alerts and security assessments. To learn more about the supported security events data +// models schemas - please visit https://aka.ms/ASCAutomationSchemas. +type AutomationSource struct { + // EventSource - A valid event source type. Possible values include: 'Assessments', 'Alerts' + EventSource EventSource `json:"eventSource,omitempty"` + // RuleSets - A set of rules which evaluate upon event interception. A logical disjunction is applied between defined rule sets (logical 'or'). + RuleSets *[]AutomationRuleSet `json:"ruleSets,omitempty"` +} + +// AutomationTriggeringRule a rule which is evaluated upon event interception. The rule is configured by +// comparing a specific value from the event model to an expected value. This comparison is done by using +// one of the supported operators set. +type AutomationTriggeringRule struct { + // PropertyJPath - The JPath of the entity model property that should be checked. + PropertyJPath *string `json:"propertyJPath,omitempty"` + // PropertyType - The data type of the compared operands (string, integer, floating point number or a boolean [true/false]]. Possible values include: 'String', 'Integer', 'Number', 'Boolean' + PropertyType PropertyType `json:"propertyType,omitempty"` + // ExpectedValue - The expected value. + ExpectedValue *string `json:"expectedValue,omitempty"` + // Operator - A valid comparer operator to use. Possible values include: 'Equals', 'GreaterThan', 'GreaterThanOrEqualTo', 'LesserThan', 'LesserThanOrEqualTo', 'NotEquals', 'Contains', 'StartsWith', 'EndsWith' + Operator Operator `json:"operator,omitempty"` +} + +// AutomationValidationStatus the security automation model state property bag. +type AutomationValidationStatus struct { + autorest.Response `json:"-"` + // IsValid - Indicates whether the model is valid or not. + IsValid *bool `json:"isValid,omitempty"` + // Message - The validation message. + Message *string `json:"message,omitempty"` +} + // AutoProvisioningSetting auto provisioning setting type AutoProvisioningSetting struct { autorest.Response `json:"-"` @@ -3563,7 +4863,7 @@ type DataExportSettingProperties struct { type DenylistCustomAlertRule struct { // DenylistValues - The values to deny. The format of the values depends on the rule type. DenylistValues *[]string `json:"denylistValues,omitempty"` - // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'IPCidr', 'String' + // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'ValueTypeIPCidr', 'ValueTypeString' ValueType ValueType `json:"valueType,omitempty"` // DisplayName - READ-ONLY; The display name of the custom alert. DisplayName *string `json:"displayName,omitempty"` @@ -4055,6 +5355,12 @@ type EffectiveNetworkSecurityGroups struct { NetworkSecurityGroups *[]string `json:"networkSecurityGroups,omitempty"` } +// ETag entity tag is used for comparing two or more entities from the same requested resource. +type ETag struct { + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. + Etag *string `json:"etag,omitempty"` +} + // BasicExternalSecuritySolution represents a security solution external to Azure Security Center which sends // information to an OMS workspace and whose data is displayed by Azure Security Center. type BasicExternalSecuritySolution interface { @@ -6017,7 +7323,7 @@ type Kind struct { // ListCustomAlertRule a List custom alert rule type ListCustomAlertRule struct { - // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'IPCidr', 'String' + // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'ValueTypeIPCidr', 'ValueTypeString' ValueType ValueType `json:"valueType,omitempty"` // DisplayName - READ-ONLY; The display name of the custom alert. DisplayName *string `json:"displayName,omitempty"` @@ -7796,6 +9102,21 @@ type SubAssessmentStatus struct { Severity Severity `json:"severity,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. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Tags. +func (t Tags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.Tags != nil { + objectMap["tags"] = t.Tags + } + return json.Marshal(objectMap) +} + // TagsResource a container holding only the Tags for a resource, allowing the user to update the tags. type TagsResource struct { // Tags - Resource tags @@ -8399,6 +9720,39 @@ type TopologySingleResourceParent struct { ResourceID *string `json:"resourceId,omitempty"` } +// TrackedResource describes an Azure tracked resource. +type TrackedResource struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Location where the resource is stored + Location *string `json:"location,omitempty"` + // Kind - Kind of the resource + Kind *string `json:"kind,omitempty"` + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. + Etag *string `json:"etag,omitempty"` + // Tags - A list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Kind != nil { + objectMap["kind"] = tr.Kind + } + if tr.Etag != nil { + objectMap["etag"] = tr.Etag + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + // UpdateIotSecuritySolutionData ... type UpdateIotSecuritySolutionData struct { UserDefinedResources *UserDefinedResourcesProperties `json:"userDefinedResources,omitempty"` 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 d644808b3439..aae9e052ab7e 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,18 @@ import ( "github.com/Azure/go-autorest/autorest" ) +// 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) + Delete(ctx context.Context, resourceGroupName string, automationName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, automationName string) (result security.Automation, err error) + List(ctx context.Context) (result security.AutomationListPage, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result security.AutomationListPage, err error) + Validate(ctx context.Context, resourceGroupName string, automationName string, automation security.Automation) (result security.AutomationValidationStatus, err error) +} + +var _ AutomationsClientAPI = (*security.AutomationsClient)(nil) + // SubAssessmentsClientAPI contains the set of methods on the SubAssessmentsClient type. type SubAssessmentsClientAPI interface { Get(ctx context.Context, scope string, assessmentName string, subAssessmentName string) (result security.SubAssessment, err error) diff --git a/services/preview/security/mgmt/v3.0/security/automations.go b/services/preview/security/mgmt/v3.0/security/automations.go new file mode 100644 index 000000000000..605cb35a072d --- /dev/null +++ b/services/preview/security/mgmt/v3.0/security/automations.go @@ -0,0 +1,643 @@ +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" +) + +// AutomationsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type AutomationsClient struct { + BaseClient +} + +// NewAutomationsClient creates an instance of the AutomationsClient client. +func NewAutomationsClient(subscriptionID string, ascLocation string) AutomationsClient { + return NewAutomationsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewAutomationsClientWithBaseURI creates an instance of the AutomationsClient client. +func NewAutomationsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) AutomationsClient { + return AutomationsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// CreateOrUpdate creates or updates a security automation. If a security automation is already created and a +// subsequent request is issued for the same automation id, then it will be updated. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// automationName - the security automation name. +// automation - the security automation resource +func (client AutomationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationName string, automation Automation) (result Automation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AutomationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationName, automation) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AutomationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationName string, automation Automation) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationName": autorest.Encode("path", automationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}", pathParameters), + autorest.WithJSON(automation), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AutomationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +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()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a security automation. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// automationName - the security automation name. +func (client AutomationsClient) Delete(ctx context.Context, resourceGroupName string, automationName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AutomationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, automationName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AutomationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationName": autorest.Encode("path", automationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}", 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 AutomationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +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 + return +} + +// Get retrieves information about the model of a security automation. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// automationName - the security automation name. +func (client AutomationsClient) Get(ctx context.Context, resourceGroupName string, automationName string) (result Automation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AutomationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, automationName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "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.AutomationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AutomationsClient) GetPreparer(ctx context.Context, resourceGroupName string, automationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationName": autorest.Encode("path", automationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}", 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 AutomationsClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +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()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the security automations in the specified subscription. Use the 'nextLink' property in the response +// to get the next page of security automations for the specified subscription. +func (client AutomationsClient) List(ctx context.Context) (result AutomationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.List") + defer func() { + sc := -1 + if result.al.Response.Response != nil { + sc = result.al.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.AutomationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.al.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "List", resp, "Failure sending request") + return + } + + result.al, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AutomationsClient) ListPreparer(ctx context.Context) (*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, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/automations", 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 AutomationsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +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()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AutomationsClient) listNextResults(ctx context.Context, lastResults AutomationList) (result AutomationList, err error) { + req, err := lastResults.automationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.AutomationsClient", "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.AutomationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AutomationsClient) ListComplete(ctx context.Context) (result AutomationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.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 +} + +// ListByResourceGroup lists all the security automations in the specified resource group. Use the 'nextLink' property +// in the response to get the next page of security automations for the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +func (client AutomationsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result AutomationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.al.Response.Response != nil { + sc = result.al.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AutomationsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.al.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.al, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AutomationsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AutomationsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +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()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client AutomationsClient) listByResourceGroupNextResults(ctx context.Context, lastResults AutomationList) (result AutomationList, err error) { + req, err := lastResults.automationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.AutomationsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.AutomationsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AutomationsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result AutomationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.ListByResourceGroup") + 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.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Validate validates the security automation model before create or update. Any validation errors are returned to the +// client. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// automationName - the security automation name. +// automation - the security automation resource +func (client AutomationsClient) Validate(ctx context.Context, resourceGroupName string, automationName string, automation Automation) (result AutomationValidationStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationsClient.Validate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AutomationsClient", "Validate", err.Error()) + } + + req, err := client.ValidatePreparer(ctx, resourceGroupName, automationName, automation) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Validate", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Validate", resp, "Failure sending request") + return + } + + result, err = client.ValidateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AutomationsClient", "Validate", resp, "Failure responding to request") + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client AutomationsClient) ValidatePreparer(ctx context.Context, resourceGroupName string, automationName string, automation Automation) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationName": autorest.Encode("path", automationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "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.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}/validate", pathParameters), + autorest.WithJSON(automation), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client AutomationsClient) ValidateSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +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()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/security/mgmt/v3.0/security/models.go b/services/preview/security/mgmt/v3.0/security/models.go index 1af527a3082f..41b00dc8f79c 100644 --- a/services/preview/security/mgmt/v3.0/security/models.go +++ b/services/preview/security/mgmt/v3.0/security/models.go @@ -65,6 +65,33 @@ func PossibleActionValues() []Action { return []Action{Add, Recommended, Remove} } +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // ActionTypeAutomationAction ... + ActionTypeAutomationAction ActionType = "AutomationAction" + // ActionTypeEventHub ... + ActionTypeEventHub ActionType = "EventHub" + // ActionTypeEventHub1 ... + ActionTypeEventHub1 ActionType = "EventHub" + // ActionTypeEventHub2 ... + ActionTypeEventHub2 ActionType = "EventHub" + // ActionTypeLogicApp ... + ActionTypeLogicApp ActionType = "LogicApp" + // ActionTypeLogicApp1 ... + ActionTypeLogicApp1 ActionType = "LogicApp" + // ActionTypeLogicApp2 ... + ActionTypeLogicApp2 ActionType = "LogicApp" + // ActionTypeWorkspace ... + ActionTypeWorkspace ActionType = "Workspace" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ActionTypeAutomationAction, ActionTypeEventHub, ActionTypeEventHub1, ActionTypeEventHub2, ActionTypeLogicApp, ActionTypeLogicApp1, ActionTypeLogicApp2, ActionTypeWorkspace} +} + // AlertNotifications enumerates the values for alert notifications. type AlertNotifications string @@ -254,6 +281,21 @@ func PossibleEnforcementMode1Values() []EnforcementMode1 { return []EnforcementMode1{EnforcementMode1Audit, EnforcementMode1Enforce, EnforcementMode1None} } +// EventSource enumerates the values for event source. +type EventSource string + +const ( + // Alerts ... + Alerts EventSource = "Alerts" + // Assessments ... + Assessments EventSource = "Assessments" +) + +// PossibleEventSourceValues returns an array of possible values for the EventSource const type. +func PossibleEventSourceValues() []EventSource { + return []EventSource{Alerts, Assessments} +} + // Exe enumerates the values for exe. type Exe string @@ -419,6 +461,35 @@ func PossibleMsiValues() []Msi { return []Msi{MsiAudit, MsiEnforce, MsiNone} } +// Operator enumerates the values for operator. +type Operator string + +const ( + // Contains ... + Contains Operator = "Contains" + // EndsWith ... + EndsWith Operator = "EndsWith" + // Equals ... + Equals Operator = "Equals" + // GreaterThan ... + GreaterThan Operator = "GreaterThan" + // GreaterThanOrEqualTo ... + GreaterThanOrEqualTo Operator = "GreaterThanOrEqualTo" + // LesserThan ... + LesserThan Operator = "LesserThan" + // LesserThanOrEqualTo ... + LesserThanOrEqualTo Operator = "LesserThanOrEqualTo" + // NotEquals ... + NotEquals Operator = "NotEquals" + // StartsWith ... + StartsWith Operator = "StartsWith" +) + +// PossibleOperatorValues returns an array of possible values for the Operator const type. +func PossibleOperatorValues() []Operator { + return []Operator{Contains, EndsWith, Equals, GreaterThan, GreaterThanOrEqualTo, LesserThan, LesserThanOrEqualTo, NotEquals, StartsWith} +} + // PricingTier enumerates the values for pricing tier. type PricingTier string @@ -434,6 +505,25 @@ func PossiblePricingTierValues() []PricingTier { return []PricingTier{Free, Standard} } +// PropertyType enumerates the values for property type. +type PropertyType string + +const ( + // Boolean ... + Boolean PropertyType = "Boolean" + // Integer ... + Integer PropertyType = "Integer" + // Number ... + Number PropertyType = "Number" + // String ... + String PropertyType = "String" +) + +// PossiblePropertyTypeValues returns an array of possible values for the PropertyType const type. +func PossiblePropertyTypeValues() []PropertyType { + return []PropertyType{Boolean, Integer, Number, String} +} + // Protocol enumerates the values for protocol. type Protocol string @@ -846,15 +936,15 @@ func PossibleUnmaskedIPLoggingStatusValues() []UnmaskedIPLoggingStatus { type ValueType string const ( - // IPCidr An IP range in CIDR format (e.g. '192.168.0.1/8'). - IPCidr ValueType = "IpCidr" - // String Any string value. - String ValueType = "String" + // ValueTypeIPCidr An IP range in CIDR format (e.g. '192.168.0.1/8'). + ValueTypeIPCidr ValueType = "IpCidr" + // ValueTypeString Any string value. + ValueTypeString ValueType = "String" ) // PossibleValueTypeValues returns an array of possible values for the ValueType const type. func PossibleValueTypeValues() []ValueType { - return []ValueType{IPCidr, String} + return []ValueType{ValueTypeIPCidr, ValueTypeString} } // AadConnectivityState1 describes an Azure resource with kind @@ -1682,7 +1772,7 @@ type AllowedConnectionsResourceProperties struct { type AllowlistCustomAlertRule struct { // AllowlistValues - The values to allow. The format of the values depends on the rule type. AllowlistValues *[]string `json:"allowlistValues,omitempty"` - // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'IPCidr', 'String' + // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'ValueTypeIPCidr', 'ValueTypeString' ValueType ValueType `json:"valueType,omitempty"` // DisplayName - READ-ONLY; The display name of the custom alert. DisplayName *string `json:"displayName,omitempty"` @@ -1774,83 +1864,1295 @@ func (awg *AppWhitelistingGroup) UnmarshalJSON(body []byte) error { } } - return nil + return nil +} + +// AppWhitelistingGroupData represents a VM/server group and set of rules that are Recommended by Azure +// Security Center to be allowed +type AppWhitelistingGroupData struct { + // EnforcementMode - Possible values include: 'Audit', 'Enforce', 'None' + EnforcementMode EnforcementMode `json:"enforcementMode,omitempty"` + ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` + // ConfigurationStatus - Possible values include: 'ConfigurationStatus2Configured', 'ConfigurationStatus2NotConfigured', 'ConfigurationStatus2InProgress', 'ConfigurationStatus2Failed', 'ConfigurationStatus2NoStatus' + ConfigurationStatus ConfigurationStatus2 `json:"configurationStatus,omitempty"` + // RecommendationStatus - Possible values include: 'RecommendationStatusRecommended', 'RecommendationStatusNotRecommended', 'RecommendationStatusNotAvailable', 'RecommendationStatusNoStatus' + RecommendationStatus RecommendationStatus `json:"recommendationStatus,omitempty"` + Issues *[]AppWhitelistingIssueSummary `json:"issues,omitempty"` + // SourceSystem - Possible values include: 'SourceSystemAzureAppLocker', 'SourceSystemAzureAuditD', 'SourceSystemNonAzureAppLocker', 'SourceSystemNonAzureAuditD', 'SourceSystemNone' + SourceSystem SourceSystem `json:"sourceSystem,omitempty"` + VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` + PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +} + +// AppWhitelistingGroups represents a list of VM/server groups and set of rules that are Recommended by +// Azure Security Center to be allowed +type AppWhitelistingGroups struct { + autorest.Response `json:"-"` + Value *[]AppWhitelistingGroup `json:"value,omitempty"` +} + +// AppWhitelistingIssueSummary represents a summary of the alerts of the VM/server group +type AppWhitelistingIssueSummary struct { + // Issue - Possible values include: 'ViolationsAudited', 'ViolationsBlocked', 'MsiAndScriptViolationsAudited', 'MsiAndScriptViolationsBlocked', 'ExecutableViolationsAudited', 'RulesViolatedManually' + Issue Issue `json:"issue,omitempty"` + // NumberOfVms - The number of machines in the VM/server group that have this alert + NumberOfVms *float64 `json:"numberOfVms,omitempty"` +} + +// AppWhitelistingPutGroupData the altered data of the recommended VM/server group policy +type AppWhitelistingPutGroupData struct { + // EnforcementMode - The enforcement mode of the group. Can also be defined per collection type by using ProtectionMode. Possible values include: 'EnforcementMode1Audit', 'EnforcementMode1Enforce', 'EnforcementMode1None' + EnforcementMode EnforcementMode1 `json:"enforcementMode,omitempty"` + // ProtectionMode - The protection mode of the group per collection type. Can also be defined for all collection types by using EnforcementMode + ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` + VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` + PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +} + +// AscLocation the ASC location of the subscription is in the "name" field +type AscLocation struct { + autorest.Response `json:"-"` + Properties interface{} `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// AscLocationList list of locations where ASC saves your data +type AscLocationList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY + Value *[]AscLocation `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// AscLocationListIterator provides access to a complete listing of AscLocation values. +type AscLocationListIterator struct { + i int + page AscLocationListPage +} + +// 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 *AscLocationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AscLocationListIterator.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 *AscLocationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AscLocationListIterator) 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 AscLocationListIterator) Response() AscLocationList { + 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 AscLocationListIterator) Value() AscLocation { + if !iter.page.NotDone() { + return AscLocation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AscLocationListIterator type. +func NewAscLocationListIterator(page AscLocationListPage) AscLocationListIterator { + return AscLocationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (all AscLocationList) IsEmpty() bool { + return all.Value == nil || len(*all.Value) == 0 +} + +// ascLocationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (all AscLocationList) ascLocationListPreparer(ctx context.Context) (*http.Request, error) { + if all.NextLink == nil || len(to.String(all.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(all.NextLink))) +} + +// AscLocationListPage contains a page of AscLocation values. +type AscLocationListPage struct { + fn func(context.Context, AscLocationList) (AscLocationList, error) + all AscLocationList +} + +// 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 *AscLocationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AscLocationListPage.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.all) + if err != nil { + return err + } + page.all = 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 *AscLocationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AscLocationListPage) NotDone() bool { + return !page.all.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AscLocationListPage) Response() AscLocationList { + return page.all +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AscLocationListPage) Values() []AscLocation { + if page.all.IsEmpty() { + return nil + } + return *page.all.Value +} + +// Creates a new instance of the AscLocationListPage type. +func NewAscLocationListPage(getNextPage func(context.Context, AscLocationList) (AscLocationList, error)) AscLocationListPage { + return AscLocationListPage{fn: getNextPage} +} + +// AtaExternalSecuritySolution represents an ATA security solution which sends logs to an OMS workspace +type AtaExternalSecuritySolution struct { + Properties *AtaSolutionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Location where the resource is stored + Location *string `json:"location,omitempty"` + // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' + Kind KindEnum `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) MarshalJSON() ([]byte, error) { + aess.Kind = KindATA + objectMap := make(map[string]interface{}) + if aess.Properties != nil { + objectMap["properties"] = aess.Properties + } + if aess.Kind != "" { + objectMap["kind"] = aess.Kind + } + return json.Marshal(objectMap) +} + +// AsCefExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) AsCefExternalSecuritySolution() (*CefExternalSecuritySolution, bool) { + return nil, false +} + +// AsAtaExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) AsAtaExternalSecuritySolution() (*AtaExternalSecuritySolution, bool) { + return &aess, true +} + +// AsAadExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) AsAadExternalSecuritySolution() (*AadExternalSecuritySolution, bool) { + return nil, false +} + +// AsExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) AsExternalSecuritySolution() (*ExternalSecuritySolution, bool) { + return nil, false +} + +// AsBasicExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. +func (aess AtaExternalSecuritySolution) AsBasicExternalSecuritySolution() (BasicExternalSecuritySolution, bool) { + return &aess, true +} + +// AtaSolutionProperties ... +type AtaSolutionProperties struct { + LastEventReceived *string `json:"lastEventReceived,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + DeviceVendor *string `json:"deviceVendor,omitempty"` + DeviceType *string `json:"deviceType,omitempty"` + Workspace *ConnectedWorkspace `json:"workspace,omitempty"` +} + +// MarshalJSON is the custom marshaler for AtaSolutionProperties. +func (asp AtaSolutionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asp.LastEventReceived != nil { + objectMap["lastEventReceived"] = asp.LastEventReceived + } + if asp.DeviceVendor != nil { + objectMap["deviceVendor"] = asp.DeviceVendor + } + if asp.DeviceType != nil { + objectMap["deviceType"] = asp.DeviceType + } + if asp.Workspace != nil { + objectMap["workspace"] = asp.Workspace + } + for k, v := range asp.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AtaSolutionProperties struct. +func (asp *AtaSolutionProperties) 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 "lastEventReceived": + if v != nil { + var lastEventReceived string + err = json.Unmarshal(*v, &lastEventReceived) + if err != nil { + return err + } + asp.LastEventReceived = &lastEventReceived + } + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if asp.AdditionalProperties == nil { + asp.AdditionalProperties = make(map[string]interface{}) + } + asp.AdditionalProperties[k] = additionalProperties + } + case "deviceVendor": + if v != nil { + var deviceVendor string + err = json.Unmarshal(*v, &deviceVendor) + if err != nil { + return err + } + asp.DeviceVendor = &deviceVendor + } + case "deviceType": + if v != nil { + var deviceType string + err = json.Unmarshal(*v, &deviceType) + if err != nil { + return err + } + asp.DeviceType = &deviceType + } + case "workspace": + if v != nil { + var workspace ConnectedWorkspace + err = json.Unmarshal(*v, &workspace) + if err != nil { + return err + } + asp.Workspace = &workspace + } + } + } + + return nil +} + +// Automation the security automation resource. +type Automation struct { + autorest.Response `json:"-"` + // AutomationProperties - Security automation data + *AutomationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Location where the resource is stored + Location *string `json:"location,omitempty"` + // Kind - Kind of the resource + Kind *string `json:"kind,omitempty"` + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. + Etag *string `json:"etag,omitempty"` + // Tags - A list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Automation. +func (a Automation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.AutomationProperties != nil { + objectMap["properties"] = a.AutomationProperties + } + if a.Kind != nil { + objectMap["kind"] = a.Kind + } + if a.Etag != nil { + objectMap["etag"] = a.Etag + } + if a.Tags != nil { + objectMap["tags"] = a.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Automation struct. +func (a *Automation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var automationProperties AutomationProperties + err = json.Unmarshal(*v, &automationProperties) + if err != nil { + return err + } + a.AutomationProperties = &automationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + a.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + a.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + a.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + a.Location = &location + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + a.Kind = &kind + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + a.Etag = &etag + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + a.Tags = tags + } + } + } + + return nil +} + +// BasicAutomationAction the action that should be triggered. +type BasicAutomationAction interface { + AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) + AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) + AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) + AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) + AsAutomationActionEventHub() (*AutomationActionEventHub, bool) + AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) + AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) + AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) + AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) + AsAutomationAction() (*AutomationAction, bool) +} + +// AutomationAction the action that should be triggered. +type AutomationAction struct { + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +func unmarshalBasicAutomationAction(body []byte) (BasicAutomationAction, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["actionType"] { + case string(ActionTypeLogicApp): + var aala AutomationActionLogicApp + err := json.Unmarshal(body, &aala) + return aala, err + case string(ActionTypeLogicApp): + var aalai AutomationActionLogicAppInput + err := json.Unmarshal(body, &aalai) + return aalai, err + case string(ActionTypeLogicApp): + var aalao AutomationActionLogicAppOutput + err := json.Unmarshal(body, &aalao) + return aalao, err + case string(ActionTypeEventHub): + var aaeh AutomationActionEventHub + err := json.Unmarshal(body, &aaeh) + return aaeh, err + case string(ActionTypeEventHub): + var aaehi AutomationActionEventHubInput + err := json.Unmarshal(body, &aaehi) + return aaehi, err + case string(ActionTypeEventHub): + var aaeho AutomationActionEventHubOutput + err := json.Unmarshal(body, &aaeho) + return aaeho, err + case string(ActionTypeWorkspace): + var aaw AutomationActionWorkspace + err := json.Unmarshal(body, &aaw) + return aaw, err + default: + var aa AutomationAction + err := json.Unmarshal(body, &aa) + return aa, err + } +} +func unmarshalBasicAutomationActionArray(body []byte) ([]BasicAutomationAction, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + aaArray := make([]BasicAutomationAction, len(rawMessages)) + + for index, rawMessage := range rawMessages { + aa, err := unmarshalBasicAutomationAction(*rawMessage) + if err != nil { + return nil, err + } + aaArray[index] = aa + } + return aaArray, nil +} + +// MarshalJSON is the custom marshaler for AutomationAction. +func (aa AutomationAction) MarshalJSON() ([]byte, error) { + aa.ActionType = ActionTypeAutomationAction + objectMap := make(map[string]interface{}) + if aa.ActionType != "" { + objectMap["actionType"] = aa.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return nil, false +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return nil, false +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsAutomationAction() (*AutomationAction, bool) { + return &aa, true +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationAction. +func (aa AutomationAction) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aa, true +} + +// BasicAutomationActionEventHub the target Event Hub to which event data will be exported. +type BasicAutomationActionEventHub interface { + AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) + AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) + AsAutomationActionEventHub() (*AutomationActionEventHub, bool) +} + +// AutomationActionEventHub the target Event Hub to which event data will be exported. +type AutomationActionEventHub struct { + // EventHubResourceID - The target Event Hub Azure Resource ID. + EventHubResourceID *string `json:"eventHubResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +func unmarshalBasicAutomationActionEventHub(body []byte) (BasicAutomationActionEventHub, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["actionType"] { + case string(ActionTypeEventHub): + var aaehi AutomationActionEventHubInput + err := json.Unmarshal(body, &aaehi) + return aaehi, err + case string(ActionTypeEventHub): + var aaeho AutomationActionEventHubOutput + err := json.Unmarshal(body, &aaeho) + return aaeho, err + default: + var aaeh AutomationActionEventHub + err := json.Unmarshal(body, &aaeh) + return aaeh, err + } +} +func unmarshalBasicAutomationActionEventHubArray(body []byte) ([]BasicAutomationActionEventHub, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + aaehArray := make([]BasicAutomationActionEventHub, len(rawMessages)) + + for index, rawMessage := range rawMessages { + aaeh, err := unmarshalBasicAutomationActionEventHub(*rawMessage) + if err != nil { + return nil, err + } + aaehArray[index] = aaeh + } + return aaehArray, nil +} + +// MarshalJSON is the custom marshaler for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) MarshalJSON() ([]byte, error) { + aaeh.ActionType = ActionTypeEventHub + objectMap := make(map[string]interface{}) + if aaeh.EventHubResourceID != nil { + objectMap["eventHubResourceId"] = aaeh.EventHubResourceID + } + if aaeh.ActionType != "" { + objectMap["actionType"] = aaeh.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return nil, false +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return &aaeh, true +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return &aaeh, true +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHub. +func (aaeh AutomationActionEventHub) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aaeh, true +} + +// AutomationActionEventHubInput the target Event Hub to which event data will be exported. +type AutomationActionEventHubInput struct { + // ConnectionString - The target Event Hub connection string + ConnectionString *string `json:"connectionString,omitempty"` + // EventHubResourceID - The target Event Hub Azure Resource ID. + EventHubResourceID *string `json:"eventHubResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) MarshalJSON() ([]byte, error) { + aaehi.ActionType = ActionTypeEventHub + objectMap := make(map[string]interface{}) + if aaehi.ConnectionString != nil { + objectMap["connectionString"] = aaehi.ConnectionString + } + if aaehi.EventHubResourceID != nil { + objectMap["eventHubResourceId"] = aaehi.EventHubResourceID + } + if aaehi.ActionType != "" { + objectMap["actionType"] = aaehi.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return nil, false +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return &aaehi, true +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return &aaehi, true +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHubInput. +func (aaehi AutomationActionEventHubInput) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aaehi, true +} + +// AutomationActionEventHubOutput the target Event Hub to which event data will be exported. +type AutomationActionEventHubOutput struct { + // SasPolicyName - The target Event Hub SAS policy name. + SasPolicyName *string `json:"sasPolicyName,omitempty"` + // EventHubResourceID - The target Event Hub Azure Resource ID. + EventHubResourceID *string `json:"eventHubResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) MarshalJSON() ([]byte, error) { + aaeho.ActionType = ActionTypeEventHub + objectMap := make(map[string]interface{}) + if aaeho.SasPolicyName != nil { + objectMap["sasPolicyName"] = aaeho.SasPolicyName + } + if aaeho.EventHubResourceID != nil { + objectMap["eventHubResourceId"] = aaeho.EventHubResourceID + } + if aaeho.ActionType != "" { + objectMap["actionType"] = aaeho.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return nil, false +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return &aaeho, true +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return &aaeho, true +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionEventHubOutput. +func (aaeho AutomationActionEventHubOutput) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aaeho, true +} + +// BasicAutomationActionLogicApp the logic app action that should be triggered. +type BasicAutomationActionLogicApp interface { + AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) + AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) + AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) +} + +// AutomationActionLogicApp the logic app action that should be triggered. +type AutomationActionLogicApp struct { + // LogicAppResourceID - The triggered Logic App Azure Resource ID. This can also reside on other subscriptions, given that you have permissions to trigger the Logic App + LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +func unmarshalBasicAutomationActionLogicApp(body []byte) (BasicAutomationActionLogicApp, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["actionType"] { + case string(ActionTypeLogicApp): + var aalai AutomationActionLogicAppInput + err := json.Unmarshal(body, &aalai) + return aalai, err + case string(ActionTypeLogicApp): + var aalao AutomationActionLogicAppOutput + err := json.Unmarshal(body, &aalao) + return aalao, err + default: + var aala AutomationActionLogicApp + err := json.Unmarshal(body, &aala) + return aala, err + } +} +func unmarshalBasicAutomationActionLogicAppArray(body []byte) ([]BasicAutomationActionLogicApp, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + aalaArray := make([]BasicAutomationActionLogicApp, len(rawMessages)) + + for index, rawMessage := range rawMessages { + aala, err := unmarshalBasicAutomationActionLogicApp(*rawMessage) + if err != nil { + return nil, err + } + aalaArray[index] = aala + } + return aalaArray, nil +} + +// MarshalJSON is the custom marshaler for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) MarshalJSON() ([]byte, error) { + aala.ActionType = ActionTypeLogicApp + objectMap := make(map[string]interface{}) + if aala.LogicAppResourceID != nil { + objectMap["logicAppResourceId"] = aala.LogicAppResourceID + } + if aala.ActionType != "" { + objectMap["actionType"] = aala.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return &aala, true +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return &aala, true +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return nil, false +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicApp. +func (aala AutomationActionLogicApp) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aala, true +} + +// AutomationActionLogicAppInput the logic app action that should be triggered. +type AutomationActionLogicAppInput struct { + // URI - The Logic App trigger URI endpoint. + URI *string `json:"uri,omitempty"` + // LogicAppResourceID - The triggered Logic App Azure Resource ID. This can also reside on other subscriptions, given that you have permissions to trigger the Logic App + LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) MarshalJSON() ([]byte, error) { + aalai.ActionType = ActionTypeLogicApp + objectMap := make(map[string]interface{}) + if aalai.URI != nil { + objectMap["uri"] = aalai.URI + } + if aalai.LogicAppResourceID != nil { + objectMap["logicAppResourceId"] = aalai.LogicAppResourceID + } + if aalai.ActionType != "" { + objectMap["actionType"] = aalai.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return &aalai, true +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return &aalai, true +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return nil, false +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicAppInput. +func (aalai AutomationActionLogicAppInput) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aalai, true +} + +// AutomationActionLogicAppOutput the logic app action that should be triggered. +type AutomationActionLogicAppOutput struct { + // LogicAppResourceID - The triggered Logic App Azure Resource ID. This can also reside on other subscriptions, given that you have permissions to trigger the Logic App + LogicAppResourceID *string `json:"logicAppResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) MarshalJSON() ([]byte, error) { + aalao.ActionType = ActionTypeLogicApp + objectMap := make(map[string]interface{}) + if aalao.LogicAppResourceID != nil { + objectMap["logicAppResourceId"] = aalao.LogicAppResourceID + } + if aalao.ActionType != "" { + objectMap["actionType"] = aalao.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return &aalao, true +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return &aalao, true +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return nil, false +} + +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false +} + +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false +} + +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return nil, false +} + +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsAutomationAction() (*AutomationAction, bool) { + return nil, false +} + +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionLogicAppOutput. +func (aalao AutomationActionLogicAppOutput) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aalao, true +} + +// AutomationActionWorkspace the Log Analytics Workspace to which event data will be exported. Security +// alerts data will reside in the 'SecurityAlert' table and the assessments data will reside in the +// 'SecurityRecommendation' table (under the 'Security'/'SecurityCenterFree' solutions). Note that in order +// to view the data in the workspace, the Security Center Log Analytics free/standard solution needs to be +// enabled on that workspace. +type AutomationActionWorkspace struct { + // WorkspaceResourceID - The fully qualified Log Analytics Workspace Azure Resource ID. + WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"` + // ActionType - Possible values include: 'ActionTypeAutomationAction', 'ActionTypeLogicApp', 'ActionTypeLogicApp1', 'ActionTypeLogicApp2', 'ActionTypeEventHub', 'ActionTypeEventHub1', 'ActionTypeEventHub2', 'ActionTypeWorkspace' + ActionType ActionType `json:"actionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) MarshalJSON() ([]byte, error) { + aaw.ActionType = ActionTypeWorkspace + objectMap := make(map[string]interface{}) + if aaw.WorkspaceResourceID != nil { + objectMap["workspaceResourceId"] = aaw.WorkspaceResourceID + } + if aaw.ActionType != "" { + objectMap["actionType"] = aaw.ActionType + } + return json.Marshal(objectMap) +} + +// AsAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionLogicApp() (*AutomationActionLogicApp, bool) { + return nil, false +} + +// AsBasicAutomationActionLogicApp is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsBasicAutomationActionLogicApp() (BasicAutomationActionLogicApp, bool) { + return nil, false +} + +// AsAutomationActionLogicAppInput is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionLogicAppInput() (*AutomationActionLogicAppInput, bool) { + return nil, false +} + +// AsAutomationActionLogicAppOutput is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionLogicAppOutput() (*AutomationActionLogicAppOutput, bool) { + return nil, false +} + +// AsAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionEventHub() (*AutomationActionEventHub, bool) { + return nil, false +} + +// AsBasicAutomationActionEventHub is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsBasicAutomationActionEventHub() (BasicAutomationActionEventHub, bool) { + return nil, false } -// AppWhitelistingGroupData represents a VM/server group and set of rules that are Recommended by Azure -// Security Center to be allowed -type AppWhitelistingGroupData struct { - // EnforcementMode - Possible values include: 'Audit', 'Enforce', 'None' - EnforcementMode EnforcementMode `json:"enforcementMode,omitempty"` - ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` - // ConfigurationStatus - Possible values include: 'ConfigurationStatus2Configured', 'ConfigurationStatus2NotConfigured', 'ConfigurationStatus2InProgress', 'ConfigurationStatus2Failed', 'ConfigurationStatus2NoStatus' - ConfigurationStatus ConfigurationStatus2 `json:"configurationStatus,omitempty"` - // RecommendationStatus - Possible values include: 'RecommendationStatusRecommended', 'RecommendationStatusNotRecommended', 'RecommendationStatusNotAvailable', 'RecommendationStatusNoStatus' - RecommendationStatus RecommendationStatus `json:"recommendationStatus,omitempty"` - Issues *[]AppWhitelistingIssueSummary `json:"issues,omitempty"` - // SourceSystem - Possible values include: 'SourceSystemAzureAppLocker', 'SourceSystemAzureAuditD', 'SourceSystemNonAzureAppLocker', 'SourceSystemNonAzureAuditD', 'SourceSystemNone' - SourceSystem SourceSystem `json:"sourceSystem,omitempty"` - VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` - PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +// AsAutomationActionEventHubInput is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionEventHubInput() (*AutomationActionEventHubInput, bool) { + return nil, false } -// AppWhitelistingGroups represents a list of VM/server groups and set of rules that are Recommended by -// Azure Security Center to be allowed -type AppWhitelistingGroups struct { - autorest.Response `json:"-"` - Value *[]AppWhitelistingGroup `json:"value,omitempty"` +// AsAutomationActionEventHubOutput is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionEventHubOutput() (*AutomationActionEventHubOutput, bool) { + return nil, false } -// AppWhitelistingIssueSummary represents a summary of the alerts of the VM/server group -type AppWhitelistingIssueSummary struct { - // Issue - Possible values include: 'ViolationsAudited', 'ViolationsBlocked', 'MsiAndScriptViolationsAudited', 'MsiAndScriptViolationsBlocked', 'ExecutableViolationsAudited', 'RulesViolatedManually' - Issue Issue `json:"issue,omitempty"` - // NumberOfVms - The number of machines in the VM/server group that have this alert - NumberOfVms *float64 `json:"numberOfVms,omitempty"` +// AsAutomationActionWorkspace is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationActionWorkspace() (*AutomationActionWorkspace, bool) { + return &aaw, true } -// AppWhitelistingPutGroupData the altered data of the recommended VM/server group policy -type AppWhitelistingPutGroupData struct { - // EnforcementMode - The enforcement mode of the group. Can also be defined per collection type by using ProtectionMode. Possible values include: 'EnforcementMode1Audit', 'EnforcementMode1Enforce', 'EnforcementMode1None' - EnforcementMode EnforcementMode1 `json:"enforcementMode,omitempty"` - // ProtectionMode - The protection mode of the group per collection type. Can also be defined for all collection types by using EnforcementMode - ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` - VMRecommendations *[]VMRecommendation `json:"vmRecommendations,omitempty"` - PathRecommendations *[]PathRecommendation `json:"pathRecommendations,omitempty"` +// AsAutomationAction is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsAutomationAction() (*AutomationAction, bool) { + return nil, false } -// AscLocation the ASC location of the subscription is in the "name" field -type AscLocation struct { - autorest.Response `json:"-"` - Properties interface{} `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` +// AsBasicAutomationAction is the BasicAutomationAction implementation for AutomationActionWorkspace. +func (aaw AutomationActionWorkspace) AsBasicAutomationAction() (BasicAutomationAction, bool) { + return &aaw, true } -// AscLocationList list of locations where ASC saves your data -type AscLocationList struct { +// AutomationList list of security automations response. +type AutomationList struct { autorest.Response `json:"-"` - // Value - READ-ONLY - Value *[]AscLocation `json:"value,omitempty"` + // Value - The list of security automations under the given scope. + Value *[]Automation `json:"value,omitempty"` // NextLink - READ-ONLY; The URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` } -// AscLocationListIterator provides access to a complete listing of AscLocation values. -type AscLocationListIterator struct { +// AutomationListIterator provides access to a complete listing of Automation values. +type AutomationListIterator struct { i int - page AscLocationListPage + page AutomationListPage } // 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 *AscLocationListIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *AutomationListIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AscLocationListIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationListIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -1875,62 +3177,62 @@ func (iter *AscLocationListIterator) NextWithContext(ctx context.Context) (err e // 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 *AscLocationListIterator) Next() error { +func (iter *AutomationListIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AscLocationListIterator) NotDone() bool { +func (iter AutomationListIterator) 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 AscLocationListIterator) Response() AscLocationList { +func (iter AutomationListIterator) Response() AutomationList { 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 AscLocationListIterator) Value() AscLocation { +func (iter AutomationListIterator) Value() Automation { if !iter.page.NotDone() { - return AscLocation{} + return Automation{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the AscLocationListIterator type. -func NewAscLocationListIterator(page AscLocationListPage) AscLocationListIterator { - return AscLocationListIterator{page: page} +// Creates a new instance of the AutomationListIterator type. +func NewAutomationListIterator(page AutomationListPage) AutomationListIterator { + return AutomationListIterator{page: page} } // IsEmpty returns true if the ListResult contains no values. -func (all AscLocationList) IsEmpty() bool { - return all.Value == nil || len(*all.Value) == 0 +func (al AutomationList) IsEmpty() bool { + return al.Value == nil || len(*al.Value) == 0 } -// ascLocationListPreparer prepares a request to retrieve the next set of results. +// automationListPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (all AscLocationList) ascLocationListPreparer(ctx context.Context) (*http.Request, error) { - if all.NextLink == nil || len(to.String(all.NextLink)) < 1 { +func (al AutomationList) automationListPreparer(ctx context.Context) (*http.Request, error) { + if al.NextLink == nil || len(to.String(al.NextLink)) < 1 { return nil, nil } return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), - autorest.WithBaseURL(to.String(all.NextLink))) + autorest.WithBaseURL(to.String(al.NextLink))) } -// AscLocationListPage contains a page of AscLocation values. -type AscLocationListPage struct { - fn func(context.Context, AscLocationList) (AscLocationList, error) - all AscLocationList +// AutomationListPage contains a page of Automation values. +type AutomationListPage struct { + fn func(context.Context, AutomationList) (AutomationList, error) + al AutomationList } // 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 *AscLocationListPage) NextWithContext(ctx context.Context) (err error) { +func (page *AutomationListPage) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AscLocationListPage.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/AutomationListPage.NextWithContext") defer func() { sc := -1 if page.Response().Response.Response != nil { @@ -1939,130 +3241,76 @@ func (page *AscLocationListPage) NextWithContext(ctx context.Context) (err error tracing.EndSpan(ctx, sc, err) }() } - next, err := page.fn(ctx, page.all) + next, err := page.fn(ctx, page.al) if err != nil { return err } - page.all = next + page.al = 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 *AscLocationListPage) Next() error { +func (page *AutomationListPage) Next() error { return page.NextWithContext(context.Background()) } // NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AscLocationListPage) NotDone() bool { - return !page.all.IsEmpty() +func (page AutomationListPage) NotDone() bool { + return !page.al.IsEmpty() } // Response returns the raw server response from the last page request. -func (page AscLocationListPage) Response() AscLocationList { - return page.all +func (page AutomationListPage) Response() AutomationList { + return page.al } // Values returns the slice of values for the current page or nil if there are no values. -func (page AscLocationListPage) Values() []AscLocation { - if page.all.IsEmpty() { +func (page AutomationListPage) Values() []Automation { + if page.al.IsEmpty() { return nil } - return *page.all.Value -} - -// Creates a new instance of the AscLocationListPage type. -func NewAscLocationListPage(getNextPage func(context.Context, AscLocationList) (AscLocationList, error)) AscLocationListPage { - return AscLocationListPage{fn: getNextPage} -} - -// AtaExternalSecuritySolution represents an ATA security solution which sends logs to an OMS workspace -type AtaExternalSecuritySolution struct { - Properties *AtaSolutionProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Location - READ-ONLY; Location where the resource is stored - Location *string `json:"location,omitempty"` - // Kind - Possible values include: 'KindExternalSecuritySolution', 'KindCEF', 'KindATA', 'KindAAD' - Kind KindEnum `json:"kind,omitempty"` -} - -// MarshalJSON is the custom marshaler for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) MarshalJSON() ([]byte, error) { - aess.Kind = KindATA - objectMap := make(map[string]interface{}) - if aess.Properties != nil { - objectMap["properties"] = aess.Properties - } - if aess.Kind != "" { - objectMap["kind"] = aess.Kind - } - return json.Marshal(objectMap) -} - -// AsCefExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) AsCefExternalSecuritySolution() (*CefExternalSecuritySolution, bool) { - return nil, false -} - -// AsAtaExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) AsAtaExternalSecuritySolution() (*AtaExternalSecuritySolution, bool) { - return &aess, true -} - -// AsAadExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) AsAadExternalSecuritySolution() (*AadExternalSecuritySolution, bool) { - return nil, false -} - -// AsExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) AsExternalSecuritySolution() (*ExternalSecuritySolution, bool) { - return nil, false -} - -// AsBasicExternalSecuritySolution is the BasicExternalSecuritySolution implementation for AtaExternalSecuritySolution. -func (aess AtaExternalSecuritySolution) AsBasicExternalSecuritySolution() (BasicExternalSecuritySolution, bool) { - return &aess, true + return *page.al.Value } -// AtaSolutionProperties ... -type AtaSolutionProperties struct { - LastEventReceived *string `json:"lastEventReceived,omitempty"` - // AdditionalProperties - Unmatched properties from the message are deserialized this collection - AdditionalProperties map[string]interface{} `json:""` - DeviceVendor *string `json:"deviceVendor,omitempty"` - DeviceType *string `json:"deviceType,omitempty"` - Workspace *ConnectedWorkspace `json:"workspace,omitempty"` +// Creates a new instance of the AutomationListPage type. +func NewAutomationListPage(getNextPage func(context.Context, AutomationList) (AutomationList, error)) AutomationListPage { + return AutomationListPage{fn: getNextPage} } -// MarshalJSON is the custom marshaler for AtaSolutionProperties. -func (asp AtaSolutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if asp.LastEventReceived != nil { - objectMap["lastEventReceived"] = asp.LastEventReceived - } - if asp.DeviceVendor != nil { - objectMap["deviceVendor"] = asp.DeviceVendor - } - if asp.DeviceType != nil { - objectMap["deviceType"] = asp.DeviceType - } - if asp.Workspace != nil { - objectMap["workspace"] = asp.Workspace - } - for k, v := range asp.AdditionalProperties { - objectMap[k] = v - } - return json.Marshal(objectMap) +// AutomationMetadata the metadata of the security automation resource. +type AutomationMetadata struct { + // CreatedDateTimeUtc - READ-ONLY; The security automation creation date. + CreatedDateTimeUtc *date.Time `json:"createdDateTimeUtc,omitempty"` + // CreatedBy - READ-ONLY; The AAD object ID of the entity that created the security automation. + CreatedBy *string `json:"createdBy,omitempty"` + // LastUpdatedDateTimeUtc - READ-ONLY; The security automation last updated date. + LastUpdatedDateTimeUtc *date.Time `json:"lastUpdatedDateTimeUtc,omitempty"` + // LastUpdatedBy - READ-ONLY; The AAD object ID of the entity that last updated the security automation. + LastUpdatedBy *string `json:"lastUpdatedBy,omitempty"` } -// UnmarshalJSON is the custom unmarshaler for AtaSolutionProperties struct. -func (asp *AtaSolutionProperties) UnmarshalJSON(body []byte) error { +// AutomationProperties a set of properties that defines the behavior of the automation configuration. To +// learn more about the supported security events data models schemas - please visit +// https://aka.ms/ASCAutomationSchemas. +type AutomationProperties struct { + // Description - The security automation description. + Description *string `json:"description,omitempty"` + // IsEnabled - Indicates whether the security automation is enabled. + IsEnabled *bool `json:"isEnabled,omitempty"` + // Metadata - The metadata of the security automation resource. + Metadata *AutomationMetadata `json:"metadata,omitempty"` + // Scopes - A collection of scopes on which the security automations logic is applied. Supported scopes are the subscription itself or a resource group under that subscription. The automation will only apply on defined scopes. + Scopes *[]AutomationScope `json:"scopes,omitempty"` + // Sources - A collection of the source event types which evaluate the security automation set of rules. + Sources *[]AutomationSource `json:"sources,omitempty"` + // Actions - A collection of the actions which are triggered if all the configured rules evaluations, within at least one rule set, are true. + Actions *[]BasicAutomationAction `json:"actions,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for AutomationProperties struct. +func (ap *AutomationProperties) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -2070,53 +3318,58 @@ func (asp *AtaSolutionProperties) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "lastEventReceived": + case "description": if v != nil { - var lastEventReceived string - err = json.Unmarshal(*v, &lastEventReceived) + var description string + err = json.Unmarshal(*v, &description) if err != nil { return err } - asp.LastEventReceived = &lastEventReceived + ap.Description = &description } - default: + case "isEnabled": if v != nil { - var additionalProperties interface{} - err = json.Unmarshal(*v, &additionalProperties) + var isEnabled bool + err = json.Unmarshal(*v, &isEnabled) if err != nil { return err } - if asp.AdditionalProperties == nil { - asp.AdditionalProperties = make(map[string]interface{}) + ap.IsEnabled = &isEnabled + } + case "metadata": + if v != nil { + var metadata AutomationMetadata + err = json.Unmarshal(*v, &metadata) + if err != nil { + return err } - asp.AdditionalProperties[k] = additionalProperties + ap.Metadata = &metadata } - case "deviceVendor": + case "scopes": if v != nil { - var deviceVendor string - err = json.Unmarshal(*v, &deviceVendor) + var scopes []AutomationScope + err = json.Unmarshal(*v, &scopes) if err != nil { return err } - asp.DeviceVendor = &deviceVendor + ap.Scopes = &scopes } - case "deviceType": + case "sources": if v != nil { - var deviceType string - err = json.Unmarshal(*v, &deviceType) + var sources []AutomationSource + err = json.Unmarshal(*v, &sources) if err != nil { return err } - asp.DeviceType = &deviceType + ap.Sources = &sources } - case "workspace": + case "actions": if v != nil { - var workspace ConnectedWorkspace - err = json.Unmarshal(*v, &workspace) + actions, err := unmarshalBasicAutomationActionArray(*v) if err != nil { return err } - asp.Workspace = &workspace + ap.Actions = &actions } } } @@ -2124,6 +3377,53 @@ func (asp *AtaSolutionProperties) UnmarshalJSON(body []byte) error { return nil } +// AutomationRuleSet a rule set which evaluates all its rules upon an event interception. Only when all the +// included rules in the rule set will be evaluated as 'true', will the event trigger the defined actions. +type AutomationRuleSet struct { + Rules *[]AutomationTriggeringRule `json:"rules,omitempty"` +} + +// AutomationScope a single automation scope. +type AutomationScope struct { + // Description - The resources scope description. + Description *string `json:"description,omitempty"` + // ScopePath - The resources scope path. Can be the subscription on which the automation is defined on or a resource group under that subscription (fully qualified Azure resource IDs). + ScopePath *string `json:"scopePath,omitempty"` +} + +// AutomationSource the source event types which evaluate the security automation set of rules. For example +// - security alerts and security assessments. To learn more about the supported security events data +// models schemas - please visit https://aka.ms/ASCAutomationSchemas. +type AutomationSource struct { + // EventSource - A valid event source type. Possible values include: 'Assessments', 'Alerts' + EventSource EventSource `json:"eventSource,omitempty"` + // RuleSets - A set of rules which evaluate upon event interception. A logical disjunction is applied between defined rule sets (logical 'or'). + RuleSets *[]AutomationRuleSet `json:"ruleSets,omitempty"` +} + +// AutomationTriggeringRule a rule which is evaluated upon event interception. The rule is configured by +// comparing a specific value from the event model to an expected value. This comparison is done by using +// one of the supported operators set. +type AutomationTriggeringRule struct { + // PropertyJPath - The JPath of the entity model property that should be checked. + PropertyJPath *string `json:"propertyJPath,omitempty"` + // PropertyType - The data type of the compared operands (string, integer, floating point number or a boolean [true/false]]. Possible values include: 'String', 'Integer', 'Number', 'Boolean' + PropertyType PropertyType `json:"propertyType,omitempty"` + // ExpectedValue - The expected value. + ExpectedValue *string `json:"expectedValue,omitempty"` + // Operator - A valid comparer operator to use. Possible values include: 'Equals', 'GreaterThan', 'GreaterThanOrEqualTo', 'LesserThan', 'LesserThanOrEqualTo', 'NotEquals', 'Contains', 'StartsWith', 'EndsWith' + Operator Operator `json:"operator,omitempty"` +} + +// AutomationValidationStatus the security automation model state property bag. +type AutomationValidationStatus struct { + autorest.Response `json:"-"` + // IsValid - Indicates whether the model is valid or not. + IsValid *bool `json:"isValid,omitempty"` + // Message - The validation message. + Message *string `json:"message,omitempty"` +} + // AutoProvisioningSetting auto provisioning setting type AutoProvisioningSetting struct { autorest.Response `json:"-"` @@ -3550,7 +4850,7 @@ type DataExportSettingProperties struct { type DenylistCustomAlertRule struct { // DenylistValues - The values to deny. The format of the values depends on the rule type. DenylistValues *[]string `json:"denylistValues,omitempty"` - // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'IPCidr', 'String' + // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'ValueTypeIPCidr', 'ValueTypeString' ValueType ValueType `json:"valueType,omitempty"` // DisplayName - READ-ONLY; The display name of the custom alert. DisplayName *string `json:"displayName,omitempty"` @@ -4034,6 +5334,12 @@ type DiscoveredSecuritySolutionProperties struct { Sku *string `json:"sku,omitempty"` } +// ETag entity tag is used for comparing two or more entities from the same requested resource. +type ETag struct { + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. + Etag *string `json:"etag,omitempty"` +} + // BasicExternalSecuritySolution represents a security solution external to Azure Security Center which sends // information to an OMS workspace and whose data is displayed by Azure Security Center. type BasicExternalSecuritySolution interface { @@ -5987,7 +7293,7 @@ type Kind struct { // ListCustomAlertRule a List custom alert rule. type ListCustomAlertRule struct { - // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'IPCidr', 'String' + // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'ValueTypeIPCidr', 'ValueTypeString' ValueType ValueType `json:"valueType,omitempty"` // DisplayName - READ-ONLY; The display name of the custom alert. DisplayName *string `json:"displayName,omitempty"` @@ -7835,6 +9141,21 @@ type SubAssessmentStatus struct { Severity Severity `json:"severity,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. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Tags. +func (t Tags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.Tags != nil { + objectMap["tags"] = t.Tags + } + return json.Marshal(objectMap) +} + // TagsResource a container holding only the Tags for a resource, allowing the user to update the tags. type TagsResource struct { // Tags - Resource tags @@ -8438,6 +9759,39 @@ type TopologySingleResourceParent struct { ResourceID *string `json:"resourceId,omitempty"` } +// TrackedResource describes an Azure tracked resource. +type TrackedResource struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Location where the resource is stored + Location *string `json:"location,omitempty"` + // Kind - Kind of the resource + Kind *string `json:"kind,omitempty"` + // Etag - Entity tag is used for comparing two or more entities from the same requested resource. + Etag *string `json:"etag,omitempty"` + // Tags - A list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Kind != nil { + objectMap["kind"] = tr.Kind + } + if tr.Etag != nil { + objectMap["etag"] = tr.Etag + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + // UpdateIotSecuritySolutionData ... type UpdateIotSecuritySolutionData struct { // UpdateIoTSecuritySolutionProperties - Security Solution data diff --git a/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go b/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go index 22e5109dcd51..8be8f8406950 100644 --- a/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go @@ -297,3 +297,15 @@ type SubAssessmentsClientAPI interface { } var _ SubAssessmentsClientAPI = (*security.SubAssessmentsClient)(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) + Delete(ctx context.Context, resourceGroupName string, automationName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, automationName string) (result security.Automation, err error) + List(ctx context.Context) (result security.AutomationListPage, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result security.AutomationListPage, err error) + Validate(ctx context.Context, resourceGroupName string, automationName string, automation security.Automation) (result security.AutomationValidationStatus, err error) +} + +var _ AutomationsClientAPI = (*security.AutomationsClient)(nil)