From 9359077f50c94a952de92f8d0327c5bb1feb1e83 Mon Sep 17 00:00:00 2001 From: Matthew Frahry Date: Thu, 2 Mar 2023 18:13:44 -0800 Subject: [PATCH] sentinel/automation_rule: switching to use github.com/hashicorp/go-azure-sdk (#20726) --- internal/services/sentinel/client/client.go | 5 +- .../sentinel_automation_rule_resource.go | 409 ++++------ .../sentinel_automation_rule_resource_test.go | 11 +- .../automationrules/README.md | 90 +++ .../automationrules/client.go | 18 + .../automationrules/constants.go | 760 ++++++++++++++++++ .../automationrules/id_automationrule.go | 142 ++++ .../automationrules/id_workspace.go | 127 +++ .../method_createorupdate_autorest.go | 69 ++ .../automationrules/method_delete_autorest.go | 68 ++ .../automationrules/method_get_autorest.go | 68 ++ .../automationrules/method_list_autorest.go | 186 +++++ .../automationrules/model_automationrule.go | 17 + .../model_automationruleaction.go | 56 ++ .../model_automationrulebooleancondition.go | 49 ++ .../model_automationrulecondition.go | 80 ++ ...el_automationrulemodifypropertiesaction.go | 42 + .../model_automationruleproperties.go | 88 ++ ...rulepropertyarraychangedvaluescondition.go | 9 + ...omationrulepropertyarrayvaluescondition.go | 51 ++ ...ationrulepropertyvalueschangedcondition.go | 11 + ...l_automationrulepropertyvaluescondition.go | 10 + .../model_automationrulerunplaybookaction.go | 42 + .../model_automationruletriggeringlogic.go | 70 ++ .../model_booleanconditionproperties.go | 41 + .../automationrules/model_clientinfo.go | 11 + .../automationrules/model_incidentlabel.go | 9 + .../model_incidentownerinfo.go | 12 + .../model_incidentpropertiesaction.go | 14 + .../model_playbookactionproperties.go | 9 + ...propertyarraychangedconditionproperties.go | 41 + .../model_propertyarrayconditionproperties.go | 41 + ...odel_propertychangedconditionproperties.go | 41 + .../model_propertyconditionproperties.go | 41 + .../automationrules/predicates.go | 32 + .../automationrules/version.go | 12 + vendor/modules.txt | 1 + 37 files changed, 2515 insertions(+), 268 deletions(-) create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/id_automationrule.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/id_workspace.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/method_createorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/method_delete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/method_get_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/method_list_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrule.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationruleaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulebooleancondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulecondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulemodifypropertiesaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationruleproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulepropertyarraychangedvaluescondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulepropertyarrayvaluescondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulepropertyvalueschangedcondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulepropertyvaluescondition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulerunplaybookaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationruletriggeringlogic.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_booleanconditionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_clientinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_incidentlabel.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_incidentownerinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_incidentpropertiesaction.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_playbookactionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_propertyarraychangedconditionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_propertyarrayconditionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_propertychangedconditionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_propertyconditionproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/version.go diff --git a/internal/services/sentinel/client/client.go b/internal/services/sentinel/client/client.go index bb93e3d3d5ec..e3a554a5abd4 100644 --- a/internal/services/sentinel/client/client.go +++ b/internal/services/sentinel/client/client.go @@ -3,6 +3,7 @@ package client import ( alertruletemplates "github.com/Azure/azure-sdk-for-go/services/preview/securityinsight/mgmt/2021-09-01-preview/securityinsight" // nolint: staticcheck "github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/alertrules" + "github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules" "github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates" "github.com/hashicorp/terraform-provider-azurerm/internal/common" securityinsight "github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights" @@ -11,7 +12,7 @@ import ( type Client struct { AlertRulesClient *alertrules.AlertRulesClient AlertRuleTemplatesClient *alertruletemplates.AlertRuleTemplatesClient - AutomationRulesClient *securityinsight.AutomationRulesClient + AutomationRulesClient *automationrules.AutomationRulesClient DataConnectorsClient *securityinsight.DataConnectorsClient WatchlistsClient *securityinsight.WatchlistsClient WatchlistItemsClient *securityinsight.WatchlistItemsClient @@ -26,7 +27,7 @@ func NewClient(o *common.ClientOptions) *Client { alertRuleTemplatesClient := alertruletemplates.NewAlertRuleTemplatesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) o.ConfigureClient(&alertRuleTemplatesClient.Client, o.ResourceManagerAuthorizer) - automationRulesClient := securityinsight.NewAutomationRulesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + automationRulesClient := automationrules.NewAutomationRulesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&automationRulesClient.Client, o.ResourceManagerAuthorizer) dataConnectorsClient := securityinsight.NewDataConnectorsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) diff --git a/internal/services/sentinel/sentinel_automation_rule_resource.go b/internal/services/sentinel/sentinel_automation_rule_resource.go index 876a50be4ed2..b7ae1f9290e4 100644 --- a/internal/services/sentinel/sentinel_automation_rule_resource.go +++ b/internal/services/sentinel/sentinel_automation_rule_resource.go @@ -7,9 +7,8 @@ import ( "strings" "time" - "github.com/Azure/go-autorest/autorest/date" - "github.com/gofrs/uuid" - "github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -21,7 +20,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" "github.com/hashicorp/terraform-provider-azurerm/utils" - securityinsight "github.com/tombuildsstuff/kermit/sdk/securityinsights/2022-10-01-preview/securityinsights" ) func resourceSentinelAutomationRule() *pluginsdk.Resource { @@ -37,7 +35,7 @@ func resourceSentinelAutomationRule() *pluginsdk.Resource { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: workspaces.ValidateWorkspaceID, + ValidateFunc: automationrules.ValidateWorkspaceID, }, "display_name": { @@ -59,23 +57,17 @@ func resourceSentinelAutomationRule() *pluginsdk.Resource { }, "triggers_on": { - Type: pluginsdk.TypeString, - Optional: true, - Default: string(securityinsight.TriggersOnIncidents), - ValidateFunc: validation.StringInSlice([]string{ - string(securityinsight.TriggersOnIncidents), - string(securityinsight.TriggersOnAlerts), - }, false), + Type: pluginsdk.TypeString, + Optional: true, + Default: string(automationrules.TriggersOnIncidents), + ValidateFunc: validation.StringInSlice(automationrules.PossibleValuesForTriggersOn(), false), }, "triggers_when": { - Type: pluginsdk.TypeString, - Optional: true, - Default: string(securityinsight.TriggersWhenCreated), - ValidateFunc: validation.StringInSlice([]string{ - string(securityinsight.TriggersWhenCreated), - string(securityinsight.TriggersWhenUpdated), - }, false), + Type: pluginsdk.TypeString, + Optional: true, + Default: string(automationrules.TriggersWhenCreated), + ValidateFunc: validation.StringInSlice(automationrules.PossibleValuesForTriggersWhen(), false), }, "expiration": { @@ -108,24 +100,20 @@ func resourceSentinelAutomationRule() *pluginsdk.Resource { }, "status": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - string(securityinsight.IncidentStatusActive), - string(securityinsight.IncidentStatusClosed), - string(securityinsight.IncidentStatusNew), - }, false), + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice(automationrules.PossibleValuesForIncidentStatus(), false), }, "classification": { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(securityinsight.IncidentClassificationUndetermined), - string(securityinsight.IncidentClassificationBenignPositive) + "_" + string(securityinsight.IncidentClassificationReasonSuspiciousButExpected), - string(securityinsight.IncidentClassificationFalsePositive) + "_" + string(securityinsight.IncidentClassificationReasonIncorrectAlertLogic), - string(securityinsight.IncidentClassificationFalsePositive) + "_" + string(securityinsight.IncidentClassificationReasonInaccurateData), - string(securityinsight.IncidentClassificationTruePositive) + "_" + string(securityinsight.IncidentClassificationReasonSuspiciousActivity), + string(automationrules.IncidentClassificationUndetermined), + string(automationrules.IncidentClassificationBenignPositive) + "_" + string(automationrules.IncidentClassificationReasonSuspiciousButExpected), + string(automationrules.IncidentClassificationFalsePositive) + "_" + string(automationrules.IncidentClassificationReasonIncorrectAlertLogic), + string(automationrules.IncidentClassificationFalsePositive) + "_" + string(automationrules.IncidentClassificationReasonInaccurateData), + string(automationrules.IncidentClassificationTruePositive) + "_" + string(automationrules.IncidentClassificationReasonSuspiciousActivity), }, false), }, @@ -150,14 +138,9 @@ func resourceSentinelAutomationRule() *pluginsdk.Resource { }, "severity": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice([]string{ - string(securityinsight.IncidentSeverityHigh), - string(securityinsight.IncidentSeverityInformational), - string(securityinsight.IncidentSeverityLow), - string(securityinsight.IncidentSeverityMedium), - }, false), + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice(automationrules.PossibleValuesForIncidentSeverity(), false), }, }, }, @@ -203,77 +186,15 @@ func resourceSentinelAutomationRule() *pluginsdk.Resource { Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "property": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyAccountAadTenantID), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyAccountAadUserID), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyAccountNTDomain), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyAccountName), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyAccountObjectGUID), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyAccountPUID), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyAccountSid), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyAccountUPNSuffix), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyAzureResourceResourceID), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyAzureResourceSubscriptionID), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppID), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppName), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyDNSDomainName), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyFileDirectory), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyFileHashValue), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyFileName), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyHostAzureID), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyHostNTDomain), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyHostName), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyHostNetBiosName), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyHostOSVersion), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyIPAddress), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyIncidentDescription), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyIncidentProviderName), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyIncidentRelatedAnalyticRuleIds), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyIncidentSeverity), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyIncidentStatus), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyIncidentTactics), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyIncidentTitle), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyIoTDeviceID), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyIoTDeviceModel), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyIoTDeviceName), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyIoTDeviceOperatingSystem), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyIoTDeviceType), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyIoTDeviceVendor), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyMailMessageDeliveryAction), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyMailMessageDeliveryLocation), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyMailMessageP1Sender), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyMailMessageP2Sender), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyMailMessageRecipient), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyMailMessageSenderIP), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyMailMessageSubject), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyMailboxDisplayName), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyMailboxPrimaryAddress), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyMailboxUPN), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyMalwareCategory), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyMalwareName), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyProcessCommandLine), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyProcessID), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyRegistryKey), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyRegistryValueData), - string(securityinsight.AutomationRulePropertyConditionSupportedPropertyURL), - }, false), + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(automationrules.PossibleValuesForAutomationRulePropertyConditionSupportedProperty(), false), }, "operator": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(securityinsight.AutomationRulePropertyConditionSupportedOperatorContains), - string(securityinsight.AutomationRulePropertyConditionSupportedOperatorEndsWith), - string(securityinsight.AutomationRulePropertyConditionSupportedOperatorEquals), - string(securityinsight.AutomationRulePropertyConditionSupportedOperatorNotContains), - string(securityinsight.AutomationRulePropertyConditionSupportedOperatorNotEndsWith), - string(securityinsight.AutomationRulePropertyConditionSupportedOperatorNotEquals), - string(securityinsight.AutomationRulePropertyConditionSupportedOperatorNotStartsWith), - string(securityinsight.AutomationRulePropertyConditionSupportedOperatorStartsWith), - }, false), + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(automationrules.PossibleValuesForAutomationRulePropertyConditionSupportedOperator(), false), }, "values": { @@ -325,21 +246,21 @@ func resourceSentinelAutomationRuleCreateOrUpdate(d *pluginsdk.ResourceData, met defer cancel() name := d.Get("name").(string) - workspaceId, err := workspaces.ParseWorkspaceID(d.Get("log_analytics_workspace_id").(string)) + workspaceId, err := automationrules.ParseWorkspaceID(d.Get("log_analytics_workspace_id").(string)) if err != nil { return err } - id := parse.NewAutomationRuleID(workspaceId.SubscriptionId, workspaceId.ResourceGroupName, workspaceId.WorkspaceName, name) + id := automationrules.NewAutomationRuleID(workspaceId.SubscriptionId, workspaceId.ResourceGroupName, workspaceId.WorkspaceName, name) if d.IsNewResource() { - resp, err := client.Get(ctx, id.ResourceGroup, id.WorkspaceName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("checking for existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return tf.ImportAsExistsError("azurerm_sentinel_automation_rule", id.ID()) } } @@ -348,14 +269,14 @@ func resourceSentinelAutomationRuleCreateOrUpdate(d *pluginsdk.ResourceData, met if err != nil { return err } - params := securityinsight.AutomationRule{ - AutomationRuleProperties: &securityinsight.AutomationRuleProperties{ - DisplayName: utils.String(d.Get("display_name").(string)), - Order: utils.Int32(int32(d.Get("order").(int))), - TriggeringLogic: &securityinsight.AutomationRuleTriggeringLogic{ - IsEnabled: utils.Bool(d.Get("enabled").(bool)), - TriggersOn: securityinsight.TriggersOn(d.Get("triggers_on").(string)), - TriggersWhen: securityinsight.TriggersWhen(d.Get("triggers_when").(string)), + params := automationrules.AutomationRule{ + Properties: automationrules.AutomationRuleProperties{ + DisplayName: d.Get("display_name").(string), + Order: int64(d.Get("order").(int)), + TriggeringLogic: automationrules.AutomationRuleTriggeringLogic{ + IsEnabled: d.Get("enabled").(bool), + TriggersOn: automationrules.TriggersOn(d.Get("triggers_on").(string)), + TriggersWhen: automationrules.TriggersWhen(d.Get("triggers_when").(string)), Conditions: expandAutomationRuleConditions(d.Get("condition").([]interface{})), }, Actions: actions, @@ -367,17 +288,17 @@ func resourceSentinelAutomationRuleCreateOrUpdate(d *pluginsdk.ResourceData, met if err != nil { return fmt.Errorf("expanding `condition_json`: %v", err) } - params.AutomationRuleProperties.TriggeringLogic.Conditions = conditions + params.Properties.TriggeringLogic.Conditions = conditions } else if !features.FourPointOhBeta() { - params.AutomationRuleProperties.TriggeringLogic.Conditions = expandAutomationRuleConditions(d.Get("condition").([]interface{})) + params.Properties.TriggeringLogic.Conditions = expandAutomationRuleConditions(d.Get("condition").([]interface{})) } if expiration := d.Get("expiration").(string); expiration != "" { t, _ := time.Parse(time.RFC3339, expiration) - params.AutomationRuleProperties.TriggeringLogic.ExpirationTimeUtc = &date.Time{Time: t} + params.Properties.TriggeringLogic.SetExpirationTimeUtcAsTime(t) } - _, err = client.CreateOrUpdate(ctx, id.ResourceGroup, id.WorkspaceName, id.Name, ¶ms) + _, err = client.CreateOrUpdate(ctx, id, params) if err != nil { return fmt.Errorf("creating %s: %+v", id, err) } @@ -392,14 +313,14 @@ func resourceSentinelAutomationRuleRead(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AutomationRuleID(d.Id()) + id, err := automationrules.ParseAutomationRuleID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.WorkspaceName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[DEBUG] %s was not found - removing from state!", id) d.SetId("") return nil @@ -408,45 +329,30 @@ func resourceSentinelAutomationRuleRead(d *pluginsdk.ResourceData, meta interfac return fmt.Errorf("retrieving %s: %+v", id, err) } - d.Set("name", id.Name) - d.Set("log_analytics_workspace_id", workspaces.NewWorkspaceID(id.SubscriptionId, id.ResourceGroup, id.WorkspaceName).ID()) - if prop := resp.AutomationRuleProperties; prop != nil { + d.Set("name", id.AutomationRuleId) + d.Set("log_analytics_workspace_id", automationrules.NewWorkspaceID(id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName).ID()) + if model := resp.Model; model != nil { + prop := model.Properties d.Set("display_name", prop.DisplayName) + d.Set("order", prop.Order) - var order int - if prop.Order != nil { - order = int(*prop.Order) - } - d.Set("order", order) - - if tl := prop.TriggeringLogic; tl != nil { - var enabled bool - if tl.IsEnabled != nil { - enabled = *tl.IsEnabled - } - d.Set("enabled", enabled) - - d.Set("triggers_on", string(tl.TriggersOn)) - d.Set("triggers_when", string(tl.TriggersWhen)) + tl := prop.TriggeringLogic + d.Set("enabled", tl.IsEnabled) + d.Set("triggers_on", string(tl.TriggersOn)) + d.Set("triggers_when", string(tl.TriggersWhen)) + d.Set("expiration", tl.ExpirationTimeUtc) - var expiration string - if tl.ExpirationTimeUtc != nil { - expiration = tl.ExpirationTimeUtc.Format(time.RFC3339) - } - d.Set("expiration", expiration) - - if !features.FourPointOhBeta() { - if err := d.Set("condition", flattenAutomationRuleConditions(tl.Conditions)); err != nil { - return fmt.Errorf("setting `condition`: %v", err) - } + if !features.FourPointOhBeta() { + if err := d.Set("condition", flattenAutomationRuleConditions(tl.Conditions)); err != nil { + return fmt.Errorf("setting `condition`: %v", err) } + } - conditionJSON, err := flattenAutomationRuleConditionsToJSON(tl.Conditions) - if err != nil { - return fmt.Errorf("flattening `condition_json`: %v", err) - } - d.Set("condition_json", conditionJSON) + conditionJSON, err := flattenAutomationRuleConditionsToJSON(tl.Conditions) + if err != nil { + return fmt.Errorf("flattening `condition_json`: %v", err) } + d.Set("condition_json", conditionJSON) actionIncident, actionPlaybook := flattenAutomationRuleActions(prop.Actions) @@ -466,12 +372,12 @@ func resourceSentinelAutomationRuleDelete(d *pluginsdk.ResourceData, meta interf ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AutomationRuleID(d.Id()) + id, err := automationrules.ParseAutomationRuleID(d.Id()) if err != nil { return err } - _, err = client.Delete(ctx, id.ResourceGroup, id.WorkspaceName, id.Name) + _, err = client.Delete(ctx, *id) if err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } @@ -479,28 +385,29 @@ func resourceSentinelAutomationRuleDelete(d *pluginsdk.ResourceData, meta interf return nil } -func expandAutomationRuleConditions(input []interface{}) *[]securityinsight.BasicAutomationRuleCondition { +func expandAutomationRuleConditions(input []interface{}) *[]automationrules.AutomationRuleCondition { if len(input) == 0 { return nil } - out := make([]securityinsight.BasicAutomationRuleCondition, 0, len(input)) + out := make([]automationrules.AutomationRuleCondition, 0, len(input)) for _, b := range input { b := b.(map[string]interface{}) - out = append(out, &securityinsight.PropertyConditionProperties{ - ConditionProperties: &securityinsight.AutomationRulePropertyValuesCondition{ - PropertyName: securityinsight.AutomationRulePropertyConditionSupportedProperty(b["property"].(string)), - Operator: securityinsight.AutomationRulePropertyConditionSupportedOperator(b["operator"].(string)), + propertyName := automationrules.AutomationRulePropertyConditionSupportedProperty(b["property"].(string)) + operator := automationrules.AutomationRulePropertyConditionSupportedOperator(b["operator"].(string)) + out = append(out, &automationrules.PropertyConditionProperties{ + ConditionProperties: &automationrules.AutomationRulePropertyValuesCondition{ + PropertyName: &propertyName, + Operator: &operator, PropertyValues: utils.ExpandStringSlice(b["values"].([]interface{})), }, - ConditionType: securityinsight.ConditionTypeBasicAutomationRuleConditionConditionTypeProperty, }) } return &out } -func flattenAutomationRuleConditions(conditions *[]securityinsight.BasicAutomationRuleCondition) interface{} { +func flattenAutomationRuleConditions(conditions *[]automationrules.AutomationRuleCondition) interface{} { if conditions == nil { return nil } @@ -508,7 +415,7 @@ func flattenAutomationRuleConditions(conditions *[]securityinsight.BasicAutomati out := make([]interface{}, 0, len(*conditions)) for _, condition := range *conditions { // "condition" only applies to the Property condition - condition, ok := condition.(securityinsight.PropertyConditionProperties) + condition, ok := condition.(automationrules.PropertyConditionProperties) if !ok { continue } @@ -519,8 +426,12 @@ func flattenAutomationRuleConditions(conditions *[]securityinsight.BasicAutomati values []interface{} ) if p := condition.ConditionProperties; p != nil { - property = string(p.PropertyName) - operator = string(p.Operator) + if p.PropertyName != nil { + property = string(*p.PropertyName) + } + if p.Operator != nil { + operator = string(*p.Operator) + } values = utils.FlattenStringSlice(p.PropertyValues) } @@ -533,11 +444,11 @@ func flattenAutomationRuleConditions(conditions *[]securityinsight.BasicAutomati return out } -func expandAutomationRuleConditionsFromJSON(input string) (*[]securityinsight.BasicAutomationRuleCondition, error) { +func expandAutomationRuleConditionsFromJSON(input string) (*[]automationrules.AutomationRuleCondition, error) { if input == "" { return nil, nil } - triggerLogic := &securityinsight.AutomationRuleTriggeringLogic{} + triggerLogic := &automationrules.AutomationRuleTriggeringLogic{} err := triggerLogic.UnmarshalJSON([]byte(fmt.Sprintf(`{ "conditions": %s }`, input))) if err != nil { return nil, err @@ -545,7 +456,7 @@ func expandAutomationRuleConditionsFromJSON(input string) (*[]securityinsight.Ba return triggerLogic.Conditions, nil } -func flattenAutomationRuleConditionsToJSON(input *[]securityinsight.BasicAutomationRuleCondition) (string, error) { +func flattenAutomationRuleConditionsToJSON(input *[]automationrules.AutomationRuleCondition) (string, error) { if input == nil { return "", nil } @@ -553,39 +464,32 @@ func flattenAutomationRuleConditionsToJSON(input *[]securityinsight.BasicAutomat return string(result), err } -func expandAutomationRuleActions(d *pluginsdk.ResourceData, defaultTenantId string) (*[]securityinsight.BasicAutomationRuleAction, error) { +func expandAutomationRuleActions(d *pluginsdk.ResourceData, defaultTenantId string) ([]automationrules.AutomationRuleAction, error) { actionIncident, err := expandAutomationRuleActionIncident(d.Get("action_incident").([]interface{})) if err != nil { return nil, err } - actionPlaybook, err := expandAutomationRuleActionPlaybook(d.Get("action_playbook").([]interface{}), defaultTenantId) - if err != nil { - return nil, err - } + actionPlaybook := expandAutomationRuleActionPlaybook(d.Get("action_playbook").([]interface{}), defaultTenantId) if len(actionIncident)+len(actionPlaybook) == 0 { return nil, nil } - out := make([]securityinsight.BasicAutomationRuleAction, 0, len(actionIncident)+len(actionPlaybook)) + out := make([]automationrules.AutomationRuleAction, 0, len(actionIncident)+len(actionPlaybook)) out = append(out, actionIncident...) out = append(out, actionPlaybook...) - return &out, nil + return out, nil } -func flattenAutomationRuleActions(input *[]securityinsight.BasicAutomationRuleAction) (actionIncident []interface{}, actionPlaybook []interface{}) { - if input == nil { - return nil, nil - } - +func flattenAutomationRuleActions(input []automationrules.AutomationRuleAction) (actionIncident []interface{}, actionPlaybook []interface{}) { actionIncident = make([]interface{}, 0) actionPlaybook = make([]interface{}, 0) - for _, action := range *input { + for _, action := range input { switch action := action.(type) { - case securityinsight.AutomationRuleModifyPropertiesAction: + case automationrules.AutomationRuleModifyPropertiesAction: actionIncident = append(actionIncident, flattenAutomationRuleActionIncident(action)) - case securityinsight.AutomationRuleRunPlaybookAction: + case automationrules.AutomationRuleRunPlaybookAction: actionPlaybook = append(actionPlaybook, flattenAutomationRuleActionPlaybook(action)) } } @@ -593,16 +497,16 @@ func flattenAutomationRuleActions(input *[]securityinsight.BasicAutomationRuleAc return } -func expandAutomationRuleActionIncident(input []interface{}) ([]securityinsight.BasicAutomationRuleAction, error) { +func expandAutomationRuleActionIncident(input []interface{}) ([]automationrules.AutomationRuleAction, error) { if len(input) == 0 { return nil, nil } - out := make([]securityinsight.BasicAutomationRuleAction, 0, len(input)) + out := make([]automationrules.AutomationRuleAction, 0, len(input)) for _, b := range input { b := b.(map[string]interface{}) - status := securityinsight.IncidentStatus(b["status"].(string)) + status := automationrules.IncidentStatus(b["status"].(string)) l := strings.Split(b["classification"].(string), "_") classification, clr := l[0], "" if len(l) == 2 { @@ -611,10 +515,10 @@ func expandAutomationRuleActionIncident(input []interface{}) ([]securityinsight. classificationComment := b["classification_comment"].(string) // sanity check on classification - if status == securityinsight.IncidentStatusClosed && classification == "" { + if status == automationrules.IncidentStatusClosed && classification == "" { return nil, fmt.Errorf("`classification` is required when `status` is set to `Closed`") } - if status != securityinsight.IncidentStatusClosed { + if status != automationrules.IncidentStatusClosed { if classification != "" { return nil, fmt.Errorf("`classification` can't be set when `status` is not set to `Closed`") } @@ -623,25 +527,21 @@ func expandAutomationRuleActionIncident(input []interface{}) ([]securityinsight. } } - var labelsPtr *[]securityinsight.IncidentLabel + var labelsPtr *[]automationrules.IncidentLabel if labelStrsPtr := utils.ExpandStringSlice(b["labels"].([]interface{})); labelStrsPtr != nil && len(*labelStrsPtr) > 0 { - labels := make([]securityinsight.IncidentLabel, 0, len(*labelStrsPtr)) + labels := make([]automationrules.IncidentLabel, 0, len(*labelStrsPtr)) for _, label := range *labelStrsPtr { - labels = append(labels, securityinsight.IncidentLabel{ - LabelName: utils.String(label), + labels = append(labels, automationrules.IncidentLabel{ + LabelName: label, }) } labelsPtr = &labels } - var ownerPtr *securityinsight.IncidentOwnerInfo + var ownerPtr *automationrules.IncidentOwnerInfo if ownerIdStr := b["owner_id"].(string); ownerIdStr != "" { - ownerId, err := uuid.FromString(ownerIdStr) - if err != nil { - return nil, fmt.Errorf("getting `owner_id`: %v", err) - } - ownerPtr = &securityinsight.IncidentOwnerInfo{ - ObjectID: &ownerId, + ownerPtr = &automationrules.IncidentOwnerInfo{ + ObjectId: utils.String(ownerIdStr), } } @@ -652,17 +552,19 @@ func expandAutomationRuleActionIncident(input []interface{}) ([]securityinsight. return nil, fmt.Errorf("at least one of `severity`, `owner_id`, `labels` or `status` should be specified") } - out = append(out, securityinsight.AutomationRuleModifyPropertiesAction{ - ActionType: securityinsight.ActionTypeBasicAutomationRuleActionActionTypeModifyProperties, - Order: utils.Int32(int32(b["order"].(int))), - ActionConfiguration: &securityinsight.IncidentPropertiesAction{ - Status: status, - Classification: securityinsight.IncidentClassification(classification), + classificationPtr := automationrules.IncidentClassification(classification) + clrPtr := automationrules.IncidentClassificationReason(clr) + severityPtr := automationrules.IncidentSeverity(severity) + out = append(out, automationrules.AutomationRuleModifyPropertiesAction{ + Order: int64(b["order"].(int)), + ActionConfiguration: &automationrules.IncidentPropertiesAction{ + Status: &status, + Classification: &classificationPtr, ClassificationComment: &classificationComment, - ClassificationReason: securityinsight.IncidentClassificationReason(clr), + ClassificationReason: &clrPtr, Labels: labelsPtr, Owner: ownerPtr, - Severity: securityinsight.IncidentSeverity(severity), + Severity: &severityPtr, }, }) } @@ -670,12 +572,7 @@ func expandAutomationRuleActionIncident(input []interface{}) ([]securityinsight. return out, nil } -func flattenAutomationRuleActionIncident(input securityinsight.AutomationRuleModifyPropertiesAction) map[string]interface{} { - var order int - if input.Order != nil { - order = int(*input.Order) - } - +func flattenAutomationRuleActionIncident(input automationrules.AutomationRuleModifyPropertiesAction) map[string]interface{} { var ( status string clsf string @@ -687,26 +584,32 @@ func flattenAutomationRuleActionIncident(input securityinsight.AutomationRuleMod ) if cfg := input.ActionConfiguration; cfg != nil { - status = string(cfg.Status) - clsf = string(cfg.Classification) + if cfg.Status != nil { + status = string(*cfg.Status) + } + if cfg.Classification != nil { + clsf = string(*cfg.Classification) + } if cfg.ClassificationComment != nil { clsfComment = *cfg.ClassificationComment } - clsfReason = string(cfg.ClassificationReason) + if cfg.ClassificationReason != nil { + clsfReason = string(*cfg.ClassificationReason) + } if cfg.Labels != nil { for _, label := range *cfg.Labels { - if label.LabelName != nil { - labels = append(labels, *label.LabelName) - } + labels = append(labels, label.LabelName) } } - if cfg.Owner != nil && cfg.Owner.ObjectID != nil { - owner = cfg.Owner.ObjectID.String() + if cfg.Owner != nil && cfg.Owner.ObjectId != nil { + owner = *cfg.Owner.ObjectId } - severity = string(cfg.Severity) + if cfg.Severity != nil { + severity = string(*cfg.Severity) + } } classification := clsf @@ -715,7 +618,7 @@ func flattenAutomationRuleActionIncident(input securityinsight.AutomationRuleMod } return map[string]interface{}{ - "order": order, + "order": input.Order, "status": status, "classification": classification, "classification_comment": clsfComment, @@ -725,12 +628,8 @@ func flattenAutomationRuleActionIncident(input securityinsight.AutomationRuleMod } } -func expandAutomationRuleActionPlaybook(input []interface{}, defaultTenantId string) ([]securityinsight.BasicAutomationRuleAction, error) { - if len(input) == 0 { - return nil, nil - } - - out := make([]securityinsight.BasicAutomationRuleAction, 0, len(input)) +func expandAutomationRuleActionPlaybook(input []interface{}, defaultTenantId string) []automationrules.AutomationRuleAction { + out := make([]automationrules.AutomationRuleAction, 0, len(input)) for _, b := range input { b := b.(map[string]interface{}) @@ -739,47 +638,35 @@ func expandAutomationRuleActionPlaybook(input []interface{}, defaultTenantId str tid = t } - tenantId, err := uuid.FromString(tid) - if err != nil { - return nil, fmt.Errorf("getting `tenant_id`: %v", err) - } - - out = append(out, securityinsight.AutomationRuleRunPlaybookAction{ - ActionType: securityinsight.ActionTypeBasicAutomationRuleActionActionTypeRunPlaybook, - Order: utils.Int32(int32(b["order"].(int))), - ActionConfiguration: &securityinsight.PlaybookActionProperties{ - LogicAppResourceID: utils.String(b["logic_app_id"].(string)), - TenantID: &tenantId, + out = append(out, automationrules.AutomationRuleRunPlaybookAction{ + Order: int64(b["order"].(int)), + ActionConfiguration: &automationrules.PlaybookActionProperties{ + LogicAppResourceId: utils.String(b["logic_app_id"].(string)), + TenantId: &tid, }, }) } - return out, nil + return out } -func flattenAutomationRuleActionPlaybook(input securityinsight.AutomationRuleRunPlaybookAction) map[string]interface{} { - var order int - - if input.Order != nil { - order = int(*input.Order) - } - +func flattenAutomationRuleActionPlaybook(input automationrules.AutomationRuleRunPlaybookAction) map[string]interface{} { var ( logicAppId string tenantId string ) if cfg := input.ActionConfiguration; cfg != nil { - if cfg.LogicAppResourceID != nil { - logicAppId = *cfg.LogicAppResourceID + if cfg.LogicAppResourceId != nil { + logicAppId = *cfg.LogicAppResourceId } - if cfg.TenantID != nil { - tenantId = cfg.TenantID.String() + if cfg.TenantId != nil { + tenantId = *cfg.TenantId } } return map[string]interface{}{ - "order": order, + "order": input.Order, "logic_app_id": logicAppId, "tenant_id": tenantId, } diff --git a/internal/services/sentinel/sentinel_automation_rule_resource_test.go b/internal/services/sentinel/sentinel_automation_rule_resource_test.go index 58f7d18dd50c..f28e9da3952c 100644 --- a/internal/services/sentinel/sentinel_automation_rule_resource_test.go +++ b/internal/services/sentinel/sentinel_automation_rule_resource_test.go @@ -8,10 +8,11 @@ import ( "time" "github.com/google/uuid" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -36,7 +37,7 @@ func TestAccSentinelAutomationRule_basic(t *testing.T) { }) } -func TestAccSentinelAutomationRule_completeDperecatedCondition(t *testing.T) { +func TestAccSentinelAutomationRule_completeDeprecatedCondition(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_sentinel_automation_rule", "test") r := SentinelAutomationRuleResource{uuid: uuid.New().String()} @@ -153,13 +154,13 @@ func TestAccSentinelAutomationRule_requiresImport(t *testing.T) { func (r SentinelAutomationRuleResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { client := clients.Sentinel.AutomationRulesClient - id, err := parse.AutomationRuleID(state.ID) + id, err := automationrules.ParseAutomationRuleID(state.ID) if err != nil { return nil, err } - if resp, err := client.Get(ctx, id.ResourceGroup, id.WorkspaceName, id.Name); err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if resp, err := client.Get(ctx, *id); err != nil { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } return nil, fmt.Errorf("retrieving %s: %+v", id, err) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/README.md new file mode 100644 index 000000000000..f076c49abe09 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules` Documentation + +The `automationrules` SDK allows for interaction with the Azure Resource Manager Service `securityinsights` (API Version `2022-10-01-preview`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules" +``` + + +### Client Initialization + +```go +client := automationrules.NewAutomationRulesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AutomationRulesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := automationrules.NewAutomationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "automationRuleIdValue") + +payload := automationrules.AutomationRule{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AutomationRulesClient.Delete` + +```go +ctx := context.TODO() +id := automationrules.NewAutomationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "automationRuleIdValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AutomationRulesClient.Get` + +```go +ctx := context.TODO() +id := automationrules.NewAutomationRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue", "automationRuleIdValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AutomationRulesClient.List` + +```go +ctx := context.TODO() +id := automationrules.NewWorkspaceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "workspaceValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/client.go new file mode 100644 index 000000000000..960f049c3878 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/client.go @@ -0,0 +1,18 @@ +package automationrules + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationRulesClient struct { + Client autorest.Client + baseUri string +} + +func NewAutomationRulesClientWithBaseURI(endpoint string) AutomationRulesClient { + return AutomationRulesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/constants.go new file mode 100644 index 000000000000..73ef09a09036 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/constants.go @@ -0,0 +1,760 @@ +package automationrules + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActionType string + +const ( + ActionTypeModifyProperties ActionType = "ModifyProperties" + ActionTypeRunPlaybook ActionType = "RunPlaybook" +) + +func PossibleValuesForActionType() []string { + return []string{ + string(ActionTypeModifyProperties), + string(ActionTypeRunPlaybook), + } +} + +func parseActionType(input string) (*ActionType, error) { + vals := map[string]ActionType{ + "modifyproperties": ActionTypeModifyProperties, + "runplaybook": ActionTypeRunPlaybook, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ActionType(input) + return &out, nil +} + +type AutomationRuleBooleanConditionSupportedOperator string + +const ( + AutomationRuleBooleanConditionSupportedOperatorAnd AutomationRuleBooleanConditionSupportedOperator = "And" + AutomationRuleBooleanConditionSupportedOperatorOr AutomationRuleBooleanConditionSupportedOperator = "Or" +) + +func PossibleValuesForAutomationRuleBooleanConditionSupportedOperator() []string { + return []string{ + string(AutomationRuleBooleanConditionSupportedOperatorAnd), + string(AutomationRuleBooleanConditionSupportedOperatorOr), + } +} + +func parseAutomationRuleBooleanConditionSupportedOperator(input string) (*AutomationRuleBooleanConditionSupportedOperator, error) { + vals := map[string]AutomationRuleBooleanConditionSupportedOperator{ + "and": AutomationRuleBooleanConditionSupportedOperatorAnd, + "or": AutomationRuleBooleanConditionSupportedOperatorOr, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutomationRuleBooleanConditionSupportedOperator(input) + return &out, nil +} + +type AutomationRulePropertyArrayChangedConditionSupportedArrayType string + +const ( + AutomationRulePropertyArrayChangedConditionSupportedArrayTypeAlerts AutomationRulePropertyArrayChangedConditionSupportedArrayType = "Alerts" + AutomationRulePropertyArrayChangedConditionSupportedArrayTypeComments AutomationRulePropertyArrayChangedConditionSupportedArrayType = "Comments" + AutomationRulePropertyArrayChangedConditionSupportedArrayTypeLabels AutomationRulePropertyArrayChangedConditionSupportedArrayType = "Labels" + AutomationRulePropertyArrayChangedConditionSupportedArrayTypeTactics AutomationRulePropertyArrayChangedConditionSupportedArrayType = "Tactics" +) + +func PossibleValuesForAutomationRulePropertyArrayChangedConditionSupportedArrayType() []string { + return []string{ + string(AutomationRulePropertyArrayChangedConditionSupportedArrayTypeAlerts), + string(AutomationRulePropertyArrayChangedConditionSupportedArrayTypeComments), + string(AutomationRulePropertyArrayChangedConditionSupportedArrayTypeLabels), + string(AutomationRulePropertyArrayChangedConditionSupportedArrayTypeTactics), + } +} + +func parseAutomationRulePropertyArrayChangedConditionSupportedArrayType(input string) (*AutomationRulePropertyArrayChangedConditionSupportedArrayType, error) { + vals := map[string]AutomationRulePropertyArrayChangedConditionSupportedArrayType{ + "alerts": AutomationRulePropertyArrayChangedConditionSupportedArrayTypeAlerts, + "comments": AutomationRulePropertyArrayChangedConditionSupportedArrayTypeComments, + "labels": AutomationRulePropertyArrayChangedConditionSupportedArrayTypeLabels, + "tactics": AutomationRulePropertyArrayChangedConditionSupportedArrayTypeTactics, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutomationRulePropertyArrayChangedConditionSupportedArrayType(input) + return &out, nil +} + +type AutomationRulePropertyArrayChangedConditionSupportedChangeType string + +const ( + AutomationRulePropertyArrayChangedConditionSupportedChangeTypeAdded AutomationRulePropertyArrayChangedConditionSupportedChangeType = "Added" +) + +func PossibleValuesForAutomationRulePropertyArrayChangedConditionSupportedChangeType() []string { + return []string{ + string(AutomationRulePropertyArrayChangedConditionSupportedChangeTypeAdded), + } +} + +func parseAutomationRulePropertyArrayChangedConditionSupportedChangeType(input string) (*AutomationRulePropertyArrayChangedConditionSupportedChangeType, error) { + vals := map[string]AutomationRulePropertyArrayChangedConditionSupportedChangeType{ + "added": AutomationRulePropertyArrayChangedConditionSupportedChangeTypeAdded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutomationRulePropertyArrayChangedConditionSupportedChangeType(input) + return &out, nil +} + +type AutomationRulePropertyArrayConditionSupportedArrayConditionType string + +const ( + AutomationRulePropertyArrayConditionSupportedArrayConditionTypeAnyItem AutomationRulePropertyArrayConditionSupportedArrayConditionType = "AnyItem" +) + +func PossibleValuesForAutomationRulePropertyArrayConditionSupportedArrayConditionType() []string { + return []string{ + string(AutomationRulePropertyArrayConditionSupportedArrayConditionTypeAnyItem), + } +} + +func parseAutomationRulePropertyArrayConditionSupportedArrayConditionType(input string) (*AutomationRulePropertyArrayConditionSupportedArrayConditionType, error) { + vals := map[string]AutomationRulePropertyArrayConditionSupportedArrayConditionType{ + "anyitem": AutomationRulePropertyArrayConditionSupportedArrayConditionTypeAnyItem, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutomationRulePropertyArrayConditionSupportedArrayConditionType(input) + return &out, nil +} + +type AutomationRulePropertyArrayConditionSupportedArrayType string + +const ( + AutomationRulePropertyArrayConditionSupportedArrayTypeCustomDetailValues AutomationRulePropertyArrayConditionSupportedArrayType = "CustomDetailValues" + AutomationRulePropertyArrayConditionSupportedArrayTypeCustomDetails AutomationRulePropertyArrayConditionSupportedArrayType = "CustomDetails" +) + +func PossibleValuesForAutomationRulePropertyArrayConditionSupportedArrayType() []string { + return []string{ + string(AutomationRulePropertyArrayConditionSupportedArrayTypeCustomDetailValues), + string(AutomationRulePropertyArrayConditionSupportedArrayTypeCustomDetails), + } +} + +func parseAutomationRulePropertyArrayConditionSupportedArrayType(input string) (*AutomationRulePropertyArrayConditionSupportedArrayType, error) { + vals := map[string]AutomationRulePropertyArrayConditionSupportedArrayType{ + "customdetailvalues": AutomationRulePropertyArrayConditionSupportedArrayTypeCustomDetailValues, + "customdetails": AutomationRulePropertyArrayConditionSupportedArrayTypeCustomDetails, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutomationRulePropertyArrayConditionSupportedArrayType(input) + return &out, nil +} + +type AutomationRulePropertyChangedConditionSupportedChangedType string + +const ( + AutomationRulePropertyChangedConditionSupportedChangedTypeChangedFrom AutomationRulePropertyChangedConditionSupportedChangedType = "ChangedFrom" + AutomationRulePropertyChangedConditionSupportedChangedTypeChangedTo AutomationRulePropertyChangedConditionSupportedChangedType = "ChangedTo" +) + +func PossibleValuesForAutomationRulePropertyChangedConditionSupportedChangedType() []string { + return []string{ + string(AutomationRulePropertyChangedConditionSupportedChangedTypeChangedFrom), + string(AutomationRulePropertyChangedConditionSupportedChangedTypeChangedTo), + } +} + +func parseAutomationRulePropertyChangedConditionSupportedChangedType(input string) (*AutomationRulePropertyChangedConditionSupportedChangedType, error) { + vals := map[string]AutomationRulePropertyChangedConditionSupportedChangedType{ + "changedfrom": AutomationRulePropertyChangedConditionSupportedChangedTypeChangedFrom, + "changedto": AutomationRulePropertyChangedConditionSupportedChangedTypeChangedTo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutomationRulePropertyChangedConditionSupportedChangedType(input) + return &out, nil +} + +type AutomationRulePropertyChangedConditionSupportedPropertyType string + +const ( + AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentOwner AutomationRulePropertyChangedConditionSupportedPropertyType = "IncidentOwner" + AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentSeverity AutomationRulePropertyChangedConditionSupportedPropertyType = "IncidentSeverity" + AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentStatus AutomationRulePropertyChangedConditionSupportedPropertyType = "IncidentStatus" +) + +func PossibleValuesForAutomationRulePropertyChangedConditionSupportedPropertyType() []string { + return []string{ + string(AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentOwner), + string(AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentSeverity), + string(AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentStatus), + } +} + +func parseAutomationRulePropertyChangedConditionSupportedPropertyType(input string) (*AutomationRulePropertyChangedConditionSupportedPropertyType, error) { + vals := map[string]AutomationRulePropertyChangedConditionSupportedPropertyType{ + "incidentowner": AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentOwner, + "incidentseverity": AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentSeverity, + "incidentstatus": AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentStatus, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutomationRulePropertyChangedConditionSupportedPropertyType(input) + return &out, nil +} + +type AutomationRulePropertyConditionSupportedOperator string + +const ( + AutomationRulePropertyConditionSupportedOperatorContains AutomationRulePropertyConditionSupportedOperator = "Contains" + AutomationRulePropertyConditionSupportedOperatorEndsWith AutomationRulePropertyConditionSupportedOperator = "EndsWith" + AutomationRulePropertyConditionSupportedOperatorEquals AutomationRulePropertyConditionSupportedOperator = "Equals" + AutomationRulePropertyConditionSupportedOperatorNotContains AutomationRulePropertyConditionSupportedOperator = "NotContains" + AutomationRulePropertyConditionSupportedOperatorNotEndsWith AutomationRulePropertyConditionSupportedOperator = "NotEndsWith" + AutomationRulePropertyConditionSupportedOperatorNotEquals AutomationRulePropertyConditionSupportedOperator = "NotEquals" + AutomationRulePropertyConditionSupportedOperatorNotStartsWith AutomationRulePropertyConditionSupportedOperator = "NotStartsWith" + AutomationRulePropertyConditionSupportedOperatorStartsWith AutomationRulePropertyConditionSupportedOperator = "StartsWith" +) + +func PossibleValuesForAutomationRulePropertyConditionSupportedOperator() []string { + return []string{ + string(AutomationRulePropertyConditionSupportedOperatorContains), + string(AutomationRulePropertyConditionSupportedOperatorEndsWith), + string(AutomationRulePropertyConditionSupportedOperatorEquals), + string(AutomationRulePropertyConditionSupportedOperatorNotContains), + string(AutomationRulePropertyConditionSupportedOperatorNotEndsWith), + string(AutomationRulePropertyConditionSupportedOperatorNotEquals), + string(AutomationRulePropertyConditionSupportedOperatorNotStartsWith), + string(AutomationRulePropertyConditionSupportedOperatorStartsWith), + } +} + +func parseAutomationRulePropertyConditionSupportedOperator(input string) (*AutomationRulePropertyConditionSupportedOperator, error) { + vals := map[string]AutomationRulePropertyConditionSupportedOperator{ + "contains": AutomationRulePropertyConditionSupportedOperatorContains, + "endswith": AutomationRulePropertyConditionSupportedOperatorEndsWith, + "equals": AutomationRulePropertyConditionSupportedOperatorEquals, + "notcontains": AutomationRulePropertyConditionSupportedOperatorNotContains, + "notendswith": AutomationRulePropertyConditionSupportedOperatorNotEndsWith, + "notequals": AutomationRulePropertyConditionSupportedOperatorNotEquals, + "notstartswith": AutomationRulePropertyConditionSupportedOperatorNotStartsWith, + "startswith": AutomationRulePropertyConditionSupportedOperatorStartsWith, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutomationRulePropertyConditionSupportedOperator(input) + return &out, nil +} + +type AutomationRulePropertyConditionSupportedProperty string + +const ( + AutomationRulePropertyConditionSupportedPropertyAccountAadTenantId AutomationRulePropertyConditionSupportedProperty = "AccountAadTenantId" + AutomationRulePropertyConditionSupportedPropertyAccountAadUserId AutomationRulePropertyConditionSupportedProperty = "AccountAadUserId" + AutomationRulePropertyConditionSupportedPropertyAccountNTDomain AutomationRulePropertyConditionSupportedProperty = "AccountNTDomain" + AutomationRulePropertyConditionSupportedPropertyAccountName AutomationRulePropertyConditionSupportedProperty = "AccountName" + AutomationRulePropertyConditionSupportedPropertyAccountObjectGuid AutomationRulePropertyConditionSupportedProperty = "AccountObjectGuid" + AutomationRulePropertyConditionSupportedPropertyAccountPUID AutomationRulePropertyConditionSupportedProperty = "AccountPUID" + AutomationRulePropertyConditionSupportedPropertyAccountSid AutomationRulePropertyConditionSupportedProperty = "AccountSid" + AutomationRulePropertyConditionSupportedPropertyAccountUPNSuffix AutomationRulePropertyConditionSupportedProperty = "AccountUPNSuffix" + AutomationRulePropertyConditionSupportedPropertyAlertAnalyticRuleIds AutomationRulePropertyConditionSupportedProperty = "AlertAnalyticRuleIds" + AutomationRulePropertyConditionSupportedPropertyAlertProductNames AutomationRulePropertyConditionSupportedProperty = "AlertProductNames" + AutomationRulePropertyConditionSupportedPropertyAzureResourceResourceId AutomationRulePropertyConditionSupportedProperty = "AzureResourceResourceId" + AutomationRulePropertyConditionSupportedPropertyAzureResourceSubscriptionId AutomationRulePropertyConditionSupportedProperty = "AzureResourceSubscriptionId" + AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppId AutomationRulePropertyConditionSupportedProperty = "CloudApplicationAppId" + AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppName AutomationRulePropertyConditionSupportedProperty = "CloudApplicationAppName" + AutomationRulePropertyConditionSupportedPropertyDNSDomainName AutomationRulePropertyConditionSupportedProperty = "DNSDomainName" + AutomationRulePropertyConditionSupportedPropertyFileDirectory AutomationRulePropertyConditionSupportedProperty = "FileDirectory" + AutomationRulePropertyConditionSupportedPropertyFileHashValue AutomationRulePropertyConditionSupportedProperty = "FileHashValue" + AutomationRulePropertyConditionSupportedPropertyFileName AutomationRulePropertyConditionSupportedProperty = "FileName" + AutomationRulePropertyConditionSupportedPropertyHostAzureID AutomationRulePropertyConditionSupportedProperty = "HostAzureID" + AutomationRulePropertyConditionSupportedPropertyHostNTDomain AutomationRulePropertyConditionSupportedProperty = "HostNTDomain" + AutomationRulePropertyConditionSupportedPropertyHostName AutomationRulePropertyConditionSupportedProperty = "HostName" + AutomationRulePropertyConditionSupportedPropertyHostNetBiosName AutomationRulePropertyConditionSupportedProperty = "HostNetBiosName" + AutomationRulePropertyConditionSupportedPropertyHostOSVersion AutomationRulePropertyConditionSupportedProperty = "HostOSVersion" + AutomationRulePropertyConditionSupportedPropertyIPAddress AutomationRulePropertyConditionSupportedProperty = "IPAddress" + AutomationRulePropertyConditionSupportedPropertyIncidentCustomDetailsKey AutomationRulePropertyConditionSupportedProperty = "IncidentCustomDetailsKey" + AutomationRulePropertyConditionSupportedPropertyIncidentCustomDetailsValue AutomationRulePropertyConditionSupportedProperty = "IncidentCustomDetailsValue" + AutomationRulePropertyConditionSupportedPropertyIncidentDescription AutomationRulePropertyConditionSupportedProperty = "IncidentDescription" + AutomationRulePropertyConditionSupportedPropertyIncidentLabel AutomationRulePropertyConditionSupportedProperty = "IncidentLabel" + AutomationRulePropertyConditionSupportedPropertyIncidentProviderName AutomationRulePropertyConditionSupportedProperty = "IncidentProviderName" + AutomationRulePropertyConditionSupportedPropertyIncidentRelatedAnalyticRuleIds AutomationRulePropertyConditionSupportedProperty = "IncidentRelatedAnalyticRuleIds" + AutomationRulePropertyConditionSupportedPropertyIncidentSeverity AutomationRulePropertyConditionSupportedProperty = "IncidentSeverity" + AutomationRulePropertyConditionSupportedPropertyIncidentStatus AutomationRulePropertyConditionSupportedProperty = "IncidentStatus" + AutomationRulePropertyConditionSupportedPropertyIncidentTactics AutomationRulePropertyConditionSupportedProperty = "IncidentTactics" + AutomationRulePropertyConditionSupportedPropertyIncidentTitle AutomationRulePropertyConditionSupportedProperty = "IncidentTitle" + AutomationRulePropertyConditionSupportedPropertyIncidentUpdatedBySource AutomationRulePropertyConditionSupportedProperty = "IncidentUpdatedBySource" + AutomationRulePropertyConditionSupportedPropertyIoTDeviceId AutomationRulePropertyConditionSupportedProperty = "IoTDeviceId" + AutomationRulePropertyConditionSupportedPropertyIoTDeviceModel AutomationRulePropertyConditionSupportedProperty = "IoTDeviceModel" + AutomationRulePropertyConditionSupportedPropertyIoTDeviceName AutomationRulePropertyConditionSupportedProperty = "IoTDeviceName" + AutomationRulePropertyConditionSupportedPropertyIoTDeviceOperatingSystem AutomationRulePropertyConditionSupportedProperty = "IoTDeviceOperatingSystem" + AutomationRulePropertyConditionSupportedPropertyIoTDeviceType AutomationRulePropertyConditionSupportedProperty = "IoTDeviceType" + AutomationRulePropertyConditionSupportedPropertyIoTDeviceVendor AutomationRulePropertyConditionSupportedProperty = "IoTDeviceVendor" + AutomationRulePropertyConditionSupportedPropertyMailMessageDeliveryAction AutomationRulePropertyConditionSupportedProperty = "MailMessageDeliveryAction" + AutomationRulePropertyConditionSupportedPropertyMailMessageDeliveryLocation AutomationRulePropertyConditionSupportedProperty = "MailMessageDeliveryLocation" + AutomationRulePropertyConditionSupportedPropertyMailMessagePOneSender AutomationRulePropertyConditionSupportedProperty = "MailMessageP1Sender" + AutomationRulePropertyConditionSupportedPropertyMailMessagePTwoSender AutomationRulePropertyConditionSupportedProperty = "MailMessageP2Sender" + AutomationRulePropertyConditionSupportedPropertyMailMessageRecipient AutomationRulePropertyConditionSupportedProperty = "MailMessageRecipient" + AutomationRulePropertyConditionSupportedPropertyMailMessageSenderIP AutomationRulePropertyConditionSupportedProperty = "MailMessageSenderIP" + AutomationRulePropertyConditionSupportedPropertyMailMessageSubject AutomationRulePropertyConditionSupportedProperty = "MailMessageSubject" + AutomationRulePropertyConditionSupportedPropertyMailboxDisplayName AutomationRulePropertyConditionSupportedProperty = "MailboxDisplayName" + AutomationRulePropertyConditionSupportedPropertyMailboxPrimaryAddress AutomationRulePropertyConditionSupportedProperty = "MailboxPrimaryAddress" + AutomationRulePropertyConditionSupportedPropertyMailboxUPN AutomationRulePropertyConditionSupportedProperty = "MailboxUPN" + AutomationRulePropertyConditionSupportedPropertyMalwareCategory AutomationRulePropertyConditionSupportedProperty = "MalwareCategory" + AutomationRulePropertyConditionSupportedPropertyMalwareName AutomationRulePropertyConditionSupportedProperty = "MalwareName" + AutomationRulePropertyConditionSupportedPropertyProcessCommandLine AutomationRulePropertyConditionSupportedProperty = "ProcessCommandLine" + AutomationRulePropertyConditionSupportedPropertyProcessId AutomationRulePropertyConditionSupportedProperty = "ProcessId" + AutomationRulePropertyConditionSupportedPropertyRegistryKey AutomationRulePropertyConditionSupportedProperty = "RegistryKey" + AutomationRulePropertyConditionSupportedPropertyRegistryValueData AutomationRulePropertyConditionSupportedProperty = "RegistryValueData" + AutomationRulePropertyConditionSupportedPropertyUrl AutomationRulePropertyConditionSupportedProperty = "Url" +) + +func PossibleValuesForAutomationRulePropertyConditionSupportedProperty() []string { + return []string{ + string(AutomationRulePropertyConditionSupportedPropertyAccountAadTenantId), + string(AutomationRulePropertyConditionSupportedPropertyAccountAadUserId), + string(AutomationRulePropertyConditionSupportedPropertyAccountNTDomain), + string(AutomationRulePropertyConditionSupportedPropertyAccountName), + string(AutomationRulePropertyConditionSupportedPropertyAccountObjectGuid), + string(AutomationRulePropertyConditionSupportedPropertyAccountPUID), + string(AutomationRulePropertyConditionSupportedPropertyAccountSid), + string(AutomationRulePropertyConditionSupportedPropertyAccountUPNSuffix), + string(AutomationRulePropertyConditionSupportedPropertyAlertAnalyticRuleIds), + string(AutomationRulePropertyConditionSupportedPropertyAlertProductNames), + string(AutomationRulePropertyConditionSupportedPropertyAzureResourceResourceId), + string(AutomationRulePropertyConditionSupportedPropertyAzureResourceSubscriptionId), + string(AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppId), + string(AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppName), + string(AutomationRulePropertyConditionSupportedPropertyDNSDomainName), + string(AutomationRulePropertyConditionSupportedPropertyFileDirectory), + string(AutomationRulePropertyConditionSupportedPropertyFileHashValue), + string(AutomationRulePropertyConditionSupportedPropertyFileName), + string(AutomationRulePropertyConditionSupportedPropertyHostAzureID), + string(AutomationRulePropertyConditionSupportedPropertyHostNTDomain), + string(AutomationRulePropertyConditionSupportedPropertyHostName), + string(AutomationRulePropertyConditionSupportedPropertyHostNetBiosName), + string(AutomationRulePropertyConditionSupportedPropertyHostOSVersion), + string(AutomationRulePropertyConditionSupportedPropertyIPAddress), + string(AutomationRulePropertyConditionSupportedPropertyIncidentCustomDetailsKey), + string(AutomationRulePropertyConditionSupportedPropertyIncidentCustomDetailsValue), + string(AutomationRulePropertyConditionSupportedPropertyIncidentDescription), + string(AutomationRulePropertyConditionSupportedPropertyIncidentLabel), + string(AutomationRulePropertyConditionSupportedPropertyIncidentProviderName), + string(AutomationRulePropertyConditionSupportedPropertyIncidentRelatedAnalyticRuleIds), + string(AutomationRulePropertyConditionSupportedPropertyIncidentSeverity), + string(AutomationRulePropertyConditionSupportedPropertyIncidentStatus), + string(AutomationRulePropertyConditionSupportedPropertyIncidentTactics), + string(AutomationRulePropertyConditionSupportedPropertyIncidentTitle), + string(AutomationRulePropertyConditionSupportedPropertyIncidentUpdatedBySource), + string(AutomationRulePropertyConditionSupportedPropertyIoTDeviceId), + string(AutomationRulePropertyConditionSupportedPropertyIoTDeviceModel), + string(AutomationRulePropertyConditionSupportedPropertyIoTDeviceName), + string(AutomationRulePropertyConditionSupportedPropertyIoTDeviceOperatingSystem), + string(AutomationRulePropertyConditionSupportedPropertyIoTDeviceType), + string(AutomationRulePropertyConditionSupportedPropertyIoTDeviceVendor), + string(AutomationRulePropertyConditionSupportedPropertyMailMessageDeliveryAction), + string(AutomationRulePropertyConditionSupportedPropertyMailMessageDeliveryLocation), + string(AutomationRulePropertyConditionSupportedPropertyMailMessagePOneSender), + string(AutomationRulePropertyConditionSupportedPropertyMailMessagePTwoSender), + string(AutomationRulePropertyConditionSupportedPropertyMailMessageRecipient), + string(AutomationRulePropertyConditionSupportedPropertyMailMessageSenderIP), + string(AutomationRulePropertyConditionSupportedPropertyMailMessageSubject), + string(AutomationRulePropertyConditionSupportedPropertyMailboxDisplayName), + string(AutomationRulePropertyConditionSupportedPropertyMailboxPrimaryAddress), + string(AutomationRulePropertyConditionSupportedPropertyMailboxUPN), + string(AutomationRulePropertyConditionSupportedPropertyMalwareCategory), + string(AutomationRulePropertyConditionSupportedPropertyMalwareName), + string(AutomationRulePropertyConditionSupportedPropertyProcessCommandLine), + string(AutomationRulePropertyConditionSupportedPropertyProcessId), + string(AutomationRulePropertyConditionSupportedPropertyRegistryKey), + string(AutomationRulePropertyConditionSupportedPropertyRegistryValueData), + string(AutomationRulePropertyConditionSupportedPropertyUrl), + } +} + +func parseAutomationRulePropertyConditionSupportedProperty(input string) (*AutomationRulePropertyConditionSupportedProperty, error) { + vals := map[string]AutomationRulePropertyConditionSupportedProperty{ + "accountaadtenantid": AutomationRulePropertyConditionSupportedPropertyAccountAadTenantId, + "accountaaduserid": AutomationRulePropertyConditionSupportedPropertyAccountAadUserId, + "accountntdomain": AutomationRulePropertyConditionSupportedPropertyAccountNTDomain, + "accountname": AutomationRulePropertyConditionSupportedPropertyAccountName, + "accountobjectguid": AutomationRulePropertyConditionSupportedPropertyAccountObjectGuid, + "accountpuid": AutomationRulePropertyConditionSupportedPropertyAccountPUID, + "accountsid": AutomationRulePropertyConditionSupportedPropertyAccountSid, + "accountupnsuffix": AutomationRulePropertyConditionSupportedPropertyAccountUPNSuffix, + "alertanalyticruleids": AutomationRulePropertyConditionSupportedPropertyAlertAnalyticRuleIds, + "alertproductnames": AutomationRulePropertyConditionSupportedPropertyAlertProductNames, + "azureresourceresourceid": AutomationRulePropertyConditionSupportedPropertyAzureResourceResourceId, + "azureresourcesubscriptionid": AutomationRulePropertyConditionSupportedPropertyAzureResourceSubscriptionId, + "cloudapplicationappid": AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppId, + "cloudapplicationappname": AutomationRulePropertyConditionSupportedPropertyCloudApplicationAppName, + "dnsdomainname": AutomationRulePropertyConditionSupportedPropertyDNSDomainName, + "filedirectory": AutomationRulePropertyConditionSupportedPropertyFileDirectory, + "filehashvalue": AutomationRulePropertyConditionSupportedPropertyFileHashValue, + "filename": AutomationRulePropertyConditionSupportedPropertyFileName, + "hostazureid": AutomationRulePropertyConditionSupportedPropertyHostAzureID, + "hostntdomain": AutomationRulePropertyConditionSupportedPropertyHostNTDomain, + "hostname": AutomationRulePropertyConditionSupportedPropertyHostName, + "hostnetbiosname": AutomationRulePropertyConditionSupportedPropertyHostNetBiosName, + "hostosversion": AutomationRulePropertyConditionSupportedPropertyHostOSVersion, + "ipaddress": AutomationRulePropertyConditionSupportedPropertyIPAddress, + "incidentcustomdetailskey": AutomationRulePropertyConditionSupportedPropertyIncidentCustomDetailsKey, + "incidentcustomdetailsvalue": AutomationRulePropertyConditionSupportedPropertyIncidentCustomDetailsValue, + "incidentdescription": AutomationRulePropertyConditionSupportedPropertyIncidentDescription, + "incidentlabel": AutomationRulePropertyConditionSupportedPropertyIncidentLabel, + "incidentprovidername": AutomationRulePropertyConditionSupportedPropertyIncidentProviderName, + "incidentrelatedanalyticruleids": AutomationRulePropertyConditionSupportedPropertyIncidentRelatedAnalyticRuleIds, + "incidentseverity": AutomationRulePropertyConditionSupportedPropertyIncidentSeverity, + "incidentstatus": AutomationRulePropertyConditionSupportedPropertyIncidentStatus, + "incidenttactics": AutomationRulePropertyConditionSupportedPropertyIncidentTactics, + "incidenttitle": AutomationRulePropertyConditionSupportedPropertyIncidentTitle, + "incidentupdatedbysource": AutomationRulePropertyConditionSupportedPropertyIncidentUpdatedBySource, + "iotdeviceid": AutomationRulePropertyConditionSupportedPropertyIoTDeviceId, + "iotdevicemodel": AutomationRulePropertyConditionSupportedPropertyIoTDeviceModel, + "iotdevicename": AutomationRulePropertyConditionSupportedPropertyIoTDeviceName, + "iotdeviceoperatingsystem": AutomationRulePropertyConditionSupportedPropertyIoTDeviceOperatingSystem, + "iotdevicetype": AutomationRulePropertyConditionSupportedPropertyIoTDeviceType, + "iotdevicevendor": AutomationRulePropertyConditionSupportedPropertyIoTDeviceVendor, + "mailmessagedeliveryaction": AutomationRulePropertyConditionSupportedPropertyMailMessageDeliveryAction, + "mailmessagedeliverylocation": AutomationRulePropertyConditionSupportedPropertyMailMessageDeliveryLocation, + "mailmessagep1sender": AutomationRulePropertyConditionSupportedPropertyMailMessagePOneSender, + "mailmessagep2sender": AutomationRulePropertyConditionSupportedPropertyMailMessagePTwoSender, + "mailmessagerecipient": AutomationRulePropertyConditionSupportedPropertyMailMessageRecipient, + "mailmessagesenderip": AutomationRulePropertyConditionSupportedPropertyMailMessageSenderIP, + "mailmessagesubject": AutomationRulePropertyConditionSupportedPropertyMailMessageSubject, + "mailboxdisplayname": AutomationRulePropertyConditionSupportedPropertyMailboxDisplayName, + "mailboxprimaryaddress": AutomationRulePropertyConditionSupportedPropertyMailboxPrimaryAddress, + "mailboxupn": AutomationRulePropertyConditionSupportedPropertyMailboxUPN, + "malwarecategory": AutomationRulePropertyConditionSupportedPropertyMalwareCategory, + "malwarename": AutomationRulePropertyConditionSupportedPropertyMalwareName, + "processcommandline": AutomationRulePropertyConditionSupportedPropertyProcessCommandLine, + "processid": AutomationRulePropertyConditionSupportedPropertyProcessId, + "registrykey": AutomationRulePropertyConditionSupportedPropertyRegistryKey, + "registryvaluedata": AutomationRulePropertyConditionSupportedPropertyRegistryValueData, + "url": AutomationRulePropertyConditionSupportedPropertyUrl, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AutomationRulePropertyConditionSupportedProperty(input) + return &out, nil +} + +type ConditionType string + +const ( + ConditionTypeBoolean ConditionType = "Boolean" + ConditionTypeProperty ConditionType = "Property" + ConditionTypePropertyArray ConditionType = "PropertyArray" + ConditionTypePropertyArrayChanged ConditionType = "PropertyArrayChanged" + ConditionTypePropertyChanged ConditionType = "PropertyChanged" +) + +func PossibleValuesForConditionType() []string { + return []string{ + string(ConditionTypeBoolean), + string(ConditionTypeProperty), + string(ConditionTypePropertyArray), + string(ConditionTypePropertyArrayChanged), + string(ConditionTypePropertyChanged), + } +} + +func parseConditionType(input string) (*ConditionType, error) { + vals := map[string]ConditionType{ + "boolean": ConditionTypeBoolean, + "property": ConditionTypeProperty, + "propertyarray": ConditionTypePropertyArray, + "propertyarraychanged": ConditionTypePropertyArrayChanged, + "propertychanged": ConditionTypePropertyChanged, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConditionType(input) + return &out, nil +} + +type IncidentClassification string + +const ( + IncidentClassificationBenignPositive IncidentClassification = "BenignPositive" + IncidentClassificationFalsePositive IncidentClassification = "FalsePositive" + IncidentClassificationTruePositive IncidentClassification = "TruePositive" + IncidentClassificationUndetermined IncidentClassification = "Undetermined" +) + +func PossibleValuesForIncidentClassification() []string { + return []string{ + string(IncidentClassificationBenignPositive), + string(IncidentClassificationFalsePositive), + string(IncidentClassificationTruePositive), + string(IncidentClassificationUndetermined), + } +} + +func parseIncidentClassification(input string) (*IncidentClassification, error) { + vals := map[string]IncidentClassification{ + "benignpositive": IncidentClassificationBenignPositive, + "falsepositive": IncidentClassificationFalsePositive, + "truepositive": IncidentClassificationTruePositive, + "undetermined": IncidentClassificationUndetermined, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IncidentClassification(input) + return &out, nil +} + +type IncidentClassificationReason string + +const ( + IncidentClassificationReasonInaccurateData IncidentClassificationReason = "InaccurateData" + IncidentClassificationReasonIncorrectAlertLogic IncidentClassificationReason = "IncorrectAlertLogic" + IncidentClassificationReasonSuspiciousActivity IncidentClassificationReason = "SuspiciousActivity" + IncidentClassificationReasonSuspiciousButExpected IncidentClassificationReason = "SuspiciousButExpected" +) + +func PossibleValuesForIncidentClassificationReason() []string { + return []string{ + string(IncidentClassificationReasonInaccurateData), + string(IncidentClassificationReasonIncorrectAlertLogic), + string(IncidentClassificationReasonSuspiciousActivity), + string(IncidentClassificationReasonSuspiciousButExpected), + } +} + +func parseIncidentClassificationReason(input string) (*IncidentClassificationReason, error) { + vals := map[string]IncidentClassificationReason{ + "inaccuratedata": IncidentClassificationReasonInaccurateData, + "incorrectalertlogic": IncidentClassificationReasonIncorrectAlertLogic, + "suspiciousactivity": IncidentClassificationReasonSuspiciousActivity, + "suspiciousbutexpected": IncidentClassificationReasonSuspiciousButExpected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IncidentClassificationReason(input) + return &out, nil +} + +type IncidentLabelType string + +const ( + IncidentLabelTypeAutoAssigned IncidentLabelType = "AutoAssigned" + IncidentLabelTypeUser IncidentLabelType = "User" +) + +func PossibleValuesForIncidentLabelType() []string { + return []string{ + string(IncidentLabelTypeAutoAssigned), + string(IncidentLabelTypeUser), + } +} + +func parseIncidentLabelType(input string) (*IncidentLabelType, error) { + vals := map[string]IncidentLabelType{ + "autoassigned": IncidentLabelTypeAutoAssigned, + "user": IncidentLabelTypeUser, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IncidentLabelType(input) + return &out, nil +} + +type IncidentSeverity string + +const ( + IncidentSeverityHigh IncidentSeverity = "High" + IncidentSeverityInformational IncidentSeverity = "Informational" + IncidentSeverityLow IncidentSeverity = "Low" + IncidentSeverityMedium IncidentSeverity = "Medium" +) + +func PossibleValuesForIncidentSeverity() []string { + return []string{ + string(IncidentSeverityHigh), + string(IncidentSeverityInformational), + string(IncidentSeverityLow), + string(IncidentSeverityMedium), + } +} + +func parseIncidentSeverity(input string) (*IncidentSeverity, error) { + vals := map[string]IncidentSeverity{ + "high": IncidentSeverityHigh, + "informational": IncidentSeverityInformational, + "low": IncidentSeverityLow, + "medium": IncidentSeverityMedium, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IncidentSeverity(input) + return &out, nil +} + +type IncidentStatus string + +const ( + IncidentStatusActive IncidentStatus = "Active" + IncidentStatusClosed IncidentStatus = "Closed" + IncidentStatusNew IncidentStatus = "New" +) + +func PossibleValuesForIncidentStatus() []string { + return []string{ + string(IncidentStatusActive), + string(IncidentStatusClosed), + string(IncidentStatusNew), + } +} + +func parseIncidentStatus(input string) (*IncidentStatus, error) { + vals := map[string]IncidentStatus{ + "active": IncidentStatusActive, + "closed": IncidentStatusClosed, + "new": IncidentStatusNew, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IncidentStatus(input) + return &out, nil +} + +type OwnerType string + +const ( + OwnerTypeGroup OwnerType = "Group" + OwnerTypeUnknown OwnerType = "Unknown" + OwnerTypeUser OwnerType = "User" +) + +func PossibleValuesForOwnerType() []string { + return []string{ + string(OwnerTypeGroup), + string(OwnerTypeUnknown), + string(OwnerTypeUser), + } +} + +func parseOwnerType(input string) (*OwnerType, error) { + vals := map[string]OwnerType{ + "group": OwnerTypeGroup, + "unknown": OwnerTypeUnknown, + "user": OwnerTypeUser, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OwnerType(input) + return &out, nil +} + +type TriggersOn string + +const ( + TriggersOnAlerts TriggersOn = "Alerts" + TriggersOnIncidents TriggersOn = "Incidents" +) + +func PossibleValuesForTriggersOn() []string { + return []string{ + string(TriggersOnAlerts), + string(TriggersOnIncidents), + } +} + +func parseTriggersOn(input string) (*TriggersOn, error) { + vals := map[string]TriggersOn{ + "alerts": TriggersOnAlerts, + "incidents": TriggersOnIncidents, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TriggersOn(input) + return &out, nil +} + +type TriggersWhen string + +const ( + TriggersWhenCreated TriggersWhen = "Created" + TriggersWhenUpdated TriggersWhen = "Updated" +) + +func PossibleValuesForTriggersWhen() []string { + return []string{ + string(TriggersWhenCreated), + string(TriggersWhenUpdated), + } +} + +func parseTriggersWhen(input string) (*TriggersWhen, error) { + vals := map[string]TriggersWhen{ + "created": TriggersWhenCreated, + "updated": TriggersWhenUpdated, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TriggersWhen(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/id_automationrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/id_automationrule.go new file mode 100644 index 000000000000..c4c78db2408e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/id_automationrule.go @@ -0,0 +1,142 @@ +package automationrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = AutomationRuleId{} + +// AutomationRuleId is a struct representing the Resource ID for a Automation Rule +type AutomationRuleId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string + AutomationRuleId string +} + +// NewAutomationRuleID returns a new AutomationRuleId struct +func NewAutomationRuleID(subscriptionId string, resourceGroupName string, workspaceName string, automationRuleId string) AutomationRuleId { + return AutomationRuleId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + AutomationRuleId: automationRuleId, + } +} + +// ParseAutomationRuleID parses 'input' into a AutomationRuleId +func ParseAutomationRuleID(input string) (*AutomationRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(AutomationRuleId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AutomationRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + if id.AutomationRuleId, ok = parsed.Parsed["automationRuleId"]; !ok { + return nil, fmt.Errorf("the segment 'automationRuleId' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseAutomationRuleIDInsensitively parses 'input' case-insensitively into a AutomationRuleId +// note: this method should only be used for API response data and not user input +func ParseAutomationRuleIDInsensitively(input string) (*AutomationRuleId, error) { + parser := resourceids.NewParserFromResourceIdType(AutomationRuleId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AutomationRuleId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + if id.AutomationRuleId, ok = parsed.Parsed["automationRuleId"]; !ok { + return nil, fmt.Errorf("the segment 'automationRuleId' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateAutomationRuleID checks that 'input' can be parsed as a Automation Rule ID +func ValidateAutomationRuleID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAutomationRuleID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Automation Rule ID +func (id AutomationRuleId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OperationalInsights/workspaces/%s/providers/Microsoft.SecurityInsights/automationRules/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName, id.AutomationRuleId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Automation Rule ID +func (id AutomationRuleId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftOperationalInsights", "Microsoft.OperationalInsights", "Microsoft.OperationalInsights"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceValue"), + resourceids.StaticSegment("staticProviders2", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftSecurityInsights", "Microsoft.SecurityInsights", "Microsoft.SecurityInsights"), + resourceids.StaticSegment("staticAutomationRules", "automationRules", "automationRules"), + resourceids.UserSpecifiedSegment("automationRuleId", "automationRuleIdValue"), + } +} + +// String returns a human-readable description of this Automation Rule ID +func (id AutomationRuleId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + fmt.Sprintf("Automation Rule: %q", id.AutomationRuleId), + } + return fmt.Sprintf("Automation Rule (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/id_workspace.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/id_workspace.go new file mode 100644 index 000000000000..24c2e91b90ef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/id_workspace.go @@ -0,0 +1,127 @@ +package automationrules + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = WorkspaceId{} + +// WorkspaceId is a struct representing the Resource ID for a Workspace +type WorkspaceId struct { + SubscriptionId string + ResourceGroupName string + WorkspaceName string +} + +// NewWorkspaceID returns a new WorkspaceId struct +func NewWorkspaceID(subscriptionId string, resourceGroupName string, workspaceName string) WorkspaceId { + return WorkspaceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + WorkspaceName: workspaceName, + } +} + +// ParseWorkspaceID parses 'input' into a WorkspaceId +func ParseWorkspaceID(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkspaceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkspaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseWorkspaceIDInsensitively parses 'input' case-insensitively into a WorkspaceId +// note: this method should only be used for API response data and not user input +func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { + parser := resourceids.NewParserFromResourceIdType(WorkspaceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := WorkspaceId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { + return nil, fmt.Errorf("the segment 'workspaceName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID +func ValidateWorkspaceID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseWorkspaceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Workspace ID +func (id WorkspaceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.OperationalInsights/workspaces/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.WorkspaceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Workspace ID +func (id WorkspaceId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftOperationalInsights", "Microsoft.OperationalInsights", "Microsoft.OperationalInsights"), + resourceids.StaticSegment("staticWorkspaces", "workspaces", "workspaces"), + resourceids.UserSpecifiedSegment("workspaceName", "workspaceValue"), + } +} + +// String returns a human-readable description of this Workspace ID +func (id WorkspaceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Workspace Name: %q", id.WorkspaceName), + } + return fmt.Sprintf("Workspace (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/method_createorupdate_autorest.go new file mode 100644 index 000000000000..790f2ff99f9e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/method_createorupdate_autorest.go @@ -0,0 +1,69 @@ +package automationrules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + Model *AutomationRule +} + +// CreateOrUpdate ... +func (c AutomationRulesClient) CreateOrUpdate(ctx context.Context, id AutomationRuleId, input AutomationRule) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "automationrules.AutomationRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "automationrules.AutomationRulesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForCreateOrUpdate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "automationrules.AutomationRulesClient", "CreateOrUpdate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c AutomationRulesClient) preparerForCreateOrUpdate(ctx context.Context, id AutomationRuleId, input AutomationRule) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForCreateOrUpdate handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (c AutomationRulesClient) responderForCreateOrUpdate(resp *http.Response) (result CreateOrUpdateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/method_delete_autorest.go new file mode 100644 index 000000000000..cd33f79070e3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/method_delete_autorest.go @@ -0,0 +1,68 @@ +package automationrules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + Model *interface{} +} + +// Delete ... +func (c AutomationRulesClient) Delete(ctx context.Context, id AutomationRuleId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "automationrules.AutomationRulesClient", "Delete", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "automationrules.AutomationRulesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForDelete(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "automationrules.AutomationRulesClient", "Delete", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForDelete prepares the Delete request. +func (c AutomationRulesClient) preparerForDelete(ctx context.Context, id AutomationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForDelete handles the response to the Delete request. The method always +// closes the http.Response Body. +func (c AutomationRulesClient) responderForDelete(resp *http.Response) (result DeleteOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/method_get_autorest.go new file mode 100644 index 000000000000..20f385aa8d75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/method_get_autorest.go @@ -0,0 +1,68 @@ +package automationrules + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *AutomationRule +} + +// Get ... +func (c AutomationRulesClient) Get(ctx context.Context, id AutomationRuleId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "automationrules.AutomationRulesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "automationrules.AutomationRulesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "automationrules.AutomationRulesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c AutomationRulesClient) preparerForGet(ctx context.Context, id AutomationRuleId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c AutomationRulesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/method_list_autorest.go new file mode 100644 index 000000000000..e2818088fcf6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/method_list_autorest.go @@ -0,0 +1,186 @@ +package automationrules + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]AutomationRule + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []AutomationRule +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c AutomationRulesClient) List(ctx context.Context, id WorkspaceId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "automationrules.AutomationRulesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "automationrules.AutomationRulesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "automationrules.AutomationRulesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForList prepares the List request. +func (c AutomationRulesClient) preparerForList(ctx context.Context, id WorkspaceId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.SecurityInsights/automationRules", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c AutomationRulesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c AutomationRulesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []AutomationRule `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "automationrules.AutomationRulesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "automationrules.AutomationRulesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "automationrules.AutomationRulesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c AutomationRulesClient) ListComplete(ctx context.Context, id WorkspaceId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, AutomationRuleOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c AutomationRulesClient) ListCompleteMatchingPredicate(ctx context.Context, id WorkspaceId, predicate AutomationRuleOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]AutomationRule, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrule.go new file mode 100644 index 000000000000..1c49c5a77dee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrule.go @@ -0,0 +1,17 @@ +package automationrules + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationRule struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties AutomationRuleProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationruleaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationruleaction.go new file mode 100644 index 000000000000..9f3b68be396f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationruleaction.go @@ -0,0 +1,56 @@ +package automationrules + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationRuleAction interface { +} + +func unmarshalAutomationRuleActionImplementation(input []byte) (AutomationRuleAction, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling AutomationRuleAction into map[string]interface: %+v", err) + } + + value, ok := temp["actionType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "ModifyProperties") { + var out AutomationRuleModifyPropertiesAction + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AutomationRuleModifyPropertiesAction: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "RunPlaybook") { + var out AutomationRuleRunPlaybookAction + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AutomationRuleRunPlaybookAction: %+v", err) + } + return out, nil + } + + type RawAutomationRuleActionImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawAutomationRuleActionImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulebooleancondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulebooleancondition.go new file mode 100644 index 000000000000..b73d49b15540 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulebooleancondition.go @@ -0,0 +1,49 @@ +package automationrules + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationRuleBooleanCondition struct { + InnerConditions *[]AutomationRuleCondition `json:"innerConditions,omitempty"` + Operator *AutomationRuleBooleanConditionSupportedOperator `json:"operator,omitempty"` +} + +var _ json.Unmarshaler = &AutomationRuleBooleanCondition{} + +func (s *AutomationRuleBooleanCondition) UnmarshalJSON(bytes []byte) error { + type alias AutomationRuleBooleanCondition + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into AutomationRuleBooleanCondition: %+v", err) + } + + s.Operator = decoded.Operator + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling AutomationRuleBooleanCondition into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["innerConditions"]; ok { + var listTemp []json.RawMessage + if err := json.Unmarshal(v, &listTemp); err != nil { + return fmt.Errorf("unmarshaling InnerConditions into list []json.RawMessage: %+v", err) + } + + output := make([]AutomationRuleCondition, 0) + for i, val := range listTemp { + impl, err := unmarshalAutomationRuleConditionImplementation(val) + if err != nil { + return fmt.Errorf("unmarshaling index %d field 'InnerConditions' for 'AutomationRuleBooleanCondition': %+v", i, err) + } + output = append(output, impl) + } + s.InnerConditions = &output + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulecondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulecondition.go new file mode 100644 index 000000000000..4d6ee0e4fea4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulecondition.go @@ -0,0 +1,80 @@ +package automationrules + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationRuleCondition interface { +} + +func unmarshalAutomationRuleConditionImplementation(input []byte) (AutomationRuleCondition, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling AutomationRuleCondition into map[string]interface: %+v", err) + } + + value, ok := temp["conditionType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "Boolean") { + var out BooleanConditionProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into BooleanConditionProperties: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "PropertyArrayChanged") { + var out PropertyArrayChangedConditionProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into PropertyArrayChangedConditionProperties: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "PropertyArray") { + var out PropertyArrayConditionProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into PropertyArrayConditionProperties: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "PropertyChanged") { + var out PropertyChangedConditionProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into PropertyChangedConditionProperties: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "Property") { + var out PropertyConditionProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into PropertyConditionProperties: %+v", err) + } + return out, nil + } + + type RawAutomationRuleConditionImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawAutomationRuleConditionImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulemodifypropertiesaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulemodifypropertiesaction.go new file mode 100644 index 000000000000..98eb39b6a9bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulemodifypropertiesaction.go @@ -0,0 +1,42 @@ +package automationrules + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AutomationRuleAction = AutomationRuleModifyPropertiesAction{} + +type AutomationRuleModifyPropertiesAction struct { + ActionConfiguration *IncidentPropertiesAction `json:"actionConfiguration,omitempty"` + + // Fields inherited from AutomationRuleAction + Order int64 `json:"order"` +} + +var _ json.Marshaler = AutomationRuleModifyPropertiesAction{} + +func (s AutomationRuleModifyPropertiesAction) MarshalJSON() ([]byte, error) { + type wrapper AutomationRuleModifyPropertiesAction + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AutomationRuleModifyPropertiesAction: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AutomationRuleModifyPropertiesAction: %+v", err) + } + decoded["actionType"] = "ModifyProperties" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AutomationRuleModifyPropertiesAction: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationruleproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationruleproperties.go new file mode 100644 index 000000000000..5460f9b5fbaa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationruleproperties.go @@ -0,0 +1,88 @@ +package automationrules + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationRuleProperties struct { + Actions []AutomationRuleAction `json:"actions"` + CreatedBy *ClientInfo `json:"createdBy,omitempty"` + CreatedTimeUtc *string `json:"createdTimeUtc,omitempty"` + DisplayName string `json:"displayName"` + LastModifiedBy *ClientInfo `json:"lastModifiedBy,omitempty"` + LastModifiedTimeUtc *string `json:"lastModifiedTimeUtc,omitempty"` + Order int64 `json:"order"` + TriggeringLogic AutomationRuleTriggeringLogic `json:"triggeringLogic"` +} + +func (o *AutomationRuleProperties) GetCreatedTimeUtcAsTime() (*time.Time, error) { + if o.CreatedTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreatedTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutomationRuleProperties) SetCreatedTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreatedTimeUtc = &formatted +} + +func (o *AutomationRuleProperties) GetLastModifiedTimeUtcAsTime() (*time.Time, error) { + if o.LastModifiedTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModifiedTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutomationRuleProperties) SetLastModifiedTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModifiedTimeUtc = &formatted +} + +var _ json.Unmarshaler = &AutomationRuleProperties{} + +func (s *AutomationRuleProperties) UnmarshalJSON(bytes []byte) error { + type alias AutomationRuleProperties + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into AutomationRuleProperties: %+v", err) + } + + s.CreatedBy = decoded.CreatedBy + s.CreatedTimeUtc = decoded.CreatedTimeUtc + s.DisplayName = decoded.DisplayName + s.LastModifiedBy = decoded.LastModifiedBy + s.LastModifiedTimeUtc = decoded.LastModifiedTimeUtc + s.Order = decoded.Order + s.TriggeringLogic = decoded.TriggeringLogic + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling AutomationRuleProperties into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["actions"]; ok { + var listTemp []json.RawMessage + if err := json.Unmarshal(v, &listTemp); err != nil { + return fmt.Errorf("unmarshaling Actions into list []json.RawMessage: %+v", err) + } + + output := make([]AutomationRuleAction, 0) + for i, val := range listTemp { + impl, err := unmarshalAutomationRuleActionImplementation(val) + if err != nil { + return fmt.Errorf("unmarshaling index %d field 'Actions' for 'AutomationRuleProperties': %+v", i, err) + } + output = append(output, impl) + } + s.Actions = output + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulepropertyarraychangedvaluescondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulepropertyarraychangedvaluescondition.go new file mode 100644 index 000000000000..fc4f7b8f5f79 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulepropertyarraychangedvaluescondition.go @@ -0,0 +1,9 @@ +package automationrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationRulePropertyArrayChangedValuesCondition struct { + ArrayType *AutomationRulePropertyArrayChangedConditionSupportedArrayType `json:"arrayType,omitempty"` + ChangeType *AutomationRulePropertyArrayChangedConditionSupportedChangeType `json:"changeType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulepropertyarrayvaluescondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulepropertyarrayvaluescondition.go new file mode 100644 index 000000000000..5d2faa180e54 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulepropertyarrayvaluescondition.go @@ -0,0 +1,51 @@ +package automationrules + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationRulePropertyArrayValuesCondition struct { + ArrayConditionType *AutomationRulePropertyArrayConditionSupportedArrayConditionType `json:"arrayConditionType,omitempty"` + ArrayType *AutomationRulePropertyArrayConditionSupportedArrayType `json:"arrayType,omitempty"` + ItemConditions *[]AutomationRuleCondition `json:"itemConditions,omitempty"` +} + +var _ json.Unmarshaler = &AutomationRulePropertyArrayValuesCondition{} + +func (s *AutomationRulePropertyArrayValuesCondition) UnmarshalJSON(bytes []byte) error { + type alias AutomationRulePropertyArrayValuesCondition + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into AutomationRulePropertyArrayValuesCondition: %+v", err) + } + + s.ArrayConditionType = decoded.ArrayConditionType + s.ArrayType = decoded.ArrayType + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling AutomationRulePropertyArrayValuesCondition into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["itemConditions"]; ok { + var listTemp []json.RawMessage + if err := json.Unmarshal(v, &listTemp); err != nil { + return fmt.Errorf("unmarshaling ItemConditions into list []json.RawMessage: %+v", err) + } + + output := make([]AutomationRuleCondition, 0) + for i, val := range listTemp { + impl, err := unmarshalAutomationRuleConditionImplementation(val) + if err != nil { + return fmt.Errorf("unmarshaling index %d field 'ItemConditions' for 'AutomationRulePropertyArrayValuesCondition': %+v", i, err) + } + output = append(output, impl) + } + s.ItemConditions = &output + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulepropertyvalueschangedcondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulepropertyvalueschangedcondition.go new file mode 100644 index 000000000000..9873faa9d834 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulepropertyvalueschangedcondition.go @@ -0,0 +1,11 @@ +package automationrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationRulePropertyValuesChangedCondition struct { + ChangeType *AutomationRulePropertyChangedConditionSupportedChangedType `json:"changeType,omitempty"` + Operator *AutomationRulePropertyConditionSupportedOperator `json:"operator,omitempty"` + PropertyName *AutomationRulePropertyChangedConditionSupportedPropertyType `json:"propertyName,omitempty"` + PropertyValues *[]string `json:"propertyValues,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulepropertyvaluescondition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulepropertyvaluescondition.go new file mode 100644 index 000000000000..8ace5d8c942e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulepropertyvaluescondition.go @@ -0,0 +1,10 @@ +package automationrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationRulePropertyValuesCondition struct { + Operator *AutomationRulePropertyConditionSupportedOperator `json:"operator,omitempty"` + PropertyName *AutomationRulePropertyConditionSupportedProperty `json:"propertyName,omitempty"` + PropertyValues *[]string `json:"propertyValues,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulerunplaybookaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulerunplaybookaction.go new file mode 100644 index 000000000000..c3e139aacf77 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationrulerunplaybookaction.go @@ -0,0 +1,42 @@ +package automationrules + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AutomationRuleAction = AutomationRuleRunPlaybookAction{} + +type AutomationRuleRunPlaybookAction struct { + ActionConfiguration *PlaybookActionProperties `json:"actionConfiguration,omitempty"` + + // Fields inherited from AutomationRuleAction + Order int64 `json:"order"` +} + +var _ json.Marshaler = AutomationRuleRunPlaybookAction{} + +func (s AutomationRuleRunPlaybookAction) MarshalJSON() ([]byte, error) { + type wrapper AutomationRuleRunPlaybookAction + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AutomationRuleRunPlaybookAction: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AutomationRuleRunPlaybookAction: %+v", err) + } + decoded["actionType"] = "RunPlaybook" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AutomationRuleRunPlaybookAction: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationruletriggeringlogic.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationruletriggeringlogic.go new file mode 100644 index 000000000000..2f4592c4269a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_automationruletriggeringlogic.go @@ -0,0 +1,70 @@ +package automationrules + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationRuleTriggeringLogic struct { + Conditions *[]AutomationRuleCondition `json:"conditions,omitempty"` + ExpirationTimeUtc *string `json:"expirationTimeUtc,omitempty"` + IsEnabled bool `json:"isEnabled"` + TriggersOn TriggersOn `json:"triggersOn"` + TriggersWhen TriggersWhen `json:"triggersWhen"` +} + +func (o *AutomationRuleTriggeringLogic) GetExpirationTimeUtcAsTime() (*time.Time, error) { + if o.ExpirationTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ExpirationTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *AutomationRuleTriggeringLogic) SetExpirationTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ExpirationTimeUtc = &formatted +} + +var _ json.Unmarshaler = &AutomationRuleTriggeringLogic{} + +func (s *AutomationRuleTriggeringLogic) UnmarshalJSON(bytes []byte) error { + type alias AutomationRuleTriggeringLogic + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into AutomationRuleTriggeringLogic: %+v", err) + } + + s.ExpirationTimeUtc = decoded.ExpirationTimeUtc + s.IsEnabled = decoded.IsEnabled + s.TriggersOn = decoded.TriggersOn + s.TriggersWhen = decoded.TriggersWhen + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling AutomationRuleTriggeringLogic into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["conditions"]; ok { + var listTemp []json.RawMessage + if err := json.Unmarshal(v, &listTemp); err != nil { + return fmt.Errorf("unmarshaling Conditions into list []json.RawMessage: %+v", err) + } + + output := make([]AutomationRuleCondition, 0) + for i, val := range listTemp { + impl, err := unmarshalAutomationRuleConditionImplementation(val) + if err != nil { + return fmt.Errorf("unmarshaling index %d field 'Conditions' for 'AutomationRuleTriggeringLogic': %+v", i, err) + } + output = append(output, impl) + } + s.Conditions = &output + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_booleanconditionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_booleanconditionproperties.go new file mode 100644 index 000000000000..41e5695b030e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_booleanconditionproperties.go @@ -0,0 +1,41 @@ +package automationrules + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AutomationRuleCondition = BooleanConditionProperties{} + +type BooleanConditionProperties struct { + ConditionProperties *AutomationRuleBooleanCondition `json:"conditionProperties,omitempty"` + + // Fields inherited from AutomationRuleCondition +} + +var _ json.Marshaler = BooleanConditionProperties{} + +func (s BooleanConditionProperties) MarshalJSON() ([]byte, error) { + type wrapper BooleanConditionProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling BooleanConditionProperties: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling BooleanConditionProperties: %+v", err) + } + decoded["conditionType"] = "Boolean" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling BooleanConditionProperties: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_clientinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_clientinfo.go new file mode 100644 index 000000000000..6b1a9ec75208 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_clientinfo.go @@ -0,0 +1,11 @@ +package automationrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClientInfo struct { + Email *string `json:"email,omitempty"` + Name *string `json:"name,omitempty"` + ObjectId *string `json:"objectId,omitempty"` + UserPrincipalName *string `json:"userPrincipalName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_incidentlabel.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_incidentlabel.go new file mode 100644 index 000000000000..8f66e17624fa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_incidentlabel.go @@ -0,0 +1,9 @@ +package automationrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IncidentLabel struct { + LabelName string `json:"labelName"` + LabelType *IncidentLabelType `json:"labelType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_incidentownerinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_incidentownerinfo.go new file mode 100644 index 000000000000..b3933802226f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_incidentownerinfo.go @@ -0,0 +1,12 @@ +package automationrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IncidentOwnerInfo struct { + AssignedTo *string `json:"assignedTo,omitempty"` + Email *string `json:"email,omitempty"` + ObjectId *string `json:"objectId,omitempty"` + OwnerType *OwnerType `json:"ownerType,omitempty"` + UserPrincipalName *string `json:"userPrincipalName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_incidentpropertiesaction.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_incidentpropertiesaction.go new file mode 100644 index 000000000000..55f613832aae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_incidentpropertiesaction.go @@ -0,0 +1,14 @@ +package automationrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type IncidentPropertiesAction struct { + Classification *IncidentClassification `json:"classification,omitempty"` + ClassificationComment *string `json:"classificationComment,omitempty"` + ClassificationReason *IncidentClassificationReason `json:"classificationReason,omitempty"` + Labels *[]IncidentLabel `json:"labels,omitempty"` + Owner *IncidentOwnerInfo `json:"owner,omitempty"` + Severity *IncidentSeverity `json:"severity,omitempty"` + Status *IncidentStatus `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_playbookactionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_playbookactionproperties.go new file mode 100644 index 000000000000..6fc5d55a00d8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_playbookactionproperties.go @@ -0,0 +1,9 @@ +package automationrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PlaybookActionProperties struct { + LogicAppResourceId *string `json:"logicAppResourceId,omitempty"` + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_propertyarraychangedconditionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_propertyarraychangedconditionproperties.go new file mode 100644 index 000000000000..9abf0187ac48 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_propertyarraychangedconditionproperties.go @@ -0,0 +1,41 @@ +package automationrules + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AutomationRuleCondition = PropertyArrayChangedConditionProperties{} + +type PropertyArrayChangedConditionProperties struct { + ConditionProperties *AutomationRulePropertyArrayChangedValuesCondition `json:"conditionProperties,omitempty"` + + // Fields inherited from AutomationRuleCondition +} + +var _ json.Marshaler = PropertyArrayChangedConditionProperties{} + +func (s PropertyArrayChangedConditionProperties) MarshalJSON() ([]byte, error) { + type wrapper PropertyArrayChangedConditionProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling PropertyArrayChangedConditionProperties: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling PropertyArrayChangedConditionProperties: %+v", err) + } + decoded["conditionType"] = "PropertyArrayChanged" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling PropertyArrayChangedConditionProperties: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_propertyarrayconditionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_propertyarrayconditionproperties.go new file mode 100644 index 000000000000..9e700cb4a8c3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_propertyarrayconditionproperties.go @@ -0,0 +1,41 @@ +package automationrules + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AutomationRuleCondition = PropertyArrayConditionProperties{} + +type PropertyArrayConditionProperties struct { + ConditionProperties *AutomationRulePropertyArrayValuesCondition `json:"conditionProperties,omitempty"` + + // Fields inherited from AutomationRuleCondition +} + +var _ json.Marshaler = PropertyArrayConditionProperties{} + +func (s PropertyArrayConditionProperties) MarshalJSON() ([]byte, error) { + type wrapper PropertyArrayConditionProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling PropertyArrayConditionProperties: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling PropertyArrayConditionProperties: %+v", err) + } + decoded["conditionType"] = "PropertyArray" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling PropertyArrayConditionProperties: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_propertychangedconditionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_propertychangedconditionproperties.go new file mode 100644 index 000000000000..b72736f49a21 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_propertychangedconditionproperties.go @@ -0,0 +1,41 @@ +package automationrules + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AutomationRuleCondition = PropertyChangedConditionProperties{} + +type PropertyChangedConditionProperties struct { + ConditionProperties *AutomationRulePropertyValuesChangedCondition `json:"conditionProperties,omitempty"` + + // Fields inherited from AutomationRuleCondition +} + +var _ json.Marshaler = PropertyChangedConditionProperties{} + +func (s PropertyChangedConditionProperties) MarshalJSON() ([]byte, error) { + type wrapper PropertyChangedConditionProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling PropertyChangedConditionProperties: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling PropertyChangedConditionProperties: %+v", err) + } + decoded["conditionType"] = "PropertyChanged" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling PropertyChangedConditionProperties: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_propertyconditionproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_propertyconditionproperties.go new file mode 100644 index 000000000000..6e77d74c58c5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/model_propertyconditionproperties.go @@ -0,0 +1,41 @@ +package automationrules + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AutomationRuleCondition = PropertyConditionProperties{} + +type PropertyConditionProperties struct { + ConditionProperties *AutomationRulePropertyValuesCondition `json:"conditionProperties,omitempty"` + + // Fields inherited from AutomationRuleCondition +} + +var _ json.Marshaler = PropertyConditionProperties{} + +func (s PropertyConditionProperties) MarshalJSON() ([]byte, error) { + type wrapper PropertyConditionProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling PropertyConditionProperties: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling PropertyConditionProperties: %+v", err) + } + decoded["conditionType"] = "Property" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling PropertyConditionProperties: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/predicates.go new file mode 100644 index 000000000000..977bc573b296 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/predicates.go @@ -0,0 +1,32 @@ +package automationrules + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomationRuleOperationPredicate struct { + Etag *string + Id *string + Name *string + Type *string +} + +func (p AutomationRuleOperationPredicate) Matches(input AutomationRule) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/version.go new file mode 100644 index 000000000000..ef670d008512 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules/version.go @@ -0,0 +1,12 @@ +package automationrules + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-10-01-preview" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/automationrules/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 51c790235f79..1d90f8b44974 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -491,6 +491,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-03-13/services github.com/hashicorp/go-azure-sdk/resource-manager/search/2020-08-01/sharedprivatelinkresources github.com/hashicorp/go-azure-sdk/resource-manager/security/2022-03-01/pricings github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/alertrules +github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-10-01-preview/automationrules github.com/hashicorp/go-azure-sdk/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule